From 9cfa2ee6fa56f43c629ba3ad4e6002a9827bfecc Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 22 Jul 2025 15:25:25 +0200 Subject: [PATCH 01/38] Multichain add gmx acc gm deposit --- .../GmDepositWithdrawalBox.tsx | 7 +- .../useDepositWithdrawalTransactions.tsx | 158 +++++++++++++++++- .../markets/createMultichainDepositTxn.ts | 132 +++++++++++++++ 3 files changed, 291 insertions(+), 6 deletions(-) create mode 100644 src/domain/synthetics/markets/createMultichainDepositTxn.ts diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 4c1dd1986d..ec073f09eb 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -32,8 +32,6 @@ import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; -import { SwitchToSettlementChainButtons } from "components/SwitchToSettlementChain/SwitchToSettlementChainButtons"; -import { SwitchToSettlementChainWarning } from "components/SwitchToSettlementChain/SwitchToSettlementChainWarning"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; import TokenSelector from "components/TokenSelector/TokenSelector"; @@ -811,9 +809,10 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { shouldShowWarningForExecutionFee={shouldShowWarningForExecutionFee} /> - + {/* */}
- {submitButton} + {/* {} */} + {submitButton}
diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index e5d1d6c344..963ca0641f 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -1,15 +1,24 @@ import { t } from "@lingui/macro"; -import { useCallback, useState } from "react"; +import { useCallback, useMemo, useState } from "react"; +import { zeroAddress } from "viem"; +import { getContract } from "config/contracts"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; -import { selectBlockTimestampData, selectChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; +import { + selectBlockTimestampData, + selectChainId, + selectSrcChainId, +} from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; +import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { ExecutionFee } from "domain/synthetics/fees"; import { createDepositTxn, createWithdrawalTxn, GlvInfo, MarketInfo } from "domain/synthetics/markets"; import { createGlvDepositTxn } from "domain/synthetics/markets/createGlvDepositTxn"; import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; +import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; import { TokenData, TokensData } from "domain/synthetics/tokens"; import { helperToast } from "lib/helperToast"; import { @@ -20,8 +29,13 @@ import { sendOrderSubmittedMetric, sendTxnValidationErrorMetric, } from "lib/metrics"; +import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; import useWallet from "lib/wallets/useWallet"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { getWrappedToken } from "sdk/configs/tokens"; +import { nowInSeconds } from "sdk/utils/time"; +import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { Operation } from "../types"; @@ -75,11 +89,91 @@ export const useDepositWithdrawalTransactions = ({ }: Props) => { const [isSubmitting, setIsSubmitting] = useState(false); const chainId = useSelector(selectChainId); + const srcChainId = useSelector(selectSrcChainId); + const globalExpressParams = useSelector(selectExpressGlobalParams); const { signer, account } = useWallet(); const { setPendingDeposit, setPendingWithdrawal } = useSyntheticsEvents(); const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); + const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { + const requests: IRelayUtils.TransferRequestsStruct = { + tokens: [], + receivers: [], + amounts: [], + }; + + if (longToken && longTokenAmount !== undefined && longTokenAmount > 0n) { + requests.tokens.push(longToken.address); + requests.receivers.push(getContract(chainId, "DepositVault")); + requests.amounts.push(longTokenAmount); + } + + if (shortToken && shortTokenAmount !== undefined && shortTokenAmount > 0n) { + requests.tokens.push(shortToken.address); + requests.receivers.push(getContract(chainId, "DepositVault")); + requests.amounts.push(shortTokenAmount); + } + + if (executionFee?.feeTokenAmount !== undefined) { + requests.tokens.push(getWrappedToken(chainId).address); + requests.receivers.push(getContract(chainId, "MultichainGmRouter")); + requests.amounts.push(executionFee.feeTokenAmount); + } + + return requests; + }, [chainId, executionFee?.feeTokenAmount, longToken, longTokenAmount, shortToken, shortTokenAmount]); + + const asyncResult = useArbitraryRelayParamsAndPayload({ + isGmxAccount: srcChainId !== undefined, + expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { + if (!account || !marketInfo || marketTokenAmount === undefined || !srcChainId || !signer || !executionFee) { + throw new Error("Account is not set"); + } + + const initialLongTokenAddress = longToken?.address || marketInfo.longTokenAddress; + const initialShortTokenAddress = marketInfo.isSameCollaterals + ? initialLongTokenAddress + : shortToken?.address || marketInfo.shortTokenAddress; + + const txnData = await buildAndSignMultichainDepositTxn({ + emptySignature: true, + account, + chainId, + params: { + addresses: { + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: zeroAddress, + market: marketToken.address, + initialLongToken: initialLongTokenAddress, + initialShortToken: initialShortTokenAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + callbackGasLimit: 0n, + dataList: [], + minMarketTokens: marketTokenAmount, + shouldUnwrapNativeToken: false, + executionFee: executionFee.feeTokenAmount, + }, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + }, + }); + const onCreateDeposit = useCallback( function onCreateDeposit() { const metricData = @@ -137,6 +231,62 @@ export const useDepositWithdrawalTransactions = ({ ? initialLongTokenAddress : shortToken?.address || marketInfo.shortTokenAddress; + if (srcChainId !== undefined) { + if (glvInfo && selectedMarketForGlv) { + throw new Error("Not implemented"); + } + + if (!globalExpressParams?.relayerFeeTokenAddress) { + throw new Error("Relayer fee token address is not set"); + } + + if (!asyncResult.data) { + throw new Error("Async result is not set"); + } + + return buildAndSignMultichainDepositTxn({ + chainId, + srcChainId, + signer, + account, + relayerFeeAmount: asyncResult.data.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: asyncResult.data.gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...asyncResult.data.relayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + transferRequests, + params: { + addresses: { + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: zeroAddress, + market: marketToken.address, + initialLongToken: initialLongTokenAddress, + initialShortToken: initialShortTokenAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + callbackGasLimit: 0n, + dataList: [], + minMarketTokens: marketTokenAmount, + shouldUnwrapNativeToken: false, + executionFee: executionFee.feeTokenAmount, + }, + }) + .then(async (txnData: ExpressTxnData) => { + await sendExpressTransaction({ + chainId, + // TODO MLTCH: pass true when we can + isSponsoredCall: false, + txnData, + }); + }) + .then(makeTxnSentMetricsHandler(metricData.metricId)) + .catch(makeTxnErrorMetricsHandler(metricData.metricId)) + .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); + } + if (glvInfo && selectedMarketForGlv) { return createGlvDepositTxn(chainId, signer, { account, @@ -210,11 +360,15 @@ export const useDepositWithdrawalTransactions = ({ tokensData, signer, chainId, + srcChainId, shouldDisableValidation, blockTimestampData, setPendingTxns, setPendingDeposit, + globalExpressParams?.relayerFeeTokenAddress, + asyncResult.data, isMarketTokenDeposit, + transferRequests, ] ); diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts new file mode 100644 index 0000000000..ab4195cec7 --- /dev/null +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -0,0 +1,132 @@ +import { encodeFunctionData } from "viem"; + +import { getContract } from "config/contracts"; +import { ExpressTxnData } from "lib/transactions"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import { abis } from "sdk/abis"; +import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import type { IDepositUtils } from "typechain-types/ExchangeRouter"; +import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; + +import { RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; + +export type CreateMultichainDepositParams = { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + relayParams: RelayParamsPayload; + emptySignature?: boolean; + account: string; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: IDepositUtils.CreateDepositParamsStruct; + relayerFeeTokenAddress: string; + relayerFeeAmount: bigint; +}; + +export async function buildAndSignMultichainDepositTxn({ + chainId, + srcChainId, + signer, + relayParams, + account, + transferRequests, + params, + emptySignature, + relayerFeeTokenAddress, + relayerFeeAmount, +}: CreateMultichainDepositParams): Promise { + let signature: string; + + if (emptySignature) { + signature = "0x"; + } else { + signature = await signMultichainDepositPayload({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + } + + const depositData = encodeFunctionData({ + abi: abis.MultichainGmRouter, + functionName: "createDeposit", + args: [ + { + ...relayParams, + signature, + }, + account, + srcChainId, + transferRequests, + params, + ] satisfies Parameters, + }); + + return { + callData: depositData, + to: getContract(chainId, "MultichainGmRouter"), + feeToken: relayerFeeTokenAddress, + feeAmount: relayerFeeAmount, + }; +} + +function signMultichainDepositPayload({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: IDepositUtils.CreateDepositParamsStruct; +}) { + const types = { + CreateDeposit: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateDepositAddresses" }, + { name: "minMarketTokens", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateDepositAddresses: [ + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "market", type: "address" }, + { name: "initialLongToken", type: "address" }, + { name: "initialShortToken", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId, getContract(chainId, "MultichainGmRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minMarketTokens: params.minMarketTokens, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} From 249df5c2b7cdd2e03d42cab016902da450d2b005 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Fri, 1 Aug 2025 14:20:18 +0200 Subject: [PATCH 02/38] Implement crosschain deposit functionality --- .../GmDepositWithdrawalBox.tsx | 116 +-- .../GmSwapBox/GmDepositWithdrawalBox/types.ts | 2 + .../useDepositWithdrawalTransactions.tsx | 832 +++++++++++++----- .../useGmDepositWithdrawalBoxState.tsx | 33 + .../useGmSwapSubmitState.tsx | 7 + .../Synthetics/GmxAccountModal/hooks.ts | 221 +++-- .../Synthetics/TradeBox/TradeBox.tsx | 2 +- .../TokenSelector/MultichainTokenSelector.tsx | 94 +- src/config/multichain.ts | 2 +- src/domain/multichain/arbitraryRelayParams.ts | 3 + src/domain/multichain/codecs/CodecUiHelper.ts | 115 +-- .../multichain/codecs/hashParamsAbiItems.ts | 87 ++ .../fetchMultichainTokenBalances.ts | 139 +-- src/domain/multichain/useIsGmxAccount.tsx | 36 + .../synthetics/express/expressOrderUtils.ts | 59 ++ .../synthetics/markets/createDepositTxn.ts | 133 ++- .../synthetics/markets/createGlvDepositTxn.ts | 155 ++-- .../markets/createMultichainDepositTxn.ts | 64 +- src/domain/synthetics/markets/types.ts | 43 + .../trade/usePositionEditorState.ts | 37 +- 20 files changed, 1529 insertions(+), 651 deletions(-) create mode 100644 src/domain/multichain/codecs/hashParamsAbiItems.ts create mode 100644 src/domain/multichain/useIsGmxAccount.tsx diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index ec073f09eb..07ba134c60 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -1,8 +1,11 @@ -import { t } from "@lingui/macro"; +import { t, Trans } from "@lingui/macro"; import cx from "classnames"; +import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; +import { getChainName } from "config/chains"; import { getContract } from "config/contracts"; +import { isSourceChain } from "config/multichain"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; import { useTokensData } from "context/SyntheticsStateContext/hooks/globalsHooks"; import { @@ -21,7 +24,6 @@ import { getTokenPoolType, } from "domain/synthetics/markets/utils"; import { convertToUsd, getTokenData, TokenData } from "domain/synthetics/tokens"; -import { useAvailableTokenOptions } from "domain/synthetics/trade"; import useSortedPoolsWithIndexToken from "domain/synthetics/trade/useSortedPoolsWithIndexToken"; import { Token } from "domain/tokens"; import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; @@ -32,9 +34,12 @@ import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; +import Checkbox from "components/Checkbox/Checkbox"; +import { useSrcChainTokensData } from "components/Synthetics/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; +import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; -import TokenSelector from "components/TokenSelector/TokenSelector"; +import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; import TooltipWithPortal from "components/Tooltip/TooltipWithPortal"; import type { GmSwapBoxProps } from "../GmSwapBox"; @@ -85,17 +90,16 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { ); const isDeposit = operation === Operation.Deposit; const tokensData = useTokensData(); - const { infoTokens } = useAvailableTokenOptions(chainId, { - marketsInfoData: glvAndMarketsInfoData, - tokensData, - marketTokens: isDeposit ? depositMarketTokensData : withdrawalMarketTokensData, - srcChainId, - }); + const { tokensSrcChainData } = useSrcChainTokensData(); // #region State const { focusedInput, setFocusedInput, + paySource, + setPaySource, + isSendBackToSourceChain, + setIsSendBackToSourceChain, firstTokenAddress, setFirstTokenAddress, secondTokenAddress, @@ -388,6 +392,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isMarketTokenDeposit: isMarketTokenDeposit, marketsInfoData, glvAndMarketsInfoData, + paySource, + isSendBackToSourceChain, }); const firstTokenMaxDetails = useMaxAvailableAmount({ @@ -430,30 +436,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { ? formatBalanceAmount(usedMarketToken.balance, usedMarketToken.decimals) : undefined; }, [marketToken, glvInfo, glvToken]); - - const { viewTokenInfo, showTokenName } = useMemo(() => { - const selectedToken = firstTokenAddress ? marketTokensData?.[firstTokenAddress] : undefined; - const isGm = selectedToken?.symbol === "GM"; - - const selectedMarket = selectedToken && marketsInfoData?.[selectedToken.address]; - - if (!selectedToken || !selectedMarket) { - return { - viewTokenInfo: undefined, - showTokenName: false, - }; - } - - return { - viewTokenInfo: isGm - ? { - ...selectedMarket.indexToken, - name: getMarketIndexName(selectedMarket), - } - : selectedToken, - showTokenName: isGm, - }; - }, [firstTokenAddress, marketTokensData, marketsInfoData]); // #endregion // #region Callbacks @@ -575,14 +557,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { [onFocusedCollateralInputChange, secondToken, setSecondTokenInputValue] ); - const firstTokenSelectToken = useCallback( - (token: Token): void => { - setFirstTokenAddress(token.address); + const handleFirstTokenSelect = useCallback( + (tokenAddress: string): void => { + setFirstTokenAddress(tokenAddress); - const isGmMarketSelected = glvInfo && glvInfo.markets.find((m) => m.address === token.address); + const isGmMarketSelected = glvInfo && glvInfo.markets.find((m) => m.address === tokenAddress); if (isGmMarketSelected) { - onSelectedMarketForGlv?.(token.address); + onSelectedMarketForGlv?.(tokenAddress); } }, [setFirstTokenAddress, glvInfo, onSelectedMarketForGlv] @@ -704,6 +686,26 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { [submitState] ); + const payTokenBalanceFormatted = useMemo(() => { + if (!firstToken) { + return undefined; + } + + let balance = firstToken.balance; + + if (paySource === "sourceChain") { + balance = tokensSrcChainData[firstToken.address]?.sourceChainBalance; + } + + if (balance === undefined) { + return undefined; + } + + return formatBalanceAmount(balance, firstToken.decimals, undefined, { + isStable: firstToken.isStable, + }); + }, [firstToken, paySource, tokensSrcChainData]); + return ( <>
@@ -713,32 +715,28 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { bottomLeftValue={formatUsd(firstTokenUsd ?? 0n)} isBottomLeftValueMuted={firstTokenUsd === undefined || firstTokenUsd === 0n} bottomRightLabel={t`Balance`} - bottomRightValue={ - firstToken && firstToken.balance !== undefined - ? formatBalanceAmount(firstToken.balance, firstToken.decimals, undefined, { - isStable: firstToken.isStable, - }) - : undefined - } + bottomRightValue={payTokenBalanceFormatted} onClickTopRightLabel={isDeposit ? onMaxClickFirstToken : undefined} inputValue={firstTokenInputValue} onInputValueChange={handleFirstTokenInputValueChange} onClickMax={firstTokenShowMaxButton ? onMaxClickFirstToken : undefined} > {firstTokenAddress && isSingle && isDeposit && tokenOptions.length > 1 ? ( - { + setPaySource( + isSourceChain(srcChainId) ? "sourceChain" : isGmxAccount ? "gmxAccount" : "settlementChain" + ); + handleFirstTokenSelect(tokenAddress); + }} + multichainTokens={Object.values(tokensSrcChainData)} + includeMultichainTokensInPay + onDepositTokenAddress={noop} /> ) : ( firstTokenPlaceholder @@ -792,6 +790,12 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) {
+ {srcChainId !== undefined && paySource === "sourceChain" && ( + Send back to {getChainName(srcChainId)}} + value={} + /> + )} void; isMarketToken?: boolean; }; + +export type GmOrGlvPaySource = "settlementChain" | "gmxAccount" | "sourceChain"; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index 963ca0641f..14f48a029b 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -1,9 +1,15 @@ import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import chunk from "lodash/chunk"; import { useCallback, useMemo, useState } from "react"; -import { zeroAddress } from "viem"; +import { bytesToHex, encodeFunctionData, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; +import { ContractsChainId } from "config/chains"; import { getContract } from "config/contracts"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; +import { CHAIN_ID_TO_ENDPOINT_ID, IStargateAbi } from "config/multichain"; +import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; @@ -14,12 +20,34 @@ import { } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import { + CodecUiHelper, + GMX_DATA_ACTION_HASH, + MultichainAction, + MultichainActionType, +} from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { signCreateDeposit } from "domain/synthetics/express/expressOrderUtils"; +import { getRawRelayerParams } from "domain/synthetics/express/relayParamsUtils"; +import { RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express/types"; import { ExecutionFee } from "domain/synthetics/fees"; -import { createDepositTxn, createWithdrawalTxn, GlvInfo, MarketInfo } from "domain/synthetics/markets"; +import { + CreateDepositParamsStruct, + createDepositTxn, + CreateGlvDepositParamsStruct, + createWithdrawalTxn, + GlvInfo, + MarketInfo, +} from "domain/synthetics/markets"; import { createGlvDepositTxn } from "domain/synthetics/markets/createGlvDepositTxn"; import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; -import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; +import { + buildAndSignMultichainDepositTxn, + createMultichainDepositTxn, +} from "domain/synthetics/markets/createMultichainDepositTxn"; import { TokenData, TokensData } from "domain/synthetics/tokens"; +import { useChainId } from "lib/chains"; import { helperToast } from "lib/helperToast"; import { initGLVSwapMetricData, @@ -29,20 +57,26 @@ import { sendOrderSubmittedMetric, sendTxnValidationErrorMetric, } from "lib/metrics"; -import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; +import { EMPTY_ARRAY } from "lib/objects"; +import { sendWalletTransaction } from "lib/transactions/sendWalletTransaction"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { getWrappedToken } from "sdk/configs/tokens"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; +import { applySlippageToMinOut } from "sdk/utils/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; +import { IStargate, SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; import { Operation } from "../types"; +import type { GmOrGlvPaySource } from "./types"; interface Props { marketInfo?: MarketInfo; glvInfo?: GlvInfo; - marketToken: TokenData; + marketToken: TokenData | undefined; operation: Operation; longToken: TokenData | undefined; shortToken: TokenData | undefined; @@ -63,12 +97,134 @@ interface Props { selectedMarketInfoForGlv?: MarketInfo; isMarketTokenDeposit?: boolean; isFirstBuy: boolean; + paySource: GmOrGlvPaySource; + isSendBackToSourceChain: boolean; +} + +function getTransferRequests({ + chainId, + longTokenAddress, + longTokenAmount, + shortTokenAddress, + shortTokenAmount, + feeTokenAmount, +}: { + chainId: ContractsChainId; + longTokenAddress: string | undefined; + longTokenAmount: bigint | undefined; + shortTokenAddress: string | undefined; + shortTokenAmount: bigint | undefined; + feeTokenAmount: bigint | undefined; +}): IRelayUtils.TransferRequestsStruct { + const requests: IRelayUtils.TransferRequestsStruct = { + tokens: [], + receivers: [], + amounts: [], + }; + + if (longTokenAddress && longTokenAmount !== undefined && longTokenAmount > 0n) { + requests.tokens.push(longTokenAddress); + requests.receivers.push(getContract(chainId, "DepositVault")); + requests.amounts.push(longTokenAmount); + } + + if (shortTokenAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n) { + requests.tokens.push(shortTokenAddress); + requests.receivers.push(getContract(chainId, "DepositVault")); + requests.amounts.push(shortTokenAmount); + } + + if (feeTokenAmount !== undefined) { + requests.tokens.push(getWrappedToken(chainId).address); + requests.receivers.push(getContract(chainId, "MultichainGmRouter")); + requests.amounts.push(feeTokenAmount); + } + + return requests; +} + +function useMultichainDepositExpressTxnParams({ + transferRequests, + paySource, + gmParams, + glvParams, +}: { + marketInfo: MarketInfo | undefined; + marketTokenAmount: bigint | undefined; + executionFee: ExecutionFee | undefined; + longToken: TokenData | undefined; + shortToken: TokenData | undefined; + transferRequests: IRelayUtils.TransferRequestsStruct; + paySource: GmOrGlvPaySource; + gmParams: CreateDepositParamsStruct | undefined; + glvParams: CreateGlvDepositParamsStruct | undefined; +}) { + const { chainId, srcChainId } = useChainId(); + const { signer } = useWallet(); + + const asyncResult = useArbitraryRelayParamsAndPayload({ + isGmxAccount: srcChainId !== undefined, + enabled: paySource !== "settlementChain", + expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { + // if (!account || !marketInfo || marketTokenAmount === undefined || !srcChainId || !signer || !executionFee) { + if ((!gmParams && !glvParams) || !srcChainId || !signer) { + throw new Error("Invalid params"); + } + + if (glvParams) { + throw new Error("Not implemented"); + } + + // const initialLongTokenAddress = longToken?.address || marketInfo.longTokenAddress; + // const initialShortTokenAddress = marketInfo.isSameCollaterals + // ? initialLongTokenAddress + // : shortToken?.address || marketInfo.shortTokenAddress; + + const txnData = await buildAndSignMultichainDepositTxn({ + emptySignature: true, + account: gmParams!.addresses.receiver, + chainId, + // params: { + // addresses: { + // receiver: account, + // callbackContract: zeroAddress, + // uiFeeReceiver: zeroAddress, + // market: marketInfo.marketTokenAddress, + // initialLongToken: initialLongTokenAddress, + // initialShortToken: initialShortTokenAddress, + // longTokenSwapPath: [], + // shortTokenSwapPath: [], + // }, + // callbackGasLimit: 0n, + // dataList: [], + // minMarketTokens: marketTokenAmount, + // shouldUnwrapNativeToken: false, + // executionFee: executionFee.feeTokenAmount, + // }, + params: gmParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + }, + }); + + return asyncResult; } -export const useDepositWithdrawalTransactions = ({ +const useDepositTransactions = ({ marketInfo, marketToken, - operation, longToken, longTokenAmount, shortToken, @@ -86,139 +242,243 @@ export const useDepositWithdrawalTransactions = ({ glvInfo, isMarketTokenDeposit, isFirstBuy, -}: Props) => { - const [isSubmitting, setIsSubmitting] = useState(false); + paySource, + isSendBackToSourceChain, +}: Props): { + onCreateDeposit: () => Promise; +} => { const chainId = useSelector(selectChainId); const srcChainId = useSelector(selectSrcChainId); - const globalExpressParams = useSelector(selectExpressGlobalParams); const { signer, account } = useWallet(); - const { setPendingDeposit, setPendingWithdrawal } = useSyntheticsEvents(); + const { setPendingDeposit } = useSyntheticsEvents(); const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); + const globalExpressParams = useSelector(selectExpressGlobalParams); - const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { - const requests: IRelayUtils.TransferRequestsStruct = { - tokens: [], - receivers: [], - amounts: [], - }; + const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; + const executionFeeTokenAmount = executionFee?.feeTokenAmount; - if (longToken && longTokenAmount !== undefined && longTokenAmount > 0n) { - requests.tokens.push(longToken.address); - requests.receivers.push(getContract(chainId, "DepositVault")); - requests.amounts.push(longTokenAmount); - } + const longTokenAddress = longToken?.address || marketInfo?.longTokenAddress; + const shortTokenAddress = shortToken?.address || marketInfo?.shortTokenAddress; - if (shortToken && shortTokenAmount !== undefined && shortTokenAmount > 0n) { - requests.tokens.push(shortToken.address); - requests.receivers.push(getContract(chainId, "DepositVault")); - requests.amounts.push(shortTokenAmount); - } + const shouldUnwrapNativeToken = + (longTokenAddress === zeroAddress && longTokenAmount !== undefined && longTokenAmount > 0n) || + (shortTokenAddress === zeroAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n); - if (executionFee?.feeTokenAmount !== undefined) { - requests.tokens.push(getWrappedToken(chainId).address); - requests.receivers.push(getContract(chainId, "MultichainGmRouter")); - requests.amounts.push(executionFee.feeTokenAmount); - } + const initialLongTokenAddress = longTokenAddress + ? convertTokenAddress(chainId, longTokenAddress, "wrapped") + : undefined; + const initialShortTokenAddress = + shortTokenAddress && initialLongTokenAddress + ? convertTokenAddress( + chainId, + marketInfo?.isSameCollaterals ? initialLongTokenAddress : shortTokenAddress, + "wrapped" + ) + : undefined; - return requests; - }, [chainId, executionFee?.feeTokenAmount, longToken, longTokenAmount, shortToken, shortTokenAmount]); + const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { + return getTransferRequests({ + chainId, + longTokenAddress: longTokenAddress, + longTokenAmount, + shortTokenAddress: shortTokenAddress, + shortTokenAmount, + feeTokenAmount: executionFeeTokenAmount, + }); + }, [chainId, executionFeeTokenAmount, longTokenAddress, longTokenAmount, shortTokenAddress, shortTokenAmount]); + + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + + const gmParams = useMemo((): CreateDepositParamsStruct | undefined => { + if ( + !account || + !marketTokenAddress || + marketTokenAmount === undefined || + executionFeeTokenAmount === undefined || + isGlv || + !initialLongTokenAddress || + !initialShortTokenAddress + ) { + return undefined; + } - const asyncResult = useArbitraryRelayParamsAndPayload({ - isGmxAccount: srcChainId !== undefined, - expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - if (!account || !marketInfo || marketTokenAmount === undefined || !srcChainId || !signer || !executionFee) { - throw new Error("Account is not set"); - } + const minMarketTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketTokenAmount); - const initialLongTokenAddress = longToken?.address || marketInfo.longTokenAddress; - const initialShortTokenAddress = marketInfo.isSameCollaterals - ? initialLongTokenAddress - : shortToken?.address || marketInfo.shortTokenAddress; + let dataList: string[] = EMPTY_ARRAY; - const txnData = await buildAndSignMultichainDepositTxn({ - emptySignature: true, - account, - chainId, - params: { - addresses: { - receiver: account, - callbackContract: zeroAddress, - uiFeeReceiver: zeroAddress, - market: marketToken.address, - initialLongToken: initialLongTokenAddress, - initialShortToken: initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - }, - callbackGasLimit: 0n, - dataList: [], - minMarketTokens: marketTokenAmount, - shouldUnwrapNativeToken: false, - executionFee: executionFee.feeTokenAmount, - }, - srcChainId, - relayerFeeAmount: gasPaymentParams.relayerFeeAmount, - relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, - relayParams: { - ...relayParams, + if (isSendBackToSourceChain) { + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + minAmountOut: minMarketTokens / 2n, + provider: "0xe4ebcac4a2e6cbee385ee407f7d5e278bc07e11e", + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId!], { size: 32 }), }, - signer, - transferRequests, }); + const bytes = hexToBytes(actionHash as Hex); - return { - txnData, - }; - }, + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + const params: CreateDepositParamsStruct = { + addresses: { + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: zeroAddress, + market: marketTokenAddress, + initialLongToken: initialLongTokenAddress, + initialShortToken: initialShortTokenAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minMarketTokens, + shouldUnwrapNativeToken: false, + executionFee: executionFeeTokenAmount, + callbackGasLimit: 0n, + dataList, + }; + + return params; + }, [ + account, + chainId, + executionFeeTokenAmount, + initialLongTokenAddress, + initialShortTokenAddress, + isGlv, + isSendBackToSourceChain, + marketTokenAddress, + marketTokenAmount, + srcChainId, + ]); + + const glvParams = useMemo((): CreateGlvDepositParamsStruct | undefined => { + if ( + !account || + !marketInfo || + marketTokenAmount === undefined || + executionFeeTokenAmount === undefined || + !isGlv || + glvTokenAmount === undefined || + !initialLongTokenAddress || + !initialShortTokenAddress + ) { + return undefined; + } + + const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, glvTokenAmount); + const params: CreateGlvDepositParamsStruct = { + addresses: { + glv: glvInfo!.glvTokenAddress, + market: selectedMarketForGlv!, + receiver: glvInfo!.glvToken.totalSupply === 0n ? numberToHex(1, { size: 20 }) : account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + initialLongToken: isMarketTokenDeposit ? zeroAddress : initialLongTokenAddress, + initialShortToken: isMarketTokenDeposit ? zeroAddress : initialShortTokenAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minGlvTokens, + executionFee: executionFeeTokenAmount, + callbackGasLimit: 0n, + shouldUnwrapNativeToken, + isMarketTokenDeposit: Boolean(isMarketTokenDeposit), + dataList: [], + }; + + return params; + }, [ + account, + executionFeeTokenAmount, + glvInfo, + glvTokenAmount, + initialLongTokenAddress, + initialShortTokenAddress, + isGlv, + isMarketTokenDeposit, + marketInfo, + marketTokenAmount, + selectedMarketForGlv, + shouldUnwrapNativeToken, + ]); + + const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ + marketInfo, + marketTokenAmount, + executionFee, + longToken, + shortToken, + transferRequests, + paySource, + gmParams, + glvParams, }); - const onCreateDeposit = useCallback( - function onCreateDeposit() { - const metricData = - glvInfo && selectedMarketForGlv - ? initGLVSwapMetricData({ - longToken, - shortToken, - selectedMarketForGlv, - isDeposit: true, - executionFee, - glvAddress: glvInfo.glvTokenAddress, - glvToken: glvInfo.glvToken, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - glvTokenAmount, - marketName: selectedMarketInfoForGlv?.name, - glvTokenUsd: glvTokenUsd, - isFirstBuy, - }) - : initGMSwapMetricData({ - longToken, - shortToken, - marketToken, - isDeposit: true, - executionFee, - marketInfo, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - marketTokenUsd, - isFirstBuy, - }); + const getDepositMetricData = useCallback(() => { + if (isGlv) { + return initGLVSwapMetricData({ + longToken, + shortToken, + selectedMarketForGlv, + isDeposit: true, + executionFee, + glvAddress: glvInfo!.glvTokenAddress, + glvToken: glvInfo!.glvToken, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + glvTokenAmount, + marketName: selectedMarketInfoForGlv?.name, + glvTokenUsd: glvTokenUsd, + isFirstBuy, + }); + } + + return initGMSwapMetricData({ + longToken, + shortToken, + marketToken, + isDeposit: true, + executionFee, + marketInfo, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + marketTokenUsd, + isFirstBuy, + }); + }, [ + executionFee, + glvInfo, + glvTokenAmount, + glvTokenUsd, + isFirstBuy, + isGlv, + longToken, + longTokenAmount, + marketInfo, + marketToken, + marketTokenAmount, + marketTokenUsd, + selectedMarketForGlv, + selectedMarketInfoForGlv?.name, + shortToken, + shortTokenAmount, + ]); + + const onCreateGmDeposit = useCallback( + function onCreateGmDeposit() { + const metricData = getDepositMetricData(); sendOrderSubmittedMetric(metricData.metricId); - if ( - !account || - !executionFee || - !marketToken || - !marketInfo || - marketTokenAmount === undefined || - !tokensData || - !signer - ) { + if (!executionFee || !tokensData || !account || !signer || !gmParams) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); return Promise.resolve(); @@ -226,112 +486,194 @@ export const useDepositWithdrawalTransactions = ({ sendUserAnalyticsOrderConfirmClickEvent(chainId, metricData.metricId); - const initialLongTokenAddress = longToken?.address || marketInfo.longTokenAddress; - const initialShortTokenAddress = marketInfo.isSameCollaterals - ? initialLongTokenAddress - : shortToken?.address || marketInfo.shortTokenAddress; - - if (srcChainId !== undefined) { - if (glvInfo && selectedMarketForGlv) { - throw new Error("Not implemented"); - } - - if (!globalExpressParams?.relayerFeeTokenAddress) { - throw new Error("Relayer fee token address is not set"); - } - - if (!asyncResult.data) { - throw new Error("Async result is not set"); - } + let promise: Promise; + + if (paySource === "sourceChain") { + promise = new Promise(async (resolve) => { + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: { + feeToken: globalExpressParams!.relayerFeeTokenAddress, + // TODO MLTCH this is going through the keeper to execute a depost + // so there 100% should be a fee + feeAmount: 0n, + feeSwapPath: [], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }) as RawRelayParamsPayload; - return buildAndSignMultichainDepositTxn({ + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const signature = await signCreateDeposit({ + chainId: chainId, + srcChainId: srcChainId, + signer: signer, + relayParams, + transferRequests, + params: gmParams, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Deposit, + actionData: { + relayParams: relayParams, + transferRequests, + params: gmParams, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId: chainId, + account: account, + srcChainId: srcChainId!, + tokenAddress: shortTokenAddress!, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + inputAmount: shortTokenAmount!, + composeGas: composeGas, + isDeposit: true, + action, + }); + + const iStargateInstance = new Contract( + "0x4985b8fcEA3659FD801a5b857dA1D00e985863F0", + IStargateAbi, + signer + ) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: "0x4985b8fcEA3659FD801a5b857dA1D00e985863F0", + signer: signer, + callData: encodeFunctionData({ + abi: IStargateAbi, + functionName: "sendToken", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + }), + value: quoteSend.nativeFee as bigint, + msg: t`Sent deposit transaction`, + }); + + await txnResult.wait(); + + resolve(); + }); + } else if (paySource === "gmxAccount" && srcChainId !== undefined) { + promise = createMultichainDepositTxn({ chainId, srcChainId, signer, - account, - relayerFeeAmount: asyncResult.data.gasPaymentParams.relayerFeeAmount, - relayerFeeTokenAddress: asyncResult.data.gasPaymentParams.relayerFeeTokenAddress, - relayParams: { - ...asyncResult.data.relayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }, transferRequests, - params: { - addresses: { - receiver: account, - callbackContract: zeroAddress, - uiFeeReceiver: zeroAddress, - market: marketToken.address, - initialLongToken: initialLongTokenAddress, - initialShortToken: initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - }, - callbackGasLimit: 0n, - dataList: [], - minMarketTokens: marketTokenAmount, - shouldUnwrapNativeToken: false, - executionFee: executionFee.feeTokenAmount, - }, - }) - .then(async (txnData: ExpressTxnData) => { - await sendExpressTransaction({ - chainId, - // TODO MLTCH: pass true when we can - isSponsoredCall: false, - txnData, - }); - }) - .then(makeTxnSentMetricsHandler(metricData.metricId)) - .catch(makeTxnErrorMetricsHandler(metricData.metricId)) - .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); - } - - if (glvInfo && selectedMarketForGlv) { - return createGlvDepositTxn(chainId, signer, { - account, - initialLongTokenAddress, - initialShortTokenAddress, - minMarketTokens: glvTokenAmount ?? 0n, - glvAddress: glvInfo.glvTokenAddress, - marketTokenAddress: selectedMarketForGlv, - longTokenSwapPath: [], - shortTokenSwapPath: [], + asyncExpressTxnResult: multichainDepositExpressTxnParams, + params: gmParams!, + isGlv: Boolean(glvInfo && selectedMarketForGlv), + }); + } else if (paySource === "settlementChain") { + promise = createDepositTxn({ + chainId, + signer, + blockTimestampData, longTokenAmount: longTokenAmount ?? 0n, shortTokenAmount: shortTokenAmount ?? 0n, - marketTokenAmount: marketTokenAmount ?? 0n, - allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, executionFee: executionFee.feeTokenAmount, executionGasLimit: executionFee.gasLimit, skipSimulation: shouldDisableValidation, tokensData, - blockTimestampData, - isMarketTokenDeposit: isMarketTokenDeposit ?? false, - isFirstDeposit: glvInfo.glvToken.totalSupply === 0n, + metricId: metricData.metricId, + params: gmParams!, setPendingTxns, setPendingDeposit, - }) - .then(makeTxnSentMetricsHandler(metricData.metricId)) - .catch(makeTxnErrorMetricsHandler(metricData.metricId)) - .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); + }); + } else { + throw new Error(`Invalid pay source: ${paySource}`); } - return createDepositTxn(chainId, signer, { - account, - initialLongTokenAddress, - initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], + return promise + .then(makeTxnSentMetricsHandler(metricData.metricId)) + .catch(makeTxnErrorMetricsHandler(metricData.metricId)) + .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); + }, + [ + account, + blockTimestampData, + chainId, + executionFee, + getDepositMetricData, + globalExpressParams, + glvInfo, + gmParams, + longTokenAmount, + multichainDepositExpressTxnParams, + paySource, + selectedMarketForGlv, + setPendingDeposit, + setPendingTxns, + shortTokenAddress, + shortTokenAmount, + shouldDisableValidation, + signer, + srcChainId, + tokensData, + transferRequests, + ] + ); + + const onCreateGlvDeposit = useCallback( + function onCreateGlvDeposit() { + const metricData = getDepositMetricData(); + + sendOrderSubmittedMetric(metricData.metricId); + + if ( + !account || + !executionFee || + !marketToken || + !marketInfo || + marketTokenAmount === undefined || + !tokensData || + !signer || + (isGlv && !glvParams) + ) { + helperToast.error(t`Error submitting order`); + sendTxnValidationErrorMetric(metricData.metricId); + return Promise.resolve(); + } + + sendUserAnalyticsOrderConfirmClickEvent(chainId, metricData.metricId); + + if (srcChainId !== undefined) { + throw new Error("Not implemented"); + } + + return createGlvDepositTxn({ + chainId, + signer, + params: glvParams!, + longTokenAddress: longTokenAddress!, + shortTokenAddress: shortTokenAddress!, longTokenAmount: longTokenAmount ?? 0n, shortTokenAmount: shortTokenAmount ?? 0n, - marketTokenAddress: marketToken.address, - minMarketTokens: marketTokenAmount, + marketTokenAmount: marketTokenAmount ?? 0n, executionFee: executionFee.feeTokenAmount, executionGasLimit: executionFee.gasLimit, - allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, skipSimulation: shouldDisableValidation, tokensData, - metricId: metricData.metricId, blockTimestampData, setPendingTxns, setPendingDeposit, @@ -341,37 +683,73 @@ export const useDepositWithdrawalTransactions = ({ .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); }, [ - glvInfo, - selectedMarketForGlv, - longToken, - shortToken, + account, + blockTimestampData, + chainId, executionFee, + getDepositMetricData, + glvParams, + isGlv, + longTokenAddress, longTokenAmount, - shortTokenAmount, - marketTokenAmount, - glvTokenAmount, - selectedMarketInfoForGlv?.name, - glvTokenUsd, - isFirstBuy, - marketToken, marketInfo, - marketTokenUsd, - account, - tokensData, + marketToken, + marketTokenAmount, + setPendingDeposit, + setPendingTxns, + shortTokenAddress, + shortTokenAmount, + shouldDisableValidation, signer, - chainId, srcChainId, - shouldDisableValidation, - blockTimestampData, - setPendingTxns, - setPendingDeposit, - globalExpressParams?.relayerFeeTokenAddress, - asyncResult.data, - isMarketTokenDeposit, - transferRequests, + tokensData, ] ); + const onCreateDeposit = isGlv ? onCreateGlvDeposit : onCreateGmDeposit; + + return { + onCreateDeposit, + }; +}; + +export const useDepositWithdrawalTransactions = ( + props: Props +): { + onSubmit: () => void; + isSubmitting: boolean; +} => { + const { + marketInfo, + marketToken, + operation, + longToken, + longTokenAmount, + shortToken, + shortTokenAmount, + glvTokenAmount, + glvTokenUsd, + + marketTokenAmount, + marketTokenUsd, + shouldDisableValidation, + tokensData, + executionFee, + selectedMarketForGlv, + selectedMarketInfoForGlv, + glvInfo, + isFirstBuy, + } = props; + + const [isSubmitting, setIsSubmitting] = useState(false); + const chainId = useSelector(selectChainId); + const { signer, account } = useWallet(); + const { setPendingWithdrawal } = useSyntheticsEvents(); + const { setPendingTxns } = usePendingTxns(); + const blockTimestampData = useSelector(selectBlockTimestampData); + + const { onCreateDeposit } = useDepositTransactions(props); + const onCreateWithdrawal = useCallback( function onCreateWithdrawal() { const metricData = diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx index 75da77cfd3..7445e3dc84 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx @@ -8,6 +8,15 @@ import { useSafeState } from "lib/useSafeState"; import { Mode, Operation } from "../types"; import { useDepositWithdrawalSetFirstTokenAddress } from "../useDepositWithdrawalSetFirstTokenAddress"; +import type { GmOrGlvPaySource } from "./types"; + +function isValidPaySource(paySource: string | undefined): paySource is GmOrGlvPaySource { + return ( + (paySource as GmOrGlvPaySource) === "settlementChain" || + (paySource as GmOrGlvPaySource) === "sourceChain" || + (paySource as GmOrGlvPaySource) === "gmxAccount" + ); +} export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, marketAddress: string | undefined) { const isDeposit = operation === Operation.Deposit; @@ -16,6 +25,24 @@ export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, const [focusedInput, setFocusedInput] = useState<"longCollateral" | "shortCollateral" | "market">("market"); + let [paySource, setPaySource] = useLocalStorageSerializeKey( + [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "paySource"], + "settlementChain" + ); + + if (!isValidPaySource(paySource)) { + paySource = "gmxAccount"; + } + + let [isSendBackToSourceChain, setIsSendBackToSourceChain] = useLocalStorageSerializeKey( + [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "isSendBackToSourceChain"], + false + ); + + if (isSendBackToSourceChain === undefined) { + isSendBackToSourceChain = false; + } + const [firstTokenAddress, setFirstTokenAddress] = useDepositWithdrawalSetFirstTokenAddress(isDeposit, marketAddress); const [secondTokenAddress, setSecondTokenAddress] = useLocalStorageSerializeKey( [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, marketAddress, "second"], @@ -29,6 +56,12 @@ export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, focusedInput, setFocusedInput, + paySource, + setPaySource, + + isSendBackToSourceChain, + setIsSendBackToSourceChain, + firstTokenAddress, setFirstTokenAddress, diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 52c4f7b927..4b630389ca 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -22,6 +22,7 @@ import { useDepositWithdrawalTransactions } from "./useDepositWithdrawalTransact import { useTokensToApprove } from "./useTokensToApprove"; import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; import { Operation } from "../types"; +import type { GmOrGlvPaySource } from "./types"; interface Props { amounts: ReturnType; @@ -48,6 +49,8 @@ interface Props { marketsInfoData?: MarketsInfoData; glvAndMarketsInfoData: GlvAndGmMarketsInfoData; selectedMarketInfoForGlv?: MarketInfo; + paySource: GmOrGlvPaySource; + isSendBackToSourceChain: boolean; } const processingTextMap = { @@ -90,6 +93,8 @@ export const useGmSwapSubmitState = ({ glvInfo, isMarketTokenDeposit, glvAndMarketsInfoData, + paySource, + isSendBackToSourceChain, }: Props): SubmitButtonState => { const chainId = useSelector(selectChainId); const hasOutdatedUi = useHasOutdatedUi(); @@ -129,6 +134,8 @@ export const useGmSwapSubmitState = ({ selectedMarketInfoForGlv, marketTokenUsd, isFirstBuy, + paySource, + isSendBackToSourceChain, }); const onConnectAccount = useCallback(() => { diff --git a/src/components/Synthetics/GmxAccountModal/hooks.ts b/src/components/Synthetics/GmxAccountModal/hooks.ts index d54797736d..5b55a98a10 100644 --- a/src/components/Synthetics/GmxAccountModal/hooks.ts +++ b/src/components/Synthetics/GmxAccountModal/hooks.ts @@ -1,15 +1,20 @@ import { useMemo } from "react"; +import useSWR from "swr"; import useSWRSubscription, { SWRSubscription } from "swr/subscription"; import { Address } from "viem"; import { useAccount } from "wagmi"; import { ContractsChainId, SettlementChainId, SourceChainId, getChainName } from "config/chains"; -import { MULTI_CHAIN_TOKEN_MAPPING } from "config/multichain"; -import { fetchMultichainTokenBalances } from "domain/multichain/fetchMultichainTokenBalances"; +import { MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; +import { + fetchMultichainTokenBalances, + fetchSourceChainTokenBalances, +} from "domain/multichain/fetchMultichainTokenBalances"; import type { TokenChainData } from "domain/multichain/types"; import { convertToUsd, getMidPrice, useTokenRecentPricesRequest, useTokensDataRequest } from "domain/synthetics/tokens"; -import { TokensData } from "domain/tokens"; +import { TokenPricesData, TokensData } from "domain/tokens"; import { useChainId } from "lib/chains"; +import { EMPTY_OBJECT } from "lib/objects"; import { FREQUENT_UPDATE_INTERVAL } from "lib/timeConstants"; import { getToken } from "sdk/configs/tokens"; import { bigMath } from "sdk/utils/bigmath"; @@ -132,9 +137,13 @@ const subscribeMultichainTokenBalances: SWRSubscription< let tokenBalances: Record> | undefined; let isLoaded = false; const interval = window.setInterval(() => { - fetchMultichainTokenBalances(settlementChainId, account, (chainId, tokensChainData) => { - tokenBalances = { ...tokenBalances, [chainId]: tokensChainData }; - options.next(null, { tokenBalances, isLoading: isLoaded ? false : true }); + fetchMultichainTokenBalances({ + settlementChainId, + account, + progressCallback: (chainId, tokensChainData) => { + tokenBalances = { ...tokenBalances, [chainId]: tokensChainData }; + options.next(null, { tokenBalances, isLoading: isLoaded ? false : true }); + }, }).then((finalTokenBalances) => { if (!isLoaded) { isLoaded = true; @@ -176,75 +185,173 @@ export function useMultichainTokensRequest(): { const sourceChainId = parseInt(sourceChainIdString) as SourceChainId; const tokensChainBalanceData = tokenBalances[sourceChainId]; - for (const sourceChainTokenAddress in tokensChainBalanceData) { - const mapping = MULTI_CHAIN_TOKEN_MAPPING[chainId]?.[sourceChainId]?.[sourceChainTokenAddress]; + const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[chainId]?.[sourceChainId]; - if (!mapping) { - continue; - } + if (!sourceChainTokenIdMap) { + continue; + } - const balance = tokensChainBalanceData[sourceChainTokenAddress]; + const tokenChainData = getTokensChainData({ + chainId, + sourceChainTokenIdMap, + pricesData, + sourceChainId, + tokensChainBalanceData, + }); - if (balance === undefined || balance === 0n) { - continue; - } + tokenChainDataArray.push(...Object.values(tokenChainData)); + } - const settlementChainTokenAddress = mapping.settlementChainTokenAddress; + return tokenChainDataArray; + }, [tokenBalances, chainId, pricesData]); - const token = getToken(chainId, settlementChainTokenAddress); + return { + tokenChainDataArray: tokenChainDataArray, + isPriceDataLoading, + isBalanceDataLoading, + }; +} - const tokenChainData: TokenChainData = { - ...token, - sourceChainId: sourceChainId, - sourceChainDecimals: mapping.sourceChainTokenDecimals, - sourceChainPrices: undefined, - sourceChainBalance: balance, +function getTokensChainData({ + chainId, + sourceChainTokenIdMap, + pricesData, + sourceChainId, + tokensChainBalanceData, +}: { + chainId: ContractsChainId; + sourceChainTokenIdMap: MultichainTokenMapping[SettlementChainId][SourceChainId]; + pricesData: TokenPricesData | undefined; + sourceChainId: SourceChainId; + tokensChainBalanceData: Record; +}): Record { + const tokensChainData: Record = {}; + + for (const sourceChainTokenAddress in tokensChainBalanceData) { + const mapping = sourceChainTokenIdMap[sourceChainTokenAddress]; + + if (!mapping) { + continue; + } + + const balance = tokensChainBalanceData[sourceChainTokenAddress]; + + if (balance === undefined || balance === 0n) { + continue; + } + + const settlementChainTokenAddress = mapping.settlementChainTokenAddress; + + const token = getToken(chainId, settlementChainTokenAddress); + + const tokenChainData: TokenChainData = { + ...token, + sourceChainId: sourceChainId, + sourceChainDecimals: mapping.sourceChainTokenDecimals, + sourceChainPrices: undefined, + sourceChainBalance: balance, + }; + + if (pricesData && settlementChainTokenAddress in pricesData) { + // convert prices from settlement chain decimals to source chain decimals if decimals are different + + const settlementChainTokenDecimals = token.decimals; + const sourceChainTokenDecimals = mapping.sourceChainTokenDecimals; + + let adjustedPrices = pricesData[settlementChainTokenAddress]; + + if (settlementChainTokenDecimals !== sourceChainTokenDecimals) { + // if current price is 1000 with 1 decimal (100_0) on settlement chain + // and source chain has 3 decimals + // then price should be 100_000 + // so, 1000 * 10 ** 3 / 10 ** 1 = 100_000 + adjustedPrices = { + minPrice: bigMath.mulDiv( + adjustedPrices.minPrice, + 10n ** BigInt(sourceChainTokenDecimals), + 10n ** BigInt(settlementChainTokenDecimals) + ), + maxPrice: bigMath.mulDiv( + adjustedPrices.maxPrice, + 10n ** BigInt(sourceChainTokenDecimals), + 10n ** BigInt(settlementChainTokenDecimals) + ), }; + } + + tokenChainData.sourceChainPrices = adjustedPrices; + } + + tokensChainData[settlementChainTokenAddress] = tokenChainData; + } + + return tokensChainData; +} + +export function useSourceChainTokensDataRequest( + chainId: ContractsChainId, + srcChainId: SourceChainId | undefined, + account: string | undefined +): { + tokensSrcChainData: Record; + isPriceDataLoading: boolean; + isBalanceDataLoading: boolean; +} { + const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); - if (pricesData && settlementChainTokenAddress in pricesData) { - // convert prices from settlement chain decimals to source chain decimals if decimals are different - - const settlementChainTokenDecimals = token.decimals; - const sourceChainTokenDecimals = mapping.sourceChainTokenDecimals; - - let adjustedPrices = pricesData[settlementChainTokenAddress]; - - if (settlementChainTokenDecimals !== sourceChainTokenDecimals) { - // if current price is 1000 with 1 decimal (100_0) on settlement chain - // and source chain has 3 decimals - // then price should be 100_000 - // so, 1000 * 10 ** 3 / 10 ** 1 = 100_000 - adjustedPrices = { - minPrice: bigMath.mulDiv( - adjustedPrices.minPrice, - 10n ** BigInt(sourceChainTokenDecimals), - 10n ** BigInt(settlementChainTokenDecimals) - ), - maxPrice: bigMath.mulDiv( - adjustedPrices.maxPrice, - 10n ** BigInt(sourceChainTokenDecimals), - 10n ** BigInt(settlementChainTokenDecimals) - ), - }; - } - - tokenChainData.sourceChainPrices = adjustedPrices; - } - - tokenChainDataArray.push(tokenChainData); + const { data: balanceData, isLoading: isBalanceDataLoading } = useSWR( + srcChainId && account ? ["source-chain-tokens", chainId, srcChainId, account] : null, + () => { + if (!srcChainId || !account) { + return undefined; } + const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[chainId]?.[srcChainId]; + if (!sourceChainTokenIdMap) { + return undefined; + } + + return fetchSourceChainTokenBalances({ + sourceChainId: srcChainId, + account: account!, + sourceChainTokenIdMap, + }); } + ); - return tokenChainDataArray; - }, [tokenBalances, chainId, pricesData]); + const tokensSrcChainData: Record = useMemo(() => { + if (!balanceData || !srcChainId) { + return EMPTY_OBJECT; + } + + const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[chainId]?.[srcChainId]; + + if (!sourceChainTokenIdMap) { + return EMPTY_OBJECT; + } + + return getTokensChainData({ + chainId, + sourceChainTokenIdMap, + pricesData, + sourceChainId: srcChainId, + tokensChainBalanceData: balanceData, + }); + }, [balanceData, chainId, pricesData, srcChainId]); return { - tokenChainDataArray: tokenChainDataArray, + tokensSrcChainData, isPriceDataLoading, isBalanceDataLoading, }; } +export function useSrcChainTokensData() { + const { chainId, srcChainId } = useChainId(); + const { address: account } = useAccount(); + + return useSourceChainTokensDataRequest(chainId, srcChainId, account); +} + export function useGmxAccountWithdrawNetworks() { const { chainId } = useChainId(); diff --git a/src/components/Synthetics/TradeBox/TradeBox.tsx b/src/components/Synthetics/TradeBox/TradeBox.tsx index 677ba07d05..7e5a8cb94d 100644 --- a/src/components/Synthetics/TradeBox/TradeBox.tsx +++ b/src/components/Synthetics/TradeBox/TradeBox.tsx @@ -668,7 +668,7 @@ export function TradeBox({ isMobile }: { isMobile: boolean }) { srcChainId={srcChainId} label={t`Pay`} tokenAddress={fromTokenAddress} - isGmxAccount={isFromTokenGmxAccount} + payChainId={isFromTokenGmxAccount ? 0 : undefined} onSelectTokenAddress={handleSelectFromTokenAddress} size="l" extendedSortSequence={sortedLongAndShortTokens} diff --git a/src/components/TokenSelector/MultichainTokenSelector.tsx b/src/components/TokenSelector/MultichainTokenSelector.tsx index bf9fb20f09..8c083b272d 100644 --- a/src/components/TokenSelector/MultichainTokenSelector.tsx +++ b/src/components/TokenSelector/MultichainTokenSelector.tsx @@ -3,10 +3,11 @@ import cx from "classnames"; import { ReactNode, useEffect, useMemo, useState } from "react"; import { BiChevronDown } from "react-icons/bi"; -import type { ContractsChainId, SourceChainId } from "config/chains"; +import type { AnyChainId, ContractsChainId, SourceChainId } from "config/chains"; +import { isSourceChain } from "config/multichain"; import type { TokenChainData } from "domain/multichain/types"; import { convertToUsd } from "domain/synthetics/tokens"; -import type { Token, TokenData, TokensData } from "domain/tokens"; +import type { Token, TokensData } from "domain/tokens"; import { stripBlacklistedWords } from "domain/tokens/utils"; import { formatAmount, formatBalanceAmount } from "lib/numbers"; import { EMPTY_OBJECT } from "lib/objects"; @@ -30,17 +31,18 @@ type Props = { className?: string; tokenAddress: string; - isGmxAccount: boolean; + payChainId: AnyChainId | 0 | undefined; tokensData: TokensData | undefined; selectedTokenLabel?: ReactNode | string; - onSelectTokenAddress: (tokenAddress: string, isGmxAccount: boolean) => void; + onSelectTokenAddress: (tokenAddress: string, isGmxAccount: boolean, srcChainId: SourceChainId | undefined) => void; extendedSortSequence?: string[] | undefined; footerContent?: ReactNode; qa?: string; multichainTokens: TokenChainData[] | undefined; + includeMultichainTokensInPay?: boolean; onDepositTokenAddress: (tokenAddress: string, chainId: SourceChainId) => void; }; @@ -56,19 +58,25 @@ export function MultichainTokenSelector({ qa, onSelectTokenAddress: propsOnSelectTokenAddress, tokenAddress, - isGmxAccount, + payChainId, className, label, multichainTokens, + includeMultichainTokensInPay, onDepositTokenAddress: propsOnDepositTokenAddress, }: Props) { const [isModalVisible, setIsModalVisible] = useState(false); const [searchKeyword, setSearchKeyword] = useState(""); let token: Token | undefined = getToken(chainId, tokenAddress); - const onSelectTokenAddress = (tokenAddress: string, isGmxAccount: boolean) => { + const onSelectTokenAddress = (tokenAddress: string, _chainId: AnyChainId | 0) => { setIsModalVisible(false); - propsOnSelectTokenAddress(tokenAddress, isGmxAccount); + // TODO MLTCH: bad readability + propsOnSelectTokenAddress( + tokenAddress, + _chainId === 0, + _chainId !== chainId && _chainId !== 0 && isSourceChain(_chainId) ? _chainId : undefined + ); }; const onDepositTokenAddress = (tokenAddress: string, chainId: SourceChainId) => { @@ -197,6 +205,8 @@ export function MultichainTokenSelector({ extendedSortSequence={extendedSortSequence} chainId={chainId} srcChainId={srcChainId} + multichainTokens={multichainTokens} + includeMultichainTokensInPay={includeMultichainTokensInPay} /> )} {activeFilter === "deposit" && multichainTokens && ( @@ -222,7 +232,7 @@ export function MultichainTokenSelector({ symbol={token.symbol} importSize={24} displaySize={20} - chainIdBadge={isGmxAccount ? 0 : undefined} + chainIdBadge={payChainId} /> {token.symbol} @@ -240,8 +250,10 @@ function AvailableToTradeTokenList({ setSearchKeyword, searchKeyword, tokensData, + multichainTokens, extendedSortSequence, onSelectTokenAddress, + includeMultichainTokensInPay, }: { chainId: ContractsChainId; srcChainId: SourceChainId | undefined; @@ -249,8 +261,10 @@ function AvailableToTradeTokenList({ setSearchKeyword: (searchKeyword: string) => void; searchKeyword: string; tokensData: TokensData | undefined; + multichainTokens: TokenChainData[] | undefined; extendedSortSequence?: string[]; - onSelectTokenAddress: (tokenAddress: string, isGmxAccount: boolean) => void; + onSelectTokenAddress: (tokenAddress: string, chainId: AnyChainId | 0) => void; + includeMultichainTokensInPay?: boolean; }) { useEffect(() => { if (isModalVisible) { @@ -259,16 +273,49 @@ function AvailableToTradeTokenList({ }, [isModalVisible, setSearchKeyword]); const sortedFilteredTokens = useMemo(() => { - type DisplayToken = TokenData & { balance: bigint; balanceUsd: bigint; isGmxAccount: boolean }; + type DisplayToken = Token & { + balance: bigint; + balanceUsd: bigint; + chainId: AnyChainId | 0; + }; const concatenatedTokens: DisplayToken[] = []; for (const token of Object.values(tokensData ?? (EMPTY_OBJECT as TokensData))) { if (token.gmxAccountBalance !== undefined) { - concatenatedTokens.push({ ...token, isGmxAccount: true, balance: token.gmxAccountBalance, balanceUsd: 0n }); + const balanceUsd = convertToUsd(token.gmxAccountBalance, token.decimals, token.prices.maxPrice) ?? 0n; + concatenatedTokens.push({ + ...token, + balance: token.gmxAccountBalance, + balanceUsd, + chainId: 0, + }); } if (token.walletBalance !== undefined && srcChainId === undefined) { - concatenatedTokens.push({ ...token, isGmxAccount: false, balance: token.walletBalance, balanceUsd: 0n }); + const balanceUsd = convertToUsd(token.walletBalance, token.decimals, token.prices.maxPrice) ?? 0n; + concatenatedTokens.push({ + ...token, + balance: token.walletBalance, + balanceUsd, + chainId, + }); + } + } + + if (includeMultichainTokensInPay && multichainTokens) { + for (const token of multichainTokens) { + if (token.sourceChainBalance === undefined) { + continue; + } + + const balanceUsd = + convertToUsd(token.sourceChainBalance, token.sourceChainDecimals, token.sourceChainPrices?.maxPrice) ?? 0n; + concatenatedTokens.push({ + ...token, + balance: token.sourceChainBalance, + balanceUsd, + chainId: token.sourceChainId, + }); } } @@ -294,13 +341,12 @@ function AvailableToTradeTokenList({ const tokensWithoutBalance: DisplayToken[] = []; for (const token of filteredTokens) { - const balance = token.isGmxAccount ? token.gmxAccountBalance : token.walletBalance; + const balance = token.balance; if (balance !== undefined && balance > 0n) { - const balanceUsd = convertToUsd(balance, token.decimals, token.prices.maxPrice) ?? 0n; - tokensWithBalance.push({ ...token, balanceUsd }); + tokensWithBalance.push(token); } else { - tokensWithoutBalance.push({ ...token, balanceUsd: 0n }); + tokensWithoutBalance.push(token); } } @@ -327,16 +373,24 @@ function AvailableToTradeTokenList({ }); return [...sortedTokensWithBalance, ...sortedTokensWithoutBalance]; - }, [searchKeyword, tokensData, srcChainId, extendedSortSequence]); + }, [ + chainId, + extendedSortSequence, + includeMultichainTokensInPay, + multichainTokens, + searchKeyword, + srcChainId, + tokensData, + ]); return (
{sortedFilteredTokens.map((token) => { return (
onSelectTokenAddress(token.address, token.isGmxAccount)} + onClick={() => onSelectTokenAddress(token.address, token.chainId)} >
diff --git a/src/config/multichain.ts b/src/config/multichain.ts index 2467d4979b..91bd5d936f 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -48,7 +48,7 @@ export { usdcSgPoolSepolia, }; -type MultichainTokenMapping = Record< +export type MultichainTokenMapping = Record< // settlement chain id SettlementChainId, Record< diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index 094884640d..456ebe6254 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -284,9 +284,11 @@ export function getArbitraryRelayParamsAndPayload({ export function useArbitraryRelayParamsAndPayload({ expressTransactionBuilder, isGmxAccount, + enabled = true, }: { expressTransactionBuilder: ExpressTransactionBuilder | undefined; isGmxAccount: boolean; + enabled: boolean; }): AsyncResult { const account = useSelector(selectAccount); const chainId = useSelector(selectChainId); @@ -360,6 +362,7 @@ export function useArbitraryRelayParamsAndPayload({ throttleMs: 2500, withLoading: true, params: + enabled && account !== undefined && provider !== undefined && globalExpressParams !== undefined && diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index 33c824c084..9001962ab0 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -1,9 +1,14 @@ import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities"; import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex } from "viem"; -import { RelayParamsPayload } from "domain/synthetics/express"; +import type { RelayParamsPayload } from "domain/synthetics/express"; +import { CreateDepositParamsStruct } from "domain/synthetics/markets/types"; import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; +import { hashString } from "sdk/utils/hash"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import { CREATE_DEPOSIT_PARAMS_TYPE, RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE } from "./hashParamsAbiItems"; export enum MultichainActionType { None = 0, @@ -27,59 +32,33 @@ type SetTraderReferralCodeAction = { actionData: SetTraderReferralCodeActionData; }; -const RELAY_PARAMS_TYPE = { - type: "tuple", - name: "", - components: [ - { - type: "tuple", - name: "oracleParams", - components: [ - { type: "address[]", name: "tokens" }, - { type: "address[]", name: "providers" }, - { type: "bytes[]", name: "data" }, - ], - }, - { - type: "tuple", - name: "externalCalls", - components: [ - { type: "address[]", name: "sendTokens" }, - { type: "uint256[]", name: "sendAmounts" }, - { type: "address[]", name: "externalCallTargets" }, - { type: "bytes[]", name: "externalCallDataList" }, - { type: "address[]", name: "refundTokens" }, - { type: "address[]", name: "refundReceivers" }, - ], - }, - { - type: "tuple[]", - name: "tokenPermits", - components: [ - { type: "address", name: "owner" }, - { type: "address", name: "spender" }, - { type: "uint256", name: "value" }, - { type: "uint256", name: "deadline" }, - { type: "address", name: "token" }, - ], - }, - { - type: "tuple", - name: "fee", - components: [ - { type: "address", name: "feeToken" }, - { type: "uint256", name: "feeAmount" }, - { type: "address[]", name: "feeSwapPath" }, - ], - }, - { type: "uint256", name: "userNonce" }, - { type: "uint256", name: "deadline" }, - { type: "bytes", name: "signature" }, - { type: "uint256", name: "desChainId" }, - ], -} as const; - -export type MultichainAction = SetTraderReferralCodeAction; +type DepositActionData = CommonActionData & { + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateDepositParamsStruct; +}; + +type DepositAction = { + actionType: MultichainActionType.Deposit; + actionData: DepositActionData; +}; + +type BridgeOutActionData = { + desChainId: ContractsChainId; + deadline: bigint; + provider: string; + providerData: string; + minAmountOut: bigint; +}; + +type BridgeOutAction = { + actionType: MultichainActionType.BridgeOut; + actionData: BridgeOutActionData; +}; + +export type MultichainAction = SetTraderReferralCodeAction | DepositAction | BridgeOutAction; + +export const GMX_DATA_ACTION_HASH = hashString("GMX_DATA_ACTION"); +// TODO MLTCH also implement bytes32 public constant MAX_DATA_LENGTH = keccak256(abi.encode("MAX_DATA_LENGTH")); export class CodecUiHelper { public static encodeDepositMessage(account: string, data?: string): string { @@ -121,6 +100,34 @@ export class CodecUiHelper { const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + return data; + } else if (action.actionType === MultichainActionType.Deposit) { + const actionData = encodeAbiParameters( + [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_DEPOSIT_PARAMS_TYPE], + [ + { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, + action.actionData.transferRequests, + action.actionData.params, + ] + ); + + const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + + return data; + } else if (action.actionType === MultichainActionType.BridgeOut) { + const actionData = encodeAbiParameters( + [{ type: "uint256" }, { type: "uint256" }, { type: "address" }, { type: "bytes" }, { type: "uint256" }], + [ + BigInt(action.actionData.desChainId), + action.actionData.deadline, + action.actionData.provider as Address, + action.actionData.providerData as Hex, + action.actionData.minAmountOut, + ] + ); + + const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + return data; } diff --git a/src/domain/multichain/codecs/hashParamsAbiItems.ts b/src/domain/multichain/codecs/hashParamsAbiItems.ts new file mode 100644 index 0000000000..6bd4dd2d3c --- /dev/null +++ b/src/domain/multichain/codecs/hashParamsAbiItems.ts @@ -0,0 +1,87 @@ +export const RELAY_PARAMS_TYPE = { + type: "tuple", + name: "", + components: [ + { + type: "tuple", + name: "oracleParams", + components: [ + { type: "address[]", name: "tokens" }, + { type: "address[]", name: "providers" }, + { type: "bytes[]", name: "data" }, + ], + }, + { + type: "tuple", + name: "externalCalls", + components: [ + { type: "address[]", name: "sendTokens" }, + { type: "uint256[]", name: "sendAmounts" }, + { type: "address[]", name: "externalCallTargets" }, + { type: "bytes[]", name: "externalCallDataList" }, + { type: "address[]", name: "refundTokens" }, + { type: "address[]", name: "refundReceivers" }, + ], + }, + { + type: "tuple[]", + name: "tokenPermits", + components: [ + { type: "address", name: "owner" }, + { type: "address", name: "spender" }, + { type: "uint256", name: "value" }, + { type: "uint256", name: "deadline" }, + { type: "address", name: "token" }, + ], + }, + { + type: "tuple", + name: "fee", + components: [ + { type: "address", name: "feeToken" }, + { type: "uint256", name: "feeAmount" }, + { type: "address[]", name: "feeSwapPath" }, + ], + }, + { type: "uint256", name: "userNonce" }, + { type: "uint256", name: "deadline" }, + { type: "bytes", name: "signature" }, + { type: "uint256", name: "desChainId" }, + ], +} as const; + +export const TRANSFER_REQUESTS_TYPE = { + type: "tuple", + name: "", + components: [ + { type: "address[]", name: "tokens" }, + { type: "address[]", name: "receivers" }, + { type: "uint256[]", name: "amounts" }, + ], +}; + +export const CREATE_DEPOSIT_PARAMS_TYPE = { + type: "tuple", + name: "", + components: [ + { + type: "tuple", + name: "addresses", + components: [ + { type: "address", name: "receiver" }, + { type: "address", name: "callbackContract" }, + { type: "address", name: "uiFeeReceiver" }, + { type: "address", name: "market" }, + { type: "address", name: "initialLongToken" }, + { type: "address", name: "initialShortToken" }, + { type: "address[]", name: "longTokenSwapPath" }, + { type: "address[]", name: "shortTokenSwapPath" }, + ], + }, + { type: "uint256", name: "minMarketTokens" }, + { type: "bool", name: "shouldUnwrapNativeToken" }, + { type: "uint256", name: "executionFee" }, + { type: "uint256", name: "callbackGasLimit" }, + { type: "bytes32[]", name: "dataList" }, + ], +}; diff --git a/src/domain/multichain/fetchMultichainTokenBalances.ts b/src/domain/multichain/fetchMultichainTokenBalances.ts index 6cc4275048..5516f1420c 100644 --- a/src/domain/multichain/fetchMultichainTokenBalances.ts +++ b/src/domain/multichain/fetchMultichainTokenBalances.ts @@ -1,94 +1,111 @@ import { zeroAddress } from "viem"; import { SettlementChainId, SourceChainId, getChainName } from "config/chains"; -import { MULTICALLS_MAP, MULTI_CHAIN_TOKEN_MAPPING } from "config/multichain"; +import { MULTICALLS_MAP, MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; import { executeMulticall } from "lib/multicall/executeMulticall"; import type { MulticallRequestConfig } from "lib/multicall/types"; -export async function fetchMultichainTokenBalances( - currentSettlementChainId: SettlementChainId, - account: string, - progressCallback?: (chainId: number, tokensChainData: Record) => void -): Promise>> { - const requests: Promise<{ - chainId: number; - tokensChainData: Record; - }>[] = []; +export async function fetchMultichainTokenBalances({ + settlementChainId, + account, + progressCallback, +}: { + settlementChainId: SettlementChainId; + account: string; + progressCallback?: (chainId: number, tokensChainData: Record) => void; +}): Promise>> { + const requests: Promise[] = []; - const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[currentSettlementChainId]; + const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[settlementChainId]; const result: Record> = {}; for (const sourceChainIdString in sourceChainTokenIdMap) { const sourceChainId = parseInt(sourceChainIdString) as SourceChainId; - const tokenAddresses = Object.keys(sourceChainTokenIdMap[sourceChainId] ?? {}); + const request = fetchSourceChainTokenBalances({ + sourceChainId, + account, + sourceChainTokenIdMap: sourceChainTokenIdMap[sourceChainId], + }).then((res) => { + result[sourceChainId] = res; + progressCallback?.(sourceChainId, res); + }); - const requestConfig: MulticallRequestConfig< - Record< - string, - { - calls: Record<"balanceOf", { methodName: "balanceOf" | "getEthBalance"; params: [string] | [] }>; - } - > - > = {}; + requests.push(request); + } - for (const tokenAddress of tokenAddresses) { - if (tokenAddress === zeroAddress) { - requestConfig[tokenAddress] = { - contractAddress: MULTICALLS_MAP[sourceChainId as SourceChainId], - abiId: "Multicall", - calls: { - balanceOf: { - methodName: "getEthBalance", - params: [account], - }, - }, - }; - continue; + await Promise.allSettled(requests); + + return result; +} + +export async function fetchSourceChainTokenBalances({ + sourceChainId, + account, + sourceChainTokenIdMap, +}: { + sourceChainId: SourceChainId; + account: string; + sourceChainTokenIdMap: MultichainTokenMapping[SettlementChainId][SourceChainId]; +}): Promise> { + const tokenAddresses = Object.keys(sourceChainTokenIdMap ?? {}); + + const requestConfig: MulticallRequestConfig< + Record< + string, + { + calls: Record<"balanceOf", { methodName: "balanceOf" | "getEthBalance"; params: [string] | [] }>; } + > + > = {}; + for (const tokenAddress of tokenAddresses) { + if (tokenAddress === zeroAddress) { requestConfig[tokenAddress] = { - contractAddress: tokenAddress, - abiId: "ERC20", + contractAddress: MULTICALLS_MAP[sourceChainId as SourceChainId], + abiId: "Multicall", calls: { balanceOf: { - methodName: "balanceOf", + methodName: "getEthBalance", params: [account], }, }, }; + continue; } - const request = executeMulticall( - sourceChainId, - requestConfig, - "urgent", - `fetchMultichainTokens-${getChainName(sourceChainId)}` - ).then((res) => { - const tokensChainData: Record = {}; - for (const tokenAddress of tokenAddresses) { - if (tokenAddress === zeroAddress) { - const balance = res.data[tokenAddress].balanceOf.returnValues[0] ?? 0n; - tokensChainData[tokenAddress] = balance; - continue; - } + requestConfig[tokenAddress] = { + contractAddress: tokenAddress, + abiId: "ERC20", + calls: { + balanceOf: { + methodName: "balanceOf", + params: [account], + }, + }, + }; + } + const request = executeMulticall( + sourceChainId, + requestConfig, + "urgent", + `fetchMultichainTokens-${getChainName(sourceChainId)}` + ).then((res) => { + const tokensChainData: Record = {}; + for (const tokenAddress of tokenAddresses) { + if (tokenAddress === zeroAddress) { const balance = res.data[tokenAddress].balanceOf.returnValues[0] ?? 0n; tokensChainData[tokenAddress] = balance; + continue; } - result[sourceChainId] = tokensChainData; - progressCallback?.(sourceChainId, tokensChainData); - return { - chainId: sourceChainId, - tokensChainData, - }; - }); - - requests.push(request); - } + const balance = res.data[tokenAddress].balanceOf.returnValues[0] ?? 0n; + tokensChainData[tokenAddress] = balance; + } - await Promise.allSettled(requests); + return tokensChainData; + }); - return result; + return request; } diff --git a/src/domain/multichain/useIsGmxAccount.tsx b/src/domain/multichain/useIsGmxAccount.tsx new file mode 100644 index 0000000000..c6e779115e --- /dev/null +++ b/src/domain/multichain/useIsGmxAccount.tsx @@ -0,0 +1,36 @@ +import noop from "lodash/noop"; + +import { ContractsChainId, SourceChainId } from "config/chains"; +import { isSettlementChain } from "config/multichain"; + +export function useIsGmxAccount({ + chainId, + srcChainId, + storedIsGmxAccount, + setStoredIsGmxAccount, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + storedIsGmxAccount: boolean | undefined; + setStoredIsGmxAccount: (isGmxAccount: boolean) => void; +}): [boolean, (isGmxAccount: boolean) => void] { + let isGmxAccount = false; + if (srcChainId !== undefined) { + isGmxAccount = true; + } else if (!isSettlementChain(chainId)) { + isGmxAccount = false; + } else { + isGmxAccount = Boolean(storedIsGmxAccount); + } + + let setIsGmxAccount: (value: boolean) => void; + if (srcChainId !== undefined) { + setIsGmxAccount = noop; + } else if (!isSettlementChain(chainId)) { + setIsGmxAccount = noop; + } else { + setIsGmxAccount = setStoredIsGmxAccount; + } + + return [isGmxAccount, setIsGmxAccount]; +} diff --git a/src/domain/synthetics/express/expressOrderUtils.ts b/src/domain/synthetics/express/expressOrderUtils.ts index dc64651565..a43f3b7909 100644 --- a/src/domain/synthetics/express/expressOrderUtils.ts +++ b/src/domain/synthetics/express/expressOrderUtils.ts @@ -22,6 +22,7 @@ import { RelayParamsPayload, RelayParamsPayloadWithSignature, } from "domain/synthetics/express"; +import type { CreateDepositParamsStruct } from "domain/synthetics/markets/types"; import { getSubaccountValidations, hashSubaccountApproval, @@ -57,6 +58,7 @@ import { import { nowInSeconds } from "sdk/utils/time"; import { setUiFeeReceiverIsExpress } from "sdk/utils/twap/uiFeeReceiver"; import { GelatoRelayRouter, MultichainSubaccountRouter, SubaccountGelatoRelayRouter } from "typechain-types"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { MultichainOrderRouter } from "typechain-types/MultichainOrderRouter"; import { approximateL1GasBuffer, estimateBatchGasLimit, estimateRelayerGasLimit, GasLimitsConfig } from "../fees"; @@ -982,6 +984,63 @@ export async function signSetTraderReferralCode({ return signTypedData({ signer, domain, types, typedData }); } +export async function signCreateDeposit({ + signer, + chainId, + srcChainId, + relayParams, + transferRequests, + params, +}: { + signer: WalletSigner | Wallet; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateDepositParamsStruct; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; +}) { + const types = { + CreateDeposit: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateDepositAddresses" }, + { name: "minMarketTokens", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateDepositAddresses: [ + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "market", type: "address" }, + { name: "initialLongToken", type: "address" }, + { name: "initialShortToken", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minMarketTokens: params.minMarketTokens, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} + function updateExpressOrdersAddresses(addressess: CreateOrderPayload["addresses"]): CreateOrderPayload["addresses"] { return { ...addressess, diff --git a/src/domain/synthetics/markets/createDepositTxn.ts b/src/domain/synthetics/markets/createDepositTxn.ts index 9a525274a0..de7026affb 100644 --- a/src/domain/synthetics/markets/createDepositTxn.ts +++ b/src/domain/synthetics/markets/createDepositTxn.ts @@ -1,109 +1,96 @@ import { t } from "@lingui/macro"; -import { Signer, ethers } from "ethers"; +import { Contract, Signer } from "ethers"; import { getContract } from "config/contracts"; -import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; -import { SetPendingDeposit } from "context/SyntheticsEvents"; +import type { SetPendingDeposit } from "context/SyntheticsEvents"; import { callContract } from "lib/contracts"; -import { OrderMetricId } from "lib/metrics/types"; -import { BlockTimestampData } from "lib/useBlockTimestampRequest"; +import type { OrderMetricId } from "lib/metrics/types"; +import type { BlockTimestampData } from "lib/useBlockTimestampRequest"; import { abis } from "sdk/abis"; import type { ContractsChainId } from "sdk/configs/chains"; -import { NATIVE_TOKEN_ADDRESS, convertTokenAddress } from "sdk/configs/tokens"; -import { IDepositUtils } from "typechain-types/ExchangeRouter"; +import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import { validateSignerAddress } from "components/Errors/errorToasts"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; -import { TokensData } from "../tokens"; -import { applySlippageToMinOut } from "../trade"; +import type { TokensData } from "../tokens"; +import type { CreateDepositParamsStruct } from "./types"; export type CreateDepositParams = { - account: string; - initialLongTokenAddress: string; - initialShortTokenAddress: string; - longTokenSwapPath: string[]; - shortTokenSwapPath: string[]; - marketTokenAddress: string; + chainId: ContractsChainId; + signer: Signer; longTokenAmount: bigint; shortTokenAmount: bigint; - minMarketTokens: bigint; executionFee: bigint; executionGasLimit: bigint; - allowedSlippage: number; tokensData: TokensData; skipSimulation?: boolean; metricId?: OrderMetricId; blockTimestampData: BlockTimestampData | undefined; setPendingTxns: (txns: any) => void; setPendingDeposit: SetPendingDeposit; + params: CreateDepositParamsStruct; }; -export async function createDepositTxn(chainId: ContractsChainId, signer: Signer, p: CreateDepositParams) { - const contract = new ethers.Contract(getContract(chainId, "ExchangeRouter"), abis.ExchangeRouter, signer); +export async function createDepositTxn({ + chainId, + signer, + params, + longTokenAmount, + shortTokenAmount, + executionFee, + executionGasLimit, + tokensData, + skipSimulation, + metricId, + blockTimestampData, + setPendingTxns, + setPendingDeposit, +}: CreateDepositParams) { + const contract = new Contract(getContract(chainId, "ExchangeRouter"), abis.ExchangeRouter, signer); const depositVaultAddress = getContract(chainId, "DepositVault"); - await validateSignerAddress(signer, p.account); + await validateSignerAddress(signer, params.addresses.receiver); const isNativeLongDeposit = Boolean( - p.initialLongTokenAddress === NATIVE_TOKEN_ADDRESS && p.longTokenAmount != undefined && p.longTokenAmount > 0 + params.addresses.initialLongToken === NATIVE_TOKEN_ADDRESS && longTokenAmount != undefined && longTokenAmount > 0 ); const isNativeShortDeposit = Boolean( - p.initialShortTokenAddress === NATIVE_TOKEN_ADDRESS && p.shortTokenAmount != undefined && p.shortTokenAmount > 0 + params.addresses.initialShortToken === NATIVE_TOKEN_ADDRESS && shortTokenAmount != undefined && shortTokenAmount > 0 ); let wntDeposit = 0n; if (isNativeLongDeposit) { - wntDeposit = wntDeposit + p.longTokenAmount!; + wntDeposit = wntDeposit + longTokenAmount!; } if (isNativeShortDeposit) { - wntDeposit = wntDeposit + p.shortTokenAmount!; + wntDeposit = wntDeposit + shortTokenAmount!; } const shouldUnwrapNativeToken = isNativeLongDeposit || isNativeShortDeposit; - const wntAmount = p.executionFee + wntDeposit; - - const initialLongTokenAddress = convertTokenAddress(chainId, p.initialLongTokenAddress, "wrapped"); - const initialShortTokenAddress = convertTokenAddress(chainId, p.initialShortTokenAddress, "wrapped"); - - const minMarketTokens = applySlippageToMinOut(p.allowedSlippage, p.minMarketTokens); + const wntAmount = executionFee + wntDeposit; const multicall = [ { method: "sendWnt", params: [depositVaultAddress, wntAmount] }, - !isNativeLongDeposit && p.longTokenAmount > 0 - ? { method: "sendTokens", params: [p.initialLongTokenAddress, depositVaultAddress, p.longTokenAmount] } + !isNativeLongDeposit && longTokenAmount > 0 + ? { method: "sendTokens", params: [params.addresses.initialLongToken, depositVaultAddress, longTokenAmount] } : undefined, - !isNativeShortDeposit && p.shortTokenAmount > 0 - ? { method: "sendTokens", params: [p.initialShortTokenAddress, depositVaultAddress, p.shortTokenAmount] } + !isNativeShortDeposit && shortTokenAmount > 0 + ? { + method: "sendTokens", + params: [params.addresses.initialShortToken, depositVaultAddress, shortTokenAmount], + } : undefined, { method: "createDeposit", - params: [ - { - addresses: { - receiver: p.account, - callbackContract: ethers.ZeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, - market: p.marketTokenAddress, - initialLongToken: initialLongTokenAddress, - initialShortToken: initialShortTokenAddress, - longTokenSwapPath: p.longTokenSwapPath, - shortTokenSwapPath: p.shortTokenSwapPath, - }, - minMarketTokens: minMarketTokens, - shouldUnwrapNativeToken: shouldUnwrapNativeToken, - executionFee: p.executionFee, - callbackGasLimit: 0, - dataList: [], - } satisfies IDepositUtils.CreateDepositParamsStruct, - ], + params: [params], }, ]; @@ -111,17 +98,17 @@ export async function createDepositTxn(chainId: ContractsChainId, signer: Signer .filter(Boolean) .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); - const simulationPromise = !p.skipSimulation + const simulationPromise = !skipSimulation ? simulateExecuteTxn(chainId, { - account: p.account, + account: params.addresses.receiver, primaryPriceOverrides: {}, - tokensData: p.tokensData, + tokensData, createMulticallPayload: encodedPayload, method: "simulateExecuteLatestDeposit", errorTitle: t`Deposit error.`, value: wntAmount, - metricId: p.metricId, - blockTimestampData: p.blockTimestampData, + metricId, + blockTimestampData, }) : undefined; @@ -132,32 +119,32 @@ export async function createDepositTxn(chainId: ContractsChainId, signer: Signer [encodedPayload], wntAmount, simulationPromise, - p.metricId + metricId ); return callContract(chainId, contract, "multicall", [encodedPayload], { value: wntAmount, hideSentMsg: true, hideSuccessMsg: true, - metricId: p.metricId, + metricId, gasLimit, gasPriceData, - setPendingTxns: p.setPendingTxns, + setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.executionFee, - estimatedExecutionGasLimit: p.executionGasLimit, + estimatedExecutionFee: executionFee, + estimatedExecutionGasLimit: executionGasLimit, }, }).then(() => { - p.setPendingDeposit({ - account: p.account, - marketAddress: p.marketTokenAddress, - initialLongTokenAddress, - initialShortTokenAddress, - longTokenSwapPath: p.longTokenSwapPath, - shortTokenSwapPath: p.shortTokenSwapPath, - initialLongTokenAmount: p.longTokenAmount, - initialShortTokenAmount: p.shortTokenAmount, - minMarketTokens: minMarketTokens, + setPendingDeposit({ + account: params.addresses.receiver, + marketAddress: params.addresses.market, + initialLongTokenAddress: params.addresses.initialLongToken, + initialShortTokenAddress: params.addresses.initialShortToken, + longTokenSwapPath: params.addresses.longTokenSwapPath, + shortTokenSwapPath: params.addresses.shortTokenSwapPath, + initialLongTokenAmount: longTokenAmount, + initialShortTokenAmount: shortTokenAmount, + minMarketTokens: params.minMarketTokens, shouldUnwrapNativeToken, isGlvDeposit: false, }); diff --git a/src/domain/synthetics/markets/createGlvDepositTxn.ts b/src/domain/synthetics/markets/createGlvDepositTxn.ts index 7d3df45ff3..618b068eb9 100644 --- a/src/domain/synthetics/markets/createGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createGlvDepositTxn.ts @@ -1,99 +1,106 @@ import { t } from "@lingui/macro"; import { Signer, ethers } from "ethers"; -import { numberToHex } from "viem"; import { getContract } from "config/contracts"; -import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; +import type { SetPendingDeposit } from "context/SyntheticsEvents"; import { callContract } from "lib/contracts"; +import type { OrderMetricId } from "lib/metrics"; +import { BlockTimestampData } from "lib/useBlockTimestampRequest"; import { abis } from "sdk/abis"; import type { ContractsChainId } from "sdk/configs/chains"; -import { NATIVE_TOKEN_ADDRESS, convertTokenAddress } from "sdk/configs/tokens"; -import { IGlvDepositUtils } from "typechain-types/GlvRouter"; +import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import { validateSignerAddress } from "components/Errors/errorToasts"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; -import { applySlippageToMinOut } from "../trade"; -import { CreateDepositParams } from "./createDepositTxn"; - -interface CreateGlvDepositParams extends CreateDepositParams { - glvAddress: string; +import type { TokensData } from "../tokens"; +import type { CreateGlvDepositParamsStruct } from "./types"; + +interface CreateGlvDepositParams { + chainId: ContractsChainId; + signer: Signer; + longTokenAddress: string; + shortTokenAddress: string; + longTokenAmount: bigint; + shortTokenAmount: bigint; + executionFee: bigint; + executionGasLimit: bigint; + tokensData: TokensData; + skipSimulation?: boolean; + metricId?: OrderMetricId; + blockTimestampData: BlockTimestampData | undefined; + setPendingTxns: (txns: any) => void; + setPendingDeposit: SetPendingDeposit; + params: CreateGlvDepositParamsStruct; marketTokenAmount: bigint; - isMarketTokenDeposit: boolean; - isFirstDeposit: boolean; } -export async function createGlvDepositTxn(chainId: ContractsChainId, signer: Signer, p: CreateGlvDepositParams) { +export async function createGlvDepositTxn({ + chainId, + signer, + params, + longTokenAddress, + shortTokenAddress, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + executionFee, + executionGasLimit, + tokensData, + skipSimulation, + metricId, + blockTimestampData, + setPendingTxns, + setPendingDeposit, +}: CreateGlvDepositParams) { const contract = new ethers.Contract(getContract(chainId, "GlvRouter"), abis.GlvRouter, signer); const depositVaultAddress = getContract(chainId, "GlvVault"); const isNativeLongDeposit = Boolean( - p.initialLongTokenAddress === NATIVE_TOKEN_ADDRESS && p.longTokenAmount != undefined && p.longTokenAmount > 0 + longTokenAddress === NATIVE_TOKEN_ADDRESS && longTokenAmount != undefined && longTokenAmount > 0 ); const isNativeShortDeposit = Boolean( - p.initialShortTokenAddress === NATIVE_TOKEN_ADDRESS && p.shortTokenAmount != undefined && p.shortTokenAmount > 0 + shortTokenAddress === NATIVE_TOKEN_ADDRESS && shortTokenAmount != undefined && shortTokenAmount > 0 ); - await validateSignerAddress(signer, p.account); + await validateSignerAddress(signer, params.addresses.receiver); let wntDeposit = 0n; if (isNativeLongDeposit) { - wntDeposit = wntDeposit + p.longTokenAmount!; + wntDeposit = wntDeposit + longTokenAmount!; } if (isNativeShortDeposit) { - wntDeposit = wntDeposit + p.shortTokenAmount!; + wntDeposit = wntDeposit + shortTokenAmount!; } - const shouldUnwrapNativeToken = isNativeLongDeposit || isNativeShortDeposit; - - const wntAmount = p.executionFee + wntDeposit; - - const initialLongTokenAddress = convertTokenAddress(chainId, p.initialLongTokenAddress, "wrapped"); - const initialShortTokenAddress = convertTokenAddress(chainId, p.initialShortTokenAddress, "wrapped"); + const shouldUnwrapNativeToken = params.shouldUnwrapNativeToken; - const minGlvTokens = applySlippageToMinOut(p.allowedSlippage, p.minMarketTokens); + const wntAmount = executionFee + wntDeposit; const multicall = [ { method: "sendWnt", params: [depositVaultAddress, wntAmount] }, - !isNativeLongDeposit && p.longTokenAmount > 0 && !p.isMarketTokenDeposit - ? { method: "sendTokens", params: [p.initialLongTokenAddress, depositVaultAddress, p.longTokenAmount] } + !isNativeLongDeposit && longTokenAmount > 0 && !params.isMarketTokenDeposit + ? { method: "sendTokens", params: [params.addresses.initialLongToken, depositVaultAddress, longTokenAmount] } : undefined, - !isNativeShortDeposit && p.shortTokenAmount > 0 && !p.isMarketTokenDeposit - ? { method: "sendTokens", params: [p.initialShortTokenAddress, depositVaultAddress, p.shortTokenAmount] } + !isNativeShortDeposit && shortTokenAmount > 0 && !params.isMarketTokenDeposit + ? { + method: "sendTokens", + params: [params.addresses.initialShortToken, depositVaultAddress, shortTokenAmount], + } : undefined, - p.isMarketTokenDeposit + params.isMarketTokenDeposit ? { method: "sendTokens", - params: [p.marketTokenAddress, depositVaultAddress, p.marketTokenAmount], + params: [params.addresses.market, depositVaultAddress, marketTokenAmount], } : undefined, { method: "createGlvDeposit", - params: [ - { - addresses: { - glv: p.glvAddress, - market: p.marketTokenAddress, - receiver: p.isFirstDeposit ? numberToHex(1, { size: 20 }) : p.account, - callbackContract: ethers.ZeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, - initialLongToken: p.isMarketTokenDeposit ? ethers.ZeroAddress : initialLongTokenAddress, - initialShortToken: p.isMarketTokenDeposit ? ethers.ZeroAddress : initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - }, - minGlvTokens: minGlvTokens, - executionFee: p.executionFee, - callbackGasLimit: 0n, - shouldUnwrapNativeToken, - isMarketTokenDeposit: p.isMarketTokenDeposit, - dataList: [], - } satisfies IGlvDepositUtils.CreateGlvDepositParamsStruct, - ], + params: [params], }, ]; @@ -101,17 +108,17 @@ export async function createGlvDepositTxn(chainId: ContractsChainId, signer: Sig .filter(Boolean) .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); - const simulationPromise = !p.skipSimulation + const simulationPromise = !skipSimulation ? simulateExecuteTxn(chainId, { - account: p.account, + account: params.addresses.receiver, primaryPriceOverrides: {}, - tokensData: p.tokensData, + tokensData, createMulticallPayload: encodedPayload, method: "simulateExecuteLatestGlvDeposit", errorTitle: t`Deposit error.`, value: wntAmount, - metricId: p.metricId, - blockTimestampData: p.blockTimestampData, + metricId, + blockTimestampData, }) : undefined; @@ -122,37 +129,37 @@ export async function createGlvDepositTxn(chainId: ContractsChainId, signer: Sig [encodedPayload], wntAmount, simulationPromise, - p.metricId + metricId ); return callContract(chainId, contract, "multicall", [encodedPayload], { value: wntAmount, hideSentMsg: true, hideSuccessMsg: true, - metricId: p.metricId, + metricId, gasLimit, gasPriceData, - setPendingTxns: p.setPendingTxns, + setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.executionFee, - estimatedExecutionGasLimit: p.executionGasLimit, + estimatedExecutionFee: executionFee, + estimatedExecutionGasLimit: executionGasLimit, }, }).then(() => { - p.setPendingDeposit({ - account: p.account, - marketAddress: p.marketTokenAddress, - glvAddress: p.glvAddress, - initialLongTokenAddress: p.isMarketTokenDeposit ? ethers.ZeroAddress : initialLongTokenAddress, - initialShortTokenAddress: p.isMarketTokenDeposit ? ethers.ZeroAddress : initialShortTokenAddress, - longTokenSwapPath: p.longTokenSwapPath, - shortTokenSwapPath: p.shortTokenSwapPath, - minMarketTokens: p.minMarketTokens, + setPendingDeposit({ + account: params.addresses.receiver, + marketAddress: params.addresses.market, + glvAddress: params.addresses.glv, + initialLongTokenAddress: params.addresses.initialLongToken, + initialShortTokenAddress: params.addresses.initialShortToken, + longTokenSwapPath: params.addresses.longTokenSwapPath, + shortTokenSwapPath: params.addresses.shortTokenSwapPath, + minMarketTokens: params.minGlvTokens, shouldUnwrapNativeToken, - initialLongTokenAmount: p.longTokenAmount, - initialShortTokenAmount: p.shortTokenAmount, - initialMarketTokenAmount: p.isMarketTokenDeposit ? p.marketTokenAmount : 0n, + initialLongTokenAmount: longTokenAmount, + initialShortTokenAmount: shortTokenAmount, + initialMarketTokenAmount: params.isMarketTokenDeposit ? marketTokenAmount : 0n, isGlvDeposit: true, - isMarketDeposit: p.isMarketTokenDeposit, + isMarketDeposit: params.isMarketTokenDeposit, }); }); } diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index ab4195cec7..ca8c7495ed 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -1,15 +1,21 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; -import { ExpressTxnData } from "lib/transactions"; +import { OrderMetricId, makeTxnErrorMetricsHandler, makeTxnSentMetricsHandler } from "lib/metrics"; +import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; +import { makeUserAnalyticsOrderFailResultHandler } from "lib/userAnalytics"; +import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; import type { IDepositUtils } from "typechain-types/ExchangeRouter"; import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; -import { RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; +import { CreateDepositParamsStruct } from "."; +import { ExpressTxnParams, RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; export type CreateMultichainDepositParams = { chainId: ContractsChainId; @@ -130,3 +136,57 @@ function signMultichainDepositPayload({ return signTypedData({ signer, domain, types, typedData }); } +export function createMultichainDepositTxn({ + chainId, + srcChainId, + signer, + transferRequests, + asyncExpressTxnResult, + isGlv, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + asyncExpressTxnResult: AsyncResult; + params: CreateDepositParamsStruct; + // TODO MLTCH: support GLV + isGlv: boolean; + // TODO MLTCH: support pending txns + // setPendingTxns, + // setPendingDeposit, +}) { + if (isGlv) { + throw new Error("Not implemented"); + } + + if (!asyncExpressTxnResult.data) { + throw new Error("Async result is not set"); + } + + return buildAndSignMultichainDepositTxn({ + chainId, + srcChainId, + signer, + account: params.addresses.receiver, + relayerFeeAmount: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...asyncExpressTxnResult.data.relayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + transferRequests, + params, + }).then(async (txnData: ExpressTxnData) => { + await sendExpressTransaction({ + chainId, + // TODO MLTCH: pass true when we can + isSponsoredCall: false, + txnData, + }); + }); + // .then(makeTxnSentMetricsHandler(metricId)) + // .catch(makeTxnErrorMetricsHandler(metricId)) + // .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricId)); +} diff --git a/src/domain/synthetics/markets/types.ts b/src/domain/synthetics/markets/types.ts index 89764a5b31..c6b57c9c31 100644 --- a/src/domain/synthetics/markets/types.ts +++ b/src/domain/synthetics/markets/types.ts @@ -1,4 +1,5 @@ import { TokenData } from "domain/synthetics/tokens"; +import type { ERC20Address } from "domain/tokens"; import { Market, MarketInfo, MarketPoolTokens } from "sdk/types/markets"; export * from "sdk/types/markets"; @@ -61,3 +62,45 @@ export type ClaimableFunding = { export type ClaimableFundingData = { [marketAddress: string]: ClaimableFunding; }; + +export type CreateDepositParamsAddressesStructOutput = { + receiver: string; + callbackContract: string; + uiFeeReceiver: string; + market: string; + initialLongToken: ERC20Address; + initialShortToken: ERC20Address; + longTokenSwapPath: string[]; + shortTokenSwapPath: string[]; +}; + +export type CreateDepositParamsStruct = { + addresses: CreateDepositParamsAddressesStructOutput; + minMarketTokens: bigint; + shouldUnwrapNativeToken: boolean; + executionFee: bigint; + callbackGasLimit: bigint; + dataList: string[]; +}; + +export type CreateGlvDepositAddressesStruct = { + glv: string; + market: string; + receiver: string; + callbackContract: string; + uiFeeReceiver: string; + initialLongToken: string; + initialShortToken: string; + longTokenSwapPath: string[]; + shortTokenSwapPath: string[]; +}; + +export type CreateGlvDepositParamsStruct = { + addresses: CreateGlvDepositAddressesStruct; + minGlvTokens: bigint; + executionFee: bigint; + callbackGasLimit: bigint; + shouldUnwrapNativeToken: boolean; + isMarketTokenDeposit: boolean; + dataList: string[]; +}; diff --git a/src/domain/synthetics/trade/usePositionEditorState.ts b/src/domain/synthetics/trade/usePositionEditorState.ts index 9e8a69adca..7a5a8d35c3 100644 --- a/src/domain/synthetics/trade/usePositionEditorState.ts +++ b/src/domain/synthetics/trade/usePositionEditorState.ts @@ -1,4 +1,3 @@ -import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; import { Address } from "viem"; @@ -7,11 +6,12 @@ import { getSyntheticsCollateralEditAddressMapKey, getSyntheticsCollateralEditTokenIsFromGmxAccountMapKey, } from "config/localStorage"; -import { isSettlementChain } from "config/multichain"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; +import { useIsGmxAccount } from "domain/multichain/useIsGmxAccount"; import { useLocalStorageSerializeKey } from "lib/localStorage"; import { parsePositionKey } from "../positions"; + export type PositionEditorState = ReturnType; export function usePositionEditorState(chainId: ContractsChainId, srcChainId: SourceChainId | undefined) { @@ -22,28 +22,15 @@ export function usePositionEditorState(chainId: ContractsChainId, srcChainId: So const [selectedCollateralAddressMap, setSelectedCollateralAddressMap] = useLocalStorageSerializeKey< Partial> >(getSyntheticsCollateralEditAddressMapKey(chainId), {}); - const [_isCollateralTokenFromGmxAccount, _setIsCollateralTokenFromGmxAccount] = useLocalStorageSerializeKey( - getSyntheticsCollateralEditTokenIsFromGmxAccountMapKey(chainId), - false - ); - - let isCollateralTokenFromGmxAccount = false; - if (srcChainId !== undefined) { - isCollateralTokenFromGmxAccount = true; - } else if (!isSettlementChain(chainId)) { - isCollateralTokenFromGmxAccount = false; - } else { - isCollateralTokenFromGmxAccount = Boolean(_isCollateralTokenFromGmxAccount); - } + const [storedIsCollateralTokenFromGmxAccount, setStoredIsCollateralTokenFromGmxAccount] = + useLocalStorageSerializeKey(getSyntheticsCollateralEditTokenIsFromGmxAccountMapKey(chainId), false); - let setIsCollateralTokenFromGmxAccount: (value: boolean) => void; - if (srcChainId !== undefined) { - setIsCollateralTokenFromGmxAccount = noop; - } else if (!isSettlementChain(chainId)) { - setIsCollateralTokenFromGmxAccount = noop; - } else { - setIsCollateralTokenFromGmxAccount = _setIsCollateralTokenFromGmxAccount; - } + const [isCollateralTokenFromGmxAccount, setIsCollateralTokenFromGmxAccount] = useIsGmxAccount({ + chainId, + srcChainId, + storedIsGmxAccount: storedIsCollateralTokenFromGmxAccount, + setStoredIsGmxAccount: setStoredIsCollateralTokenFromGmxAccount, + }); const setSelectedCollateralAddress = useCallback( (selectedCollateralAddress: Address) => { @@ -61,8 +48,8 @@ export function usePositionEditorState(chainId: ContractsChainId, srcChainId: So useEffect(() => { setEditingPositionKey(undefined); setCollateralInputValue(""); - _setIsCollateralTokenFromGmxAccount(srcChainId !== undefined); - }, [_setIsCollateralTokenFromGmxAccount, chainId, srcChainId]); + setStoredIsCollateralTokenFromGmxAccount(srcChainId !== undefined); + }, [setStoredIsCollateralTokenFromGmxAccount, srcChainId]); useEffect( function fallbackIsCollateralTokenFromGmxAccount() { From e070a1a1bd6a450a6f118a4e89f2b8d6000f9fe5 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 5 Aug 2025 13:57:27 +0200 Subject: [PATCH 03/38] Multichain lp --- sdk/src/abis/MultichainUtils.json | 133 ------ sdk/src/abis/index.ts | 3 - sdk/src/configs/contracts.ts | 24 +- sdk/src/types/subsquid.ts | 170 ++++++++ sdk/src/types/tokens.ts | 12 +- sdk/src/utils/tokens.ts | 6 +- .../PositionEditorCollateralSelector.tsx | 29 +- .../GmDepositWithdrawalBox.tsx | 153 ++++--- .../useDepositWithdrawalTransactions.tsx | 390 ++++++++++-------- .../useGmSwapSubmitState.tsx | 24 +- .../useTokensToApprove.tsx | 63 ++- src/components/TokenIcon/TokenWithIcon.tsx | 11 +- .../selectors/positionEditorSelectors.ts | 5 +- .../selectors/tradeboxSelectors/index.ts | 9 +- src/domain/multichain/arbitraryRelayParams.ts | 56 ++- .../markets/createMultichainDepositTxn.ts | 11 +- .../markets/createMultichainGlvDepositTxn.ts | 187 +++++++++ .../synthetics/tokens/useTokensDataRequest.ts | 11 +- .../synthetics/trade/utils/validation.ts | 1 + src/lib/metrics/utils.ts | 49 ++- 20 files changed, 875 insertions(+), 472 deletions(-) delete mode 100644 sdk/src/abis/MultichainUtils.json create mode 100644 src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts diff --git a/sdk/src/abis/MultichainUtils.json b/sdk/src/abis/MultichainUtils.json deleted file mode 100644 index 7e60599995..0000000000 --- a/sdk/src/abis/MultichainUtils.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyMultichainTransferInAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "InsufficientMultichainBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "endpoint", - "type": "address" - } - ], - "name": "InvalidMultichainEndpoint", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "InvalidMultichainProvider", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "DataStore" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getMultichainBalanceAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "DataStore" - }, - { - "internalType": "address", - "name": "endpoint", - "type": "address" - } - ], - "name": "validateMultichainEndpoint", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "DataStore" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "validateMultichainProvider", - "outputs": [], - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/sdk/src/abis/index.ts b/sdk/src/abis/index.ts index d66e62eec7..3fc4a32fba 100644 --- a/sdk/src/abis/index.ts +++ b/sdk/src/abis/index.ts @@ -23,7 +23,6 @@ import MultichainGmRouter from "./MultichainGmRouter.json"; import MultichainOrderRouter from "./MultichainOrderRouter.json"; import MultichainSubaccountRouter from "./MultichainSubaccountRouter.json"; import MultichainTransferRouter from "./MultichainTransferRouter.json"; -import MultichainUtils from "./MultichainUtils.json"; import MultichainVault from "./MultichainVault.json"; import OrderBook from "./OrderBook.json"; import OrderBookReader from "./OrderBookReader.json"; @@ -82,7 +81,6 @@ export type AbiId = | "MultichainOrderRouter" | "MultichainSubaccountRouter" | "MultichainTransferRouter" - | "MultichainUtils" | "MultichainVault" | "OrderBook" | "OrderBookReader" @@ -163,7 +161,6 @@ export const abis: Record = { MultichainOrderRouter: MultichainOrderRouter.abi, MultichainSubaccountRouter: MultichainSubaccountRouter.abi, MultichainTransferRouter: MultichainTransferRouter.abi, - MultichainUtils: MultichainUtils.abi, MultichainVault: MultichainVault.abi, OrderBook: OrderBook.abi, OrderBookReader: OrderBookReader.abi, diff --git a/sdk/src/configs/contracts.ts b/sdk/src/configs/contracts.ts index e61e55513b..1902cbd2bf 100644 --- a/sdk/src/configs/contracts.ts +++ b/sdk/src/configs/contracts.ts @@ -4,7 +4,6 @@ import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX, Contrac export const CONTRACTS = { [ARBITRUM]: { - // arbitrum mainnet Vault: "0x489ee077994B6658eAfA855C308275EAd8097C4A", Router: "0xaBBc5F99639c9B6bCb58544ddf04EFA6802F4064", VaultReader: "0xfebB9f4CAC4cD523598fE1C5771181440143F24A", @@ -50,21 +49,29 @@ export const CONTRACTS = { // Synthetics DataStore: "0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8", EventEmitter: "0xC8ee91A54287DB53897056e12D9819156D3822Fb", - SubaccountRouter: "0xa329221a77BE08485f59310b873b14815c82E10D", - ExchangeRouter: "0x602b805EedddBbD9ddff44A7dcBD46cb07849685", + SubaccountRouter: "0xfB0dd3878440817e1F12cDF023a88E74D4ae82e2", + ExchangeRouter: "0x96F257288f00a9aD8ba159294D373550fE2b6771", DepositVault: "0xF89e77e8Dc11691C9e8757e84aaFbCD8A67d7A55", WithdrawalVault: "0x0628D46b5D145f183AdB6Ef1f2c97eD1C4701C55", OrderVault: "0x31eF83a530Fde1B38EE9A18093A333D8Bbbc40D5", ShiftVault: "0xfe99609C4AA83ff6816b64563Bdffd7fa68753Ab", - SyntheticsReader: "0xcF2845Ab3866842A6b51Fb6a551b92dF58333574", + SyntheticsReader: "0xd42986AFC0660dd1f1C8C76F248262Ffcb37db79", SyntheticsRouter: "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6", - GlvReader: "0x6a9505D0B44cFA863d9281EA5B0b34cB36243b45", - GlvRouter: "0x994c598e3b0661bb805d53c6fa6b4504b23b68dd", + GlvReader: "0xF90192b6D68cAF5947114212755C67c64518CCE9", + GlvRouter: "0x36194Db64C1881E44E34e14dc3bb8AfA83B65608", GlvVault: "0x393053B58f9678C9c28c2cE941fF6cac49C3F8f9", - GelatoRelayRouter: "0x9EB239eDf4c6f4c4fC9d30ea2017F8716d049C8D", - SubaccountGelatoRelayRouter: "0x5F345B765d5856bC0843cEE8bE234b575eC77DBC", + GelatoRelayRouter: "0xC0d483eD76ceCd52eB44Eb78d813Cf5Ace5138fD", + SubaccountGelatoRelayRouter: "0xeb1f997F95D970701B72F4f66DdD8E360c34C762", + + MultichainClaimsRouter: "0xDa3e6AB64699f159C82acF9bA7216eD57806DFc6", + MultichainGlvRouter: "0x49a10eb59193ff2dC2C95C13979D0C045ccbCE42", + MultichainGmRouter: "0x6DFEa567810CfbF8B787a504D66C767a8A770eB7", + MultichainOrderRouter: "0xba4C3574553BB99bC7D0116CD49DCc757870b68E", + MultichainSubaccountRouter: "0xDF4fB0eb95f70C3E3EeAdBe5d1074F009d3F0193", + MultichainTransferRouter: "0x379b75be4cA9a25C72753f56ad9EA3850e206D35", + MultichainVault: "0xCeaadFAf6A8C489B250e407987877c5fDfcDBE6E", ExternalHandler: "0x389CEf541397e872dC04421f166B5Bc2E0b374a5", OpenOceanRouter: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", @@ -368,7 +375,6 @@ export const CONTRACTS = { MultichainOrderRouter: "0x7727E80A396Bc999a26439DbbE9F762A0b2a2421", MultichainSubaccountRouter: "0xCA029324581F9E0d3740b0Be828E309A3571f391", MultichainTransferRouter: "0x65E5dBa8d9c7a9000BfC4FBE979cd822B29e99e5", - MultichainUtils: "0x48361663c5691c977dd37F13c3155580D2ca258D", MultichainVault: "0xCd46EF5ed7d08B345c47b5a193A719861Aa2CD91", Oracle: "0x0dC4e24C63C24fE898Dda574C962Ba7Fbb146964", OracleStore: "0x322F621C9fDb9faa4993Ba1fECBE4666138B1435", diff --git a/sdk/src/types/subsquid.ts b/sdk/src/types/subsquid.ts index 1afa622444..f9fd8084b8 100644 --- a/sdk/src/types/subsquid.ts +++ b/sdk/src/types/subsquid.ts @@ -1534,6 +1534,155 @@ export interface CumulativePoolValuesConnection { totalCount: Scalars["Int"]["output"]; } +export interface Distribution { + __typename?: "Distribution"; + amounts: Array; + amountsInUsd: Array; + id: Scalars["String"]["output"]; + receiver: Scalars["String"]["output"]; + tokens: Array; + transaction: Transaction; + typeId: Scalars["Int"]["output"]; +} + +export interface DistributionEdge { + __typename?: "DistributionEdge"; + cursor: Scalars["String"]["output"]; + node: Distribution; +} + +export enum DistributionOrderByInput { + id_ASC = "id_ASC", + id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", + id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", + id_DESC = "id_DESC", + id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", + id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", + receiver_ASC = "receiver_ASC", + receiver_ASC_NULLS_FIRST = "receiver_ASC_NULLS_FIRST", + receiver_ASC_NULLS_LAST = "receiver_ASC_NULLS_LAST", + receiver_DESC = "receiver_DESC", + receiver_DESC_NULLS_FIRST = "receiver_DESC_NULLS_FIRST", + receiver_DESC_NULLS_LAST = "receiver_DESC_NULLS_LAST", + transaction_blockNumber_ASC = "transaction_blockNumber_ASC", + transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", + transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", + transaction_blockNumber_DESC = "transaction_blockNumber_DESC", + transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", + transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", + transaction_from_ASC = "transaction_from_ASC", + transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", + transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", + transaction_from_DESC = "transaction_from_DESC", + transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", + transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", + transaction_hash_ASC = "transaction_hash_ASC", + transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", + transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", + transaction_hash_DESC = "transaction_hash_DESC", + transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", + transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", + transaction_id_ASC = "transaction_id_ASC", + transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", + transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", + transaction_id_DESC = "transaction_id_DESC", + transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", + transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", + transaction_timestamp_ASC = "transaction_timestamp_ASC", + transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", + transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", + transaction_timestamp_DESC = "transaction_timestamp_DESC", + transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", + transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", + transaction_to_ASC = "transaction_to_ASC", + transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", + transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", + transaction_to_DESC = "transaction_to_DESC", + transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", + transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", + transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", + transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", + transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", + transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", + transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", + transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", + typeId_ASC = "typeId_ASC", + typeId_ASC_NULLS_FIRST = "typeId_ASC_NULLS_FIRST", + typeId_ASC_NULLS_LAST = "typeId_ASC_NULLS_LAST", + typeId_DESC = "typeId_DESC", + typeId_DESC_NULLS_FIRST = "typeId_DESC_NULLS_FIRST", + typeId_DESC_NULLS_LAST = "typeId_DESC_NULLS_LAST", +} + +export interface DistributionWhereInput { + AND?: InputMaybe>; + OR?: InputMaybe>; + amountsInUsd_containsAll?: InputMaybe>; + amountsInUsd_containsAny?: InputMaybe>; + amountsInUsd_containsNone?: InputMaybe>; + amountsInUsd_isNull?: InputMaybe; + amounts_containsAll?: InputMaybe>; + amounts_containsAny?: InputMaybe>; + amounts_containsNone?: InputMaybe>; + amounts_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + receiver_contains?: InputMaybe; + receiver_containsInsensitive?: InputMaybe; + receiver_endsWith?: InputMaybe; + receiver_eq?: InputMaybe; + receiver_gt?: InputMaybe; + receiver_gte?: InputMaybe; + receiver_in?: InputMaybe>; + receiver_isNull?: InputMaybe; + receiver_lt?: InputMaybe; + receiver_lte?: InputMaybe; + receiver_not_contains?: InputMaybe; + receiver_not_containsInsensitive?: InputMaybe; + receiver_not_endsWith?: InputMaybe; + receiver_not_eq?: InputMaybe; + receiver_not_in?: InputMaybe>; + receiver_not_startsWith?: InputMaybe; + receiver_startsWith?: InputMaybe; + tokens_containsAll?: InputMaybe>; + tokens_containsAny?: InputMaybe>; + tokens_containsNone?: InputMaybe>; + tokens_isNull?: InputMaybe; + transaction?: InputMaybe; + transaction_isNull?: InputMaybe; + typeId_eq?: InputMaybe; + typeId_gt?: InputMaybe; + typeId_gte?: InputMaybe; + typeId_in?: InputMaybe>; + typeId_isNull?: InputMaybe; + typeId_lt?: InputMaybe; + typeId_lte?: InputMaybe; + typeId_not_eq?: InputMaybe; + typeId_not_in?: InputMaybe>; +} + +export interface DistributionsConnection { + __typename?: "DistributionsConnection"; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars["Int"]["output"]; +} + export enum EntityType { Glv = "Glv", Market = "Market", @@ -5875,6 +6024,9 @@ export interface Query { cumulativePoolValueById?: Maybe; cumulativePoolValues: Array; cumulativePoolValuesConnection: CumulativePoolValuesConnection; + distributionById?: Maybe; + distributions: Array; + distributionsConnection: DistributionsConnection; glvById?: Maybe; glvs: Array; glvsAprByPeriod: Array; @@ -6100,6 +6252,24 @@ export interface QuerycumulativePoolValuesConnectionArgs { where?: InputMaybe; } +export interface QuerydistributionByIdArgs { + id: Scalars["String"]["input"]; +} + +export interface QuerydistributionsArgs { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +} + +export interface QuerydistributionsConnectionArgs { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +} + export interface QueryglvByIdArgs { id: Scalars["String"]["input"]; } diff --git a/sdk/src/types/tokens.ts b/sdk/src/types/tokens.ts index b26b39287c..42f80936c8 100644 --- a/sdk/src/types/tokens.ts +++ b/sdk/src/types/tokens.ts @@ -120,14 +120,20 @@ export type TokenPrices = { maxPrice: bigint; }; +export enum TokenBalanceType { + Wallet = 0, + GmxAccount = 1, + SourceChain = 2, +} + export type TokenData = Token & { prices: TokenPrices; - isGmxAccount?: boolean; walletBalance?: bigint; gmxAccountBalance?: bigint; + sourceChainBalance?: bigint; + balanceType?: TokenBalanceType; /** - * If isGmxAccount is true, then this is the gmx account balance - * If isGmxAccount is false, then this is the wallet balance + * Balance according to the balanceType */ balance?: bigint; totalSupply?: bigint; diff --git a/sdk/src/utils/tokens.ts b/sdk/src/utils/tokens.ts index 91cd3af4d5..fcbccd83b2 100644 --- a/sdk/src/utils/tokens.ts +++ b/sdk/src/utils/tokens.ts @@ -95,7 +95,11 @@ export function getIsEquivalentTokens(token1: Token, token2: Token) { return false; } -export function getTokenData(tokensData?: TokensData, address?: string, convertTo?: "wrapped" | "native") { +export function getTokenData( + tokensData?: TokensData, + address?: string, + convertTo?: "wrapped" | "native" +): TokenData | undefined { if (!address || !tokensData?.[address]) { return undefined; } diff --git a/src/components/Synthetics/CollateralSelector/PositionEditorCollateralSelector.tsx b/src/components/Synthetics/CollateralSelector/PositionEditorCollateralSelector.tsx index c1202ef562..a3d7acc8c6 100644 --- a/src/components/Synthetics/CollateralSelector/PositionEditorCollateralSelector.tsx +++ b/src/components/Synthetics/CollateralSelector/PositionEditorCollateralSelector.tsx @@ -8,6 +8,7 @@ import { ContractsChainId, getChainName } from "config/chains"; import { getChainIcon } from "config/icons"; import type { TokenData } from "domain/synthetics/tokens/types"; import { formatBalanceAmount } from "lib/numbers"; +import { TokenBalanceType } from "sdk/types/tokens"; import { TableTd } from "components/Table/Table"; import TokenIcon from "components/TokenIcon/TokenIcon"; @@ -70,9 +71,9 @@ function CollateralSelectorDesktop(props: Props) { {props.options?.map((option) => ( { - props.onSelect(option.address, Boolean(option.isGmxAccount)); + props.onSelect(option.address, option.balanceType === TokenBalanceType.GmxAccount); close(); }} chainId={props.chainId} @@ -118,7 +119,13 @@ function CollateralListItemDesktop({ symbol={tokenData.symbol} displaySize={variant === "destination" ? 16 : 28} importSize={24} - chainIdBadge={variant === "destination" ? undefined : tokenData.isGmxAccount ? 0 : chainId} + chainIdBadge={ + variant === "destination" + ? undefined + : tokenData.balanceType === TokenBalanceType.GmxAccount + ? 0 + : chainId + } /> {tokenData.symbol}
@@ -128,11 +135,15 @@ function CollateralListItemDesktop({
{getChainName(tokenData.isGmxAccount - {tokenData.isGmxAccount ? GMX Balance : getChainName(chainId)} + {tokenData.balanceType === TokenBalanceType.GmxAccount ? ( + GMX Balance + ) : ( + getChainName(chainId) + )}
)} @@ -158,9 +169,9 @@ function CollateralSelectorMobile(props: Props) { {props.options?.map((option) => ( { - props.onSelect(option.address, Boolean(option.isGmxAccount)); + props.onSelect(option.address, option.balanceType === TokenBalanceType.GmxAccount); close(); }} chainId={props.chainId} @@ -201,7 +212,7 @@ function CollateralListItemMobile({ symbol={tokenData.symbol} displaySize={28} importSize={24} - chainIdBadge={tokenData.isGmxAccount ? 0 : chainId} + chainIdBadge={tokenData.balanceType === TokenBalanceType.GmxAccount ? 0 : chainId} />
{tokenData.symbol}
diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 07ba134c60..deb6ba7e7e 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -1,5 +1,6 @@ import { t, Trans } from "@lingui/macro"; import cx from "classnames"; +import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; @@ -25,17 +26,18 @@ import { } from "domain/synthetics/markets/utils"; import { convertToUsd, getTokenData, TokenData } from "domain/synthetics/tokens"; import useSortedPoolsWithIndexToken from "domain/synthetics/trade/useSortedPoolsWithIndexToken"; -import { Token } from "domain/tokens"; +import { Token, TokenBalanceType } from "domain/tokens"; import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; import { useChainId } from "lib/chains"; import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "lib/numbers"; import { getByKey } from "lib/objects"; +import { switchNetwork } from "lib/wallets"; import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; import Checkbox from "components/Checkbox/Checkbox"; -import { useSrcChainTokensData } from "components/Synthetics/GmxAccountModal/hooks"; +import { useMultichainTokensRequest } from "components/Synthetics/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; @@ -78,6 +80,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); + const { tokenChainDataArray } = useMultichainTokensRequest(); // #endregion // #region Selectors @@ -89,8 +92,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { depositMarketTokensData ); const isDeposit = operation === Operation.Deposit; - const tokensData = useTokensData(); - const { tokensSrcChainData } = useSrcChainTokensData(); + const rawTokensData = useTokensData(); // #region State const { @@ -114,6 +116,29 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #endregion // #region Derived state + const tokensData = useMemo(() => { + if (paySource !== "sourceChain") { + return rawTokensData; + } + + return mapValues(rawTokensData, (token) => { + const sourceChainToken = tokenChainDataArray.find( + (t) => t.address === token.address && t.sourceChainId === srcChainId + ); + + if (!sourceChainToken) { + return token; + } + + return { + ...token, + balanceType: TokenBalanceType.SourceChain, + balance: sourceChainToken.sourceChainBalance, + sourceChainBalance: sourceChainToken.sourceChainBalance, + }; + }); + }, [rawTokensData, tokenChainDataArray, srcChainId, paySource]); + /** * When buy/sell GM - marketInfo is GM market, glvInfo is undefined * When buy/sell GLV - marketInfo is corresponding GM market, glvInfo is selected GLV @@ -186,7 +211,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { amount?: bigint; isMarketToken?: boolean; usd?: bigint; - token?: TokenData; setValue: (val: string) => void; }[] = []; @@ -198,7 +222,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { setValue: setFirstTokenInputValue, amount: firstTokenAmount, usd: firstTokenUsd, - token: firstToken, }); } @@ -210,7 +233,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { setValue: setSecondTokenInputValue, amount: secondTokenAmount, usd: secondTokenUsd, - token: secondToken, }); } @@ -235,7 +257,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { firstTokenUsd, isPair, marketInfo, - secondToken, secondTokenAddress, secondTokenAmount, secondTokenInputValue, @@ -312,15 +333,18 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { result.push(shortToken); } - const nativeToken = getByKey(tokensData, NATIVE_TOKEN_ADDRESS)!; + // TODO MLTCH: maybe allow to, but change chain + if (srcChainId === undefined || !isPair) { + const nativeToken = getByKey(tokensData, NATIVE_TOKEN_ADDRESS)!; - if (result.some((token) => token.isWrapped) && nativeToken) { - result.unshift(nativeToken); + if (result.some((token) => token.isWrapped) && nativeToken) { + result.unshift(nativeToken); + } } return result; }, - [marketInfo, tokensData, marketTokensData, marketsInfoData, isPair, glvInfo] + [marketInfo, glvInfo, isPair, srcChainId, tokensData, marketTokensData, marketsInfoData] ); const { longCollateralLiquidityUsd, shortCollateralLiquidityUsd } = useMemo(() => { @@ -382,8 +406,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { glvToken, shouldDisableValidation: shouldDisableValidationForTesting, tokensData, - longToken: longTokenInputState?.token, - shortToken: shortTokenInputState?.token, + longTokenAddress: longTokenInputState?.address, + shortTokenAddress: shortTokenInputState?.address, longTokenLiquidityUsd: longCollateralLiquidityUsd, shortTokenLiquidityUsd: shortCollateralLiquidityUsd, marketTokensData, @@ -436,6 +460,30 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { ? formatBalanceAmount(usedMarketToken.balance, usedMarketToken.decimals) : undefined; }, [marketToken, glvInfo, glvToken]); + + const receiveTokenUsd = glvInfo + ? amounts?.glvTokenUsd ?? 0n + : convertToUsd( + marketTokenAmount, + marketToken?.decimals, + isDeposit ? marketToken?.prices?.maxPrice : marketToken?.prices?.minPrice + )!; + + const payTokenBalanceFormatted = useMemo(() => { + if (!firstToken) { + return undefined; + } + + let balance = firstToken.balance; + + if (balance === undefined) { + return undefined; + } + + return formatBalanceAmount(balance, firstToken.decimals, undefined, { + isStable: firstToken.isStable, + }); + }, [firstToken]); // #endregion // #region Callbacks @@ -569,6 +617,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }, [setFirstTokenAddress, glvInfo, onSelectedMarketForGlv] ); + + const handleSubmit = useCallback( + (e: React.FormEvent) => { + e.preventDefault(); + submitState.onSubmit?.(); + }, + [submitState] + ); // #endregion // #region Effects @@ -632,6 +688,15 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { fromMarketTokenInputState, marketTokensData, }); + + useEffect( + function fallbackSourceChainPaySource() { + if (paySource === "sourceChain" && isPair) { + setPaySource("gmxAccount"); + } + }, + [isPair, paySource, setPaySource] + ); // #endregion // #region Render @@ -665,46 +730,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return (
- +
); - }, [firstToken?.symbol]); - - const receiveTokenUsd = glvInfo - ? amounts?.glvTokenUsd ?? 0n - : convertToUsd( - marketTokenAmount, - marketToken?.decimals, - isDeposit ? marketToken?.prices?.maxPrice : marketToken?.prices?.minPrice - )!; - - const handleSubmit = useCallback( - (e: React.FormEvent) => { - e.preventDefault(); - submitState.onSubmit?.(); - }, - [submitState] - ); - - const payTokenBalanceFormatted = useMemo(() => { - if (!firstToken) { - return undefined; - } - - let balance = firstToken.balance; - - if (paySource === "sourceChain") { - balance = tokensSrcChainData[firstToken.address]?.sourceChainBalance; - } - - if (balance === undefined) { - return undefined; - } - - return formatBalanceAmount(balance, firstToken.decimals, undefined, { - isStable: firstToken.isStable, - }); - }, [firstToken, paySource, tokensSrcChainData]); + }, [firstToken?.symbol, paySource, srcChainId]); return ( <> @@ -728,13 +761,17 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { tokenAddress={firstTokenAddress} payChainId={paySource === "gmxAccount" ? 0 : paySource === "sourceChain" ? srcChainId : undefined} tokensData={tokensData} - onSelectTokenAddress={(tokenAddress, isGmxAccount, srcChainId) => { + onSelectTokenAddress={async (tokenAddress, isGmxAccount, newSrcChainId) => { + if (newSrcChainId !== srcChainId && newSrcChainId !== undefined) { + await switchNetwork(newSrcChainId, true); + } + setPaySource( - isSourceChain(srcChainId) ? "sourceChain" : isGmxAccount ? "gmxAccount" : "settlementChain" + isSourceChain(newSrcChainId) ? "sourceChain" : isGmxAccount ? "gmxAccount" : "settlementChain" ); handleFirstTokenSelect(tokenAddress); }} - multichainTokens={Object.values(tokensSrcChainData)} + multichainTokens={tokenChainDataArray} includeMultichainTokensInPay onDepositTokenAddress={noop} /> @@ -762,7 +799,11 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { onClickMax={secondTokenShowMaxButton ? onMaxClickSecondToken : undefined} >
- +
)} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index 14f48a029b..79be903340 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -5,10 +5,10 @@ import chunk from "lodash/chunk"; import { useCallback, useMemo, useState } from "react"; import { bytesToHex, encodeFunctionData, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; -import { ContractsChainId } from "config/chains"; +import { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; -import { CHAIN_ID_TO_ENDPOINT_ID, IStargateAbi } from "config/multichain"; +import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId, IStargateAbi } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; @@ -30,7 +30,7 @@ import { getMultichainTransferSendParams } from "domain/multichain/getSendParams import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { signCreateDeposit } from "domain/synthetics/express/expressOrderUtils"; import { getRawRelayerParams } from "domain/synthetics/express/relayParamsUtils"; -import { RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express/types"; +import { GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express/types"; import { ExecutionFee } from "domain/synthetics/fees"; import { CreateDepositParamsStruct, @@ -46,6 +46,10 @@ import { buildAndSignMultichainDepositTxn, createMultichainDepositTxn, } from "domain/synthetics/markets/createMultichainDepositTxn"; +import { + buildAndSignMultichainGlvDepositTxn, + createMultichainGlvDepositTxn, +} from "domain/synthetics/markets/createMultichainGlvDepositTxn"; import { TokenData, TokensData } from "domain/synthetics/tokens"; import { useChainId } from "lib/chains"; import { helperToast } from "lib/helperToast"; @@ -60,6 +64,7 @@ import { import { EMPTY_ARRAY } from "lib/objects"; import { sendWalletTransaction } from "lib/transactions/sendWalletTransaction"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; +import { WalletSigner } from "lib/wallets"; import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; @@ -70,6 +75,8 @@ import { applySlippageToMinOut } from "sdk/utils/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { IStargate, SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + import { Operation } from "../types"; import type { GmOrGlvPaySource } from "./types"; @@ -78,8 +85,8 @@ interface Props { glvInfo?: GlvInfo; marketToken: TokenData | undefined; operation: Operation; - longToken: TokenData | undefined; - shortToken: TokenData | undefined; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; marketTokenAmount: bigint | undefined; marketTokenUsd: bigint | undefined; @@ -108,6 +115,7 @@ function getTransferRequests({ shortTokenAddress, shortTokenAmount, feeTokenAmount, + isGlv, }: { chainId: ContractsChainId; longTokenAddress: string | undefined; @@ -115,6 +123,7 @@ function getTransferRequests({ shortTokenAddress: string | undefined; shortTokenAmount: bigint | undefined; feeTokenAmount: bigint | undefined; + isGlv: boolean; }): IRelayUtils.TransferRequestsStruct { const requests: IRelayUtils.TransferRequestsStruct = { tokens: [], @@ -122,21 +131,26 @@ function getTransferRequests({ amounts: [], }; + const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); + const routerAddress = isGlv + ? getContract(chainId, "MultichainGlvRouter") + : getContract(chainId, "MultichainGmRouter"); + if (longTokenAddress && longTokenAmount !== undefined && longTokenAmount > 0n) { requests.tokens.push(longTokenAddress); - requests.receivers.push(getContract(chainId, "DepositVault")); + requests.receivers.push(vaultAddress); requests.amounts.push(longTokenAmount); } if (shortTokenAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n) { requests.tokens.push(shortTokenAddress); - requests.receivers.push(getContract(chainId, "DepositVault")); + requests.receivers.push(vaultAddress); requests.amounts.push(shortTokenAmount); } if (feeTokenAmount !== undefined) { requests.tokens.push(getWrappedToken(chainId).address); - requests.receivers.push(getContract(chainId, "MultichainGmRouter")); + requests.receivers.push(routerAddress); requests.amounts.push(feeTokenAmount); } @@ -149,11 +163,6 @@ function useMultichainDepositExpressTxnParams({ gmParams, glvParams, }: { - marketInfo: MarketInfo | undefined; - marketTokenAmount: bigint | undefined; - executionFee: ExecutionFee | undefined; - longToken: TokenData | undefined; - shortToken: TokenData | undefined; transferRequests: IRelayUtils.TransferRequestsStruct; paySource: GmOrGlvPaySource; gmParams: CreateDepositParamsStruct | undefined; @@ -162,45 +171,49 @@ function useMultichainDepositExpressTxnParams({ const { chainId, srcChainId } = useChainId(); const { signer } = useWallet(); - const asyncResult = useArbitraryRelayParamsAndPayload({ + const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ isGmxAccount: srcChainId !== undefined, enabled: paySource !== "settlementChain", + executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - // if (!account || !marketInfo || marketTokenAmount === undefined || !srcChainId || !signer || !executionFee) { if ((!gmParams && !glvParams) || !srcChainId || !signer) { throw new Error("Invalid params"); } if (glvParams) { - throw new Error("Not implemented"); - } + console.log({ + executionFee: glvParams.executionFee, + total: gasPaymentParams.totalRelayerFeeTokenAmount, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + diff: gasPaymentParams.totalRelayerFeeTokenAmount - gasPaymentParams.relayerFeeAmount, + fee: relayParams.fee.feeAmount, + }); - // const initialLongTokenAddress = longToken?.address || marketInfo.longTokenAddress; - // const initialShortTokenAddress = marketInfo.isSameCollaterals - // ? initialLongTokenAddress - // : shortToken?.address || marketInfo.shortTokenAddress; + const txnData = await buildAndSignMultichainGlvDepositTxn({ + emptySignature: true, + account: glvParams!.addresses.receiver, + chainId, + params: glvParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + } const txnData = await buildAndSignMultichainDepositTxn({ emptySignature: true, account: gmParams!.addresses.receiver, chainId, - // params: { - // addresses: { - // receiver: account, - // callbackContract: zeroAddress, - // uiFeeReceiver: zeroAddress, - // market: marketInfo.marketTokenAddress, - // initialLongToken: initialLongTokenAddress, - // initialShortToken: initialShortTokenAddress, - // longTokenSwapPath: [], - // shortTokenSwapPath: [], - // }, - // callbackGasLimit: 0n, - // dataList: [], - // minMarketTokens: marketTokenAmount, - // shouldUnwrapNativeToken: false, - // executionFee: executionFee.feeTokenAmount, - // }, params: gmParams!, srcChainId, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, @@ -219,15 +232,15 @@ function useMultichainDepositExpressTxnParams({ }, }); - return asyncResult; + return multichainDepositExpressTxnParams; } const useDepositTransactions = ({ marketInfo, marketToken, - longToken, + longTokenAddress = marketInfo?.longTokenAddress, longTokenAmount, - shortToken, + shortTokenAddress = marketInfo?.shortTokenAddress, shortTokenAmount, glvTokenAmount, glvTokenUsd, @@ -258,9 +271,6 @@ const useDepositTransactions = ({ const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; const executionFeeTokenAmount = executionFee?.feeTokenAmount; - const longTokenAddress = longToken?.address || marketInfo?.longTokenAddress; - const shortTokenAddress = shortToken?.address || marketInfo?.shortTokenAddress; - const shouldUnwrapNativeToken = (longTokenAddress === zeroAddress && longTokenAmount !== undefined && longTokenAmount > 0n) || (shortTokenAddress === zeroAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n); @@ -277,18 +287,19 @@ const useDepositTransactions = ({ ) : undefined; + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { return getTransferRequests({ chainId, - longTokenAddress: longTokenAddress, + longTokenAddress: initialLongTokenAddress, longTokenAmount, - shortTokenAddress: shortTokenAddress, + shortTokenAddress: initialShortTokenAddress, shortTokenAmount, - feeTokenAmount: executionFeeTokenAmount, + feeTokenAmount: 0n, // executionFeeTokenAmount, + isGlv, }); - }, [chainId, executionFeeTokenAmount, longTokenAddress, longTokenAmount, shortTokenAddress, shortTokenAmount]); - - const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + }, [chainId, initialLongTokenAddress, initialShortTokenAddress, isGlv, longTokenAmount, shortTokenAmount]); const gmParams = useMemo((): CreateDepositParamsStruct | undefined => { if ( @@ -392,6 +403,11 @@ const useDepositTransactions = ({ dataList: [], }; + // console.log({ + // params, + // transferRequests, + // }); + return params; }, [ account, @@ -409,11 +425,6 @@ const useDepositTransactions = ({ ]); const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ - marketInfo, - marketTokenAmount, - executionFee, - longToken, - shortToken, transferRequests, paySource, gmParams, @@ -423,8 +434,9 @@ const useDepositTransactions = ({ const getDepositMetricData = useCallback(() => { if (isGlv) { return initGLVSwapMetricData({ - longToken, - shortToken, + chainId, + longTokenAddress, + shortTokenAddress, selectedMarketForGlv, isDeposit: true, executionFee, @@ -441,8 +453,9 @@ const useDepositTransactions = ({ } return initGMSwapMetricData({ - longToken, - shortToken, + chainId, + longTokenAddress, + shortTokenAddress, marketToken, isDeposit: true, executionFee, @@ -454,13 +467,14 @@ const useDepositTransactions = ({ isFirstBuy, }); }, [ + chainId, executionFee, glvInfo, glvTokenAmount, glvTokenUsd, isFirstBuy, isGlv, - longToken, + longTokenAddress, longTokenAmount, marketInfo, marketToken, @@ -468,7 +482,7 @@ const useDepositTransactions = ({ marketTokenUsd, selectedMarketForGlv, selectedMarketInfoForGlv?.name, - shortToken, + shortTokenAddress, shortTokenAmount, ]); @@ -489,90 +503,23 @@ const useDepositTransactions = ({ let promise: Promise; if (paySource === "sourceChain") { - promise = new Promise(async (resolve) => { - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - feeParams: { - feeToken: globalExpressParams!.relayerFeeTokenAddress, - // TODO MLTCH this is going through the keeper to execute a depost - // so there 100% should be a fee - feeAmount: 0n, - feeSwapPath: [], - }, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }) as RawRelayParamsPayload; - - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; - - const signature = await signCreateDeposit({ - chainId: chainId, - srcChainId: srcChainId, - signer: signer, - relayParams, - transferRequests, - params: gmParams, - }); - - const action: MultichainAction = { - actionType: MultichainActionType.Deposit, - actionData: { - relayParams: relayParams, - transferRequests, - params: gmParams, - signature, - }, - }; - - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId: chainId, - account: account, - srcChainId: srcChainId!, - tokenAddress: shortTokenAddress!, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - - const sendParams: SendParamStruct = getMultichainTransferSendParams({ - dstChainId: chainId, - account, - srcChainId, - inputAmount: shortTokenAmount!, - composeGas: composeGas, - isDeposit: true, - action, - }); - - const iStargateInstance = new Contract( - "0x4985b8fcEA3659FD801a5b857dA1D00e985863F0", - IStargateAbi, - signer - ) as unknown as IStargate; - - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - - const txnResult = await sendWalletTransaction({ - chainId: srcChainId!, - to: "0x4985b8fcEA3659FD801a5b857dA1D00e985863F0", - signer: signer, - callData: encodeFunctionData({ - abi: IStargateAbi, - functionName: "sendToken", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], - }), - value: quoteSend.nativeFee as bigint, - msg: t`Sent deposit transaction`, - }); - - await txnResult.wait(); - - resolve(); + if (longTokenAmount! > 0n && shortTokenAmount! > 0n) { + throw new Error("Pay source sourceChain does not support both long and short token deposits"); + } + + const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; + const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; + + promise = createSourceChainDepositTxn({ + chainId, + globalExpressParams: globalExpressParams!, + srcChainId: srcChainId!, + signer, + transferRequests, + params: gmParams!, + account, + tokenAddress, + tokenAmount, }); } else if (paySource === "gmxAccount" && srcChainId !== undefined) { promise = createMultichainDepositTxn({ @@ -582,7 +529,6 @@ const useDepositTransactions = ({ transferRequests, asyncExpressTxnResult: multichainDepositExpressTxnParams, params: gmParams!, - isGlv: Boolean(glvInfo && selectedMarketForGlv), }); } else if (paySource === "settlementChain") { promise = createDepositTxn({ @@ -616,12 +562,11 @@ const useDepositTransactions = ({ executionFee, getDepositMetricData, globalExpressParams, - glvInfo, gmParams, + longTokenAddress, longTokenAmount, multichainDepositExpressTxnParams, paySource, - selectedMarketForGlv, setPendingDeposit, setPendingTxns, shortTokenAddress, @@ -658,7 +603,14 @@ const useDepositTransactions = ({ sendUserAnalyticsOrderConfirmClickEvent(chainId, metricData.metricId); if (srcChainId !== undefined) { - throw new Error("Not implemented"); + return createMultichainGlvDepositTxn({ + chainId, + srcChainId, + signer, + transferRequests, + asyncExpressTxnResult: multichainDepositExpressTxnParams, + params: glvParams!, + }); } return createGlvDepositTxn({ @@ -695,6 +647,7 @@ const useDepositTransactions = ({ marketInfo, marketToken, marketTokenAmount, + multichainDepositExpressTxnParams, setPendingDeposit, setPendingTxns, shortTokenAddress, @@ -703,6 +656,7 @@ const useDepositTransactions = ({ signer, srcChainId, tokensData, + transferRequests, ] ); @@ -723,9 +677,9 @@ export const useDepositWithdrawalTransactions = ( marketInfo, marketToken, operation, - longToken, + longTokenAddress, longTokenAmount, - shortToken, + shortTokenAddress, shortTokenAmount, glvTokenAmount, glvTokenUsd, @@ -755,8 +709,9 @@ export const useDepositWithdrawalTransactions = ( const metricData = glvInfo && selectedMarketForGlv ? initGLVSwapMetricData({ - longToken, - shortToken, + chainId, + longTokenAddress, + shortTokenAddress, selectedMarketForGlv, isDeposit: false, executionFee, @@ -771,8 +726,9 @@ export const useDepositWithdrawalTransactions = ( isFirstBuy, }) : initGMSwapMetricData({ - longToken, - shortToken, + chainId, + longTokenAddress, + shortTokenAddress, marketToken, isDeposit: false, executionFee, @@ -802,8 +758,8 @@ export const useDepositWithdrawalTransactions = ( if (glvInfo && selectedMarketForGlv) { return createGlvWithdrawalTxn(chainId, signer, { account, - initialLongTokenAddress: longToken?.address || marketInfo.longTokenAddress, - initialShortTokenAddress: shortToken?.address || marketInfo.shortTokenAddress, + initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, + initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, longTokenSwapPath: [], shortTokenSwapPath: [], glvTokenAddress: glvInfo.glvTokenAddress, @@ -827,8 +783,8 @@ export const useDepositWithdrawalTransactions = ( return createWithdrawalTxn(chainId, signer, { account, - initialLongTokenAddress: longToken?.address || marketInfo.longTokenAddress, - initialShortTokenAddress: shortToken?.address || marketInfo.shortTokenAddress, + initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, + initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, longTokenSwapPath: [], shortTokenSwapPath: [], marketTokenAmount: marketTokenAmount!, @@ -850,8 +806,8 @@ export const useDepositWithdrawalTransactions = ( [ glvInfo, selectedMarketForGlv, - longToken, - shortToken, + longTokenAddress, + shortTokenAddress, executionFee, longTokenAmount, shortTokenAmount, @@ -901,3 +857,115 @@ export const useDepositWithdrawalTransactions = ( isSubmitting, }; }; + +async function createSourceChainDepositTxn({ + chainId, + globalExpressParams, + srcChainId, + signer, + transferRequests, + params, + account, + tokenAddress, + tokenAmount, +}: { + chainId: ContractsChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateDepositParamsStruct; + account: string; + tokenAddress: string; + tokenAmount: bigint; +}) { + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: { + feeToken: globalExpressParams!.relayerFeeTokenAddress, + // TODO MLTCH this is going through the keeper to execute a depost + // so there 100% should be a fee + feeAmount: 0n, + feeSwapPath: [], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }) as RawRelayParamsPayload; + + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const signature = await signCreateDeposit({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Deposit, + actionData: { + relayParams: relayParams, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + inputAmount: tokenAmount, + composeGas: composeGas, + isDeposit: true, + action, + }); + + const sourceChainTokenId = getMultichainTokenId(srcChainId, tokenAddress); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi, + functionName: "sendToken", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + }), + value, + msg: t`Sent deposit transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 4b630389ca..9e7e6237c5 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -8,7 +8,7 @@ import { selectChainId } from "context/SyntheticsStateContext/selectors/globalSe import { useSelector } from "context/SyntheticsStateContext/utils"; import { ExecutionFee } from "domain/synthetics/fees"; import { GlvAndGmMarketsInfoData, GlvInfo, MarketInfo, MarketsInfoData } from "domain/synthetics/markets"; -import { TokenData, TokensData } from "domain/synthetics/tokens"; +import { getTokenData, TokenData, TokensData } from "domain/synthetics/tokens"; import { getCommonError, getGmSwapError } from "domain/synthetics/trade/utils/validation"; import { approveTokens } from "domain/tokens"; import { useHasOutdatedUi } from "lib/useHasOutdatedUi"; @@ -33,8 +33,8 @@ interface Props { glvInfo?: GlvInfo; marketToken: TokenData; operation: Operation; - longToken: TokenData | undefined; - shortToken: TokenData | undefined; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; glvToken: TokenData | undefined; longTokenLiquidityUsd?: bigint | undefined; shortTokenLiquidityUsd?: bigint | undefined; @@ -76,9 +76,9 @@ export const useGmSwapSubmitState = ({ fees, marketInfo, marketToken, - longToken, + longTokenAddress, + shortTokenAddress, operation, - shortToken, glvToken, longTokenLiquidityUsd, shortTokenLiquidityUsd, @@ -118,9 +118,9 @@ export const useGmSwapSubmitState = ({ marketInfo, marketToken, operation, - longToken, + longTokenAddress, longTokenAmount, - shortToken, + shortTokenAddress, shortTokenAmount, marketTokenAmount, glvTokenAmount, @@ -153,8 +153,8 @@ export const useGmSwapSubmitState = ({ marketInfo, glvInfo, marketToken, - longToken, - shortToken, + longToken: getTokenData(tokensData, longTokenAddress), + shortToken: getTokenData(tokensData, shortTokenAddress), glvToken, glvTokenAmount, glvTokenUsd, @@ -180,11 +180,11 @@ export const useGmSwapSubmitState = ({ operation, marketToken, marketTokenAmount, - longToken, + longTokenAddress, longTokenAmount, - shortToken, + shortTokenAddress, shortTokenAmount, - glvToken, + glvTokenAddress: glvToken?.address, glvTokenAmount, isMarketTokenDeposit, }); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx index 2cfff24dd2..d32440835d 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx @@ -14,9 +14,9 @@ interface Props { operation: Operation; marketToken: TokenData | undefined; - longToken: TokenData | undefined; - shortToken: TokenData | undefined; - glvToken: TokenData | undefined; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; + glvTokenAddress: string | undefined; marketTokenAmount: bigint | undefined; longTokenAmount: bigint | undefined; @@ -32,11 +32,11 @@ export const useTokensToApprove = ({ operation, marketToken, marketTokenAmount, - longToken, + longTokenAddress, longTokenAmount, - shortToken, + shortTokenAddress, shortTokenAmount, - glvToken, + glvTokenAddress, glvTokenAmount, isMarketTokenDeposit, }: Props) => { @@ -50,11 +50,11 @@ export const useTokensToApprove = ({ const addresses: string[] = []; if (operation === Operation.Deposit) { - if (longTokenAmount !== undefined && longTokenAmount > 0 && longToken) { - addresses.push(longToken.address); + if (longTokenAmount !== undefined && longTokenAmount > 0 && longTokenAddress) { + addresses.push(longTokenAddress); } - if (shortTokenAmount !== undefined && shortTokenAmount > 0 && shortToken) { - addresses.push(shortToken.address); + if (shortTokenAmount !== undefined && shortTokenAmount > 0 && shortTokenAddress) { + addresses.push(shortTokenAddress); } if (glvInfo && isMarketTokenDeposit) { if (marketTokenAmount !== undefined && marketTokenAmount > 0) { @@ -62,7 +62,7 @@ export const useTokensToApprove = ({ } } } else if (operation === Operation.Withdrawal) { - addresses.push(glvToken ? glvToken.address : marketToken.address); + addresses.push(glvTokenAddress ? glvTokenAddress : marketToken.address); } return uniq(addresses); @@ -71,11 +71,11 @@ export const useTokensToApprove = ({ operation, marketToken, longTokenAmount, - longToken, + longTokenAddress, shortTokenAmount, - shortToken, + shortTokenAddress, glvInfo, - glvToken, + glvTokenAddress, isMarketTokenDeposit, marketTokenAmount, ] @@ -101,32 +101,27 @@ export const useTokensToApprove = ({ [] ); - const shouldApproveGlvToken = getNeedTokenApprove(tokensAllowanceData, glvToken?.address, glvTokenAmount, []); + const shouldApproveGlvToken = getNeedTokenApprove(tokensAllowanceData, glvTokenAddress, glvTokenAmount, []); - const shouldApproveLongToken = getNeedTokenApprove(tokensAllowanceData, longToken?.address, longTokenAmount, []); + const shouldApproveLongToken = getNeedTokenApprove(tokensAllowanceData, longTokenAddress, longTokenAmount, []); - const shouldApproveShortToken = getNeedTokenApprove( - tokensAllowanceData, - shortToken?.address, - shortTokenAmount, - [] - ); + const shouldApproveShortToken = getNeedTokenApprove(tokensAllowanceData, shortTokenAddress, shortTokenAmount, []); if (operation === Operation.Deposit) { - if (shouldApproveLongToken && longToken?.address) { - addresses.push(longToken?.address); + if (shouldApproveLongToken && longTokenAddress) { + addresses.push(longTokenAddress); } - if (shouldApproveShortToken && shortToken?.address) { - addresses.push(shortToken.address); + if (shouldApproveShortToken && shortTokenAddress) { + addresses.push(shortTokenAddress); } if (glvInfo && isMarketTokenDeposit && shouldApproveMarketToken && marketToken) { addresses.push(marketToken.address); } } else if (operation === Operation.Withdrawal) { - if (glvInfo && shouldApproveGlvToken && glvToken?.address) { - addresses.push(glvToken.address); + if (glvInfo && shouldApproveGlvToken && glvTokenAddress) { + addresses.push(glvTokenAddress); } else if (!glvInfo && shouldApproveMarketToken && marketToken?.address) { addresses.push(marketToken.address); } @@ -135,18 +130,18 @@ export const useTokensToApprove = ({ return uniq(addresses); }, [ - longToken, + glvInfo, + glvTokenAddress, + glvTokenAmount, + isMarketTokenDeposit, + longTokenAddress, longTokenAmount, marketToken, marketTokenAmount, operation, - shortToken, + shortTokenAddress, shortTokenAmount, - glvToken, - glvTokenAmount, - glvInfo, tokensAllowanceData, - isMarketTokenDeposit, ] ); diff --git a/src/components/TokenIcon/TokenWithIcon.tsx b/src/components/TokenIcon/TokenWithIcon.tsx index 2d2e5a09de..f69a259d3c 100644 --- a/src/components/TokenIcon/TokenWithIcon.tsx +++ b/src/components/TokenIcon/TokenWithIcon.tsx @@ -7,15 +7,22 @@ type Props = { symbol?: string; className?: string; importSize?: 24 | 40; + chainIdBadge?: number | undefined; }; -export default function TokenWithIcon({ symbol, className, importSize, displaySize }: Props) { +export default function TokenWithIcon({ symbol, className, importSize, displaySize, chainIdBadge }: Props) { const classNames = cx("Token-icon inline-flex items-center whitespace-nowrap", className); if (!symbol) return <>; return ( - + {symbol} ); diff --git a/src/context/SyntheticsStateContext/selectors/positionEditorSelectors.ts b/src/context/SyntheticsStateContext/selectors/positionEditorSelectors.ts index 1c4d9f69b4..1d43677f1c 100644 --- a/src/context/SyntheticsStateContext/selectors/positionEditorSelectors.ts +++ b/src/context/SyntheticsStateContext/selectors/positionEditorSelectors.ts @@ -7,6 +7,7 @@ import { } from "domain/synthetics/positions"; import { convertToUsd } from "domain/synthetics/tokens/utils"; import { parseValue } from "lib/numbers"; +import { TokenBalanceType } from "sdk/types/tokens"; import { SyntheticsState } from "../SyntheticsStateContextProvider"; import { createSelector } from "../utils"; @@ -76,8 +77,8 @@ export const selectPositionEditorSelectedCollateralToken = createSelector((q) => return; } - if (isCollateralTokenFromGmxAccount && !token.isGmxAccount) { - return { ...token, isGmxAccount: true, balance: token.gmxAccountBalance }; + if (isCollateralTokenFromGmxAccount && token.balanceType !== TokenBalanceType.GmxAccount) { + return { ...token, balanceType: TokenBalanceType.GmxAccount, balance: token.gmxAccountBalance }; } return token; diff --git a/src/context/SyntheticsStateContext/selectors/tradeboxSelectors/index.ts b/src/context/SyntheticsStateContext/selectors/tradeboxSelectors/index.ts index 1faf8ae5b1..b986a85333 100644 --- a/src/context/SyntheticsStateContext/selectors/tradeboxSelectors/index.ts +++ b/src/context/SyntheticsStateContext/selectors/tradeboxSelectors/index.ts @@ -53,6 +53,7 @@ import { getByKey } from "lib/objects"; import { mustNeverExist } from "lib/types"; import { BOTANIX } from "sdk/configs/chains"; import { NATIVE_TOKEN_ADDRESS, convertTokenAddress } from "sdk/configs/tokens"; +import { TokenBalanceType } from "sdk/types/tokens"; import { bigMath } from "sdk/utils/bigmath"; import { getExecutionFee } from "sdk/utils/fees/executionFee"; import { createTradeFlags } from "sdk/utils/trade"; @@ -1206,16 +1207,16 @@ export const selectTradeboxFromToken = createSelector((q): TokenData | undefined return undefined; } - if (isFromTokenGmxAccount && !token.isGmxAccount) { + if (isFromTokenGmxAccount && token.balanceType !== TokenBalanceType.GmxAccount) { return { ...token, - isGmxAccount: true, + balanceType: TokenBalanceType.GmxAccount, balance: token.gmxAccountBalance, }; - } else if (!isFromTokenGmxAccount && token.isGmxAccount) { + } else if (!isFromTokenGmxAccount && token.balanceType !== TokenBalanceType.Wallet) { return { ...token, - isGmxAccount: false, + balanceType: TokenBalanceType.Wallet, balance: token.walletBalance, }; } diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index 456ebe6254..4f8feeb7ee 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -49,10 +49,12 @@ export function getRawBaseRelayerParams({ chainId, account, globalExpressParams, + executionFeeAmount, }: { chainId: ContractsChainId; account: string; globalExpressParams: GlobalExpressParams; + executionFeeAmount?: bigint; }): Partial<{ rawBaseRelayParamsPayload: RawRelayParamsPayload; baseRelayFeeSwapParams: { @@ -70,7 +72,7 @@ export function getRawBaseRelayerParams({ } const baseRelayerFeeAmount = convertToTokenAmount( - expandDecimals(1, USD_DECIMALS), + expandDecimals(10, USD_DECIMALS), relayerFeeToken.decimals, relayerFeeToken.prices.maxPrice )!; @@ -82,7 +84,7 @@ export function getRawBaseRelayerParams({ gasPaymentToken, relayerFeeToken, relayerFeeAmount: baseRelayerFeeAmount, - totalRelayerFeeTokenAmount: baseRelayerFeeAmount, + totalRelayerFeeTokenAmount: baseRelayerFeeAmount + (executionFeeAmount ?? 0n), gasPaymentTokenAsCollateralAmount: 0n, findFeeSwapPath: findFeeSwapPath, @@ -138,6 +140,7 @@ async function estimateArbitraryGasLimit({ ] ); + // try { const gasLimit = await fallbackCustomError( async () => provider.estimateGas({ @@ -148,6 +151,16 @@ async function estimateArbitraryGasLimit({ }), "gasLimit" ); + // } catch (error) { + // console.log({ + // from: GMX_SIMULATION_ORIGIN as Address, + // to: baseTxnData.to as Address, + // data: baseData, + // value: 0n, + // }); + // debugger; + // throw error; + // } return gasLimit + 100_000n; } @@ -285,10 +298,12 @@ export function useArbitraryRelayParamsAndPayload({ expressTransactionBuilder, isGmxAccount, enabled = true, + executionFeeAmount, }: { expressTransactionBuilder: ExpressTransactionBuilder | undefined; isGmxAccount: boolean; - enabled: boolean; + enabled?: boolean; + executionFeeAmount?: bigint; }): AsyncResult { const account = useSelector(selectAccount); const chainId = useSelector(selectChainId); @@ -309,24 +324,22 @@ export function useArbitraryRelayParamsAndPayload({ chainId, account: p.account, globalExpressParams: p.globalExpressParams, + executionFeeAmount: p.executionFeeAmount, }); if (baseRelayFeeSwapParams === undefined || rawBaseRelayParamsPayload === undefined) { throw new Error("no baseRelayFeeSwapParams or rawBaseRelayParamsPayload"); } - let gasLimit: bigint = await fallbackCustomError( - async () => - await estimateArbitraryGasLimit({ - chainId, - provider: p.provider, - expressTransactionBuilder: p.expressTransactionBuilder, - rawRelayParamsPayload: rawBaseRelayParamsPayload, - gasPaymentParams: baseRelayFeeSwapParams.gasPaymentParams, - subaccount: p.subaccount, - }), - "gasLimit" - ).catch((error) => { + // HERE + const gasLimit: bigint = await estimateArbitraryGasLimit({ + chainId, + provider: p.provider, + expressTransactionBuilder: p.expressTransactionBuilder, + rawRelayParamsPayload: rawBaseRelayParamsPayload, + gasPaymentParams: baseRelayFeeSwapParams.gasPaymentParams, + subaccount: p.subaccount, + }).catch((error) => { metrics.pushError(error, "expressArbitrary.estimateGas"); throw error; }); @@ -344,13 +357,23 @@ export function useArbitraryRelayParamsAndPayload({ account: p.account, isValid: true, transactionExternalCalls: getEmptyExternalCallsPayload(), - executionFeeAmount: 0n, + executionFeeAmount: p.executionFeeAmount ?? 0n, gasPaymentTokenAsCollateralAmount: 0n, subaccountActions: 0, transactionPayloadGasLimit: gasLimit, expressTransactionBuilder: p.expressTransactionBuilder, }, }); + + console.log({ + executionFeeAmount: p.executionFeeAmount, + relayerFeeAmount: expressParams?.gasPaymentParams.relayerFeeAmount, + totalRelayerFeeTokenAmount: expressParams?.gasPaymentParams.totalRelayerFeeTokenAmount, + diff: expressParams?.gasPaymentParams.totalRelayerFeeTokenAmount + ? expressParams.gasPaymentParams.totalRelayerFeeTokenAmount - + expressParams.gasPaymentParams.relayerFeeAmount + : undefined, + }); return expressParams; } catch (error) { throw new Error("no expressParams"); @@ -375,6 +398,7 @@ export function useArbitraryRelayParamsAndPayload({ expressTransactionBuilder, isGmxAccount, subaccount, + executionFeeAmount, } : undefined, forceRecalculate, diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index ca8c7495ed..99b02ecce6 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -1,9 +1,7 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; -import { OrderMetricId, makeTxnErrorMetricsHandler, makeTxnSentMetricsHandler } from "lib/metrics"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; -import { makeUserAnalyticsOrderFailResultHandler } from "lib/userAnalytics"; import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; @@ -25,7 +23,7 @@ export type CreateMultichainDepositParams = { emptySignature?: boolean; account: string; transferRequests: IRelayUtils.TransferRequestsStruct; - params: IDepositUtils.CreateDepositParamsStruct; + params: CreateDepositParamsStruct; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; }; @@ -142,7 +140,6 @@ export function createMultichainDepositTxn({ signer, transferRequests, asyncExpressTxnResult, - isGlv, params, }: { chainId: ContractsChainId; @@ -151,16 +148,10 @@ export function createMultichainDepositTxn({ transferRequests: IRelayUtils.TransferRequestsStruct; asyncExpressTxnResult: AsyncResult; params: CreateDepositParamsStruct; - // TODO MLTCH: support GLV - isGlv: boolean; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, }) { - if (isGlv) { - throw new Error("Not implemented"); - } - if (!asyncExpressTxnResult.data) { throw new Error("Async result is not set"); } diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts new file mode 100644 index 0000000000..e1438d78f1 --- /dev/null +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -0,0 +1,187 @@ +import { encodeFunctionData } from "viem"; + +import { getContract } from "config/contracts"; +import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; +import { AsyncResult } from "lib/useThrottledAsync"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import { abis } from "sdk/abis"; +import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; +import { MultichainGlvRouter } from "typechain-types/MultichainGlvRouter"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import { CreateGlvDepositParamsStruct } from "."; +import { ExpressTxnParams, RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; + +export type CreateMultichainGlvDepositParams = { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + relayParams: RelayParamsPayload; + emptySignature?: boolean; + account: string; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvDepositParamsStruct; + relayerFeeTokenAddress: string; + relayerFeeAmount: bigint; +}; + +export async function buildAndSignMultichainGlvDepositTxn({ + chainId, + srcChainId, + signer, + relayParams, + account, + transferRequests, + params, + emptySignature, + relayerFeeTokenAddress, + relayerFeeAmount, +}: CreateMultichainGlvDepositParams): Promise { + let signature: string; + + if (emptySignature) { + signature = "0x"; + } else { + signature = await signMultichainGlvDepositPayload({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + } + + const depositData = encodeFunctionData({ + abi: abis.MultichainGlvRouter, + functionName: "createGlvDeposit", + args: [ + { + ...relayParams, + signature, + }, + account, + srcChainId, + transferRequests, + params, + ] satisfies Parameters, + }); + + return { + callData: depositData, + to: getContract(chainId, "MultichainGlvRouter"), + feeToken: relayerFeeTokenAddress, + feeAmount: relayerFeeAmount, + }; +} + +function signMultichainGlvDepositPayload({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvDepositParamsStruct; +}) { + const types = { + CreateGlvDeposit: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateGlvDepositAddresses" }, + { name: "minGlvTokens", type: "uint256" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "isMarketTokenDeposit", type: "bool" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateGlvDepositAddresses: [ + { name: "glv", type: "address" }, + { name: "market", type: "address" }, + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "initialLongToken", type: "address" }, + { name: "initialShortToken", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId, getContract(chainId, "MultichainGlvRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minGlvTokens: params.minGlvTokens, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + isMarketTokenDeposit: params.isMarketTokenDeposit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} + +export function createMultichainGlvDepositTxn({ + chainId, + srcChainId, + signer, + transferRequests, + asyncExpressTxnResult, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + asyncExpressTxnResult: AsyncResult; + params: CreateGlvDepositParamsStruct; + // TODO MLTCH: support pending txns + // setPendingTxns, + // setPendingDeposit, +}) { + if (!asyncExpressTxnResult.data) { + throw new Error("Async result is not set"); + } + + return buildAndSignMultichainGlvDepositTxn({ + chainId, + srcChainId, + signer, + account: params.addresses.receiver, + relayerFeeAmount: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...asyncExpressTxnResult.data.relayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + transferRequests, + params, + }).then(async (txnData: ExpressTxnData) => { + await sendExpressTransaction({ + chainId, + // TODO MLTCH: pass true when we can + isSponsoredCall: false, + txnData, + }); + }); + // .then(makeTxnSentMetricsHandler(metricId)) + // .catch(makeTxnErrorMetricsHandler(metricId)) + // .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricId)); +} diff --git a/src/domain/synthetics/tokens/useTokensDataRequest.ts b/src/domain/synthetics/tokens/useTokensDataRequest.ts index 7ed75124b9..595fab3000 100644 --- a/src/domain/synthetics/tokens/useTokensDataRequest.ts +++ b/src/domain/synthetics/tokens/useTokensDataRequest.ts @@ -3,6 +3,7 @@ import { useMemo } from "react"; import { useGmxAccountTokenBalances } from "domain/multichain/useGmxAccountTokenBalances"; import { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { getTokensMap, getV2Tokens } from "sdk/configs/tokens"; +import { TokenBalanceType } from "sdk/types/tokens"; import { TokensData } from "./types"; import { useOnchainTokenConfigs } from "./useOnchainTokenConfigs"; @@ -80,7 +81,7 @@ export function useTokensDataRequest(chainId: ContractsChainId, srcChainId?: Sou walletBalance, gmxAccountBalance, balance: srcChainId !== undefined ? gmxAccountBalance : walletBalance, - isGmxAccount: srcChainId !== undefined, + balanceType: getBalanceTypeFromSrcChainId(srcChainId), }; return acc; @@ -103,3 +104,11 @@ export function useTokensDataRequest(chainId: ContractsChainId, srcChainId?: Sou tokenConfigs, ]); } + +export function getBalanceTypeFromSrcChainId(srcChainId: SourceChainId | undefined) { + if (srcChainId !== undefined) { + return TokenBalanceType.GmxAccount; + } + + return TokenBalanceType.Wallet; +} diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index e78ce1534a..0af9d9ca9e 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -22,6 +22,7 @@ import { PRECISION, expandDecimals, formatAmount, formatUsd } from "lib/numbers" import { getByKey } from "lib/objects"; import { getToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import { MAX_TWAP_NUMBER_OF_PARTS, MIN_TWAP_NUMBER_OF_PARTS } from "sdk/configs/twap"; +import { Token } from "sdk/types/tokens"; import { ExternalSwapQuote, GmSwapFees, diff --git a/src/lib/metrics/utils.ts b/src/lib/metrics/utils.ts index 9cc4698c3b..a4b4383f51 100644 --- a/src/lib/metrics/utils.ts +++ b/src/lib/metrics/utils.ts @@ -9,6 +9,7 @@ import { TokenData } from "domain/synthetics/tokens"; import { DecreasePositionAmounts, IncreasePositionAmounts, SwapAmounts, TradeMode } from "domain/synthetics/trade"; import { ErrorLike, extendError, OrderErrorContext, parseError } from "lib/errors"; import { bigintToNumber, formatPercentage, formatRatePercentage, getBasisPoints, roundToOrder } from "lib/numbers"; +import { getToken } from "sdk/configs/tokens"; import { TwapDuration } from "sdk/types/twap"; import { CreateOrderPayload } from "sdk/utils/orderTransactions"; @@ -496,8 +497,8 @@ export function initEditCollateralMetricData({ } export function initGMSwapMetricData({ - longToken, - shortToken, + longTokenAddress, + shortTokenAddress, isDeposit, executionFee, marketInfo, @@ -507,9 +508,10 @@ export function initGMSwapMetricData({ marketTokenAmount, marketTokenUsd, isFirstBuy, + chainId, }: { - longToken: TokenData | undefined; - shortToken: TokenData | undefined; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; marketToken: TokenData | undefined; isDeposit: boolean; executionFee: ExecutionFee | undefined; @@ -519,6 +521,7 @@ export function initGMSwapMetricData({ marketTokenAmount: bigint | undefined; marketTokenUsd: bigint | undefined; isFirstBuy: boolean | undefined; + chainId: number; }) { return metrics.setCachedMetricData({ metricId: getGMSwapMetricId({ @@ -527,13 +530,19 @@ export function initGMSwapMetricData({ }), metricType: isDeposit ? "buyGM" : "sellGM", requestId: getRequestId(), - initialLongTokenAddress: longToken?.address, - initialShortTokenAddress: shortToken?.address, + initialLongTokenAddress: longTokenAddress, + initialShortTokenAddress: shortTokenAddress, marketAddress: marketInfo?.marketTokenAddress, marketName: marketInfo?.name, executionFee: formatAmountForMetrics(executionFee?.feeTokenAmount, executionFee?.feeToken.decimals), - longTokenAmount: formatAmountForMetrics(longTokenAmount, longToken?.decimals), - shortTokenAmount: formatAmountForMetrics(shortTokenAmount, shortToken?.decimals), + longTokenAmount: formatAmountForMetrics( + longTokenAmount, + longTokenAddress ? getToken(chainId, longTokenAddress)?.decimals : undefined + ), + shortTokenAmount: formatAmountForMetrics( + shortTokenAmount, + shortTokenAddress ? getToken(chainId, shortTokenAddress)?.decimals : undefined + ), marketTokenAmount: formatAmountForMetrics(marketTokenAmount, marketToken?.decimals), marketTokenUsd: formatAmountForMetrics(marketTokenUsd), isFirstBuy, @@ -541,8 +550,9 @@ export function initGMSwapMetricData({ } export function initGLVSwapMetricData({ - longToken, - shortToken, + chainId, + longTokenAddress, + shortTokenAddress, isDeposit, executionFee, marketName, @@ -555,8 +565,9 @@ export function initGLVSwapMetricData({ glvTokenUsd, isFirstBuy, }: { - longToken: TokenData | undefined; - shortToken: TokenData | undefined; + chainId: number; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; selectedMarketForGlv: string | undefined; isDeposit: boolean; executionFee: ExecutionFee | undefined; @@ -577,14 +588,20 @@ export function initGLVSwapMetricData({ }), metricType: isDeposit ? "buyGLV" : "sellGLV", requestId: getRequestId(), - initialLongTokenAddress: longToken?.address, - initialShortTokenAddress: shortToken?.address, + initialLongTokenAddress: longTokenAddress, + initialShortTokenAddress: shortTokenAddress, glvAddress, selectedMarketForGlv, marketName, executionFee: formatAmountForMetrics(executionFee?.feeTokenAmount, executionFee?.feeToken.decimals), - longTokenAmount: formatAmountForMetrics(longTokenAmount, longToken?.decimals), - shortTokenAmount: formatAmountForMetrics(shortTokenAmount, shortToken?.decimals), + longTokenAmount: formatAmountForMetrics( + longTokenAmount, + longTokenAddress ? getToken(chainId, longTokenAddress)?.decimals : undefined + ), + shortTokenAmount: formatAmountForMetrics( + shortTokenAmount, + shortTokenAddress ? getToken(chainId, shortTokenAddress)?.decimals : undefined + ), glvTokenAmount: formatAmountForMetrics(glvTokenAmount, glvToken?.decimals), glvTokenUsd: formatAmountForMetrics(glvTokenUsd), isFirstBuy, From 337610d84d8f90968400ad64394143108a4883c7 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Wed, 6 Aug 2025 14:52:17 +0200 Subject: [PATCH 04/38] Refactor multichain deposit --- .../useDepositWithdrawalTransactions.tsx | 153 +----------------- .../Synthetics/GmxAccountModal/hooks.ts | 102 ++++++++++-- src/config/multichain.ts | 35 +++- .../fetchMultichainTokenBalances.ts | 25 ++- .../markets/createSourceChainDepositTxn.ts | 144 +++++++++++++++++ .../synthetics/markets/useMarketTokensData.ts | 32 +++- src/locales/de/messages.po | 18 ++- src/locales/en/messages.po | 18 ++- src/locales/es/messages.po | 18 ++- src/locales/fr/messages.po | 18 ++- src/locales/ja/messages.po | 18 ++- src/locales/ko/messages.po | 18 ++- src/locales/pseudo/messages.po | 18 ++- src/locales/ru/messages.po | 18 ++- src/locales/zh/messages.po | 18 ++- src/pages/PoolsDetails/PoolsDetails.tsx | 2 +- src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 60 ++++++- 17 files changed, 516 insertions(+), 199 deletions(-) create mode 100644 src/domain/synthetics/markets/createSourceChainDepositTxn.ts diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index 79be903340..abfd0d1ad0 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -1,14 +1,12 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; -import { Contract } from "ethers"; import chunk from "lodash/chunk"; import { useCallback, useMemo, useState } from "react"; -import { bytesToHex, encodeFunctionData, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; +import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; -import { ContractsChainId, SourceChainId } from "config/chains"; +import { ContractsChainId, SettlementChainId } from "config/chains"; import { getContract } from "config/contracts"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; -import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId, IStargateAbi } from "config/multichain"; +import { CHAIN_ID_TO_ENDPOINT_ID } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; @@ -20,17 +18,7 @@ import { } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; -import { - CodecUiHelper, - GMX_DATA_ACTION_HASH, - MultichainAction, - MultichainActionType, -} from "domain/multichain/codecs/CodecUiHelper"; -import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { signCreateDeposit } from "domain/synthetics/express/expressOrderUtils"; -import { getRawRelayerParams } from "domain/synthetics/express/relayParamsUtils"; -import { GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express/types"; +import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { ExecutionFee } from "domain/synthetics/fees"; import { CreateDepositParamsStruct, @@ -62,21 +50,15 @@ import { sendTxnValidationErrorMetric, } from "lib/metrics"; import { EMPTY_ARRAY } from "lib/objects"; -import { sendWalletTransaction } from "lib/transactions/sendWalletTransaction"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; -import { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; -import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; import { applySlippageToMinOut } from "sdk/utils/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; -import { IStargate, SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; - -import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; +import { createSourceChainDepositTxn } from "../../../../../domain/synthetics/markets/createSourceChainDepositTxn"; import { Operation } from "../types"; import type { GmOrGlvPaySource } from "./types"; @@ -148,7 +130,7 @@ function getTransferRequests({ requests.amounts.push(shortTokenAmount); } - if (feeTokenAmount !== undefined) { + if (feeTokenAmount !== undefined && feeTokenAmount > 0n) { requests.tokens.push(getWrappedToken(chainId).address); requests.receivers.push(routerAddress); requests.amounts.push(feeTokenAmount); @@ -181,14 +163,6 @@ function useMultichainDepositExpressTxnParams({ } if (glvParams) { - console.log({ - executionFee: glvParams.executionFee, - total: gasPaymentParams.totalRelayerFeeTokenAmount, - relayerFeeAmount: gasPaymentParams.relayerFeeAmount, - diff: gasPaymentParams.totalRelayerFeeTokenAmount - gasPaymentParams.relayerFeeAmount, - fee: relayParams.fee.feeAmount, - }); - const txnData = await buildAndSignMultichainGlvDepositTxn({ emptySignature: true, account: glvParams!.addresses.receiver, @@ -511,7 +485,7 @@ const useDepositTransactions = ({ const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; promise = createSourceChainDepositTxn({ - chainId, + chainId: chainId as SettlementChainId, globalExpressParams: globalExpressParams!, srcChainId: srcChainId!, signer, @@ -520,6 +494,7 @@ const useDepositTransactions = ({ account, tokenAddress, tokenAmount, + executionFee: executionFee.feeTokenAmount, }); } else if (paySource === "gmxAccount" && srcChainId !== undefined) { promise = createMultichainDepositTxn({ @@ -857,115 +832,3 @@ export const useDepositWithdrawalTransactions = ( isSubmitting, }; }; - -async function createSourceChainDepositTxn({ - chainId, - globalExpressParams, - srcChainId, - signer, - transferRequests, - params, - account, - tokenAddress, - tokenAmount, -}: { - chainId: ContractsChainId; - globalExpressParams: GlobalExpressParams; - srcChainId: SourceChainId; - signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; - params: CreateDepositParamsStruct; - account: string; - tokenAddress: string; - tokenAmount: bigint; -}) { - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - feeParams: { - feeToken: globalExpressParams!.relayerFeeTokenAddress, - // TODO MLTCH this is going through the keeper to execute a depost - // so there 100% should be a fee - feeAmount: 0n, - feeSwapPath: [], - }, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }) as RawRelayParamsPayload; - - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; - - const signature = await signCreateDeposit({ - chainId, - srcChainId, - signer, - relayParams, - transferRequests, - params, - }); - - const action: MultichainAction = { - actionType: MultichainActionType.Deposit, - actionData: { - relayParams: relayParams, - transferRequests, - params, - signature, - }, - }; - - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - - const sendParams: SendParamStruct = getMultichainTransferSendParams({ - dstChainId: chainId, - account, - srcChainId, - inputAmount: tokenAmount, - composeGas: composeGas, - isDeposit: true, - action, - }); - - const sourceChainTokenId = getMultichainTokenId(srcChainId, tokenAddress); - - if (!sourceChainTokenId) { - throw new Error("Token ID not found"); - } - - const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; - - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - - const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); - - try { - const txnResult = await sendWalletTransaction({ - chainId: srcChainId!, - to: sourceChainTokenId.stargate, - signer, - callData: encodeFunctionData({ - abi: IStargateAbi, - functionName: "sendToken", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], - }), - value, - msg: t`Sent deposit transaction`, - }); - - await txnResult.wait(); - } catch (error) { - toastCustomOrStargateError(chainId, error); - } -} diff --git a/src/components/Synthetics/GmxAccountModal/hooks.ts b/src/components/Synthetics/GmxAccountModal/hooks.ts index 5b55a98a10..221d61ea72 100644 --- a/src/components/Synthetics/GmxAccountModal/hooks.ts +++ b/src/components/Synthetics/GmxAccountModal/hooks.ts @@ -1,16 +1,18 @@ import { useMemo } from "react"; import useSWR from "swr"; import useSWRSubscription, { SWRSubscription } from "swr/subscription"; -import { Address } from "viem"; import { useAccount } from "wagmi"; -import { ContractsChainId, SettlementChainId, SourceChainId, getChainName } from "config/chains"; -import { MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; +import { AnyChainId, ContractsChainId, getChainName, SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; +import { selectAccount } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; import { fetchMultichainTokenBalances, fetchSourceChainTokenBalances, } from "domain/multichain/fetchMultichainTokenBalances"; import type { TokenChainData } from "domain/multichain/types"; +import { useMarketTokensData } from "domain/synthetics/markets"; import { convertToUsd, getMidPrice, useTokenRecentPricesRequest, useTokensDataRequest } from "domain/synthetics/tokens"; import { TokenPricesData, TokensData } from "domain/tokens"; import { useChainId } from "lib/chains"; @@ -126,17 +128,17 @@ export function useAvailableToTradeAssetMultichain(): { } const subscribeMultichainTokenBalances: SWRSubscription< - [string, ContractsChainId, Address], + [string, ContractsChainId, string, string[] | undefined], { tokenBalances: Record>; isLoading: boolean; } > = (key, options) => { - const [, settlementChainId, account] = key as [string, SettlementChainId, string]; + const [, settlementChainId, account, tokens] = key as [string, SettlementChainId, string, string[]]; let tokenBalances: Record> | undefined; let isLoaded = false; - const interval = window.setInterval(() => { + const interval = (setInterval as Window["setInterval"])(() => { fetchMultichainTokenBalances({ settlementChainId, account, @@ -144,6 +146,7 @@ const subscribeMultichainTokenBalances: SWRSubscription< tokenBalances = { ...tokenBalances, [chainId]: tokensChainData }; options.next(null, { tokenBalances, isLoading: isLoaded ? false : true }); }, + tokens, }).then((finalTokenBalances) => { if (!isLoaded) { isLoaded = true; @@ -157,20 +160,21 @@ const subscribeMultichainTokenBalances: SWRSubscription< }; }; -export function useMultichainTokensRequest(): { +export function useMultichainTokensRequest(account: string | undefined): { tokenChainDataArray: TokenChainData[]; isPriceDataLoading: boolean; isBalanceDataLoading: boolean; } { const { chainId } = useChainId(); - const { address: account } = useAccount(); const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); const { data: balanceData } = useSWRSubscription( - account ? ["multichain-tokens", chainId, account] : null, + account ? ["multichain-tokens", chainId, account, undefined] : null, + // TODO MLTCH optimistically update useSourceChainTokensDataRequest subscribeMultichainTokenBalances ); + const tokenBalances = balanceData?.tokenBalances; const isBalanceDataLoading = balanceData?.isLoading === undefined ? true : balanceData.isLoading; @@ -212,6 +216,76 @@ export function useMultichainTokensRequest(): { }; } +export function useMultichainMarketTokenBalancesRequest(tokenAddress: string | undefined): { + tokenBalancesData: Partial>; + totalBalance: bigint | undefined; + isBalanceDataLoading: boolean; +} { + const { chainId, srcChainId } = useChainId(); + const account = useSelector(selectAccount); + + const { marketTokensData } = useMarketTokensData(chainId, srcChainId, { + isDeposit: true, + withGlv: true, + }); + + const { data: balancesResult } = useSWRSubscription( + account && tokenAddress ? ["multichain-market-tokens", chainId, account, [tokenAddress]] : null, + // TODO MLTCH optimistically update useSourceChainTokensDataRequest + subscribeMultichainTokenBalances + ); + + const tokenBalancesData: Partial> = useMemo(() => { + if (!marketTokensData || !tokenAddress) { + return EMPTY_OBJECT; + } + + const walletBalance = marketTokensData[tokenAddress].walletBalance; + const gmxAccountBalance = marketTokensData[tokenAddress].gmxAccountBalance; + + const balances = { [chainId]: walletBalance, [0]: gmxAccountBalance }; + + if (balancesResult) { + for (const sourceChainId in balancesResult.tokenBalances) { + const sourceChainTokenId = getMappedTokenId( + chainId as SettlementChainId, + tokenAddress, + parseInt(sourceChainId) as SourceChainId + ); + + if (!sourceChainTokenId) { + continue; + } + + const balance = balancesResult.tokenBalances[sourceChainId][sourceChainTokenId.address]; + + if (balance !== undefined && balance !== 0n) { + balances[sourceChainId] = balance; + } + } + } + + return balances; + }, [balancesResult, chainId, marketTokensData, tokenAddress]); + + const totalBalance = useMemo(() => { + if (!tokenBalancesData) { + return undefined; + } + let totalBalance = 0n; + for (const balance of Object.values(tokenBalancesData)) { + totalBalance += balance; + } + return totalBalance; + }, [tokenBalancesData]); + + return { + tokenBalancesData, + totalBalance, + isBalanceDataLoading: balancesResult?.isLoading ?? true, + }; +} + function getTokensChainData({ chainId, sourceChainTokenIdMap, @@ -288,6 +362,14 @@ function getTokensChainData({ return tokensChainData; } +const getSourceChainTokensDataRequestKey = ( + chainId: ContractsChainId, + srcChainId: SourceChainId | undefined, + account: string | undefined +) => { + return srcChainId && account ? ["source-chain-tokens", chainId, srcChainId, account] : null; +}; + export function useSourceChainTokensDataRequest( chainId: ContractsChainId, srcChainId: SourceChainId | undefined, @@ -300,7 +382,7 @@ export function useSourceChainTokensDataRequest( const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); const { data: balanceData, isLoading: isBalanceDataLoading } = useSWR( - srcChainId && account ? ["source-chain-tokens", chainId, srcChainId, account] : null, + srcChainId && account ? getSourceChainTokensDataRequestKey(chainId, srcChainId, account) : null, () => { if (!srcChainId || !account) { return undefined; diff --git a/src/config/multichain.ts b/src/config/multichain.ts index 91bd5d936f..f5904c81bc 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -82,6 +82,7 @@ export type MultichainTokenId = { decimals: number; stargate: string; symbol: string; + isPlatformToken?: boolean; }; export const TOKEN_GROUPS: Partial< @@ -171,6 +172,25 @@ if (isDevelopment()) { symbol: "ETH", }, }; + + TOKEN_GROUPS[""] = { + [ARBITRUM_SEPOLIA]: { + address: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", + decimals: 18, + chainId: ARBITRUM_SEPOLIA, + stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + symbol: "", + isPlatformToken: true, + }, + [SOURCE_SEPOLIA]: { + address: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + decimals: 18, + chainId: SOURCE_SEPOLIA, + stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + symbol: "", + isPlatformToken: true, + }, + }; } export const DEBUG_MULTICHAIN_SAME_CHAIN_DEPOSIT = false; @@ -221,6 +241,7 @@ export function isSourceChain(chainId: number | undefined): chainId is SourceCha } export const MULTI_CHAIN_TOKEN_MAPPING = {} as MultichainTokenMapping; +export const MULTI_CHAIN_TRADE_TOKENS = {} as Record; export const MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS = {} as MultichainWithdrawSupportedTokens; @@ -236,15 +257,23 @@ for (const tokenSymbol in TOKEN_GROUPS) { const chainId = parseInt(chainIdString) as SettlementChainId | SourceChainId; const tokenId = TOKEN_GROUPS[tokenSymbol]?.[chainId]; - if (tokenId) { - CHAIN_ID_TO_TOKEN_ID_MAP[chainId] = CHAIN_ID_TO_TOKEN_ID_MAP[chainId] || {}; - CHAIN_ID_TO_TOKEN_ID_MAP[chainId][tokenId.address] = tokenId; + + if (!tokenId) { + continue; } + CHAIN_ID_TO_TOKEN_ID_MAP[chainId] = CHAIN_ID_TO_TOKEN_ID_MAP[chainId] || {}; + CHAIN_ID_TO_TOKEN_ID_MAP[chainId][tokenId.address] = tokenId; + if (!isSettlementChain(chainId)) { continue; } + if (!tokenId?.isPlatformToken) { + MULTI_CHAIN_TRADE_TOKENS[chainId] = MULTI_CHAIN_TRADE_TOKENS[chainId] || []; + MULTI_CHAIN_TRADE_TOKENS[chainId].push(tokenId.address); + } + const settlementChainId = chainId; let empty = true; diff --git a/src/domain/multichain/fetchMultichainTokenBalances.ts b/src/domain/multichain/fetchMultichainTokenBalances.ts index 5516f1420c..e6f63260d1 100644 --- a/src/domain/multichain/fetchMultichainTokenBalances.ts +++ b/src/domain/multichain/fetchMultichainTokenBalances.ts @@ -1,7 +1,13 @@ +import pickBy from "lodash/pickBy"; import { zeroAddress } from "viem"; import { SettlementChainId, SourceChainId, getChainName } from "config/chains"; -import { MULTICALLS_MAP, MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; +import { + MULTICALLS_MAP, + MULTI_CHAIN_TOKEN_MAPPING, + MULTI_CHAIN_TRADE_TOKENS, + MultichainTokenMapping, +} from "config/multichain"; import { executeMulticall } from "lib/multicall/executeMulticall"; import type { MulticallRequestConfig } from "lib/multicall/types"; @@ -9,23 +15,34 @@ export async function fetchMultichainTokenBalances({ settlementChainId, account, progressCallback, + tokens = MULTI_CHAIN_TRADE_TOKENS[settlementChainId], }: { settlementChainId: SettlementChainId; account: string; progressCallback?: (chainId: number, tokensChainData: Record) => void; + tokens?: string[]; }): Promise>> { const requests: Promise[] = []; - const sourceChainTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[settlementChainId]; + const sourceChainsTokenIdMap = MULTI_CHAIN_TOKEN_MAPPING[settlementChainId]; const result: Record> = {}; - for (const sourceChainIdString in sourceChainTokenIdMap) { + for (const sourceChainIdString in sourceChainsTokenIdMap) { const sourceChainId = parseInt(sourceChainIdString) as SourceChainId; + + const sourceChainTokenIdMap = tokens + ? pickBy(sourceChainsTokenIdMap[sourceChainId], (value) => tokens.includes(value.settlementChainTokenAddress)) + : sourceChainsTokenIdMap[sourceChainId]; + + if (Object.keys(sourceChainTokenIdMap).length === 0) { + continue; + } + const request = fetchSourceChainTokenBalances({ sourceChainId, account, - sourceChainTokenIdMap: sourceChainTokenIdMap[sourceChainId], + sourceChainTokenIdMap, }).then((res) => { result[sourceChainId] = res; progressCallback?.(sourceChainId, res); diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts new file mode 100644 index 0000000000..c33d317eb5 --- /dev/null +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -0,0 +1,144 @@ +import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import { encodeFunctionData, zeroAddress } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { + getRawRelayerParams, + GlobalExpressParams, + RawRelayParamsPayload, + RelayParamsPayload, +} from "domain/synthetics/express"; +import { signCreateDeposit } from "domain/synthetics/express/expressOrderUtils"; +import { CreateDepositParamsStruct } from "domain/synthetics/markets"; +import { sendWalletTransaction } from "lib/transactions"; +import { WalletSigner } from "lib/wallets"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { nowInSeconds } from "sdk/utils/time"; +import { IRelayUtils } from "typechain-types/MultichainGmRouter"; +import { IStargate } from "typechain-types-stargate"; +import { SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; + +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + +export async function createSourceChainDepositTxn({ + chainId, + globalExpressParams, + srcChainId, + signer, + transferRequests, + params, + account, + tokenAddress, + tokenAmount, + executionFee, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateDepositParamsStruct; + account: string; + tokenAddress: string; + tokenAmount: bigint; + executionFee: bigint; +}) { + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: { + // feeToken: globalExpressParams!.relayerFeeTokenAddress, + feeToken: tokenAddress, + // TODO MLTCH this is going through the keeper to execute a depost + // so there 100% should be a fee + feeAmount: 2n * 10n ** 6n, + feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }) as RawRelayParamsPayload; + + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const signature = await signCreateDeposit({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Deposit, + actionData: { + relayParams: relayParams, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + inputAmount: tokenAmount, + composeGas: composeGas, + isDeposit: true, + action, + }); + + const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi, + functionName: "sendToken", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + }), + value, + msg: t`Sent deposit transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/domain/synthetics/markets/useMarketTokensData.ts b/src/domain/synthetics/markets/useMarketTokensData.ts index d27472255d..de6af7834a 100644 --- a/src/domain/synthetics/markets/useMarketTokensData.ts +++ b/src/domain/synthetics/markets/useMarketTokensData.ts @@ -2,7 +2,11 @@ import { useMemo } from "react"; import { getExplorerUrl } from "config/chains"; import { getContract } from "config/contracts"; -import { MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY } from "config/dataStore"; +import { + MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, + MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY, + multichainBalanceKey, +} from "config/dataStore"; // Warning: do not import through reexport, it will break jest import { USD_DECIMALS } from "config/factors"; import { selectGlvInfo, selectGlvs } from "context/SyntheticsStateContext/selectors/globalSelectors"; @@ -127,6 +131,19 @@ export function useMarketTokensDataRequest( }, } satisfies ContractCallsConfig; + if (account) { + requests[`${marketAddress}-gmxAccountData`] = { + contractAddress: getContract(chainId, "DataStore"), + abiId: "DataStore", + calls: { + balance: { + methodName: "getUint", + params: [multichainBalanceKey(account, marketAddress)], + }, + }, + } satisfies ContractCallsConfig; + } + return requests; }, {}), parseResponse: (res) => @@ -136,6 +153,7 @@ export function useMarketTokensDataRequest( const pricesData = res.data[`${marketAddress}-prices`]; const tokenData = res.data[`${marketAddress}-tokenData`]; + const gmxAccountData = res.data[`${marketAddress}-gmxAccountData`]; if (pricesErrors || tokenDataErrors || !pricesData || !tokenData) { return marketTokensMap; @@ -146,6 +164,14 @@ export function useMarketTokensDataRequest( const minPrice = BigInt(pricesData?.minPrice.returnValues[0]); const maxPrice = BigInt(pricesData?.maxPrice.returnValues[0]); + const walletBalance = + account && tokenData.balance?.returnValues ? BigInt(tokenData?.balance?.returnValues[0]) : undefined; + const gmxAccountBalance = + account && gmxAccountData?.balance?.returnValues + ? BigInt(gmxAccountData?.balance?.returnValues[0]) + : undefined; + const balance = srcChainId !== undefined ? gmxAccountBalance : walletBalance; + marketTokensMap[marketAddress] = { ...tokenConfig, address: marketAddress, @@ -154,7 +180,9 @@ export function useMarketTokensDataRequest( maxPrice: maxPrice !== undefined && maxPrice > 0 ? maxPrice : expandDecimals(1, USD_DECIMALS), }, totalSupply: BigInt(tokenData?.totalSupply.returnValues[0]), - balance: account && tokenData.balance?.returnValues ? BigInt(tokenData?.balance?.returnValues[0]) : undefined, + walletBalance, + gmxAccountBalance, + balance, explorerUrl: `${getExplorerUrl(chainId)}/token/${marketAddress}`, }; diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index 7efee4bcfd..a8c75947e4 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "Limit Swap fehlgeschlagen" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "Unzureichende {0} Balance" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "Versuche, die Einstellung \"Erlaubter Slippage\" im Menü \"Einstellungen\" oben rechts zu erhöhen" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 70d0fd747b..644bf7d0c8 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -931,7 +931,6 @@ msgstr "Liq. {0} {longOrShortText}" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "Failed Limit Swap" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "Liq. {longOrShortText} - {marketIndexName}" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "Back to Pools" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "Market - Long Inc." @@ -6135,6 +6138,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -6930,7 +6934,6 @@ msgstr "Claim <0>{0}" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -7003,6 +7006,7 @@ msgstr "Transfer {nativeTokenSymbol}" msgid "Meme" msgstr "Meme" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7092,6 +7096,10 @@ msgstr "Size per part" msgid "Insufficient {0} balance" msgstr "Insufficient {0} balance" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "Sent deposit transaction" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "limit price" @@ -7823,6 +7831,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "Try increasing the \"Allowed Slippage\", under the Settings menu on the top right" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "GMX Account" @@ -8086,7 +8095,6 @@ msgstr "The Bonus APR will be airdropped as {airdropTokenTitle} tokens. <0>Read #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8668,6 +8676,10 @@ msgstr "Daily and Cumulative PnL" msgid "Edit {longOrShortText} {0}" msgstr "Edit {longOrShortText} {0}" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "Send back to {0}" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "short" diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index 58db70b9a6..f812c59378 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "Intercambio Límite Fallido" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "Balance {0} insuficiente" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "Prueba a incrementar el \"Deslizamiento Permitido\", debajo del menú de Ajustes en la esquina superior derecha" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index 8a63956b27..2df3091fb3 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "Échange limité échoué" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "Balance {0} insuffisante" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "Essayez d'augmenter le \" glissement autorisé\", sous le menu Paramètres en haut à droite" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 06afaccad2..d5f36e2101 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "指値スワップ失敗" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1 時間" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "残高" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "{0} 残高の不足" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "右上の設定メニューにある\"最大スリッページ\"を増やしてください" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index ee87feb5f5..93e70d3dac 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "지정가 스왑 실패" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1시간" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "잔고" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "{0} 잔고 부족" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "우측 상단의 세팅을 이용해 \"허용 가능한 슬리피지\"를 증가시켜보세요" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index d0a8ffccd8..5d42f25844 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index f5017a2cc1..c3cfdf6a03 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "Лимитный обмен не удался" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1ч" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Баланс" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr "Недостаточный {0} баланс" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "Попробуйте увеличить \" Допустимое Скольжение\", под меню Настройки в правом верхнем углу" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index 7a5615f7ad..420441f994 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -931,7 +931,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx #: src/components/Synthetics/TradeBox/TradeBox.tsx @@ -1351,6 +1350,10 @@ msgstr "限价交换失败" msgid "Liq. {longOrShortText} - {marketIndexName}" msgstr "" +#: src/pages/PoolsDetails/PoolsDetails.tsx +msgid "Back to Pools" +msgstr "" + #: src/components/TVChartContainer/constants.ts msgid "Market - Long Inc." msgstr "" @@ -6132,6 +6135,7 @@ msgstr "{formattedNetRate} / 1 小时" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "余额" @@ -6924,7 +6928,6 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/PositionEditor/PositionEditor.tsx #: src/components/Synthetics/PositionSeller/PositionSeller.tsx @@ -6997,6 +7000,7 @@ msgstr "" msgid "Meme" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/useShiftTransactions.tsx @@ -7086,6 +7090,10 @@ msgstr "" msgid "Insufficient {0} balance" msgstr " {0}余额不足" +#: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +msgid "Sent deposit transaction" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "limit price" msgstr "" @@ -7817,6 +7825,7 @@ msgid "Try increasing the \"Allowed Slippage\", under the Settings menu on the t msgstr "尝试增加 \"Allowed Slippage\", 在右上角设置下方" #: src/components/Synthetics/GmxAccountModal/GmxAccountModal.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "GMX Account" msgstr "" @@ -8080,7 +8089,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/TransferDetailsView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GlpCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx @@ -8662,6 +8670,10 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" +#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +msgid "Send back to {0}" +msgstr "" + #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/pages/PoolsDetails/PoolsDetails.tsx b/src/pages/PoolsDetails/PoolsDetails.tsx index f905ecfc21..fd3c66824d 100644 --- a/src/pages/PoolsDetails/PoolsDetails.tsx +++ b/src/pages/PoolsDetails/PoolsDetails.tsx @@ -62,7 +62,7 @@ export function PoolsDetails() { className="inline-flex w-fit gap-4 rounded-4 bg-slate-700 px-16 py-12 hover:bg-cold-blue-700" > - Back to Pools + Back to Pools {glvOrMarketInfo ? ( <> diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index d1cfe6db1d..deece7ba28 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -1,5 +1,7 @@ -import { Trans } from "@lingui/macro"; +import { t, Trans } from "@lingui/macro"; import cx from "classnames"; +import { useMemo } from "react"; +import { ImSpinner2 } from "react-icons/im"; import { USD_DECIMALS } from "config/factors"; import { @@ -16,8 +18,11 @@ import { useChainId } from "lib/chains"; import { formatAmountHuman, formatBalanceAmount, formatUsd } from "lib/numbers"; import { getByKey } from "lib/objects"; import { usePoolsIsMobilePage } from "pages/Pools/usePoolsIsMobilePage"; +import { AnyChainId, getChainName } from "sdk/configs/chains"; import { getNormalizedTokenSymbol } from "sdk/configs/tokens"; +import { useMultichainMarketTokenBalancesRequest } from "components/Synthetics/GmxAccountModal/hooks"; +import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import TokenIcon from "components/TokenIcon/TokenIcon"; import { PoolsDetailsMarketAmount } from "./PoolsDetailsMarketAmount"; @@ -38,8 +43,6 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { : glvOrMarketInfo?.indexToken.symbol; const marketPrice = marketToken?.prices?.maxPrice; - const marketBalance = marketToken?.balance; - const marketBalanceUsd = convertToUsd(marketBalance, marketToken?.decimals, marketPrice); const marketTotalSupply = marketToken?.totalSupply; const marketTotalSupplyUsd = convertToUsd(marketTotalSupply, marketToken?.decimals, marketPrice); @@ -49,6 +52,26 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { const isMobile = usePoolsIsMobilePage(); + const { totalBalance, tokenBalancesData, isBalanceDataLoading } = useMultichainMarketTokenBalancesRequest( + marketToken?.address + ); + + const sortedTokenBalancesDataArray = useMemo(() => { + return Object.entries(tokenBalancesData) + .sort((a, b) => { + const aBalance = a[1]; + const bBalance = b[1]; + + return aBalance > bBalance ? -1 : 1; + }) + .map(([chainId, balance]) => ({ + chainId: parseInt(chainId) as AnyChainId | 0, + balance, + })); + }, [tokenBalancesData]); + + const marketBalanceUsd = convertToUsd(totalBalance, marketToken?.decimals, marketPrice); + return (
- {typeof marketBalance === "bigint" && typeof marketToken?.decimals === "number" ? ( + {typeof totalBalance === "bigint" && typeof marketToken?.decimals === "number" ? ( Wallet} - value={formatUsd(marketBalanceUsd)} - secondaryValue={`${formatBalanceAmount(marketBalance, marketToken?.decimals, undefined, { + label={Balance} + value={ + <> + {isBalanceDataLoading ? : null} + {formatUsd(marketBalanceUsd)} + + } + secondaryValue={`${formatBalanceAmount(totalBalance, marketToken?.decimals, undefined, { showZero: true, })} ${isGlv ? "GLV" : "GM"}`} + tooltipContent={ +
+ {sortedTokenBalancesDataArray.map(({ chainId, balance }) => { + const chainName = chainId === 0 ? t`GMX Account` : getChainName(chainId); + + return ( + + ); + })} + {isBalanceDataLoading ? : null} +
+ } /> ) : null} From 21347283b850f967338d24edc90c11dcf7a51db2 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Wed, 6 Aug 2025 14:59:32 +0200 Subject: [PATCH 05/38] Multichain fix tests --- sdk/src/modules/orders/utils.ts | 47 +++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/sdk/src/modules/orders/utils.ts b/sdk/src/modules/orders/utils.ts index 4f1d4d52a5..cbf79f075a 100644 --- a/sdk/src/modules/orders/utils.ts +++ b/sdk/src/modules/orders/utils.ts @@ -186,17 +186,48 @@ export function buildGetOrdersMulticall(chainId: ContractsChainId, account: stri export function parseGetOrdersResponse(res: MulticallResult>) { const count = Number(res.data.dataStore.count.returnValues[0]); - const orderKeys = res.data.dataStore.keys.returnValues; - const orders = res.data.reader.orders.returnValues as any[]; + const orders = res.data.reader.orders.returnValues as { + order: { + addresses: { + account: string; + receiver: string; + cancellationReceiver: string; + callbackContract: string; + uiFeeReceiver: string; + market: string; + initialCollateralToken: string; + swapPath: string[]; + }; + numbers: { + orderType: number; + decreasePositionSwapType: number; + sizeDeltaUsd: bigint; + initialCollateralDeltaAmount: bigint; + triggerPrice: bigint; + acceptablePrice: bigint; + executionFee: bigint; + callbackGasLimit: bigint; + minOutputAmount: bigint; + updatedAtTime: bigint; + validFromTime: bigint; + srcChainId: bigint; + }; + flags: { + isLong: boolean; + shouldUnwrapNativeToken: boolean; + isFrozen: boolean; + autoCancel: boolean; + }; + _dataList: string[]; + }; + orderKey: string; + }[]; return { count, - orders: orders.map((order, i) => { - const key = orderKeys[i]; - const { data } = order; - + orders: orders.map(({ order, orderKey }) => { const orderData: Order = { - key, + key: orderKey, account: order.addresses.account as Address, receiver: order.addresses.receiver as Address, callbackContract: order.addresses.callbackContract as Address, @@ -219,7 +250,7 @@ export function parseGetOrdersResponse(res: MulticallResult Date: Wed, 6 Aug 2025 15:32:39 +0200 Subject: [PATCH 06/38] GmDepositWithdrawalBox remove unused state --- sdk/src/configs/tokens.ts | 1 + .../GmDepositWithdrawalBox.tsx | 14 +------------- .../useDepositWithdrawalTransactions.tsx | 6 ++---- .../useGmSwapSubmitState.tsx | 3 --- src/components/Synthetics/GmxAccountModal/hooks.ts | 3 ++- src/domain/multichain/arbitraryRelayParams.ts | 9 --------- .../markets/createSourceChainDepositTxn.ts | 2 +- src/domain/synthetics/trade/utils/validation.ts | 3 +-- src/locales/de/messages.po | 4 ---- src/locales/en/messages.po | 4 ---- src/locales/es/messages.po | 4 ---- src/locales/fr/messages.po | 4 ---- src/locales/ja/messages.po | 4 ---- src/locales/ko/messages.po | 4 ---- src/locales/pseudo/messages.po | 4 ---- src/locales/ru/messages.po | 4 ---- src/locales/zh/messages.po | 4 ---- 17 files changed, 8 insertions(+), 69 deletions(-) diff --git a/sdk/src/configs/tokens.ts b/sdk/src/configs/tokens.ts index 141ac55dd4..2dacf0d238 100644 --- a/sdk/src/configs/tokens.ts +++ b/sdk/src/configs/tokens.ts @@ -1718,6 +1718,7 @@ export const TOKEN_COLOR_MAP = { PBTC: "#F7931A", USDC: "#2775CA", "USDC.E": "#2A5ADA", + "USDC.SG": "#2775CA", USDT: "#67B18A", MIM: "#9695F8", FRAX: "#000", diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index deb6ba7e7e..d40f75b54b 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -1,10 +1,9 @@ -import { t, Trans } from "@lingui/macro"; +import { t } from "@lingui/macro"; import cx from "classnames"; import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; -import { getChainName } from "config/chains"; import { getContract } from "config/contracts"; import { isSourceChain } from "config/multichain"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; @@ -36,10 +35,8 @@ import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; -import Checkbox from "components/Checkbox/Checkbox"; import { useMultichainTokensRequest } from "components/Synthetics/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; -import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; import TooltipWithPortal from "components/Tooltip/TooltipWithPortal"; @@ -100,8 +97,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { setFocusedInput, paySource, setPaySource, - isSendBackToSourceChain, - setIsSendBackToSourceChain, firstTokenAddress, setFirstTokenAddress, secondTokenAddress, @@ -417,7 +412,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { marketsInfoData, glvAndMarketsInfoData, paySource, - isSendBackToSourceChain, }); const firstTokenMaxDetails = useMaxAvailableAmount({ @@ -831,12 +825,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) {
- {srcChainId !== undefined && paySource === "sourceChain" && ( - Send back to {getChainName(srcChainId)}} - value={} - /> - )} Promise; } => { @@ -292,7 +290,7 @@ const useDepositTransactions = ({ let dataList: string[] = EMPTY_ARRAY; - if (isSendBackToSourceChain) { + if (paySource === "sourceChain") { const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { @@ -336,9 +334,9 @@ const useDepositTransactions = ({ initialLongTokenAddress, initialShortTokenAddress, isGlv, - isSendBackToSourceChain, marketTokenAddress, marketTokenAmount, + paySource, srcChainId, ]); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 9e7e6237c5..84aeb0f561 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -50,7 +50,6 @@ interface Props { glvAndMarketsInfoData: GlvAndGmMarketsInfoData; selectedMarketInfoForGlv?: MarketInfo; paySource: GmOrGlvPaySource; - isSendBackToSourceChain: boolean; } const processingTextMap = { @@ -94,7 +93,6 @@ export const useGmSwapSubmitState = ({ isMarketTokenDeposit, glvAndMarketsInfoData, paySource, - isSendBackToSourceChain, }: Props): SubmitButtonState => { const chainId = useSelector(selectChainId); const hasOutdatedUi = useHasOutdatedUi(); @@ -135,7 +133,6 @@ export const useGmSwapSubmitState = ({ marketTokenUsd, isFirstBuy, paySource, - isSendBackToSourceChain, }); const onConnectAccount = useCallback(() => { diff --git a/src/components/Synthetics/GmxAccountModal/hooks.ts b/src/components/Synthetics/GmxAccountModal/hooks.ts index 221d61ea72..b967a99834 100644 --- a/src/components/Synthetics/GmxAccountModal/hooks.ts +++ b/src/components/Synthetics/GmxAccountModal/hooks.ts @@ -160,12 +160,13 @@ const subscribeMultichainTokenBalances: SWRSubscription< }; }; -export function useMultichainTokensRequest(account: string | undefined): { +export function useMultichainTokensRequest(): { tokenChainDataArray: TokenChainData[]; isPriceDataLoading: boolean; isBalanceDataLoading: boolean; } { const { chainId } = useChainId(); + const account = useSelector(selectAccount); const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index 4f8feeb7ee..5e7127bbdc 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -365,15 +365,6 @@ export function useArbitraryRelayParamsAndPayload({ }, }); - console.log({ - executionFeeAmount: p.executionFeeAmount, - relayerFeeAmount: expressParams?.gasPaymentParams.relayerFeeAmount, - totalRelayerFeeTokenAmount: expressParams?.gasPaymentParams.totalRelayerFeeTokenAmount, - diff: expressParams?.gasPaymentParams.totalRelayerFeeTokenAmount - ? expressParams.gasPaymentParams.totalRelayerFeeTokenAmount - - expressParams.gasPaymentParams.relayerFeeAmount - : undefined, - }); return expressParams; } catch (error) { throw new Error("no expressParams"); diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index c33d317eb5..f5d430f123 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -38,7 +38,7 @@ export async function createSourceChainDepositTxn({ account, tokenAddress, tokenAmount, - executionFee, + // executionFee, }: { chainId: SettlementChainId; globalExpressParams: GlobalExpressParams; diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index 0af9d9ca9e..216514dbb8 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -20,9 +20,8 @@ import { TokenData, TokensData, TokensRatio, getIsEquivalentTokens } from "domai import { DUST_USD, isAddressZero } from "lib/legacy"; import { PRECISION, expandDecimals, formatAmount, formatUsd } from "lib/numbers"; import { getByKey } from "lib/objects"; -import { getToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; +import { NATIVE_TOKEN_ADDRESS, getToken } from "sdk/configs/tokens"; import { MAX_TWAP_NUMBER_OF_PARTS, MIN_TWAP_NUMBER_OF_PARTS } from "sdk/configs/twap"; -import { Token } from "sdk/types/tokens"; import { ExternalSwapQuote, GmSwapFees, diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index a8c75947e4..31c38e0160 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 644bf7d0c8..4307878851 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -8676,10 +8676,6 @@ msgstr "Daily and Cumulative PnL" msgid "Edit {longOrShortText} {0}" msgstr "Edit {longOrShortText} {0}" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "Send back to {0}" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "short" diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index f812c59378..489c2ea9be 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index 2df3091fb3..ff8bb9cdf7 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index d5f36e2101..1b158c182f 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index 93e70d3dac..f5a9930c2a 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index 5d42f25844..1bdf16d28c 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index c3cfdf6a03..188f5ac559 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index 420441f994..cfa39f3d01 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -8670,10 +8670,6 @@ msgstr "" msgid "Edit {longOrShortText} {0}" msgstr "" -#: src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx -msgid "Send back to {0}" -msgstr "" - #: src/domain/synthetics/orders/utils.tsx msgid "short" msgstr "" From 359f9cf0858340098d99a31db3e429dcae0bed0e Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 7 Aug 2025 12:21:05 +0200 Subject: [PATCH 07/38] Refactor multichain deposit --- src/components/Referrals/JoinReferralCode.tsx | 4 +- .../useDepositWithdrawalTransactions.tsx | 137 +++++++++++++---- .../GmxAccountModal/DepositView.tsx | 2 +- .../GmxAccountModal/WithdrawalView.tsx | 4 +- .../Synthetics/GmxAccountModal/hooks.ts | 5 +- .../Synthetics/MarketStats/MarketGraphs.tsx | 1 + src/components/TokenCard/TokenCard.tsx | 4 +- src/config/multichain.ts | 20 +++ .../SyntheticsEventsProvider.tsx | 1 + .../SyntheticsStateContextProvider.tsx | 5 +- src/domain/multichain/codecs/CodecUiHelper.ts | 34 ++++- .../multichain/codecs/hashParamsAbiItems.ts | 28 ++++ src/domain/multichain/getSendParams.ts | 6 +- .../synthetics/express/expressOrderUtils.ts | 59 -------- .../markets/createMultichainDepositTxn.ts | 69 +-------- .../markets/createMultichainGlvDepositTxn.ts | 72 +-------- .../markets/createSourceChainDepositTxn.ts | 5 +- .../markets/createSourceChainGlvDepositTxn.ts | 139 ++++++++++++++++++ .../synthetics/markets/signCreateDeposit.ts | 68 +++++++++ .../markets/signCreateGlvDeposit.ts | 68 +++++++++ .../synthetics/markets/useGlvMarkets.ts | 27 +++- .../synthetics/markets/useGmMarketsApy.ts | 1 + .../synthetics/markets/useMarketTokensData.ts | 3 +- src/domain/tokens/utils.ts | 10 +- src/locales/de/messages.po | 1 + src/locales/en/messages.po | 1 + src/locales/es/messages.po | 1 + src/locales/fr/messages.po | 1 + src/locales/ja/messages.po | 1 + src/locales/ko/messages.po | 1 + src/locales/pseudo/messages.po | 1 + src/locales/ru/messages.po | 1 + src/locales/zh/messages.po | 1 + .../ParseTransaction/ParseTransaction.tsx | 1 + src/pages/Pools/Pools.tsx | 1 + 35 files changed, 534 insertions(+), 249 deletions(-) create mode 100644 src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts create mode 100644 src/domain/synthetics/markets/signCreateDeposit.ts create mode 100644 src/domain/synthetics/markets/signCreateGlvDeposit.ts diff --git a/src/components/Referrals/JoinReferralCode.tsx b/src/components/Referrals/JoinReferralCode.tsx index 9f3d9dba19..cf7c062b00 100644 --- a/src/components/Referrals/JoinReferralCode.tsx +++ b/src/components/Referrals/JoinReferralCode.tsx @@ -342,7 +342,7 @@ function ReferralCodeFormMultichain({ isDeposit: true, dstChainId: p.chainId, account: p.simulationSigner.address, - inputAmount: tokenAmount, + amount: tokenAmount, srcChainId: p.srcChainId, composeGas, action, @@ -471,7 +471,7 @@ function ReferralCodeFormMultichain({ dstChainId: chainId, account, srcChainId, - inputAmount: result.data.amount, + amount: result.data.amount, composeGas: result.data.composeGas, isDeposit: true, action, diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index 37fab90c23..f0e64049a9 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -6,7 +6,7 @@ import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; import { ContractsChainId, SettlementChainId } from "config/chains"; import { getContract } from "config/contracts"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; -import { CHAIN_ID_TO_ENDPOINT_ID } from "config/multichain"; +import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; @@ -16,6 +16,7 @@ import { selectChainId, selectSrcChainId, } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; @@ -38,7 +39,9 @@ import { buildAndSignMultichainGlvDepositTxn, createMultichainGlvDepositTxn, } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; -import { TokenData, TokensData } from "domain/synthetics/tokens"; +import { createSourceChainDepositTxn } from "domain/synthetics/markets/createSourceChainDepositTxn"; +import { createSourceChainGlvDepositTxn } from "domain/synthetics/markets/createSourceChainGlvDepositTxn"; +import { convertToTokenAmount, getMidPrice, getTokenData, TokenData, TokensData } from "domain/synthetics/tokens"; import { useChainId } from "lib/chains"; import { helperToast } from "lib/helperToast"; import { @@ -58,7 +61,6 @@ import { nowInSeconds } from "sdk/utils/time"; import { applySlippageToMinOut } from "sdk/utils/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; -import { createSourceChainDepositTxn } from "../../../../../domain/synthetics/markets/createSourceChainDepositTxn"; import { Operation } from "../types"; import type { GmOrGlvPaySource } from "./types"; @@ -297,12 +299,11 @@ const useDepositTransactions = ({ deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), desChainId: chainId, minAmountOut: minMarketTokens / 2n, - provider: "0xe4ebcac4a2e6cbee385ee407f7d5e278bc07e11e", + provider: getMultichainTokenId(chainId, marketTokenAddress)!.stargate, providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId!], { size: 32 }), }, }); const bytes = hexToBytes(actionHash as Hex); - const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; @@ -312,7 +313,7 @@ const useDepositTransactions = ({ addresses: { receiver: account, callbackContract: zeroAddress, - uiFeeReceiver: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, market: marketTokenAddress, initialLongToken: initialLongTokenAddress, initialShortToken: initialShortTokenAddress, @@ -355,6 +356,26 @@ const useDepositTransactions = ({ } const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, glvTokenAmount); + + let dataList: string[] = EMPTY_ARRAY; + if (paySource === "sourceChain") { + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + minAmountOut: minGlvTokens / 2n, + provider: getMultichainTokenId(chainId, glvInfo!.glvTokenAddress)!.stargate, + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId!], { size: 32 }), + }, + }); + const bytes = hexToBytes(actionHash as Hex); + + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + const params: CreateGlvDepositParamsStruct = { addresses: { glv: glvInfo!.glvTokenAddress, @@ -372,17 +393,13 @@ const useDepositTransactions = ({ callbackGasLimit: 0n, shouldUnwrapNativeToken, isMarketTokenDeposit: Boolean(isMarketTokenDeposit), - dataList: [], + dataList, }; - // console.log({ - // params, - // transferRequests, - // }); - return params; }, [ account, + chainId, executionFeeTokenAmount, glvInfo, glvTokenAmount, @@ -392,8 +409,10 @@ const useDepositTransactions = ({ isMarketTokenDeposit, marketInfo, marketTokenAmount, + paySource, selectedMarketForGlv, shouldUnwrapNativeToken, + srcChainId, ]); const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ @@ -494,7 +513,7 @@ const useDepositTransactions = ({ tokenAmount, executionFee: executionFee.feeTokenAmount, }); - } else if (paySource === "gmxAccount" && srcChainId !== undefined) { + } else if (paySource === "gmxAccount") { promise = createMultichainDepositTxn({ chainId, srcChainId, @@ -552,6 +571,18 @@ const useDepositTransactions = ({ ] ); + // TODO MLTCH make it pretty + const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; + const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; + + const tokenData = getTokenData(tokensData, tokenAddress); + + const selectFindSwapPath = useMemo( + () => makeSelectFindSwapPath(tokenAddress, executionFee?.feeToken.address), + [executionFee?.feeToken.address, tokenAddress] + ); + const findSwapPath = useSelector(selectFindSwapPath); + const onCreateGlvDeposit = useCallback( function onCreateGlvDeposit() { const metricData = getDepositMetricData(); @@ -575,8 +606,40 @@ const useDepositTransactions = ({ sendUserAnalyticsOrderConfirmClickEvent(chainId, metricData.metricId); - if (srcChainId !== undefined) { - return createMultichainGlvDepositTxn({ + let promise: Promise; + if (paySource === "sourceChain") { + if (longTokenAmount! > 0n && shortTokenAmount! > 0n) { + throw new Error("Pay source sourceChain does not support both long and short token deposits"); + } + + if (!tokenData) { + throw new Error("Price not found"); + } + + const feeSwapPathStats = findSwapPath(executionFee.feeUsd); + const feeSwapPath = feeSwapPathStats?.swapPath ?? []; + + const feeAmount = + (convertToTokenAmount(executionFee.feeUsd, tokenData.decimals, getMidPrice(tokenData.prices))! * 11n) / 10n; + + promise = createSourceChainGlvDepositTxn({ + chainId: chainId as SettlementChainId, + srcChainId: srcChainId!, + signer, + transferRequests, + params: glvParams!, + account, + tokenAddress, + tokenAmount, + globalExpressParams: globalExpressParams!, + relayFeePayload: { + feeToken: tokenAddress, + feeAmount, + feeSwapPath, + }, + }); + } else if (paySource === "gmxAccount") { + promise = createMultichainGlvDepositTxn({ chainId, srcChainId, signer, @@ -584,25 +647,29 @@ const useDepositTransactions = ({ asyncExpressTxnResult: multichainDepositExpressTxnParams, params: glvParams!, }); + } else if (paySource === "settlementChain") { + promise = createGlvDepositTxn({ + chainId, + signer, + params: glvParams!, + longTokenAddress: longTokenAddress!, + shortTokenAddress: shortTokenAddress!, + longTokenAmount: longTokenAmount ?? 0n, + shortTokenAmount: shortTokenAmount ?? 0n, + marketTokenAmount: marketTokenAmount ?? 0n, + executionFee: executionFee.feeTokenAmount, + executionGasLimit: executionFee.gasLimit, + skipSimulation: shouldDisableValidation, + tokensData, + blockTimestampData, + setPendingTxns, + setPendingDeposit, + }); + } else { + throw new Error(`Invalid pay source: ${paySource}`); } - return createGlvDepositTxn({ - chainId, - signer, - params: glvParams!, - longTokenAddress: longTokenAddress!, - shortTokenAddress: shortTokenAddress!, - longTokenAmount: longTokenAmount ?? 0n, - shortTokenAmount: shortTokenAmount ?? 0n, - marketTokenAmount: marketTokenAmount ?? 0n, - executionFee: executionFee.feeTokenAmount, - executionGasLimit: executionFee.gasLimit, - skipSimulation: shouldDisableValidation, - tokensData, - blockTimestampData, - setPendingTxns, - setPendingDeposit, - }) + return promise .then(makeTxnSentMetricsHandler(metricData.metricId)) .catch(makeTxnErrorMetricsHandler(metricData.metricId)) .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); @@ -612,7 +679,9 @@ const useDepositTransactions = ({ blockTimestampData, chainId, executionFee, + findSwapPath, getDepositMetricData, + globalExpressParams, glvParams, isGlv, longTokenAddress, @@ -621,6 +690,7 @@ const useDepositTransactions = ({ marketToken, marketTokenAmount, multichainDepositExpressTxnParams, + paySource, setPendingDeposit, setPendingTxns, shortTokenAddress, @@ -628,6 +698,9 @@ const useDepositTransactions = ({ shouldDisableValidation, signer, srcChainId, + tokenAddress, + tokenAmount, + tokenData, tokensData, transferRequests, ] diff --git a/src/components/Synthetics/GmxAccountModal/DepositView.tsx b/src/components/Synthetics/GmxAccountModal/DepositView.tsx index a6454054a2..d400ce7219 100644 --- a/src/components/Synthetics/GmxAccountModal/DepositView.tsx +++ b/src/components/Synthetics/GmxAccountModal/DepositView.tsx @@ -286,7 +286,7 @@ export const DepositView = () => { return getMultichainTransferSendParams({ account, - inputAmount, + amount: inputAmount, srcChainId: depositViewChain, composeGas, dstChainId: settlementChainId, diff --git a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx index 930fa9d6d0..0e2c073091 100644 --- a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx @@ -201,7 +201,7 @@ export const WithdrawalView = () => { return getMultichainTransferSendParams({ dstChainId: withdrawalViewChain, account, - inputAmount, + amount: inputAmount, isDeposit: false, }); }, [account, inputAmount, withdrawalViewChain]); @@ -260,7 +260,7 @@ export const WithdrawalView = () => { return getMultichainTransferSendParams({ dstChainId: withdrawalViewChain, account, - inputAmount: fakeInputAmount, + amount: fakeInputAmount, isDeposit: false, srcChainId: chainId, }); diff --git a/src/components/Synthetics/GmxAccountModal/hooks.ts b/src/components/Synthetics/GmxAccountModal/hooks.ts index b967a99834..bc98fbc565 100644 --- a/src/components/Synthetics/GmxAccountModal/hooks.ts +++ b/src/components/Synthetics/GmxAccountModal/hooks.ts @@ -236,7 +236,7 @@ export function useMultichainMarketTokenBalancesRequest(tokenAddress: string | u subscribeMultichainTokenBalances ); - const tokenBalancesData: Partial> = useMemo(() => { + const tokenBalancesData: Partial> = useMemo(() => { if (!marketTokensData || !tokenAddress) { return EMPTY_OBJECT; } @@ -275,6 +275,9 @@ export function useMultichainMarketTokenBalancesRequest(tokenAddress: string | u } let totalBalance = 0n; for (const balance of Object.values(tokenBalancesData)) { + if (balance === undefined) { + continue; + } totalBalance += balance; } return totalBalance; diff --git a/src/components/Synthetics/MarketStats/MarketGraphs.tsx b/src/components/Synthetics/MarketStats/MarketGraphs.tsx index 64b802241d..85c8614ec0 100644 --- a/src/components/Synthetics/MarketStats/MarketGraphs.tsx +++ b/src/components/Synthetics/MarketStats/MarketGraphs.tsx @@ -99,6 +99,7 @@ export function MarketGraphs({ glvOrMarketInfo }: { glvOrMarketInfo: GlvOrMarket tokensData, chainId, account, + srcChainId, }); const { marketTokensData } = useMarketTokensData(chainId, srcChainId, { isDeposit: true, withGlv: true }); diff --git a/src/components/TokenCard/TokenCard.tsx b/src/components/TokenCard/TokenCard.tsx index c16c4b6dea..3044c990b4 100644 --- a/src/components/TokenCard/TokenCard.tsx +++ b/src/components/TokenCard/TokenCard.tsx @@ -189,7 +189,7 @@ async function sendUserAnalyticsProtocolReadMoreEvent() { const PERIOD = "90d"; export default function TokenCard({ showRedirectModal, showGlp = true }: Props) { - const { chainId } = useChainId(); + const { chainId, srcChainId } = useChainId(); const { active, account } = useWallet(); const arbitrumIncentiveState = useIncentiveStats(ARBITRUM); const avalancheIncentiveState = useIncentiveStats(AVALANCHE); @@ -199,6 +199,7 @@ export default function TokenCard({ showRedirectModal, showGlp = true }: Props) account, marketsInfoData: undefined, tokensData: undefined, + srcChainId, }); const { glvs: glvAvax } = useGlvMarketsInfo(isGlvEnabled(AVALANCHE), { @@ -206,6 +207,7 @@ export default function TokenCard({ showRedirectModal, showGlp = true }: Props) marketsInfoData: undefined, tokensData: undefined, account, + srcChainId, }); const { diff --git a/src/config/multichain.ts b/src/config/multichain.ts index f5904c81bc..aa3e716c2b 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -173,6 +173,7 @@ if (isDevelopment()) { }, }; + // TODO MLTCH wrap it in a factory TOKEN_GROUPS[""] = { [ARBITRUM_SEPOLIA]: { address: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", @@ -191,6 +192,25 @@ if (isDevelopment()) { isPlatformToken: true, }, }; + + TOKEN_GROUPS[""] = { + [ARBITRUM_SEPOLIA]: { + address: "0xAb3567e55c205c62B141967145F37b7695a9F854", + decimals: 18, + chainId: ARBITRUM_SEPOLIA, + stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + symbol: "", + isPlatformToken: true, + }, + [SOURCE_SEPOLIA]: { + address: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + decimals: 18, + chainId: SOURCE_SEPOLIA, + stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + symbol: "", + isPlatformToken: true, + }, + }; } export const DEBUG_MULTICHAIN_SAME_CHAIN_DEPOSIT = false; diff --git a/src/context/SyntheticsEvents/SyntheticsEventsProvider.tsx b/src/context/SyntheticsEvents/SyntheticsEventsProvider.tsx index 8a47e4aae3..fc5efe1501 100644 --- a/src/context/SyntheticsEvents/SyntheticsEventsProvider.tsx +++ b/src/context/SyntheticsEvents/SyntheticsEventsProvider.tsx @@ -109,6 +109,7 @@ export function SyntheticsEventsProvider({ children }: { children: ReactNode }) marketsInfoData, tokensData, chainId, + srcChainId, account: currentAccount, }); diff --git a/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx b/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx index 8e8c3e01a5..d1b4513072 100644 --- a/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx +++ b/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx @@ -191,8 +191,9 @@ export function SyntheticsStateContextProvider({ const glvInfo = useGlvMarketsInfo(shouldFetchGlvMarkets, { marketsInfoData: marketsInfo.marketsInfoData, tokensData: tokensDataResult.tokensData, - chainId: chainId, - account: account, + chainId, + account, + srcChainId, }); const { marketTokensData: depositMarketTokensData } = useMarketTokensDataRequest(chainId, srcChainId, { diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index 9001962ab0..3bebd13752 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -2,13 +2,18 @@ import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities"; import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex } from "viem"; import type { RelayParamsPayload } from "domain/synthetics/express"; -import { CreateDepositParamsStruct } from "domain/synthetics/markets/types"; +import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct } from "domain/synthetics/markets/types"; import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; import { hashString } from "sdk/utils/hash"; import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; -import { CREATE_DEPOSIT_PARAMS_TYPE, RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE } from "./hashParamsAbiItems"; +import { + CREATE_DEPOSIT_PARAMS_TYPE, + CREATE_GLV_DEPOSIT_PARAMS_TYPE, + RELAY_PARAMS_TYPE, + TRANSFER_REQUESTS_TYPE, +} from "./hashParamsAbiItems"; export enum MultichainActionType { None = 0, @@ -55,7 +60,17 @@ type BridgeOutAction = { actionData: BridgeOutActionData; }; -export type MultichainAction = SetTraderReferralCodeAction | DepositAction | BridgeOutAction; +type GlvDepositActionData = CommonActionData & { + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvDepositParamsStruct; +}; + +type GlvDepositAction = { + actionType: MultichainActionType.GlvDeposit; + actionData: GlvDepositActionData; +}; + +export type MultichainAction = SetTraderReferralCodeAction | DepositAction | BridgeOutAction | GlvDepositAction; export const GMX_DATA_ACTION_HASH = hashString("GMX_DATA_ACTION"); // TODO MLTCH also implement bytes32 public constant MAX_DATA_LENGTH = keccak256(abi.encode("MAX_DATA_LENGTH")); @@ -128,6 +143,19 @@ export class CodecUiHelper { const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + return data; + } else if (action.actionType === MultichainActionType.GlvDeposit) { + const actionData = encodeAbiParameters( + [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE], + [ + { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, + action.actionData.transferRequests, + action.actionData.params, + ] + ); + + const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + return data; } diff --git a/src/domain/multichain/codecs/hashParamsAbiItems.ts b/src/domain/multichain/codecs/hashParamsAbiItems.ts index 6bd4dd2d3c..7413334f30 100644 --- a/src/domain/multichain/codecs/hashParamsAbiItems.ts +++ b/src/domain/multichain/codecs/hashParamsAbiItems.ts @@ -85,3 +85,31 @@ export const CREATE_DEPOSIT_PARAMS_TYPE = { { type: "bytes32[]", name: "dataList" }, ], }; + +export const CREATE_GLV_DEPOSIT_PARAMS_TYPE = { + type: "tuple", + name: "", + components: [ + { + type: "tuple", + name: "addresses", + components: [ + { type: "address", name: "glv" }, + { type: "address", name: "market" }, + { type: "address", name: "receiver" }, + { type: "address", name: "callbackContract" }, + { type: "address", name: "uiFeeReceiver" }, + { type: "address", name: "initialLongToken" }, + { type: "address", name: "initialShortToken" }, + { type: "address[]", name: "longTokenSwapPath" }, + { type: "address[]", name: "shortTokenSwapPath" }, + ], + }, + { type: "uint256", name: "minGlvTokens" }, + { type: "uint256", name: "executionFee" }, + { type: "uint256", name: "callbackGasLimit" }, + { type: "bool", name: "shouldUnwrapNativeToken" }, + { type: "bool", name: "isMarketTokenDeposit" }, + { type: "bytes32[]", name: "dataList" }, + ], +}; diff --git a/src/domain/multichain/getSendParams.ts b/src/domain/multichain/getSendParams.ts index 285a66b58e..20cd0b8d04 100644 --- a/src/domain/multichain/getSendParams.ts +++ b/src/domain/multichain/getSendParams.ts @@ -16,7 +16,7 @@ export function getMultichainTransferSendParams({ dstChainId, account, srcChainId, - inputAmount, + amount, composeGas, isDeposit, action, @@ -24,7 +24,7 @@ export function getMultichainTransferSendParams({ dstChainId: AnyChainId; account: string; srcChainId?: AnyChainId; - inputAmount: bigint; + amount: bigint; composeGas?: bigint; isDeposit: boolean; action?: MultichainAction; @@ -73,7 +73,7 @@ export function getMultichainTransferSendParams({ const sendParams: SendParamStruct = { dstEid, to, - amountLD: inputAmount, + amountLD: amount, minAmountLD: 0n, extraOptions, composeMsg, diff --git a/src/domain/synthetics/express/expressOrderUtils.ts b/src/domain/synthetics/express/expressOrderUtils.ts index a43f3b7909..dc64651565 100644 --- a/src/domain/synthetics/express/expressOrderUtils.ts +++ b/src/domain/synthetics/express/expressOrderUtils.ts @@ -22,7 +22,6 @@ import { RelayParamsPayload, RelayParamsPayloadWithSignature, } from "domain/synthetics/express"; -import type { CreateDepositParamsStruct } from "domain/synthetics/markets/types"; import { getSubaccountValidations, hashSubaccountApproval, @@ -58,7 +57,6 @@ import { import { nowInSeconds } from "sdk/utils/time"; import { setUiFeeReceiverIsExpress } from "sdk/utils/twap/uiFeeReceiver"; import { GelatoRelayRouter, MultichainSubaccountRouter, SubaccountGelatoRelayRouter } from "typechain-types"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { MultichainOrderRouter } from "typechain-types/MultichainOrderRouter"; import { approximateL1GasBuffer, estimateBatchGasLimit, estimateRelayerGasLimit, GasLimitsConfig } from "../fees"; @@ -984,63 +982,6 @@ export async function signSetTraderReferralCode({ return signTypedData({ signer, domain, types, typedData }); } -export async function signCreateDeposit({ - signer, - chainId, - srcChainId, - relayParams, - transferRequests, - params, -}: { - signer: WalletSigner | Wallet; - relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; - params: CreateDepositParamsStruct; - chainId: ContractsChainId; - srcChainId: SourceChainId | undefined; -}) { - const types = { - CreateDeposit: [ - { name: "transferTokens", type: "address[]" }, - { name: "transferReceivers", type: "address[]" }, - { name: "transferAmounts", type: "uint256[]" }, - { name: "addresses", type: "CreateDepositAddresses" }, - { name: "minMarketTokens", type: "uint256" }, - { name: "shouldUnwrapNativeToken", type: "bool" }, - { name: "executionFee", type: "uint256" }, - { name: "callbackGasLimit", type: "uint256" }, - { name: "dataList", type: "bytes32[]" }, - { name: "relayParams", type: "bytes32" }, - ], - CreateDepositAddresses: [ - { name: "receiver", type: "address" }, - { name: "callbackContract", type: "address" }, - { name: "uiFeeReceiver", type: "address" }, - { name: "market", type: "address" }, - { name: "initialLongToken", type: "address" }, - { name: "initialShortToken", type: "address" }, - { name: "longTokenSwapPath", type: "address[]" }, - { name: "shortTokenSwapPath", type: "address[]" }, - ], - }; - - const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); - const typedData = { - transferTokens: transferRequests.tokens, - transferReceivers: transferRequests.receivers, - transferAmounts: transferRequests.amounts, - addresses: params.addresses, - minMarketTokens: params.minMarketTokens, - shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, - executionFee: params.executionFee, - callbackGasLimit: params.callbackGasLimit, - dataList: params.dataList, - relayParams: hashRelayParams(relayParams), - }; - - return signTypedData({ signer, domain, types, typedData }); -} - function updateExpressOrdersAddresses(addressess: CreateOrderPayload["addresses"]): CreateOrderPayload["addresses"] { return { ...addressess, diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index 99b02ecce6..2ba62e10f8 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -4,20 +4,19 @@ import { getContract } from "config/contracts"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; -import { signTypedData } from "lib/wallets/signing"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { IDepositUtils } from "typechain-types/ExchangeRouter"; import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; import { CreateDepositParamsStruct } from "."; -import { ExpressTxnParams, RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; +import { ExpressTxnParams, RelayParamsPayload } from "../express"; +import { signCreateDeposit } from "./signCreateDeposit"; export type CreateMultichainDepositParams = { chainId: ContractsChainId; - srcChainId: SourceChainId; + srcChainId: SourceChainId | undefined; signer: WalletSigner; relayParams: RelayParamsPayload; emptySignature?: boolean; @@ -45,7 +44,7 @@ export async function buildAndSignMultichainDepositTxn({ if (emptySignature) { signature = "0x"; } else { - signature = await signMultichainDepositPayload({ + signature = await signCreateDeposit({ chainId, srcChainId, signer, @@ -64,7 +63,7 @@ export async function buildAndSignMultichainDepositTxn({ signature, }, account, - srcChainId, + srcChainId ?? chainId, transferRequests, params, ] satisfies Parameters, @@ -78,62 +77,6 @@ export async function buildAndSignMultichainDepositTxn({ }; } -function signMultichainDepositPayload({ - chainId, - srcChainId, - signer, - relayParams, - transferRequests, - params, -}: { - chainId: ContractsChainId; - srcChainId: SourceChainId; - signer: WalletSigner; - relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; - params: IDepositUtils.CreateDepositParamsStruct; -}) { - const types = { - CreateDeposit: [ - { name: "transferTokens", type: "address[]" }, - { name: "transferReceivers", type: "address[]" }, - { name: "transferAmounts", type: "uint256[]" }, - { name: "addresses", type: "CreateDepositAddresses" }, - { name: "minMarketTokens", type: "uint256" }, - { name: "shouldUnwrapNativeToken", type: "bool" }, - { name: "executionFee", type: "uint256" }, - { name: "callbackGasLimit", type: "uint256" }, - { name: "dataList", type: "bytes32[]" }, - { name: "relayParams", type: "bytes32" }, - ], - CreateDepositAddresses: [ - { name: "receiver", type: "address" }, - { name: "callbackContract", type: "address" }, - { name: "uiFeeReceiver", type: "address" }, - { name: "market", type: "address" }, - { name: "initialLongToken", type: "address" }, - { name: "initialShortToken", type: "address" }, - { name: "longTokenSwapPath", type: "address[]" }, - { name: "shortTokenSwapPath", type: "address[]" }, - ], - }; - - const domain = getGelatoRelayRouterDomain(srcChainId, getContract(chainId, "MultichainGmRouter")); - const typedData = { - transferTokens: transferRequests.tokens, - transferReceivers: transferRequests.receivers, - transferAmounts: transferRequests.amounts, - addresses: params.addresses, - minMarketTokens: params.minMarketTokens, - shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, - executionFee: params.executionFee, - callbackGasLimit: params.callbackGasLimit, - dataList: params.dataList, - relayParams: hashRelayParams(relayParams), - }; - - return signTypedData({ signer, domain, types, typedData }); -} export function createMultichainDepositTxn({ chainId, srcChainId, @@ -143,7 +86,7 @@ export function createMultichainDepositTxn({ params, }: { chainId: ContractsChainId; - srcChainId: SourceChainId; + srcChainId: SourceChainId | undefined; signer: WalletSigner; transferRequests: IRelayUtils.TransferRequestsStruct; asyncExpressTxnResult: AsyncResult; diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts index e1438d78f1..e79e9b1164 100644 --- a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -4,7 +4,6 @@ import { getContract } from "config/contracts"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; -import { signTypedData } from "lib/wallets/signing"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; @@ -13,11 +12,12 @@ import { MultichainGlvRouter } from "typechain-types/MultichainGlvRouter"; import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { CreateGlvDepositParamsStruct } from "."; -import { ExpressTxnParams, RelayParamsPayload, getGelatoRelayRouterDomain, hashRelayParams } from "../express"; +import { ExpressTxnParams, RelayParamsPayload } from "../express"; +import { signCreateGlvDeposit } from "./signCreateGlvDeposit"; export type CreateMultichainGlvDepositParams = { chainId: ContractsChainId; - srcChainId: SourceChainId; + srcChainId: SourceChainId | undefined; signer: WalletSigner; relayParams: RelayParamsPayload; emptySignature?: boolean; @@ -45,7 +45,7 @@ export async function buildAndSignMultichainGlvDepositTxn({ if (emptySignature) { signature = "0x"; } else { - signature = await signMultichainGlvDepositPayload({ + signature = await signCreateGlvDeposit({ chainId, srcChainId, signer, @@ -64,7 +64,7 @@ export async function buildAndSignMultichainGlvDepositTxn({ signature, }, account, - srcChainId, + srcChainId ?? chainId, transferRequests, params, ] satisfies Parameters, @@ -78,66 +78,6 @@ export async function buildAndSignMultichainGlvDepositTxn({ }; } -function signMultichainGlvDepositPayload({ - chainId, - srcChainId, - signer, - relayParams, - transferRequests, - params, -}: { - chainId: ContractsChainId; - srcChainId: SourceChainId; - signer: WalletSigner; - relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; - params: CreateGlvDepositParamsStruct; -}) { - const types = { - CreateGlvDeposit: [ - { name: "transferTokens", type: "address[]" }, - { name: "transferReceivers", type: "address[]" }, - { name: "transferAmounts", type: "uint256[]" }, - { name: "addresses", type: "CreateGlvDepositAddresses" }, - { name: "minGlvTokens", type: "uint256" }, - { name: "executionFee", type: "uint256" }, - { name: "callbackGasLimit", type: "uint256" }, - { name: "shouldUnwrapNativeToken", type: "bool" }, - { name: "isMarketTokenDeposit", type: "bool" }, - { name: "dataList", type: "bytes32[]" }, - { name: "relayParams", type: "bytes32" }, - ], - CreateGlvDepositAddresses: [ - { name: "glv", type: "address" }, - { name: "market", type: "address" }, - { name: "receiver", type: "address" }, - { name: "callbackContract", type: "address" }, - { name: "uiFeeReceiver", type: "address" }, - { name: "initialLongToken", type: "address" }, - { name: "initialShortToken", type: "address" }, - { name: "longTokenSwapPath", type: "address[]" }, - { name: "shortTokenSwapPath", type: "address[]" }, - ], - }; - - const domain = getGelatoRelayRouterDomain(srcChainId, getContract(chainId, "MultichainGlvRouter")); - const typedData = { - transferTokens: transferRequests.tokens, - transferReceivers: transferRequests.receivers, - transferAmounts: transferRequests.amounts, - addresses: params.addresses, - minGlvTokens: params.minGlvTokens, - executionFee: params.executionFee, - callbackGasLimit: params.callbackGasLimit, - shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, - isMarketTokenDeposit: params.isMarketTokenDeposit, - dataList: params.dataList, - relayParams: hashRelayParams(relayParams), - }; - - return signTypedData({ signer, domain, types, typedData }); -} - export function createMultichainGlvDepositTxn({ chainId, srcChainId, @@ -147,7 +87,7 @@ export function createMultichainGlvDepositTxn({ params, }: { chainId: ContractsChainId; - srcChainId: SourceChainId; + srcChainId: SourceChainId | undefined; signer: WalletSigner; transferRequests: IRelayUtils.TransferRequestsStruct; asyncExpressTxnResult: AsyncResult; diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index f5d430f123..d14e528b9c 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -14,7 +14,6 @@ import { RawRelayParamsPayload, RelayParamsPayload, } from "domain/synthetics/express"; -import { signCreateDeposit } from "domain/synthetics/express/expressOrderUtils"; import { CreateDepositParamsStruct } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; @@ -28,6 +27,8 @@ import { SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; +import { signCreateDeposit } from "./signCreateDeposit"; + export async function createSourceChainDepositTxn({ chainId, globalExpressParams, @@ -105,7 +106,7 @@ export async function createSourceChainDepositTxn({ dstChainId: chainId, account, srcChainId, - inputAmount: tokenAmount, + amount: tokenAmount, composeGas: composeGas, isDeposit: true, action, diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts new file mode 100644 index 0000000000..c0c0773435 --- /dev/null +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -0,0 +1,139 @@ +import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import { encodeFunctionData, zeroAddress } from "viem"; + +import type { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { + getRawRelayerParams, + GlobalExpressParams, + RelayFeePayload, + RelayParamsPayload, +} from "domain/synthetics/express"; +import type { CreateGlvDepositParamsStruct } from "domain/synthetics/markets"; +import { sendWalletTransaction } from "lib/transactions"; +import type { WalletSigner } from "lib/wallets"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { nowInSeconds } from "sdk/utils/time"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; +import type { IStargate } from "typechain-types-stargate"; +import type { SendParamStruct } from "typechain-types-stargate/interfaces/IStargate"; + +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + +import { signCreateGlvDeposit } from "./signCreateGlvDeposit"; + +export async function createSourceChainGlvDepositTxn({ + chainId, + globalExpressParams, + srcChainId, + signer, + transferRequests, + params, + account, + tokenAddress, + tokenAmount, + // executionFee, + relayFeePayload, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvDepositParamsStruct; + account: string; + tokenAddress: string; + tokenAmount: bigint; + relayFeePayload: RelayFeePayload; +}) { + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: relayFeePayload, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }); + + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const signature = await signCreateGlvDeposit({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.GlvDeposit, + actionData: { + relayParams: relayParams, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + amount: tokenAmount + relayFeePayload.feeAmount, + composeGas: composeGas, + isDeposit: true, + action, + }); + + const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi, + functionName: "sendToken", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + }), + value, + msg: t`Sent deposit transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/domain/synthetics/markets/signCreateDeposit.ts b/src/domain/synthetics/markets/signCreateDeposit.ts new file mode 100644 index 0000000000..7c8d3ad1f9 --- /dev/null +++ b/src/domain/synthetics/markets/signCreateDeposit.ts @@ -0,0 +1,68 @@ +import { Wallet } from "ethers"; + +import type { ContractsChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { CreateDepositParamsStruct } from "."; +import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; +import type { RelayParamsPayload } from "../express/types"; + +export async function signCreateDeposit({ + signer, + chainId, + srcChainId, + relayParams, + transferRequests, + params, +}: { + signer: WalletSigner | Wallet; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateDepositParamsStruct; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; +}) { + const types = { + CreateDeposit: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateDepositAddresses" }, + { name: "minMarketTokens", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateDepositAddresses: [ + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "market", type: "address" }, + { name: "initialLongToken", type: "address" }, + { name: "initialShortToken", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minMarketTokens: params.minMarketTokens, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} diff --git a/src/domain/synthetics/markets/signCreateGlvDeposit.ts b/src/domain/synthetics/markets/signCreateGlvDeposit.ts new file mode 100644 index 0000000000..8dfefa1e09 --- /dev/null +++ b/src/domain/synthetics/markets/signCreateGlvDeposit.ts @@ -0,0 +1,68 @@ +import type { ContractsChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { CreateGlvDepositParamsStruct } from "."; +import { getGelatoRelayRouterDomain, hashRelayParams, RelayParamsPayload } from "../express"; + +export function signCreateGlvDeposit({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvDepositParamsStruct; +}) { + const types = { + CreateGlvDeposit: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateGlvDepositAddresses" }, + { name: "minGlvTokens", type: "uint256" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "isMarketTokenDeposit", type: "bool" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateGlvDepositAddresses: [ + { name: "glv", type: "address" }, + { name: "market", type: "address" }, + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "initialLongToken", type: "address" }, + { name: "initialShortToken", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGlvRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minGlvTokens: params.minGlvTokens, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + isMarketTokenDeposit: params.isMarketTokenDeposit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} diff --git a/src/domain/synthetics/markets/useGlvMarkets.ts b/src/domain/synthetics/markets/useGlvMarkets.ts index 5d68360041..fdea0afda1 100644 --- a/src/domain/synthetics/markets/useGlvMarkets.ts +++ b/src/domain/synthetics/markets/useGlvMarkets.ts @@ -8,6 +8,7 @@ import { glvShiftLastExecutedAtKey, glvShiftMinIntervalKey, isGlvDisabledKey, + multichainBalanceKey, } from "config/dataStore"; import { USD_DECIMALS } from "config/factors"; import { GLV_MARKETS } from "config/markets"; @@ -18,11 +19,11 @@ import { import { GM_DECIMALS } from "lib/legacy"; import { ContractCallConfig, ContractCallsConfig, MulticallRequestConfig, useMulticall } from "lib/multicall"; import { expandDecimals } from "lib/numbers"; -import type { ContractsChainId } from "sdk/configs/chains"; +import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { getTokenBySymbol } from "sdk/configs/tokens"; import { GlvInfoData, MarketsInfoData, getContractMarketPrices, getGlvMarketName } from "."; -import { convertToContractTokenPrices } from "../tokens"; +import { convertToContractTokenPrices, getBalanceTypeFromSrcChainId } from "../tokens"; import { TokenData, TokensData } from "../tokens/types"; export type GlvList = { @@ -51,11 +52,12 @@ export function useGlvMarketsInfo( marketsInfoData: MarketsInfoData | undefined; tokensData: TokensData | undefined; chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; account: string | undefined; } ) { const { websocketTokenBalancesUpdates, resetTokensBalancesUpdates } = useTokensBalancesUpdates(); - const { marketsInfoData, tokensData, chainId, account } = deps; + const { marketsInfoData, tokensData, chainId, account, srcChainId } = deps; const dataStoreAddress = enabled ? getContract(chainId, "DataStore") : ""; const glvReaderAddress = enabled ? getContract(chainId, "GlvReader") : ""; @@ -176,6 +178,17 @@ export function useGlvMarketsInfo( methodName: "balanceOf", params: [account], } satisfies ContractCallConfig; + + acc[glv.glvToken + "-gmxAccountData"] = { + contractAddress: getContract(chainId, "DataStore"), + abiId: "DataStore", + calls: { + balance: { + methodName: "getUint", + params: [multichainBalanceKey(account, glv.glvToken)], + }, + }, + } satisfies ContractCallsConfig; } acc[glv.glvToken + "-info"] = { @@ -250,7 +263,10 @@ export function useGlvMarketsInfo( const tokenConfig = getTokenBySymbol(chainId, "GLV"); - const balance = data[glv.glvToken + "-tokenData"].balance?.returnValues[0] ?? 0n; + const walletBalance = data[glv.glvToken + "-tokenData"].balance?.returnValues[0] ?? 0n; + const gmxAccountBalance = data[glv.glvToken + "-gmxAccountData"].balance?.returnValues[0] ?? 0n; + const balance = srcChainId !== undefined ? gmxAccountBalance : walletBalance; + const contractSymbol = data[glv.glvToken + "-tokenData"].symbol.returnValues[0]; const glvToken: TokenData & { @@ -263,7 +279,10 @@ export function useGlvMarketsInfo( maxPrice: priceMax, }, totalSupply, + balanceType: getBalanceTypeFromSrcChainId(srcChainId), balance, + gmxAccountBalance, + walletBalance, contractSymbol, }; diff --git a/src/domain/synthetics/markets/useGmMarketsApy.ts b/src/domain/synthetics/markets/useGmMarketsApy.ts index 5f75554e3f..9ec30a2605 100644 --- a/src/domain/synthetics/markets/useGmMarketsApy.ts +++ b/src/domain/synthetics/markets/useGmMarketsApy.ts @@ -252,6 +252,7 @@ export function useGmMarketsApy( tokensData, chainId, account, + srcChainId, }); const marketsInfoData = { diff --git a/src/domain/synthetics/markets/useMarketTokensData.ts b/src/domain/synthetics/markets/useMarketTokensData.ts index de6af7834a..3539692134 100644 --- a/src/domain/synthetics/markets/useMarketTokensData.ts +++ b/src/domain/synthetics/markets/useMarketTokensData.ts @@ -15,7 +15,7 @@ import { useTokensBalancesUpdates, useUpdatedTokensBalances, } from "context/TokensBalancesContext/TokensBalancesContextProvider"; -import { TokensData, useTokensDataRequest } from "domain/synthetics/tokens"; +import { getBalanceTypeFromSrcChainId, TokensData, useTokensDataRequest } from "domain/synthetics/tokens"; import { ContractCallsConfig, useMulticall } from "lib/multicall"; import { expandDecimals } from "lib/numbers"; import { getByKey } from "lib/objects"; @@ -182,6 +182,7 @@ export function useMarketTokensDataRequest( totalSupply: BigInt(tokenData?.totalSupply.returnValues[0]), walletBalance, gmxAccountBalance, + balanceType: getBalanceTypeFromSrcChainId(srcChainId), balance, explorerUrl: `${getExplorerUrl(chainId)}/token/${marketAddress}`, }; diff --git a/src/domain/tokens/utils.ts b/src/domain/tokens/utils.ts index 38b68d9b5f..9730ee747c 100644 --- a/src/domain/tokens/utils.ts +++ b/src/domain/tokens/utils.ts @@ -4,18 +4,18 @@ import { getExplorerUrl } from "config/chains"; import { USD_DECIMALS } from "config/factors"; import { convertToTokenAmount } from "domain/synthetics/tokens/utils"; import { + adjustForDecimals, DUST_BNB, + getFeeBasisPoints, MARKET, MINT_BURN_FEE_BASIS_POINTS, TAX_BASIS_POINTS, USDG_ADDRESS, USDG_DECIMALS, - adjustForDecimals, - getFeeBasisPoints, } from "lib/legacy"; import { expandDecimals, PRECISION } from "lib/numbers"; import { getVisibleV1Tokens, getWhitelistedV1Tokens } from "sdk/configs/tokens"; -import { InfoTokens, Token, TokenInfo, TokenPrices } from "sdk/types/tokens"; +import { InfoTokens, Token, TokenInfo } from "sdk/types/tokens"; export * from "sdk/utils/tokens"; @@ -254,10 +254,6 @@ export function getSpread(p: { minPrice: bigint; maxPrice: bigint }): bigint { return (diff * PRECISION) / ((p.maxPrice + p.minPrice) / 2n); } -export function getMidPrice(prices: TokenPrices) { - return (prices.minPrice + prices.maxPrice) / 2n; -} - // calculates the minimum amount of native currency that should be left to be used as gas fees export function getMinResidualAmount(decimals?: number, price?: bigint) { if (!decimals || price === undefined) { diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index 31c38e0160..0e2bb5605e 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "Unzureichende {0} Balance" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 4307878851..c812bc16a8 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -7097,6 +7097,7 @@ msgid "Insufficient {0} balance" msgstr "Insufficient {0} balance" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "Sent deposit transaction" diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index 489c2ea9be..2ebe47e388 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "Balance {0} insuficiente" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index ff8bb9cdf7..20685893e6 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "Balance {0} insuffisante" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 1b158c182f..e757ecf68a 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "{0} 残高の不足" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index f5a9930c2a..cd92b0cb6a 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "{0} 잔고 부족" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index 1bdf16d28c..bb16548006 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index 188f5ac559..e02f2765a0 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr "Недостаточный {0} баланс" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index cfa39f3d01..b72d74797f 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -7091,6 +7091,7 @@ msgid "Insufficient {0} balance" msgstr " {0}余额不足" #: src/domain/synthetics/markets/createSourceChainDepositTxn.ts +#: src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts msgid "Sent deposit transaction" msgstr "" diff --git a/src/pages/ParseTransaction/ParseTransaction.tsx b/src/pages/ParseTransaction/ParseTransaction.tsx index f05d079e27..ce8251f58d 100644 --- a/src/pages/ParseTransaction/ParseTransaction.tsx +++ b/src/pages/ParseTransaction/ParseTransaction.tsx @@ -103,6 +103,7 @@ export function ParseTransactionPage() { tokensData, chainId, account: undefined, + srcChainId: undefined, }); const { marketTokensData } = useMarketTokensDataRequest(chainId, undefined, { isDeposit, diff --git a/src/pages/Pools/Pools.tsx b/src/pages/Pools/Pools.tsx index f2df440d02..6031e6721f 100644 --- a/src/pages/Pools/Pools.tsx +++ b/src/pages/Pools/Pools.tsx @@ -50,6 +50,7 @@ export default function Pools() { tokensData, chainId, account, + srcChainId, }); const { glvPerformance, gmPerformance, glvPerformanceSnapshots, gmPerformanceSnapshots } = useGmGlvPerformance({ From 7d975549583921774838968c01bf6ee900f96967 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 7 Aug 2025 16:48:54 +0200 Subject: [PATCH 08/38] multichain gm eth --- src/components/Referrals/JoinReferralCode.tsx | 2 +- .../GmDepositWithdrawalBox.tsx | 23 ++++++--- .../useDepositWithdrawalTransactions.tsx | 49 +++++++++++++------ .../GmxAccountModal/DepositView.tsx | 6 +-- .../SelectAssetToDepositView.tsx | 5 +- .../GmxAccountModal/WithdrawalView.tsx | 7 ++- .../Synthetics/GmxAccountModal/hooks.ts | 25 +++++++--- .../Synthetics/TradeBox/TradeBox.tsx | 4 +- .../TradeBox/hooks/useTradeButtonState.tsx | 4 +- src/config/multichain.ts | 9 ++-- .../fetchMultichainTokenBalances.ts | 4 +- .../markets/createMultichainGlvDepositTxn.ts | 15 ++---- .../markets/createSourceChainGlvDepositTxn.ts | 2 +- .../synthetics/markets/useGlvMarkets.ts | 5 +- src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 6 +++ 15 files changed, 106 insertions(+), 60 deletions(-) diff --git a/src/components/Referrals/JoinReferralCode.tsx b/src/components/Referrals/JoinReferralCode.tsx index cf7c062b00..ef3ad5406c 100644 --- a/src/components/Referrals/JoinReferralCode.tsx +++ b/src/components/Referrals/JoinReferralCode.tsx @@ -240,7 +240,7 @@ function ReferralCodeFormMultichain({ const [referralCodeExists, setReferralCodeExists] = useState(true); const debouncedReferralCode = useDebounce(referralCode, 300); const settlementChainPublicClient = usePublicClient({ chainId }); - const { tokenChainDataArray: multichainTokens } = useMultichainTokensRequest(); + const { tokenChainDataArray: multichainTokens } = useMultichainTokensRequest(chainId, account); const simulationSigner = useMemo(() => { if (!signer?.provider) { diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index d40f75b54b..ffdefdb9de 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -35,7 +35,7 @@ import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; -import { useMultichainTokensRequest } from "components/Synthetics/GmxAccountModal/hooks"; +import { useMultichainTokens } from "components/Synthetics/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; @@ -77,7 +77,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); - const { tokenChainDataArray } = useMultichainTokensRequest(); + const { tokenChainDataArray } = useMultichainTokens(); // #endregion // #region Selectors @@ -468,7 +468,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return undefined; } - let balance = firstToken.balance; + let balance; + if (paySource === "gmxAccount") { + balance = firstToken.gmxAccountBalance; + } else if (paySource === "sourceChain") { + balance = firstToken.sourceChainBalance; + } else { + balance = firstToken.walletBalance; + } if (balance === undefined) { return undefined; @@ -477,7 +484,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return formatBalanceAmount(balance, firstToken.decimals, undefined, { isStable: firstToken.isStable, }); - }, [firstToken]); + }, [firstToken, paySource]); // #endregion // #region Callbacks @@ -685,11 +692,13 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { useEffect( function fallbackSourceChainPaySource() { - if (paySource === "sourceChain" && isPair) { - setPaySource("gmxAccount"); + if (paySource === "sourceChain" && srcChainId === undefined) { + setPaySource("settlementChain"); + } else if (paySource === "settlementChain" && srcChainId !== undefined) { + setPaySource("sourceChain"); } }, - [isPair, paySource, setPaySource] + [paySource, setPaySource, srcChainId] ); // #endregion diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx index f0e64049a9..82366c27a7 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx @@ -155,11 +155,11 @@ function useMultichainDepositExpressTxnParams({ const { signer } = useWallet(); const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ - isGmxAccount: srcChainId !== undefined, - enabled: paySource !== "settlementChain", + isGmxAccount: paySource === "gmxAccount", + enabled: paySource === "gmxAccount", executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - if ((!gmParams && !glvParams) || !srcChainId || !signer) { + if ((!gmParams && !glvParams) || !signer) { throw new Error("Invalid params"); } @@ -293,6 +293,10 @@ const useDepositTransactions = ({ let dataList: string[] = EMPTY_ARRAY; if (paySource === "sourceChain") { + if (!srcChainId) { + return undefined; + } + const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { @@ -300,7 +304,7 @@ const useDepositTransactions = ({ desChainId: chainId, minAmountOut: minMarketTokens / 2n, provider: getMultichainTokenId(chainId, marketTokenAddress)!.stargate, - providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId!], { size: 32 }), + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), }, }); const bytes = hexToBytes(actionHash as Hex); @@ -359,6 +363,10 @@ const useDepositTransactions = ({ let dataList: string[] = EMPTY_ARRAY; if (paySource === "sourceChain") { + if (!srcChainId) { + return undefined; + } + const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { @@ -366,7 +374,7 @@ const useDepositTransactions = ({ desChainId: chainId, minAmountOut: minGlvTokens / 2n, provider: getMultichainTokenId(chainId, glvInfo!.glvTokenAddress)!.stargate, - providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId!], { size: 32 }), + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), }, }); const bytes = hexToBytes(actionHash as Hex); @@ -478,7 +486,7 @@ const useDepositTransactions = ({ ]); const onCreateGmDeposit = useCallback( - function onCreateGmDeposit() { + async function onCreateGmDeposit() { const metricData = getDepositMetricData(); sendOrderSubmittedMetric(metricData.metricId); @@ -542,7 +550,7 @@ const useDepositTransactions = ({ throw new Error(`Invalid pay source: ${paySource}`); } - return promise + return await promise .then(makeTxnSentMetricsHandler(metricData.metricId)) .catch(makeTxnErrorMetricsHandler(metricData.metricId)) .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); @@ -573,18 +581,25 @@ const useDepositTransactions = ({ // TODO MLTCH make it pretty const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; + const wrappedTokenAddress = longTokenAmount! > 0n ? initialLongTokenAddress! : initialShortTokenAddress!; const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; const tokenData = getTokenData(tokensData, tokenAddress); const selectFindSwapPath = useMemo( - () => makeSelectFindSwapPath(tokenAddress, executionFee?.feeToken.address), - [executionFee?.feeToken.address, tokenAddress] + () => + makeSelectFindSwapPath( + wrappedTokenAddress, + executionFee?.feeToken.address + ? convertTokenAddress(chainId, executionFee.feeToken.address, "wrapped") + : undefined + ), + [chainId, executionFee?.feeToken.address, wrappedTokenAddress] ); const findSwapPath = useSelector(selectFindSwapPath); const onCreateGlvDeposit = useCallback( - function onCreateGlvDeposit() { + async function onCreateGlvDeposit() { const metricData = getDepositMetricData(); sendOrderSubmittedMetric(metricData.metricId); @@ -633,18 +648,23 @@ const useDepositTransactions = ({ tokenAmount, globalExpressParams: globalExpressParams!, relayFeePayload: { - feeToken: tokenAddress, + feeToken: wrappedTokenAddress, feeAmount, feeSwapPath, }, }); } else if (paySource === "gmxAccount") { + const expressTxnParams = await multichainDepositExpressTxnParams.promise; + if (!expressTxnParams) { + throw new Error("Express txn params are not set"); + } + promise = createMultichainGlvDepositTxn({ chainId, srcChainId, signer, transferRequests, - asyncExpressTxnResult: multichainDepositExpressTxnParams, + expressTxnParams, params: glvParams!, }); } else if (paySource === "settlementChain") { @@ -669,7 +689,7 @@ const useDepositTransactions = ({ throw new Error(`Invalid pay source: ${paySource}`); } - return promise + return await promise .then(makeTxnSentMetricsHandler(metricData.metricId)) .catch(makeTxnErrorMetricsHandler(metricData.metricId)) .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); @@ -689,7 +709,7 @@ const useDepositTransactions = ({ marketInfo, marketToken, marketTokenAmount, - multichainDepositExpressTxnParams, + multichainDepositExpressTxnParams.promise, paySource, setPendingDeposit, setPendingTxns, @@ -703,6 +723,7 @@ const useDepositTransactions = ({ tokenData, tokensData, transferRequests, + wrappedTokenAddress, ] ); diff --git a/src/components/Synthetics/GmxAccountModal/DepositView.tsx b/src/components/Synthetics/GmxAccountModal/DepositView.tsx index d400ce7219..9cf63efc65 100644 --- a/src/components/Synthetics/GmxAccountModal/DepositView.tsx +++ b/src/components/Synthetics/GmxAccountModal/DepositView.tsx @@ -16,7 +16,7 @@ import { CHAIN_ID_PREFERRED_DEPOSIT_TOKEN, DEBUG_MULTICHAIN_SAME_CHAIN_DEPOSIT, MULTICHAIN_FUNDING_SLIPPAGE_BPS, - MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS, + MULTI_CHAIN_DEPOSIT_TRADE_TOKENS, StargateErrorsAbi, getMappedTokenId, } from "config/multichain"; @@ -114,7 +114,7 @@ export const DepositView = () => { tokenChainDataArray: multichainTokens, isPriceDataLoading, isBalanceDataLoading, - } = useMultichainTokensRequest(); + } = useMultichainTokensRequest(settlementChainId, account); const [isApproving, setIsApproving] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); @@ -530,7 +530,7 @@ export const DepositView = () => { const isInvalidTokenAddress = depositViewTokenAddress === undefined || - !MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS[settlementChainId as SettlementChainId] + !MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[settlementChainId as SettlementChainId] .map((token) => convertTokenAddress(settlementChainId, token, "native")) .includes(depositViewTokenAddress as NativeTokenSupportedAddress); diff --git a/src/components/Synthetics/GmxAccountModal/SelectAssetToDepositView.tsx b/src/components/Synthetics/GmxAccountModal/SelectAssetToDepositView.tsx index 85d074847b..b3890e9a4d 100644 --- a/src/components/Synthetics/GmxAccountModal/SelectAssetToDepositView.tsx +++ b/src/components/Synthetics/GmxAccountModal/SelectAssetToDepositView.tsx @@ -1,6 +1,7 @@ import { Trans } from "@lingui/macro"; import cx from "classnames"; import { useMemo, useState } from "react"; +import { useAccount } from "wagmi"; import { getChainName } from "config/chains"; import { getChainIcon } from "config/icons"; @@ -72,6 +73,8 @@ type DisplayTokenChainData = TokenChainData & { export const SelectAssetToDepositView = () => { const { chainId } = useChainId(); + const { address: account } = useAccount(); + const [, setIsVisibleOrView] = useGmxAccountModalOpen(); const [, setDepositViewChain] = useGmxAccountDepositViewChain(); const [, setDepositViewTokenAddress] = useGmxAccountDepositViewTokenAddress(); @@ -79,7 +82,7 @@ export const SelectAssetToDepositView = () => { const [selectedNetwork, setSelectedNetwork] = useState("all"); const [searchQuery, setSearchQuery] = useState(""); - const { tokenChainDataArray } = useMultichainTokensRequest(); + const { tokenChainDataArray } = useMultichainTokensRequest(chainId, account); const NETWORKS_FILTER = useMemo(() => { const wildCard = { id: "all" as const, name: "All Networks" }; diff --git a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx index 0e2c073091..676c80e323 100644 --- a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx @@ -16,7 +16,7 @@ import { getMultichainTokenId, getStargatePoolAddress, isSettlementChain, - MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS, + MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS, MULTICHAIN_FUNDING_SLIPPAGE_BPS, } from "config/multichain"; import { @@ -169,9 +169,8 @@ export const WithdrawalView = () => { return EMPTY_ARRAY; } - return MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS[chainId as SettlementChainId] + return MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS[chainId as SettlementChainId] ?.map((tokenAddress) => tokensData[tokenAddress]) - .filter((token) => token.address !== zeroAddress) .sort((a, b) => { const aFloat = bigintToNumber(a.gmxAccountBalance ?? 0n, a.decimals); const bFloat = bigintToNumber(b.gmxAccountBalance ?? 0n, b.decimals); @@ -654,7 +653,7 @@ export const WithdrawalView = () => { return; } - const settlementChainWrappedTokenAddresses = MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS[chainId]; + const settlementChainWrappedTokenAddresses = MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS[chainId]; if (!settlementChainWrappedTokenAddresses) { return; } diff --git a/src/components/Synthetics/GmxAccountModal/hooks.ts b/src/components/Synthetics/GmxAccountModal/hooks.ts index bc98fbc565..6aed333050 100644 --- a/src/components/Synthetics/GmxAccountModal/hooks.ts +++ b/src/components/Synthetics/GmxAccountModal/hooks.ts @@ -160,14 +160,14 @@ const subscribeMultichainTokenBalances: SWRSubscription< }; }; -export function useMultichainTokensRequest(): { +export function useMultichainTokensRequest( + chainId: ContractsChainId, + account: string | undefined +): { tokenChainDataArray: TokenChainData[]; isPriceDataLoading: boolean; isBalanceDataLoading: boolean; } { - const { chainId } = useChainId(); - const account = useSelector(selectAccount); - const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); const { data: balanceData } = useSWRSubscription( @@ -217,14 +217,23 @@ export function useMultichainTokensRequest(): { }; } -export function useMultichainMarketTokenBalancesRequest(tokenAddress: string | undefined): { +export function useMultichainTokens() { + const { chainId } = useChainId(); + const account = useSelector(selectAccount); + + return useMultichainTokensRequest(chainId, account); +} + +export function useMultichainMarketTokenBalancesRequest( + chainId: ContractsChainId, + srcChainId: SourceChainId | undefined, + account: string | undefined, + tokenAddress: string | undefined +): { tokenBalancesData: Partial>; totalBalance: bigint | undefined; isBalanceDataLoading: boolean; } { - const { chainId, srcChainId } = useChainId(); - const account = useSelector(selectAccount); - const { marketTokensData } = useMarketTokensData(chainId, srcChainId, { isDeposit: true, withGlv: true, diff --git a/src/components/Synthetics/TradeBox/TradeBox.tsx b/src/components/Synthetics/TradeBox/TradeBox.tsx index 7e5a8cb94d..e748df5b1a 100644 --- a/src/components/Synthetics/TradeBox/TradeBox.tsx +++ b/src/components/Synthetics/TradeBox/TradeBox.tsx @@ -100,7 +100,7 @@ import SettingsIcon24 from "img/ic_settings_24.svg?react"; import { useIsCurtainOpen } from "./Curtain"; import { ExpressTradingWarningCard } from "./ExpressTradingWarningCard"; -import { useMultichainTokensRequest } from "../GmxAccountModal/hooks"; +import { useMultichainTokens } from "../GmxAccountModal/hooks"; import { HighPriceImpactOrFeesWarningCard } from "../HighPriceImpactOrFeesWarningCard/HighPriceImpactOrFeesWarningCard"; import TradeInfoIcon from "../TradeInfoIcon/TradeInfoIcon"; import TwapRows from "../TwapRows/TwapRows"; @@ -136,7 +136,7 @@ export function TradeBox({ isMobile }: { isMobile: boolean }) { const { swapTokens, infoTokens, sortedLongAndShortTokens, sortedAllMarkets } = availableTokenOptions; const tokensData = useTokensData(); - const { tokenChainDataArray: multichainTokens } = useMultichainTokensRequest(); + const { tokenChainDataArray: multichainTokens } = useMultichainTokens(); const marketsInfoData = useSelector(selectMarketsInfoData); const tradeFlags = useSelector(selectTradeboxTradeFlags); const { isLong, isSwap, isIncrease, isPosition, isLimit, isTrigger, isMarket, isTwap } = tradeFlags; diff --git a/src/components/Synthetics/TradeBox/hooks/useTradeButtonState.tsx b/src/components/Synthetics/TradeBox/hooks/useTradeButtonState.tsx index 2680d7bcec..f254e3d745 100644 --- a/src/components/Synthetics/TradeBox/hooks/useTradeButtonState.tsx +++ b/src/components/Synthetics/TradeBox/hooks/useTradeButtonState.tsx @@ -7,7 +7,7 @@ import { getBridgingOptionsForToken } from "config/bridging"; import { BOTANIX, SettlementChainId } from "config/chains"; import { BASIS_POINTS_DIVISOR } from "config/factors"; import { get1InchSwapUrlFromAddresses } from "config/links"; -import { MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS } from "config/multichain"; +import { MULTI_CHAIN_DEPOSIT_TRADE_TOKENS } from "config/multichain"; import { useGmxAccountDepositViewTokenAddress, useGmxAccountDepositViewTokenInputValue, @@ -308,7 +308,7 @@ export function useTradeboxButtonState({ if (fromToken) { const wrappedAddress = convertTokenAddress(chainId, fromToken.address, "wrapped"); const isSupportedToDeposit = - MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS[chainId as SettlementChainId].includes(wrappedAddress); + MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[chainId as SettlementChainId].includes(wrappedAddress); if (isSupportedToDeposit) { setGmxAccountDepositViewTokenAddress(fromToken.address); diff --git a/src/config/multichain.ts b/src/config/multichain.ts index aa3e716c2b..c954db390c 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -261,7 +261,8 @@ export function isSourceChain(chainId: number | undefined): chainId is SourceCha } export const MULTI_CHAIN_TOKEN_MAPPING = {} as MultichainTokenMapping; -export const MULTI_CHAIN_TRADE_TOKENS = {} as Record; +export const MULTI_CHAIN_DEPOSIT_TRADE_TOKENS = {} as Record; +export const MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS = {} as Record; export const MULTI_CHAIN_TRANSFER_SUPPORTED_TOKENS = {} as MultichainWithdrawSupportedTokens; @@ -290,8 +291,10 @@ for (const tokenSymbol in TOKEN_GROUPS) { } if (!tokenId?.isPlatformToken) { - MULTI_CHAIN_TRADE_TOKENS[chainId] = MULTI_CHAIN_TRADE_TOKENS[chainId] || []; - MULTI_CHAIN_TRADE_TOKENS[chainId].push(tokenId.address); + MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[chainId] = MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[chainId] || []; + MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[chainId].push(tokenId.address); + MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS[chainId] = MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS[chainId] || []; + MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS[chainId].push(convertTokenAddress(chainId, tokenId.address, "wrapped")); } const settlementChainId = chainId; diff --git a/src/domain/multichain/fetchMultichainTokenBalances.ts b/src/domain/multichain/fetchMultichainTokenBalances.ts index e6f63260d1..08876135d6 100644 --- a/src/domain/multichain/fetchMultichainTokenBalances.ts +++ b/src/domain/multichain/fetchMultichainTokenBalances.ts @@ -5,7 +5,7 @@ import { SettlementChainId, SourceChainId, getChainName } from "config/chains"; import { MULTICALLS_MAP, MULTI_CHAIN_TOKEN_MAPPING, - MULTI_CHAIN_TRADE_TOKENS, + MULTI_CHAIN_DEPOSIT_TRADE_TOKENS, MultichainTokenMapping, } from "config/multichain"; import { executeMulticall } from "lib/multicall/executeMulticall"; @@ -15,7 +15,7 @@ export async function fetchMultichainTokenBalances({ settlementChainId, account, progressCallback, - tokens = MULTI_CHAIN_TRADE_TOKENS[settlementChainId], + tokens = MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[settlementChainId], }: { settlementChainId: SettlementChainId; account: string; diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts index e79e9b1164..4b4c4f22e3 100644 --- a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -2,7 +2,6 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; -import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; @@ -83,32 +82,28 @@ export function createMultichainGlvDepositTxn({ srcChainId, signer, transferRequests, - asyncExpressTxnResult, + expressTxnParams, params, }: { chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; transferRequests: IRelayUtils.TransferRequestsStruct; - asyncExpressTxnResult: AsyncResult; + expressTxnParams: ExpressTxnParams; params: CreateGlvDepositParamsStruct; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, }) { - if (!asyncExpressTxnResult.data) { - throw new Error("Async result is not set"); - } - return buildAndSignMultichainGlvDepositTxn({ chainId, srcChainId, signer, account: params.addresses.receiver, - relayerFeeAmount: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeAmount, - relayerFeeTokenAddress: asyncExpressTxnResult.data.gasPaymentParams.relayerFeeTokenAddress, + relayerFeeAmount: expressTxnParams.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: expressTxnParams.gasPaymentParams.relayerFeeTokenAddress, relayParams: { - ...asyncExpressTxnResult.data.relayParamsPayload, + ...expressTxnParams.relayParamsPayload, deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), }, transferRequests, diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts index c0c0773435..ef37655401 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -116,7 +116,7 @@ export async function createSourceChainGlvDepositTxn({ const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount + relayFeePayload.feeAmount : 0n); try { const txnResult = await sendWalletTransaction({ diff --git a/src/domain/synthetics/markets/useGlvMarkets.ts b/src/domain/synthetics/markets/useGlvMarkets.ts index fdea0afda1..8b8561b235 100644 --- a/src/domain/synthetics/markets/useGlvMarkets.ts +++ b/src/domain/synthetics/markets/useGlvMarkets.ts @@ -263,8 +263,9 @@ export function useGlvMarketsInfo( const tokenConfig = getTokenBySymbol(chainId, "GLV"); - const walletBalance = data[glv.glvToken + "-tokenData"].balance?.returnValues[0] ?? 0n; - const gmxAccountBalance = data[glv.glvToken + "-gmxAccountData"].balance?.returnValues[0] ?? 0n; + const walletBalance: bigint | undefined = data[glv.glvToken + "-tokenData"].balance?.returnValues[0]; + const gmxAccountBalance: bigint | undefined = + data[glv.glvToken + "-gmxAccountData"]?.balance?.returnValues[0]; const balance = srcChainId !== undefined ? gmxAccountBalance : walletBalance; const contractSymbol = data[glv.glvToken + "-tokenData"].symbol.returnValues[0]; diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index deece7ba28..02f415ea2c 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -4,6 +4,8 @@ import { useMemo } from "react"; import { ImSpinner2 } from "react-icons/im"; import { USD_DECIMALS } from "config/factors"; +import { selectAccount } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; import { getGlvMarketShortening, getGlvOrMarketAddress, @@ -34,6 +36,7 @@ type Props = { export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { const { chainId, srcChainId } = useChainId(); + const account = useSelector(selectAccount); const isGlv = glvOrMarketInfo && isGlvInfo(glvOrMarketInfo); const iconName = glvOrMarketInfo?.isSpotOnly ? getNormalizedTokenSymbol(glvOrMarketInfo.longToken.symbol) + @@ -53,6 +56,9 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { const isMobile = usePoolsIsMobilePage(); const { totalBalance, tokenBalancesData, isBalanceDataLoading } = useMultichainMarketTokenBalancesRequest( + chainId, + srcChainId, + account, marketToken?.address ); From 7927495dac9bb8508472e80df90ac0c53a041616 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Fri, 8 Aug 2025 13:13:03 +0200 Subject: [PATCH 09/38] Refactor GmDepositWithdrawalBox --- .../GmDepositWithdrawalBox.tsx | 26 ++++++++++--------- .../GmSwapBox/GmDepositWithdrawalBox/types.ts | 9 +++---- .../useDepositWithdrawalAmounts.tsx | 11 ++++---- .../useUpdateInputAmounts.tsx | 11 +++++--- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index ffdefdb9de..b7a7cf3ec7 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -49,6 +49,7 @@ import { Swap } from "../Swap"; import { Mode, Operation } from "../types"; import { useGmWarningState } from "../useGmWarningState"; import { InfoRows } from "./InfoRows"; +import { TokenInputState } from "./types"; import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; import { useGmDepositWithdrawalBoxState } from "./useGmDepositWithdrawalBoxState"; @@ -195,7 +196,11 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { shortTokenInputState, // undefined when not paying with GM fromMarketTokenInputState, - } = useMemo(() => { + } = useMemo((): Partial<{ + longTokenInputState: TokenInputState; + shortTokenInputState: TokenInputState; + fromMarketTokenInputState: TokenInputState; + }> => { if (!marketInfo) { return {}; } @@ -203,9 +208,9 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const inputs: { address: string; value: string; - amount?: bigint; - isMarketToken?: boolean; - usd?: bigint; + amount: bigint | undefined; + isMarketToken: boolean; + usd: bigint | undefined; setValue: (val: string) => void; }[] = []; @@ -560,12 +565,12 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const handleFirstTokenInputValueChange = useCallback( (e) => { - if (firstToken) { + if (firstTokenAddress) { setFirstTokenInputValue(e.target.value); - onFocusedCollateralInputChange(firstToken.address); + onFocusedCollateralInputChange(firstTokenAddress); } }, - [firstToken, onFocusedCollateralInputChange, setFirstTokenInputValue] + [firstTokenAddress, onFocusedCollateralInputChange, setFirstTokenInputValue] ); const marketTokenInputClickMax = useCallback(() => { @@ -630,6 +635,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #region Effects useUpdateInputAmounts({ + chainId, marketToken, marketInfo, fromMarketTokenInputState, @@ -851,11 +857,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { shouldShowWarningForExecutionFee={shouldShowWarningForExecutionFee} />
- {/* */} -
- {/* {} */} - {submitButton} -
+
{submitButton}
diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts index 9ff7810393..35cb8a578f 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts @@ -1,13 +1,10 @@ -import { TokenData } from "domain/synthetics/tokens"; - export type TokenInputState = { address: string; value: string; - amount?: bigint | undefined; - usd?: bigint | undefined; - token?: TokenData | undefined; + amount: bigint | undefined; + usd: bigint | undefined; setValue: (val: string) => void; - isMarketToken?: boolean; + isMarketToken: boolean; }; export type GmOrGlvPaySource = "settlementChain" | "gmxAccount" | "sourceChain"; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx index c59bd8b74b..60cd35c5b1 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx @@ -100,11 +100,12 @@ export function useDepositWithdrawalAmounts({ } const longTokenAmount = marketInfo.isSameCollaterals ? halfOfLong ?? 0n : longTokenInputState?.amount ?? 0n; - const shortTokenAmount = marketInfo.isSameCollaterals - ? longTokenInputState?.amount !== undefined - ? longTokenInputState?.amount - longTokenAmount - : undefined ?? 0n - : shortTokenInputState?.amount ?? 0n; + const shortTokenAmount = + (marketInfo.isSameCollaterals + ? longTokenInputState?.amount !== undefined + ? longTokenInputState?.amount - longTokenAmount + : 0n + : shortTokenInputState?.amount) ?? 0n; return getWithdrawalAmounts({ marketInfo, diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx index 581d94acf6..e27072131d 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx @@ -4,10 +4,13 @@ import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; import { TokenData } from "domain/synthetics/tokens"; import type { DepositAmounts, WithdrawalAmounts } from "domain/synthetics/trade"; import { formatAmountFree } from "lib/numbers"; +import { ContractsChainId } from "sdk/configs/chains"; +import { getToken } from "sdk/configs/tokens"; import { TokenInputState } from "./types"; export function useUpdateInputAmounts({ + chainId, marketToken, marketInfo, longTokenInputState, @@ -25,6 +28,7 @@ export function useUpdateInputAmounts({ setFirstTokenInputValue, setSecondTokenInputValue, }: { + chainId: ContractsChainId; marketToken: TokenData | undefined; glvToken: TokenData | undefined; marketInfo: MarketInfo | undefined; @@ -48,9 +52,9 @@ export function useUpdateInputAmounts({ return; } - const longToken = longTokenInputState?.token; - const shortToken = shortTokenInputState?.token; - const fromMarketToken = fromMarketTokenInputState?.token; + const longToken = longTokenInputState ? getToken(chainId, longTokenInputState.address) : undefined; + const shortToken = shortTokenInputState ? getToken(chainId, shortTokenInputState.address) : undefined; + const fromMarketToken = marketToken; if (isDeposit) { if (["longCollateral", "shortCollateral"].includes(focusedInput)) { @@ -185,6 +189,7 @@ export function useUpdateInputAmounts({ glvInfo, glvToken, glvTokenAmount, + chainId, ] ); } From 5fe5fecee117b75dcd8b92e541c55b0af57c5802 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 14 Aug 2025 16:16:55 +0200 Subject: [PATCH 10/38] Multichain update contracts addresses --- sdk/src/configs/contracts.ts | 60 ++++++++++++-------------- sdk/src/types/subsquid.ts | 55 +++++++++++++++++++---- src/typechain-types/factories/index.ts | 1 - src/typechain-types/index.ts | 2 - 4 files changed, 73 insertions(+), 45 deletions(-) diff --git a/sdk/src/configs/contracts.ts b/sdk/src/configs/contracts.ts index 1902cbd2bf..8f5a0c570a 100644 --- a/sdk/src/configs/contracts.ts +++ b/sdk/src/configs/contracts.ts @@ -49,35 +49,28 @@ export const CONTRACTS = { // Synthetics DataStore: "0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8", EventEmitter: "0xC8ee91A54287DB53897056e12D9819156D3822Fb", - SubaccountRouter: "0xfB0dd3878440817e1F12cDF023a88E74D4ae82e2", - ExchangeRouter: "0x96F257288f00a9aD8ba159294D373550fE2b6771", + SubaccountRouter: "0x5b9A353F18d543B9F8a57B2AE50a4FBc80033EC1", + ExchangeRouter: "0x87d66368cD08a7Ca42252f5ab44B2fb6d1Fb8d15", DepositVault: "0xF89e77e8Dc11691C9e8757e84aaFbCD8A67d7A55", WithdrawalVault: "0x0628D46b5D145f183AdB6Ef1f2c97eD1C4701C55", OrderVault: "0x31eF83a530Fde1B38EE9A18093A333D8Bbbc40D5", ShiftVault: "0xfe99609C4AA83ff6816b64563Bdffd7fa68753Ab", - SyntheticsReader: "0xd42986AFC0660dd1f1C8C76F248262Ffcb37db79", + SyntheticsReader: "0x65A6CC451BAfF7e7B4FDAb4157763aB4b6b44D0E", SyntheticsRouter: "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6", - GlvReader: "0xF90192b6D68cAF5947114212755C67c64518CCE9", - GlvRouter: "0x36194Db64C1881E44E34e14dc3bb8AfA83B65608", + GlvReader: "0xb51e34dc3A7c80E4ABbC3800aD0e487b7b878339", + GlvRouter: "0x10Fa5Bd343373101654E896B43Ca38Fd8f3789F9", GlvVault: "0x393053B58f9678C9c28c2cE941fF6cac49C3F8f9", - GelatoRelayRouter: "0xC0d483eD76ceCd52eB44Eb78d813Cf5Ace5138fD", - SubaccountGelatoRelayRouter: "0xeb1f997F95D970701B72F4f66DdD8E360c34C762", + GelatoRelayRouter: "0x0C08518C41755C6907135266dCCf09d51aE53CC4", + SubaccountGelatoRelayRouter: "0xA1D94802EcD642051B677dBF37c8E78ce6dd3784", - MultichainClaimsRouter: "0xDa3e6AB64699f159C82acF9bA7216eD57806DFc6", - MultichainGlvRouter: "0x49a10eb59193ff2dC2C95C13979D0C045ccbCE42", - MultichainGmRouter: "0x6DFEa567810CfbF8B787a504D66C767a8A770eB7", - MultichainOrderRouter: "0xba4C3574553BB99bC7D0116CD49DCc757870b68E", - MultichainSubaccountRouter: "0xDF4fB0eb95f70C3E3EeAdBe5d1074F009d3F0193", - MultichainTransferRouter: "0x379b75be4cA9a25C72753f56ad9EA3850e206D35", - MultichainVault: "0xCeaadFAf6A8C489B250e407987877c5fDfcDBE6E", + ClaimHandler: "0x28f1F4AA95F49FAB62464536A269437B13d48976", + ChainlinkPriceFeedProvider: "0x38B8dB61b724b51e42A88Cb8eC564CD685a0f53B", ExternalHandler: "0x389CEf541397e872dC04421f166B5Bc2E0b374a5", OpenOceanRouter: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", - ChainlinkPriceFeedProvider: "0x527FB0bCfF63C47761039bB386cFE181A92a4701", - Multicall: "0x842ec2c7d803033edf55e478f461fc547bc54eb2", ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8", }, @@ -129,54 +122,55 @@ export const CONTRACTS = { // Synthetics DataStore: "0x2F0b22339414ADeD7D5F06f9D604c7fF5b2fe3f6", EventEmitter: "0xDb17B211c34240B014ab6d61d4A31FA0C0e20c26", - SubaccountRouter: "0x5aEb6AD978f59e220aA9099e09574e1c5E03AafD", - ExchangeRouter: "0xFa843af557824Be5127eaCB3c4B5D86EADEB73A1", + SubaccountRouter: "0x88a5c6D94634Abd7745f5348e5D8C42868ed4AC3", + ExchangeRouter: "0xF0864BE1C39C0AB28a8f1918BC8321beF8F7C317", DepositVault: "0x90c670825d0C62ede1c5ee9571d6d9a17A722DFF", WithdrawalVault: "0xf5F30B10141E1F63FC11eD772931A8294a591996", OrderVault: "0xD3D60D22d415aD43b7e64b510D86A30f19B1B12C", ShiftVault: "0x7fC46CCb386e9bbBFB49A2639002734C3Ec52b39", - SyntheticsReader: "0xc304F8e9872A9c00371A7406662dC10A10740AA8", + SyntheticsReader: "0x1EC018d2b6ACCA20a0bEDb86450b7E27D1D8355B", SyntheticsRouter: "0x820F5FfC5b525cD4d88Cd91aCf2c28F16530Cc68", - GlvReader: "0xae9596a1C438675AcC75f69d32E21Ac9c8fF99bD", - GlvRouter: "0x16500c1d8ffe2f695d8dcadf753f664993287ae4", + GlvReader: "0x12Ac77003B3D11b0853d1FD12E5AF22a9060eC4b", + GlvRouter: "0x4729D9f61c0159F5e02D2C2e5937B3225e55442C", GlvVault: "0x527FB0bCfF63C47761039bB386cFE181A92a4701", - GelatoRelayRouter: "0x035A9A047d20a486e14A613B04d5a95d7A617c5D", - SubaccountGelatoRelayRouter: "0x3B753c0D0aE55530f24532B8Bb9d0bAcD5B675C0", + GelatoRelayRouter: "0xa61f92ab63cc5C3d60574d40A6e73861c37aaC95", + SubaccountGelatoRelayRouter: "0x58b09FD12863218F2ca156808C2Ae48aaCD0c072", + + ChainlinkPriceFeedProvider: "0x05d97cee050bfb81FB3EaD4A9368584F8e72C88e", + ClaimHandler: "0x7FfedCAC2eCb2C29dDc027B60D6F8107295Ff2eA", ExternalHandler: "0xD149573a098223a9185433290a5A5CDbFa54a8A9", OpenOceanRouter: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", - ChainlinkPriceFeedProvider: "0x713c6a2479f6C079055A6AD3690D95dEDCEf9e1e", - Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11", ArbitrumNodeInterface: zeroAddress, }, [BOTANIX]: { DataStore: "0xA23B81a89Ab9D7D89fF8fc1b5d8508fB75Cc094d", EventEmitter: "0xAf2E131d483cedE068e21a9228aD91E623a989C2", - SubaccountRouter: "0x31568A44593297788Cae4D0A70b0746c26886208", - ExchangeRouter: "0xB11214E34796d6Df5F17172D82B5F3221E17253d", + SubaccountRouter: "0x11E590f6092D557bF71BaDEd50D81521674F8275", + ExchangeRouter: "0x72fa3978E2E330C7B2debc23CB676A3ae63333F6", DepositVault: "0x4D12C3D3e750e051e87a2F3f7750fBd94767742c", WithdrawalVault: "0x46BAeAEdbF90Ce46310173A04942e2B3B781Bf0e", OrderVault: "0xe52B3700D17B45dE9de7205DEe4685B4B9EC612D", ShiftVault: "0xa7EE2737249e0099906cB079BCEe85f0bbd837d4", - SyntheticsReader: "0xcA3D8Ea2aCfd46D7D3732F4264bD62996A04Bb3F", + SyntheticsReader: "0xa254B60cbB85a92F6151B10E1233639F601f2F0F", SyntheticsRouter: "0x3d472afcd66F954Fe4909EEcDd5c940e9a99290c", - GlvReader: "0x5AE7478d10C7298E06f38E90cf544dAE28fFE88B", - GlvRouter: "0x8C142F1826a6679Abcc9bAa54ddbf11CC080C106", + GlvReader: "0x490d660A21fB75701b7781E191cB888D1FE38315", + GlvRouter: "0x348Eca94e7c6F35430aF1cAccE27C29E9Bef9ae3", GlvVault: "0xd336087512BeF8Df32AF605b492f452Fd6436CD8", - GelatoRelayRouter: "0xfF95979396B138E7e014E91932A12D78d569f3B8", - SubaccountGelatoRelayRouter: "0x0817645a12215EAb65379AEe23fD9f9b69BAa063", + GelatoRelayRouter: "0x7f8eF83C92B48a4B5B954A24D98a6cD0Ed4D160a", + SubaccountGelatoRelayRouter: "0xfbb9C41046E27405224a911f44602C3667f9D8f6", ExternalHandler: "0x36b906eA6AE7c74aeEE8cDE66D01B3f1f8843872", OpenOceanRouter: zeroAddress, - ChainlinkPriceFeedProvider: "0x8c0dF501394C0fee105f92F5CA59D7B876393B99", + ChainlinkPriceFeedProvider: "0xDc613305e9267f0770072dEaB8c03162e0554b2d", Multicall: "0x4BaA24f93a657f0c1b4A0Ffc72B91011E35cA46b", diff --git a/sdk/src/types/subsquid.ts b/sdk/src/types/subsquid.ts index f9fd8084b8..a29132332e 100644 --- a/sdk/src/types/subsquid.ts +++ b/sdk/src/types/subsquid.ts @@ -325,6 +325,15 @@ export interface AccountStatsConnection { totalCount: Scalars["Int"]["output"]; } +export interface AnnualizedPerformanceObject { + __typename?: "AnnualizedPerformanceObject"; + address: Scalars["String"]["output"]; + entity: Scalars["String"]["output"]; + longTokenPerformance: Scalars["BigInt"]["output"]; + shortTokenPerformance: Scalars["BigInt"]["output"]; + uniswapV2Performance: Scalars["BigInt"]["output"]; +} + export interface AprSnapshot { __typename?: "AprSnapshot"; address: Scalars["String"]["output"]; @@ -1542,7 +1551,7 @@ export interface Distribution { receiver: Scalars["String"]["output"]; tokens: Array; transaction: Transaction; - typeId: Scalars["Int"]["output"]; + typeId: Scalars["BigInt"]["output"]; } export interface DistributionEdge { @@ -1665,15 +1674,15 @@ export interface DistributionWhereInput { tokens_isNull?: InputMaybe; transaction?: InputMaybe; transaction_isNull?: InputMaybe; - typeId_eq?: InputMaybe; - typeId_gt?: InputMaybe; - typeId_gte?: InputMaybe; - typeId_in?: InputMaybe>; + typeId_eq?: InputMaybe; + typeId_gt?: InputMaybe; + typeId_gte?: InputMaybe; + typeId_in?: InputMaybe>; typeId_isNull?: InputMaybe; - typeId_lt?: InputMaybe; - typeId_lte?: InputMaybe; - typeId_not_eq?: InputMaybe; - typeId_not_in?: InputMaybe>; + typeId_lt?: InputMaybe; + typeId_lte?: InputMaybe; + typeId_not_eq?: InputMaybe; + typeId_not_in?: InputMaybe>; } export interface DistributionsConnection { @@ -4301,6 +4310,24 @@ export interface PageInfo { startCursor: Scalars["String"]["output"]; } +export interface PerformanceSnapshotObject { + __typename?: "PerformanceSnapshotObject"; + snapshotTimestamp: Scalars["String"]["output"]; + uniswapV2Performance: Scalars["String"]["output"]; +} + +export interface PerformanceSnapshots { + __typename?: "PerformanceSnapshots"; + address: Scalars["String"]["output"]; + entity: Scalars["String"]["output"]; + snapshots: Array; +} + +export interface PerformanceWhereInput { + addresses?: InputMaybe>; + period: Scalars["String"]["input"]; +} + export interface PeriodAccountStatObject { __typename?: "PeriodAccountStatObject"; closedCount: Scalars["Float"]["output"]; @@ -6000,6 +6027,7 @@ export interface Query { accountStatById?: Maybe; accountStats: Array; accountStatsConnection: AccountStatsConnection; + annualizedPerformance: Array; aprSnapshotById?: Maybe; aprSnapshots: Array; aprSnapshotsConnection: AprSnapshotsConnection; @@ -6046,6 +6074,7 @@ export interface Query { orderById?: Maybe; orders: Array; ordersConnection: OrdersConnection; + performanceSnapshots: Array; periodAccountStats: Array; pnlAprSnapshotById?: Maybe; pnlAprSnapshots: Array; @@ -6108,6 +6137,10 @@ export interface QueryaccountStatsConnectionArgs { where?: InputMaybe; } +export interface QueryannualizedPerformanceArgs { + where?: InputMaybe; +} + export interface QueryaprSnapshotByIdArgs { id: Scalars["String"]["input"]; } @@ -6376,6 +6409,10 @@ export interface QueryordersConnectionArgs { where?: InputMaybe; } +export interface QueryperformanceSnapshotsArgs { + where?: InputMaybe; +} + export interface QueryperiodAccountStatsArgs { limit?: InputMaybe; offset?: InputMaybe; diff --git a/src/typechain-types/factories/index.ts b/src/typechain-types/factories/index.ts index 088fdd2238..ceb40fa096 100644 --- a/src/typechain-types/factories/index.ts +++ b/src/typechain-types/factories/index.ts @@ -24,7 +24,6 @@ export { MultichainGmRouter__factory } from "./MultichainGmRouter__factory"; export { MultichainOrderRouter__factory } from "./MultichainOrderRouter__factory"; export { MultichainSubaccountRouter__factory } from "./MultichainSubaccountRouter__factory"; export { MultichainTransferRouter__factory } from "./MultichainTransferRouter__factory"; -export { MultichainUtils__factory } from "./MultichainUtils__factory"; export { MultichainVault__factory } from "./MultichainVault__factory"; export { OrderBook__factory } from "./OrderBook__factory"; export { OrderBookReader__factory } from "./OrderBookReader__factory"; diff --git a/src/typechain-types/index.ts b/src/typechain-types/index.ts index b0becb1d95..5ab50f2c31 100644 --- a/src/typechain-types/index.ts +++ b/src/typechain-types/index.ts @@ -24,7 +24,6 @@ export type { MultichainGmRouter } from "./MultichainGmRouter"; export type { MultichainOrderRouter } from "./MultichainOrderRouter"; export type { MultichainSubaccountRouter } from "./MultichainSubaccountRouter"; export type { MultichainTransferRouter } from "./MultichainTransferRouter"; -export type { MultichainUtils } from "./MultichainUtils"; export type { MultichainVault } from "./MultichainVault"; export type { OrderBook } from "./OrderBook"; export type { OrderBookReader } from "./OrderBookReader"; @@ -83,7 +82,6 @@ export { MultichainGmRouter__factory } from "./factories/MultichainGmRouter__fac export { MultichainOrderRouter__factory } from "./factories/MultichainOrderRouter__factory"; export { MultichainSubaccountRouter__factory } from "./factories/MultichainSubaccountRouter__factory"; export { MultichainTransferRouter__factory } from "./factories/MultichainTransferRouter__factory"; -export { MultichainUtils__factory } from "./factories/MultichainUtils__factory"; export { MultichainVault__factory } from "./factories/MultichainVault__factory"; export { OrderBook__factory } from "./factories/OrderBook__factory"; export { OrderBookReader__factory } from "./factories/OrderBookReader__factory"; From 7ac49de602f5168b90449b4c2b5e2003c47c3473 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 15 Sep 2025 21:42:20 +0200 Subject: [PATCH 11/38] Multichain lp mark correct pay source for second token in pair --- .../GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index a04c8a1655..798c8f9e17 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -811,7 +811,13 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { className={isPair ? "rounded-t-0" : undefined} >
- +
From 646f99c681fd993ffe5877b820fb3aab20d2748e Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 15 Sep 2025 21:44:15 +0200 Subject: [PATCH 12/38] Multichain lp reset pay source on gm tradebox change --- .../GmDepositWithdrawalBox.tsx | 11 -------- .../useGmDepositWithdrawalBoxState.tsx | 28 +++++++++++++++++-- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 798c8f9e17..c38802172f 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -694,17 +694,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { fromMarketTokenInputState, marketTokensData, }); - - useEffect( - function fallbackSourceChainPaySource() { - if (paySource === "sourceChain" && srcChainId === undefined) { - setPaySource("settlementChain"); - } else if (paySource === "settlementChain" && srcChainId !== undefined) { - setPaySource("sourceChain"); - } - }, - [paySource, setPaySource, srcChainId] - ); // #endregion // #region Render diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx index 7445e3dc84..eeffe4c4c3 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx @@ -1,7 +1,7 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; -import { selectChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { useLocalStorageSerializeKey } from "lib/localStorage"; import { useSafeState } from "lib/useSafeState"; @@ -22,18 +22,40 @@ export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, const isDeposit = operation === Operation.Deposit; const chainId = useSelector(selectChainId); + const srcChainId = useSelector(selectSrcChainId); const [focusedInput, setFocusedInput] = useState<"longCollateral" | "shortCollateral" | "market">("market"); - let [paySource, setPaySource] = useLocalStorageSerializeKey( + let [rawPaySource, setPaySource] = useLocalStorageSerializeKey( [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "paySource"], "settlementChain" ); + let paySource = rawPaySource; + if (!isValidPaySource(paySource)) { paySource = "gmxAccount"; + } else if (rawPaySource === "sourceChain" && srcChainId === undefined) { + paySource = "settlementChain"; + } else if (rawPaySource === "settlementChain" && srcChainId !== undefined) { + paySource = "sourceChain"; + } else if (paySource === "sourceChain" && mode === Mode.Pair) { + paySource = "gmxAccount"; } + useEffect( + function fallbackSourceChainPaySource() { + if (rawPaySource === "sourceChain" && srcChainId === undefined) { + setPaySource("settlementChain"); + } else if (rawPaySource === "settlementChain" && srcChainId !== undefined) { + setPaySource("sourceChain"); + } else if (rawPaySource === "sourceChain" && mode === Mode.Pair) { + setPaySource("gmxAccount"); + } + }, + [mode, rawPaySource, setPaySource, srcChainId] + ); + let [isSendBackToSourceChain, setIsSendBackToSourceChain] = useLocalStorageSerializeKey( [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "isSendBackToSourceChain"], false From c8ad488dc9fc6964c9eea5a409a224758d1d58f1 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 15 Sep 2025 21:45:18 +0200 Subject: [PATCH 13/38] Multichain lp rename pay source type --- .../GmDepositWithdrawalBox.tsx | 4 ++-- .../GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts | 5 ++++- .../useDepositWithdrawalTransactions.tsx | 6 +++--- .../useGmDepositWithdrawalBoxState.tsx | 12 ++++++------ .../GmDepositWithdrawalBox/useGmSwapSubmitState.tsx | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index c38802172f..82cc463f3b 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -801,8 +801,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { >
("market"); - let [rawPaySource, setPaySource] = useLocalStorageSerializeKey( + let [rawPaySource, setPaySource] = useLocalStorageSerializeKey( [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "paySource"], "settlementChain" ); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 84aeb0f561..e64eed0b84 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -22,7 +22,7 @@ import { useDepositWithdrawalTransactions } from "./useDepositWithdrawalTransact import { useTokensToApprove } from "./useTokensToApprove"; import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; import { Operation } from "../types"; -import type { GmOrGlvPaySource } from "./types"; +import type { GmPaySource } from "./types"; interface Props { amounts: ReturnType; @@ -49,7 +49,7 @@ interface Props { marketsInfoData?: MarketsInfoData; glvAndMarketsInfoData: GlvAndGmMarketsInfoData; selectedMarketInfoForGlv?: MarketInfo; - paySource: GmOrGlvPaySource; + paySource: GmPaySource; } const processingTextMap = { From b8f72338d90c8b30fe268bf327ce433ef5fb9faf Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 15 Sep 2025 21:45:41 +0200 Subject: [PATCH 14/38] Multichain change pools header --- src/img/ic_buy_16.svg | 4 + src/img/ic_sell_16.svg | 4 + src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 191 ++++++++++-------- 3 files changed, 115 insertions(+), 84 deletions(-) create mode 100644 src/img/ic_buy_16.svg create mode 100644 src/img/ic_sell_16.svg diff --git a/src/img/ic_buy_16.svg b/src/img/ic_buy_16.svg new file mode 100644 index 0000000000..d7d0bdb7c9 --- /dev/null +++ b/src/img/ic_buy_16.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/img/ic_sell_16.svg b/src/img/ic_sell_16.svg new file mode 100644 index 0000000000..2ff871d795 --- /dev/null +++ b/src/img/ic_sell_16.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index d58cb9f95b..54d5954e55 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -20,7 +20,7 @@ import { convertToUsd, TokenData } from "domain/synthetics/tokens"; import { useChainId } from "lib/chains"; import { formatAmountHuman, formatBalanceAmount, formatUsd } from "lib/numbers"; import { getByKey } from "lib/objects"; -import { usePoolsIsMobilePage } from "pages/Pools/usePoolsIsMobilePage"; +import { useBreakpoints } from "lib/useBreakpoints"; import { AnyChainId, getChainName } from "sdk/configs/chains"; import { getNormalizedTokenSymbol } from "sdk/configs/tokens"; @@ -29,6 +29,9 @@ import { useMultichainMarketTokenBalancesRequest } from "components/Synthetics/G import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import TokenIcon from "components/TokenIcon/TokenIcon"; +import Buy16Icon from "img/ic_buy_16.svg?react"; +import Sell16Icon from "img/ic_sell_16.svg?react"; + import { PoolsDetailsMarketAmount } from "./PoolsDetailsMarketAmount"; type Props = { @@ -55,7 +58,7 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { const userEarnings = useUserEarnings(chainId, srcChainId); const marketEarnings = getByKey(userEarnings?.byMarketAddress, marketToken?.address); - const isMobile = usePoolsIsMobilePage(); + const { isMobile, isTablet } = useBreakpoints(); const { totalBalance, tokenBalancesData, isBalanceDataLoading } = useMultichainMarketTokenBalancesRequest( chainId, @@ -86,96 +89,116 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { setIsOpen((isOpen) => !isOpen); }, []); + const glOrGm = isGlv ? "GLV" : "GM"; + return (
- {glvOrMarketInfo ? ( - <> -
-
- {iconName ? ( - - ) : null} -
-
{isGlv ? "GLV" : `GM: ${getMarketIndexName(glvOrMarketInfo)}`}
-
{`[${getMarketPoolName(glvOrMarketInfo)}]`}
+
+ {!glvOrMarketInfo ? ( +
...
+ ) : ( + <> +
+
+ {iconName && ( + + )} +
+
{isGlv ? "GLV" : `GM: ${getMarketIndexName(glvOrMarketInfo)}`}
+
{`[${getMarketPoolName(glvOrMarketInfo)}]`}
+
+ {isMobile && ( + + )}
- {isMobile ? ( - - ) : null} -
- {!isOpen && isMobile ? null : ( -
- TVL (Supply)} - value={formatAmountHuman(marketTotalSupplyUsd, USD_DECIMALS, true, 2)} - secondaryValue={ - typeof marketTotalSupply === "bigint" && typeof marketToken?.decimals === "number" - ? `${formatAmountHuman(marketTotalSupply, marketToken?.decimals, false, 2)} ${isGlv ? "GLV" : "GM"}` - : undefined - } - /> - - {typeof totalBalance === "bigint" && typeof marketToken?.decimals === "number" ? ( + {(isOpen || !isMobile) && ( +
Wallet} - value={formatUsd(marketBalanceUsd)} - secondaryValue={`${formatBalanceAmount(totalBalance, marketToken?.decimals, undefined, { - showZero: true, - })} ${isGlv ? "GLV" : "GM"}`} - tooltipContent={ -
- {sortedTokenBalancesDataArray.map(({ chainId, balance }) => { - const chainName = chainId === 0 ? t`GMX Account` : getChainName(chainId); - - return ( - - ); - })} - {isBalanceDataLoading ? : null} -
+ label={TVL (Supply)} + value={formatAmountHuman(marketTotalSupplyUsd, USD_DECIMALS, true, 2)} + secondaryValue={ + typeof marketTotalSupply === "bigint" && typeof marketToken?.decimals === "number" + ? `${formatAmountHuman(marketTotalSupply, marketToken?.decimals, false, 2)} ${isGlv ? "GLV" : "GM"}` + : undefined } /> - ) : null} - - {marketEarnings ? ( - Total Earned Fees} - value={formatUsd(marketEarnings?.total)} - /> - ) : null} -
- )} - - ) : ( -
...
- )} + {typeof totalBalance === "bigint" && typeof marketToken?.decimals === "number" && ( + Balance} + value={formatUsd(marketBalanceUsd)} + secondaryValue={`${formatBalanceAmount(totalBalance, marketToken?.decimals, undefined, { + showZero: true, + })} ${isGlv ? "GLV" : "GM"}`} + tooltipContent={ +
+ {sortedTokenBalancesDataArray.map(({ chainId, balance }) => { + const chainName = chainId === 0 ? t`GMX Account` : getChainName(chainId); + + return ( + + ); + })} + {isBalanceDataLoading && } +
+ } + /> + )} + {marketEarnings && ( + Total Earned Fees} + value={formatUsd(marketEarnings?.total)} + /> + )} +
+ )} + + )} +
+
+ + +
); } From a27dda4e9e5dd1db7e95f990b177e560e4829832 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 15 Sep 2025 21:46:08 +0200 Subject: [PATCH 15/38] Sync translations --- src/locales/de/messages.po | 10 +++++++++- src/locales/en/messages.po | 10 +++++++++- src/locales/es/messages.po | 10 +++++++++- src/locales/fr/messages.po | 10 +++++++++- src/locales/ja/messages.po | 10 +++++++++- src/locales/ko/messages.po | 10 +++++++++- src/locales/pseudo/messages.po | 10 +++++++++- src/locales/ru/messages.po | 10 +++++++++- src/locales/zh/messages.po | 10 +++++++++- 9 files changed, 81 insertions(+), 9 deletions(-) diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index ddfb29565f..aa81793bd8 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -670,6 +670,10 @@ msgstr "In Liquidität" msgid "Exit Price" msgstr "Exit-Preis" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "Rabatte auf V2" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "esGMX staken" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "Der Bonus-APR wird als {airdropTokenTitle}-Tokens airdropped. <0>Mehr le #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index ae009becbd..57baeae8b5 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -670,6 +670,10 @@ msgstr "in liquidity" msgid "Exit Price" msgstr "Exit Price" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "Withdraw {glOrGm}" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "Rebates on V2" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -8156,6 +8161,10 @@ msgstr "Please <0>swap to get {nativeTokenSymbol}." msgid "Stake esGMX" msgstr "Stake esGMX" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "Deposit {glOrGm}" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "The Bonus APR will be airdropped as {airdropTokenTitle} tokens. <0>Read #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index 78d0876376..d656091a9d 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -670,6 +670,10 @@ msgstr "en liquidez" msgid "Exit Price" msgstr "Precio de Salida" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "Reembolsos en V2" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Balance" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "Stakear esGMX" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "El APR de Bonificación se airdropeará como tokens {airdropTokenTitle}. #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index 741ca0d6e8..151de1f669 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -670,6 +670,10 @@ msgstr "en liquidité" msgid "Exit Price" msgstr "Prix de sortie" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "Remises sur V2" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1h" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Solde" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "Staker esGMX" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "Le TAEG bonus sera airdroppé sous forme de tokens {airdropTokenTitle}. #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 6f8590c463..6556329ae3 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -670,6 +670,10 @@ msgstr "流動性で" msgid "Exit Price" msgstr "手仕舞い価格" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "V2のリベート" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1 時間" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "残高" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "esGMXをステーク" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "ボーナスAPRは{airdropTokenTitle}トークンとしてエアドロ #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index e17d603245..4871380cad 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -670,6 +670,10 @@ msgstr "유동성 내" msgid "Exit Price" msgstr "종료 가격" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "V2 리베이트" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1시간" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "잔고" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "esGMX 스테이킹" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "보너스 APR은 {airdropTokenTitle} 토큰으로 에어드랍됩니다. #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index 2826d084fc..9d06ced12d 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -670,6 +670,10 @@ msgstr "" msgid "Exit Price" msgstr "" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "" @@ -6366,6 +6370,7 @@ msgstr "" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "" @@ -8150,6 +8155,10 @@ msgstr "" msgid "Stake esGMX" msgstr "" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8296,7 +8305,6 @@ msgstr "" #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index 78b2585058..95970028ab 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -670,6 +670,10 @@ msgstr "используется для обеспечения ликвидно msgid "Exit Price" msgstr "Цена выхода" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "Ребейты на V2" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1ч" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "Баланс" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "Стейкать esGMX" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "Бонусный APR будет аирдропнут как токены #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index ed58f21fa3..f2a59ce261 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -670,6 +670,10 @@ msgstr "流动性中" msgid "Exit Price" msgstr "退出价格" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Withdraw {glOrGm}" +msgstr "" + #: src/components/Referrals/AffiliatesStats.tsx msgid "Rebates on V2" msgstr "V2 返利" @@ -6369,6 +6373,7 @@ msgstr "{formattedNetRate} / 1 小时" #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx msgid "Balance" msgstr "余额" @@ -8156,6 +8161,10 @@ msgstr "" msgid "Stake esGMX" msgstr "质押 esGMX" +#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx +msgid "Deposit {glOrGm}" +msgstr "" + #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts #: src/domain/synthetics/trade/utils/validation.ts @@ -8302,7 +8311,6 @@ msgstr "奖金年利率将作为 {airdropTokenTitle} 代币空投。<0>阅读更 #: src/components/Synthetics/GmList/GmTokensTotalBalanceInfo.tsx #: src/components/Synthetics/GmxAccountModal/AvailableToTradeAssetsView.tsx #: src/components/Synthetics/GmxAccountModal/MainView.tsx -#: src/pages/PoolsDetails/PoolsDetailsHeader.tsx #: src/pages/Stake/EscrowedGmxCard.tsx #: src/pages/Stake/GmxAndVotingPowerCard.tsx #: src/pages/Stake/VesterDepositModal.tsx From 671626bc5a3d99c2b193df8d65357d4dd96a2e54 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 18 Sep 2025 23:49:23 +0200 Subject: [PATCH 16/38] Multichain LP big txn refactor --- src/components/Referrals/JoinReferralCode.tsx | 4 +- .../GmDepositWithdrawalBox.tsx | 52 +- .../useDepositTransactions.tsx} | 430 ++----------- .../lpTxn/useLpTransactions.tsx | 79 +++ .../useMultichainDepositExpressTxnParams.tsx | 81 +++ ...seMultichainWithdrawalExpressTxnParams.tsx | 81 +++ .../lpTxn/useWithdrawalTransactions.tsx | 592 ++++++++++++++++++ .../useGmDepositWithdrawalBoxState.tsx | 48 +- .../useGmSwapSubmitState.tsx | 8 +- .../GmSwap/GmSwapBox/SelectedPool.tsx | 2 +- .../GmxAccountModal/DepositView.tsx | 2 +- .../GmxAccountModal/WithdrawalView.tsx | 4 +- .../MultichainMarketTokenSelector.tsx | 389 ++++++++++++ .../TokenSelector/MultichainTokenSelector.tsx | 24 +- src/domain/multichain/codecs/CodecUiHelper.ts | 87 ++- .../multichain/codecs/hashParamsAbiItems.ts | 46 +- src/domain/multichain/getSendParams.ts | 29 +- src/domain/multichain/getTransferRequests.tsx | 27 + .../useMultichainDepositNetworkComposeGas.ts | 7 +- .../synthetics/markets/createBridgeInTxn.ts | 83 +++ .../synthetics/markets/createBridgeOutTxn.ts | 103 +++ .../markets/createGlvWithdrawalTxn.ts | 85 +-- .../markets/createMultichainDepositTxn.ts | 5 +- .../createMultichainGlvWithdrawalTxn.ts | 119 ++++ .../markets/createMultichainWithdrawalTxn.ts | 118 ++++ .../markets/createSourceChainDepositTxn.ts | 11 +- .../markets/createSourceChainGlvDepositTxn.ts | 4 +- .../markets/createSourceChainWithdrawalTxn.ts | 147 +++++ .../synthetics/markets/createWithdrawalTxn.ts | 90 ++- .../synthetics/markets/signCreateBridgeOut.ts | 66 ++ .../synthetics/markets/signCreateDeposit.ts | 2 +- .../markets/signCreateGlvWithdrawal.ts | 69 ++ .../markets/signCreateWithdrawal.ts | 68 ++ src/domain/synthetics/markets/types.ts | 43 +- .../synthetics/trade/utils/validation.ts | 10 + src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 39 +- src/pages/PoolsDetails/TransferInModal.tsx | 182 ++++++ 37 files changed, 2642 insertions(+), 594 deletions(-) rename src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/{useDepositWithdrawalTransactions.tsx => lpTxn/useDepositTransactions.tsx} (59%) create mode 100644 src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx create mode 100644 src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx create mode 100644 src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx create mode 100644 src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx create mode 100644 src/components/TokenSelector/MultichainMarketTokenSelector.tsx create mode 100644 src/domain/multichain/getTransferRequests.tsx create mode 100644 src/domain/synthetics/markets/createBridgeInTxn.ts create mode 100644 src/domain/synthetics/markets/createBridgeOutTxn.ts create mode 100644 src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts create mode 100644 src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts create mode 100644 src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts create mode 100644 src/domain/synthetics/markets/signCreateBridgeOut.ts create mode 100644 src/domain/synthetics/markets/signCreateGlvWithdrawal.ts create mode 100644 src/domain/synthetics/markets/signCreateWithdrawal.ts create mode 100644 src/pages/PoolsDetails/TransferInModal.tsx diff --git a/src/components/Referrals/JoinReferralCode.tsx b/src/components/Referrals/JoinReferralCode.tsx index 08c2d2b55d..5bca797078 100644 --- a/src/components/Referrals/JoinReferralCode.tsx +++ b/src/components/Referrals/JoinReferralCode.tsx @@ -348,7 +348,7 @@ function ReferralCodeFormMultichain({ FAKE_INPUT_AMOUNT_MAP[p.sourceChainTokenId.symbol] ?? numberToBigint(0.02, p.sourceChainTokenId.decimals); const sendParamsWithRoughAmount = getMultichainTransferSendParams({ - isDeposit: true, + isToGmx: true, dstChainId: p.chainId, account: p.simulationSigner.address, amount: tokenAmount, @@ -482,7 +482,7 @@ function ReferralCodeFormMultichain({ srcChainId, amount: result.data.amount, composeGas: result.data.composeGas, - isDeposit: true, + isToGmx: true, action, }); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 82cc463f3b..8cdb3fc918 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -3,6 +3,7 @@ import cx from "classnames"; import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; +import { useAccount } from "wagmi"; import { getContract } from "config/contracts"; import { isSourceChain } from "config/multichain"; @@ -23,7 +24,7 @@ import { getMarketIndexName, getTokenPoolType, } from "domain/synthetics/markets/utils"; -import { convertToUsd, getTokenData, TokenData } from "domain/synthetics/tokens"; +import { convertToUsd, getMidPrice, getTokenData, TokenData } from "domain/synthetics/tokens"; import useSortedPoolsWithIndexToken from "domain/synthetics/trade/useSortedPoolsWithIndexToken"; import { Token, TokenBalanceType } from "domain/tokens"; import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; @@ -35,16 +36,19 @@ import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; -import { useMultichainTokens } from "components/Synthetics/GmxAccountModal/hooks"; +import { + useMultichainMarketTokenBalancesRequest, + useMultichainTokens, +} from "components/Synthetics/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/hooks/useBestGmPoolForGlv"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; +import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; import TooltipWithPortal from "components/Tooltip/TooltipWithPortal"; import type { GmSwapBoxProps } from "../GmSwapBox"; import { GmSwapBoxPoolRow } from "../GmSwapBoxPoolRow"; import { GmSwapWarningsRow } from "../GmSwapWarningsRow"; -import { SelectedPool } from "../SelectedPool"; import { Mode, Operation } from "../types"; import { useGmWarningState } from "../useGmWarningState"; import { InfoRows } from "./InfoRows"; @@ -78,6 +82,13 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); const { tokenChainDataArray } = useMultichainTokens(); + const { address: account } = useAccount(); + const { tokenBalancesData: marketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( + chainId, + srcChainId, + account, + selectedGlvOrMarketAddress + ); // #endregion // #region Selectors @@ -416,6 +427,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { marketsInfoData, glvAndMarketsInfoData, paySource, + isPair, }); const firstTokenMaxDetails = useMaxAvailableAmount({ @@ -824,10 +836,36 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { onClickTopRightLabel={marketTokenInputClickTopRightLabel} onClickMax={marketTokenInputShowMaxButton ? marketTokenInputClickMax : undefined} > - + {selectedGlvOrMarketAddress && ( + { + if (newChainId === 0) { + setPaySource("gmxAccount"); + } else if (newChainId === chainId) { + if (srcChainId !== undefined) { + await switchNetwork(chainId, true); + } + setPaySource("settlementChain"); + } else { + await switchNetwork(newChainId, true); + setPaySource("sourceChain"); + } + }} + marketInfo={glvInfo ?? marketInfo} + tokenBalancesData={marketTokenBalancesData} + marketTokenPrice={ + glvToken + ? getMidPrice(glvToken.prices) + : marketToken + ? getMidPrice(marketToken.prices) + : undefined + } + /> + )}
diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx similarity index 59% rename from src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx rename to src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index be87b7016f..62a2420da8 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -1,10 +1,9 @@ import { t } from "@lingui/macro"; import chunk from "lodash/chunk"; -import { useCallback, useMemo, useState } from "react"; -import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; +import { useCallback, useMemo } from "react"; +import { Hex, bytesToHex, hexToBytes, numberToHex, zeroAddress } from "viem"; -import { ContractsChainId, SettlementChainId } from "config/chains"; -import { getContract } from "config/contracts"; +import { SettlementChainId } from "config/chains"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; @@ -18,31 +17,15 @@ import { } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; -import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; -import { ExecutionFee } from "domain/synthetics/fees"; -import { - CreateDepositParamsStruct, - createDepositTxn, - CreateGlvDepositParamsStruct, - createWithdrawalTxn, - GlvInfo, - MarketInfo, -} from "domain/synthetics/markets"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct, createDepositTxn } from "domain/synthetics/markets"; import { createGlvDepositTxn } from "domain/synthetics/markets/createGlvDepositTxn"; -import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; -import { - buildAndSignMultichainDepositTxn, - createMultichainDepositTxn, -} from "domain/synthetics/markets/createMultichainDepositTxn"; -import { - buildAndSignMultichainGlvDepositTxn, - createMultichainGlvDepositTxn, -} from "domain/synthetics/markets/createMultichainGlvDepositTxn"; +import { createMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; +import { createMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; import { createSourceChainDepositTxn } from "domain/synthetics/markets/createSourceChainDepositTxn"; import { createSourceChainGlvDepositTxn } from "domain/synthetics/markets/createSourceChainGlvDepositTxn"; -import { convertToTokenAmount, getMidPrice, getTokenData, TokenData, TokensData } from "domain/synthetics/tokens"; -import { useChainId } from "lib/chains"; +import { convertToTokenAmount, getMidPrice, getTokenData } from "domain/tokens"; import { helperToast } from "lib/helperToast"; import { initGLVSwapMetricData, @@ -55,162 +38,17 @@ import { import { EMPTY_ARRAY } from "lib/objects"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; import useWallet from "lib/wallets/useWallet"; +import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { convertTokenAddress } from "sdk/configs/tokens"; import { nowInSeconds } from "sdk/utils/time"; import { applySlippageToMinOut } from "sdk/utils/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; -import { Operation } from "../types"; -import type { GmPaySource } from "./types"; - -interface Props { - marketInfo?: MarketInfo; - glvInfo?: GlvInfo; - marketToken: TokenData | undefined; - operation: Operation; - longTokenAddress: string | undefined; - shortTokenAddress: string | undefined; - - marketTokenAmount: bigint | undefined; - marketTokenUsd: bigint | undefined; - longTokenAmount: bigint | undefined; - shortTokenAmount: bigint | undefined; - - glvTokenAmount: bigint | undefined; - glvTokenUsd: bigint | undefined; - - shouldDisableValidation?: boolean; - - tokensData: TokensData | undefined; - executionFee: ExecutionFee | undefined; - selectedMarketForGlv?: string; - selectedMarketInfoForGlv?: MarketInfo; - isMarketTokenDeposit?: boolean; - isFirstBuy: boolean; - paySource: GmPaySource; -} - -function getTransferRequests({ - chainId, - longTokenAddress, - longTokenAmount, - shortTokenAddress, - shortTokenAmount, - feeTokenAmount, - isGlv, -}: { - chainId: ContractsChainId; - longTokenAddress: string | undefined; - longTokenAmount: bigint | undefined; - shortTokenAddress: string | undefined; - shortTokenAmount: bigint | undefined; - feeTokenAmount: bigint | undefined; - isGlv: boolean; -}): IRelayUtils.TransferRequestsStruct { - const requests: IRelayUtils.TransferRequestsStruct = { - tokens: [], - receivers: [], - amounts: [], - }; - - const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); - const routerAddress = isGlv - ? getContract(chainId, "MultichainGlvRouter") - : getContract(chainId, "MultichainGmRouter"); - - if (longTokenAddress && longTokenAmount !== undefined && longTokenAmount > 0n) { - requests.tokens.push(longTokenAddress); - requests.receivers.push(vaultAddress); - requests.amounts.push(longTokenAmount); - } - - if (shortTokenAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n) { - requests.tokens.push(shortTokenAddress); - requests.receivers.push(vaultAddress); - requests.amounts.push(shortTokenAmount); - } - - if (feeTokenAmount !== undefined && feeTokenAmount > 0n) { - requests.tokens.push(getWrappedToken(chainId).address); - requests.receivers.push(routerAddress); - requests.amounts.push(feeTokenAmount); - } - - return requests; -} - -function useMultichainDepositExpressTxnParams({ - transferRequests, - paySource, - gmParams, - glvParams, -}: { - transferRequests: IRelayUtils.TransferRequestsStruct; - paySource: GmPaySource; - gmParams: CreateDepositParamsStruct | undefined; - glvParams: CreateGlvDepositParamsStruct | undefined; -}) { - const { chainId, srcChainId } = useChainId(); - const { signer } = useWallet(); - - const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ - isGmxAccount: paySource === "gmxAccount", - enabled: paySource === "gmxAccount", - executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, - expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - if ((!gmParams && !glvParams) || !signer) { - throw new Error("Invalid params"); - } - - if (glvParams) { - const txnData = await buildAndSignMultichainGlvDepositTxn({ - emptySignature: true, - account: glvParams!.addresses.receiver, - chainId, - params: glvParams!, - srcChainId, - relayerFeeAmount: gasPaymentParams.relayerFeeAmount, - relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, - relayParams: { - ...relayParams, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }, - signer, - transferRequests, - }); - - return { - txnData, - }; - } - - const txnData = await buildAndSignMultichainDepositTxn({ - emptySignature: true, - account: gmParams!.addresses.receiver, - chainId, - params: gmParams!, - srcChainId, - relayerFeeAmount: gasPaymentParams.relayerFeeAmount, - relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, - relayParams: { - ...relayParams, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }, - signer, - transferRequests, - }); - - return { - txnData, - }; - }, - }); - - return multichainDepositExpressTxnParams; -} +import type { UseLpTransactionProps } from "./useLpTransactions"; +import { useMultichainDepositExpressTxnParams } from "./useMultichainDepositExpressTxnParams"; -const useDepositTransactions = ({ +export const useDepositTransactions = ({ marketInfo, marketToken, longTokenAddress = marketInfo?.longTokenAddress, @@ -219,7 +57,6 @@ const useDepositTransactions = ({ shortTokenAmount, glvTokenAmount, glvTokenUsd, - marketTokenAmount, marketTokenUsd, shouldDisableValidation, @@ -231,7 +68,7 @@ const useDepositTransactions = ({ isMarketTokenDeposit, isFirstBuy, paySource, -}: Props): { +}: UseLpTransactionProps): { onCreateDeposit: () => Promise; } => { const chainId = useSelector(selectChainId); @@ -264,15 +101,19 @@ const useDepositTransactions = ({ const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { - return getTransferRequests({ - chainId, - longTokenAddress: initialLongTokenAddress, - longTokenAmount, - shortTokenAddress: initialShortTokenAddress, - shortTokenAmount, - feeTokenAmount: 0n, // executionFeeTokenAmount, - isGlv, - }); + const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); + return getTransferRequests([ + { + to: vaultAddress, + token: initialLongTokenAddress, + amount: longTokenAmount, + }, + { + to: vaultAddress, + token: initialShortTokenAddress, + amount: shortTokenAmount, + }, + ]); }, [chainId, initialLongTokenAddress, initialShortTokenAddress, isGlv, longTokenAmount, shortTokenAmount]); const gmParams = useMemo((): CreateDepositParamsStruct | undefined => { @@ -297,23 +138,19 @@ const useDepositTransactions = ({ return undefined; } - const tokenId = getMultichainTokenId(chainId, marketTokenAddress); - - if (!tokenId) { - return undefined; - } - const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), desChainId: chainId, - minAmountOut: minMarketTokens / 2n, - provider: tokenId.stargate, + provider: getMultichainTokenId(chainId, marketTokenAddress)!.stargate, providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), + minAmountOut: minMarketTokens, + secondaryProvider: zeroAddress, + secondaryProviderData: zeroAddress, + secondaryMinAmountOut: 0n, }, }); - const bytes = hexToBytes(actionHash as Hex); const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); @@ -374,14 +211,22 @@ const useDepositTransactions = ({ return undefined; } + const tokenId = getMultichainTokenId(chainId, glvInfo!.glvTokenAddress); + if (!tokenId) { + return undefined; + } + const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), desChainId: chainId, - minAmountOut: minGlvTokens / 2n, - provider: getMultichainTokenId(chainId, glvInfo!.glvTokenAddress)!.stargate, + minAmountOut: minGlvTokens, + provider: tokenId.stargate, providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), + secondaryProvider: zeroAddress, + secondaryProviderData: zeroAddress, + secondaryMinAmountOut: 0n, }, }); const bytes = hexToBytes(actionHash as Hex); @@ -740,194 +585,3 @@ const useDepositTransactions = ({ onCreateDeposit, }; }; - -export const useDepositWithdrawalTransactions = ( - props: Props -): { - onSubmit: () => void; - isSubmitting: boolean; -} => { - const { - marketInfo, - marketToken, - operation, - longTokenAddress, - longTokenAmount, - shortTokenAddress, - shortTokenAmount, - glvTokenAmount, - glvTokenUsd, - - marketTokenAmount, - marketTokenUsd, - shouldDisableValidation, - tokensData, - executionFee, - selectedMarketForGlv, - selectedMarketInfoForGlv, - glvInfo, - isFirstBuy, - } = props; - - const [isSubmitting, setIsSubmitting] = useState(false); - const chainId = useSelector(selectChainId); - const { signer, account } = useWallet(); - const { setPendingWithdrawal } = useSyntheticsEvents(); - const { setPendingTxns } = usePendingTxns(); - const blockTimestampData = useSelector(selectBlockTimestampData); - - const { onCreateDeposit } = useDepositTransactions(props); - - const onCreateWithdrawal = useCallback( - function onCreateWithdrawal() { - const metricData = - glvInfo && selectedMarketForGlv - ? initGLVSwapMetricData({ - chainId, - longTokenAddress, - shortTokenAddress, - selectedMarketForGlv, - isDeposit: false, - executionFee, - glvAddress: glvInfo.glvTokenAddress, - glvToken: glvInfo.glvToken, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - glvTokenAmount, - marketName: selectedMarketInfoForGlv?.name, - glvTokenUsd, - isFirstBuy, - }) - : initGMSwapMetricData({ - chainId, - longTokenAddress, - shortTokenAddress, - marketToken, - isDeposit: false, - executionFee, - marketInfo, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - marketTokenUsd, - isFirstBuy, - }); - - if ( - !account || - !marketInfo || - !marketToken || - !executionFee || - longTokenAmount === undefined || - shortTokenAmount === undefined || - !tokensData || - !signer - ) { - helperToast.error(t`Error submitting order`); - sendTxnValidationErrorMetric(metricData.metricId); - return Promise.resolve(); - } - - if (glvInfo && selectedMarketForGlv) { - return createGlvWithdrawalTxn(chainId, signer, { - account, - initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, - initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - glvTokenAddress: glvInfo.glvTokenAddress, - glvTokenAmount: glvTokenAmount!, - minLongTokenAmount: longTokenAmount, - minShortTokenAmount: shortTokenAmount, - executionFee: executionFee.feeTokenAmount, - executionGasLimit: executionFee.gasLimit, - allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, - skipSimulation: shouldDisableValidation, - tokensData, - setPendingTxns, - setPendingWithdrawal, - selectedGmMarket: selectedMarketForGlv, - glv: glvInfo.glvTokenAddress, - blockTimestampData, - }) - .then(makeTxnSentMetricsHandler(metricData.metricId)) - .catch(makeTxnErrorMetricsHandler(metricData.metricId)); - } - - return createWithdrawalTxn(chainId, signer, { - account, - initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, - initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - marketTokenAmount: marketTokenAmount!, - minLongTokenAmount: longTokenAmount, - minShortTokenAmount: shortTokenAmount, - marketTokenAddress: marketToken.address, - executionFee: executionFee.feeTokenAmount, - executionGasLimit: executionFee.gasLimit, - allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, - tokensData, - skipSimulation: shouldDisableValidation, - setPendingTxns, - setPendingWithdrawal, - blockTimestampData, - }) - .then(makeTxnSentMetricsHandler(metricData.metricId)) - .catch(makeTxnErrorMetricsHandler(metricData.metricId)); - }, - [ - glvInfo, - selectedMarketForGlv, - longTokenAddress, - shortTokenAddress, - executionFee, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - glvTokenAmount, - selectedMarketInfoForGlv?.name, - glvTokenUsd, - isFirstBuy, - marketToken, - marketInfo, - marketTokenUsd, - account, - tokensData, - signer, - chainId, - shouldDisableValidation, - setPendingTxns, - setPendingWithdrawal, - blockTimestampData, - ] - ); - - const onSubmit = useCallback(() => { - setIsSubmitting(true); - - let txnPromise: Promise; - - if (operation === Operation.Deposit) { - txnPromise = onCreateDeposit(); - } else if (operation === Operation.Withdrawal) { - txnPromise = onCreateWithdrawal(); - } else { - throw new Error("Invalid operation"); - } - - txnPromise - .catch((error) => { - throw error; - }) - .finally(() => { - setIsSubmitting(false); - }); - }, [operation, onCreateDeposit, onCreateWithdrawal]); - - return { - onSubmit, - isSubmitting, - }; -}; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx new file mode 100644 index 0000000000..4a479422ac --- /dev/null +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx @@ -0,0 +1,79 @@ +import { useCallback, useState } from "react"; + +import { ExecutionFee } from "domain/synthetics/fees"; +import { GlvInfo, MarketInfo } from "domain/synthetics/markets"; +import { TokenData, TokensData } from "domain/synthetics/tokens"; + +import { Operation } from "../../types"; +import type { GmPaySource } from "../types"; +import { useDepositTransactions } from "./useDepositTransactions"; +import { useWithdrawalTransactions } from "./useWithdrawalTransactions"; + +export interface UseLpTransactionProps { + marketInfo?: MarketInfo; + glvInfo?: GlvInfo; + marketToken: TokenData | undefined; + operation: Operation; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; + + marketTokenAmount: bigint | undefined; + marketTokenUsd: bigint | undefined; + longTokenAmount: bigint | undefined; + shortTokenAmount: bigint | undefined; + + glvTokenAmount: bigint | undefined; + glvTokenUsd: bigint | undefined; + + shouldDisableValidation?: boolean; + + tokensData: TokensData | undefined; + executionFee: ExecutionFee | undefined; + selectedMarketForGlv?: string; + selectedMarketInfoForGlv?: MarketInfo; + isMarketTokenDeposit?: boolean; + isFirstBuy: boolean; + paySource: GmPaySource; +} + +export const useLpTransactions = ( + props: UseLpTransactionProps +): { + onSubmit: () => void; + isSubmitting: boolean; +} => { + const { operation } = props; + + const [isSubmitting, setIsSubmitting] = useState(false); + + const { onCreateDeposit } = useDepositTransactions(props); + + const { onCreateWithdrawal } = useWithdrawalTransactions(props); + + const onSubmit = useCallback(() => { + setIsSubmitting(true); + + let txnPromise: Promise; + + if (operation === Operation.Deposit) { + txnPromise = onCreateDeposit(); + } else if (operation === Operation.Withdrawal) { + txnPromise = onCreateWithdrawal(); + } else { + throw new Error("Invalid operation"); + } + + txnPromise + .catch((error) => { + throw error; + }) + .finally(() => { + setIsSubmitting(false); + }); + }, [operation, onCreateDeposit, onCreateWithdrawal]); + + return { + onSubmit, + isSubmitting, + }; +}; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx new file mode 100644 index 0000000000..621911c484 --- /dev/null +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx @@ -0,0 +1,81 @@ +import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import type { CreateDepositParamsStruct, CreateGlvDepositParamsStruct } from "domain/synthetics/markets"; +import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; +import { buildAndSignMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; +import { useChainId } from "lib/chains"; +import useWallet from "lib/wallets/useWallet"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { GmPaySource } from "../types"; + +export function useMultichainDepositExpressTxnParams({ + transferRequests, + paySource, + gmParams, + glvParams, +}: { + transferRequests: IRelayUtils.TransferRequestsStruct; + paySource: GmPaySource; + gmParams: CreateDepositParamsStruct | undefined; + glvParams: CreateGlvDepositParamsStruct | undefined; +}) { + const { chainId, srcChainId } = useChainId(); + const { signer } = useWallet(); + + const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ + isGmxAccount: paySource === "gmxAccount", + enabled: paySource === "gmxAccount", + executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, + expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { + if ((!gmParams && !glvParams) || !signer) { + throw new Error("Invalid params"); + } + + if (glvParams) { + const txnData = await buildAndSignMultichainGlvDepositTxn({ + emptySignature: true, + account: glvParams!.addresses.receiver, + chainId, + params: glvParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + } + + const txnData = await buildAndSignMultichainDepositTxn({ + emptySignature: true, + account: gmParams!.addresses.receiver, + chainId, + params: gmParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + }, + }); + + return multichainDepositExpressTxnParams; +} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx new file mode 100644 index 0000000000..ff78b13350 --- /dev/null +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx @@ -0,0 +1,81 @@ +import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import type { CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; +import { buildAndSignMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; +import { buildAndSignMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; +import { useChainId } from "lib/chains"; +import useWallet from "lib/wallets/useWallet"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { GmPaySource } from "../types"; + +export function useMultichainWithdrawalExpressTxnParams({ + transferRequests, + paySource, + gmParams, + glvParams, +}: { + transferRequests: IRelayUtils.TransferRequestsStruct; + paySource: GmPaySource; + gmParams: CreateWithdrawalParamsStruct | undefined; + glvParams: CreateGlvWithdrawalParamsStruct | undefined; +}) { + const { chainId, srcChainId } = useChainId(); + const { signer } = useWallet(); + + const multichainWithdrawalExpressTxnParams = useArbitraryRelayParamsAndPayload({ + isGmxAccount: paySource === "gmxAccount", + enabled: paySource === "gmxAccount", + executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, + expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { + if ((!gmParams && !glvParams) || !signer) { + throw new Error("Invalid params"); + } + + if (glvParams) { + const txnData = await buildAndSignMultichainGlvWithdrawalTxn({ + emptySignature: true, + account: glvParams!.addresses.receiver, + chainId, + params: glvParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + } + + const txnData = await buildAndSignMultichainWithdrawalTxn({ + emptySignature: true, + account: gmParams!.addresses.receiver, + chainId, + params: gmParams!, + srcChainId, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...relayParams, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + signer, + transferRequests, + }); + + return { + txnData, + }; + }, + }); + + return multichainWithdrawalExpressTxnParams; +} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx new file mode 100644 index 0000000000..c67c8bfb52 --- /dev/null +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -0,0 +1,592 @@ +import { t } from "@lingui/macro"; +import chunk from "lodash/chunk"; +import { useCallback, useMemo } from "react"; +import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; + +import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; +import { + CHAIN_ID_TO_ENDPOINT_ID, + getLayerZeroEndpointId, + getMultichainTokenId, + getStargatePoolAddress, + isSettlementChain, +} from "config/multichain"; +import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; +import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; +import { useSyntheticsEvents } from "context/SyntheticsEvents"; +import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; +import { selectBlockTimestampData } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; +import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { + CreateGlvWithdrawalParamsStruct, + CreateWithdrawalParamsStruct, + createWithdrawalTxn, +} from "domain/synthetics/markets"; +import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; +import { createMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; +import { createMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; +import { createSourceChainWithdrawalTxn } from "domain/synthetics/markets/createSourceChainWithdrawalTxn"; +import { useChainId } from "lib/chains"; +import { helperToast } from "lib/helperToast"; +import { + initGLVSwapMetricData, + initGMSwapMetricData, + makeTxnErrorMetricsHandler, + makeTxnSentMetricsHandler, + sendTxnValidationErrorMetric, +} from "lib/metrics"; +import { EMPTY_ARRAY } from "lib/objects"; +import useWallet from "lib/wallets/useWallet"; +import { getContract } from "sdk/configs/contracts"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { convertTokenAddress } from "sdk/configs/tokens"; +import { nowInSeconds } from "sdk/utils/time"; +import { applySlippageToMinOut } from "sdk/utils/trade/trade"; +import { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { UseLpTransactionProps } from "./useLpTransactions"; +import { useMultichainWithdrawalExpressTxnParams } from "./useMultichainWithdrawalExpressTxnParams"; + +export const useWithdrawalTransactions = ({ + glvInfo, + selectedMarketForGlv, + longTokenAddress, + shortTokenAddress, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + marketTokenUsd, + glvTokenAmount, + glvTokenUsd, + isFirstBuy, + paySource, + executionFee, + selectedMarketInfoForGlv, + marketToken, + operation, + tokensData, + isMarketTokenDeposit, + marketInfo, + shouldDisableValidation, +}: UseLpTransactionProps) => { + const { chainId, srcChainId } = useChainId(); + const { signer, account } = useWallet(); + const { setPendingWithdrawal } = useSyntheticsEvents(); + const { setPendingTxns } = usePendingTxns(); + const blockTimestampData = useSelector(selectBlockTimestampData); + const globalExpressParams = useSelector(selectExpressGlobalParams); + + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; + const glvTokenAddress = glvInfo?.glvTokenAddress; + const glvTokenTotalSupply = glvInfo?.glvToken.totalSupply; + const executionFeeTokenAmount = executionFee?.feeTokenAmount; + const initialLongTokenAddress = longTokenAddress + ? convertTokenAddress(chainId, longTokenAddress, "wrapped") + : undefined; + const initialShortTokenAddress = + shortTokenAddress && initialLongTokenAddress + ? convertTokenAddress( + chainId, + marketInfo?.isSameCollaterals ? initialLongTokenAddress : shortTokenAddress, + "wrapped" + ) + : undefined; + + const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { + if (isGlv) { + return getTransferRequests([ + { + to: getContract(chainId, "GlvVault"), + token: glvTokenAddress, + amount: glvTokenAmount, + }, + ]); + } + + return getTransferRequests([ + { + to: getContract(chainId, "WithdrawalVault"), + token: marketTokenAddress, + amount: marketTokenAmount, + }, + ]); + }, [chainId, glvTokenAddress, glvTokenAmount, isGlv, marketTokenAddress, marketTokenAmount]); + + const gmParams = useMemo((): CreateWithdrawalParamsStruct | undefined => { + if ( + !account || + !marketTokenAddress || + marketTokenAmount === undefined || + executionFeeTokenAmount === undefined || + isGlv || + !initialLongTokenAddress || + !initialShortTokenAddress + ) { + console.log("NO GM PARAMS"); + + return undefined; + } + + // const minMarketTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketTokenAmount); + + let dataList: string[] = EMPTY_ARRAY; + + if (paySource === "sourceChain") { + if (!srcChainId) { + console.log("NO SRC CHAIN ID"); + + return undefined; + } + + const provider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, initialLongTokenAddress, "native")); + const secondaryProvider = getStargatePoolAddress( + chainId, + convertTokenAddress(chainId, initialShortTokenAddress, "native") + ); + + if (!provider || !secondaryProvider) { + console.log("NO PROVIDER OR SECONDARY PROVIDER", { + initialLongTokenAddress, + initialShortTokenAddress, + }); + return undefined; + } + + const dstEid = getLayerZeroEndpointId(srcChainId); + + if (!dstEid) { + console.log("NO DST EID"); + return undefined; + } + + const providerData = numberToHex(dstEid, { size: 32 }); + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + provider: provider, + providerData: providerData, + // TODO MLTCH apply some slippage + minAmountOut: 0n, + // TODO MLTCH put secondary provider and data + secondaryProvider: secondaryProvider, + secondaryProviderData: providerData, + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + const params: CreateWithdrawalParamsStruct = { + addresses: { + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + market: marketTokenAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + shouldUnwrapNativeToken: false, + executionFee: executionFeeTokenAmount, + callbackGasLimit: 0n, + dataList, + }; + + return params; + }, [ + account, + chainId, + executionFeeTokenAmount, + initialLongTokenAddress, + initialShortTokenAddress, + isGlv, + longTokenAmount, + marketTokenAddress, + marketTokenAmount, + paySource, + shortTokenAmount, + srcChainId, + ]); + + const glvParams = useMemo((): CreateGlvWithdrawalParamsStruct | undefined => { + if ( + !account || + executionFeeTokenAmount === undefined || + !isGlv || + glvTokenAmount === undefined || + !initialLongTokenAddress || + !initialShortTokenAddress + ) { + return undefined; + } + + const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, glvTokenAmount); + + let dataList: string[] = EMPTY_ARRAY; + if (paySource === "sourceChain") { + if (!srcChainId) { + return undefined; + } + + const tokenId = getMultichainTokenId(chainId, glvTokenAddress!); + if (!tokenId) { + return undefined; + } + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + minAmountOut: minGlvTokens / 2n, + provider: tokenId.stargate, + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), + // TODO MLTCH put secondary provider and data + secondaryProvider: zeroAddress, + secondaryProviderData: zeroAddress, + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + let shouldUnwrapNativeToken = false; + if (paySource === "settlementChain") { + shouldUnwrapNativeToken = true; + } + + const params: CreateGlvWithdrawalParamsStruct = { + addresses: { + glv: glvTokenAddress!, + market: selectedMarketForGlv!, + receiver: glvTokenTotalSupply === 0n ? numberToHex(1, { size: 20 }) : account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + executionFee: executionFeeTokenAmount, + callbackGasLimit: 0n, + shouldUnwrapNativeToken, + dataList, + }; + + return params; + }, [ + account, + chainId, + executionFeeTokenAmount, + glvTokenAddress, + glvTokenAmount, + glvTokenTotalSupply, + initialLongTokenAddress, + initialShortTokenAddress, + isGlv, + longTokenAmount, + paySource, + selectedMarketForGlv, + shortTokenAmount, + srcChainId, + ]); + + const multichainWithdrawalExpressTxnParams = useMultichainWithdrawalExpressTxnParams({ + transferRequests, + paySource, + gmParams, + glvParams, + }); + + const getWithdrawalMetricData = useCallback(() => { + const metricData = + glvInfo && selectedMarketForGlv + ? initGLVSwapMetricData({ + chainId, + longTokenAddress, + shortTokenAddress, + selectedMarketForGlv, + isDeposit: false, + executionFee, + glvAddress: glvInfo.glvTokenAddress, + glvToken: glvInfo.glvToken, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + glvTokenAmount, + marketName: selectedMarketInfoForGlv?.name, + glvTokenUsd, + isFirstBuy, + }) + : initGMSwapMetricData({ + chainId, + longTokenAddress, + shortTokenAddress, + marketToken, + isDeposit: false, + executionFee, + marketInfo, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + marketTokenUsd, + isFirstBuy, + }); + + return metricData; + }, [ + chainId, + executionFee, + glvInfo, + glvTokenAmount, + glvTokenUsd, + isFirstBuy, + longTokenAddress, + longTokenAmount, + marketInfo, + marketToken, + marketTokenAmount, + marketTokenUsd, + selectedMarketForGlv, + selectedMarketInfoForGlv?.name, + shortTokenAddress, + shortTokenAmount, + ]); + + const onCreateGlvWithdrawal = useCallback( + async function onCreateWithdrawal() { + const metricData = getWithdrawalMetricData(); + + if ( + !account || + !marketInfo || + !marketToken || + !executionFee || + longTokenAmount === undefined || + shortTokenAmount === undefined || + !tokensData || + !signer + ) { + helperToast.error(t`Error submitting order`); + sendTxnValidationErrorMetric(metricData.metricId); + return Promise.resolve(); + } + + let promise: Promise; + + if (paySource === "sourceChain") { + throw new Error("Not implemented"); + } else if (paySource === "gmxAccount") { + const expressTxnParams = await multichainWithdrawalExpressTxnParams.promise; + if (!expressTxnParams) { + console.log(multichainWithdrawalExpressTxnParams.error); + + throw new Error("Express txn params are not set"); + } + + promise = createMultichainGlvWithdrawalTxn({ + chainId, + signer, + params: glvParams!, + expressTxnParams, + transferRequests, + srcChainId, + }); + } else if (paySource === "settlementChain") { + // promise = createGlvWithdrawalTxn({ + // chainId, + // signer, + // account, + // initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, + // initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, + // longTokenSwapPath: [], + // shortTokenSwapPath: [], + // glvTokenAddress: glvInfo!.glvTokenAddress, + // glvTokenAmount: glvTokenAmount!, + // minLongTokenAmount: longTokenAmount, + // minShortTokenAmount: shortTokenAmount, + // executionFee: executionFee.feeTokenAmount, + // executionGasLimit: executionFee.gasLimit, + // allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, + // skipSimulation: shouldDisableValidation, + // tokensData, + // setPendingTxns, + // setPendingWithdrawal, + // selectedGmMarket: selectedMarketForGlv!, + // glv: glvInfo!.glvTokenAddress, + // blockTimestampData, + // }); + + promise = createGlvWithdrawalTxn({ + chainId, + signer, + params: glvParams!, + executionGasLimit: executionFee.gasLimit, + tokensData, + setPendingTxns, + setPendingWithdrawal, + blockTimestampData, + glvTokenAmount: glvTokenAmount!, + }); + } else { + throw new Error(`Invalid pay source: ${paySource}`); + } + + return promise + .then(makeTxnSentMetricsHandler(metricData.metricId)) + .catch(makeTxnErrorMetricsHandler(metricData.metricId)); + }, + [ + getWithdrawalMetricData, + account, + marketInfo, + marketToken, + executionFee, + longTokenAmount, + shortTokenAmount, + tokensData, + signer, + paySource, + multichainWithdrawalExpressTxnParams.promise, + multichainWithdrawalExpressTxnParams.error, + chainId, + glvParams, + transferRequests, + srcChainId, + setPendingTxns, + setPendingWithdrawal, + blockTimestampData, + glvTokenAmount, + ] + ); + + const onCreateGmWithdrawal = useCallback( + async function onCreateWithdrawal() { + const metricData = getWithdrawalMetricData(); + + if ( + !account || + !marketInfo || + !marketToken || + !executionFee || + longTokenAmount === undefined || + shortTokenAmount === undefined || + !tokensData || + !signer + ) { + helperToast.error(t`Error submitting order`); + sendTxnValidationErrorMetric(metricData.metricId); + return Promise.resolve(); + } + + let promise: Promise; + + if (paySource === "sourceChain") { + if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams) { + throw new Error("An error occurred"); + } + + // throw new Error("Not implemented"); + promise = createSourceChainWithdrawalTxn({ + chainId, + srcChainId, + signer, + globalExpressParams, + // executionFee: executionFee.feeTokenAmount, + transferRequests, + params: gmParams!, + tokenAmount: marketTokenAmount!, + }); + } else if (paySource === "gmxAccount") { + const expressTxnParams = await multichainWithdrawalExpressTxnParams.promise; + if (!expressTxnParams) { + console.log(multichainWithdrawalExpressTxnParams.error); + + throw new Error("Express txn params are not set"); + } + + promise = createMultichainWithdrawalTxn({ + chainId, + signer, + params: gmParams!, + expressTxnParams, + transferRequests, + srcChainId, + }); + } else if (paySource === "settlementChain") { + promise = createWithdrawalTxn({ + chainId, + signer, + // account, + // initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, + // initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, + // longTokenSwapPath: [], + // shortTokenSwapPath: [], + marketTokenAmount: marketTokenAmount!, + // minLongTokenAmount: longTokenAmount, + // minShortTokenAmount: shortTokenAmount, + // marketTokenAddress: marketToken.address, + // executionFee: executionFee.feeTokenAmount, + executionGasLimit: executionFee.gasLimit, + params: gmParams!, + // allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, + tokensData, + skipSimulation: shouldDisableValidation, + setPendingTxns, + setPendingWithdrawal, + blockTimestampData, + }); + } else { + throw new Error(`Invalid pay source: ${paySource}`); + } + + return promise + .then(makeTxnSentMetricsHandler(metricData.metricId)) + .catch(makeTxnErrorMetricsHandler(metricData.metricId)); + }, + [ + getWithdrawalMetricData, + account, + marketInfo, + marketToken, + executionFee, + longTokenAmount, + shortTokenAmount, + tokensData, + signer, + paySource, + chainId, + srcChainId, + globalExpressParams, + transferRequests, + gmParams, + marketTokenAmount, + multichainWithdrawalExpressTxnParams.promise, + multichainWithdrawalExpressTxnParams.error, + shouldDisableValidation, + setPendingTxns, + setPendingWithdrawal, + blockTimestampData, + ] + ); + + const onCreateWithdrawal = isGlv ? onCreateGlvWithdrawal : onCreateGmWithdrawal; + + return { + onCreateWithdrawal, + }; +}; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx index 6b7e2a8a39..3971debff5 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from "react"; +import type { SourceChainId } from "config/chains"; import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; @@ -18,6 +19,30 @@ function isValidPaySource(paySource: string | undefined): paySource is GmPaySour ); } +function fallbackPaySource({ + operation, + mode, + paySource, + srcChainId, +}: { + operation: Operation; + mode: Mode; + paySource: GmPaySource | undefined; + srcChainId: SourceChainId | undefined; +}) { + if (!isValidPaySource(paySource)) { + return "gmxAccount"; + } else if (paySource === "sourceChain" && srcChainId === undefined) { + return "settlementChain"; + } else if (paySource === "settlementChain" && srcChainId !== undefined) { + return "sourceChain"; + } else if (operation === Operation.Deposit && paySource === "sourceChain" && mode === Mode.Pair) { + return "gmxAccount"; + } + + return paySource; +} + export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, marketAddress: string | undefined) { const isDeposit = operation === Operation.Deposit; @@ -31,29 +56,16 @@ export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, "settlementChain" ); - let paySource = rawPaySource; - - if (!isValidPaySource(paySource)) { - paySource = "gmxAccount"; - } else if (rawPaySource === "sourceChain" && srcChainId === undefined) { - paySource = "settlementChain"; - } else if (rawPaySource === "settlementChain" && srcChainId !== undefined) { - paySource = "sourceChain"; - } else if (paySource === "sourceChain" && mode === Mode.Pair) { - paySource = "gmxAccount"; - } + let paySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); useEffect( function fallbackSourceChainPaySource() { - if (rawPaySource === "sourceChain" && srcChainId === undefined) { - setPaySource("settlementChain"); - } else if (rawPaySource === "settlementChain" && srcChainId !== undefined) { - setPaySource("sourceChain"); - } else if (rawPaySource === "sourceChain" && mode === Mode.Pair) { - setPaySource("gmxAccount"); + const newPaySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); + if (newPaySource !== rawPaySource) { + setPaySource(newPaySource); } }, - [mode, rawPaySource, setPaySource, srcChainId] + [mode, operation, rawPaySource, setPaySource, srcChainId] ); let [isSendBackToSourceChain, setIsSendBackToSourceChain] = useLocalStorageSerializeKey( diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index e64eed0b84..6f5a72181c 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -16,9 +16,9 @@ import { userAnalytics } from "lib/userAnalytics"; import { TokenApproveClickEvent, TokenApproveResultEvent } from "lib/userAnalytics/types"; import useWallet from "lib/wallets/useWallet"; +import { useLpTransactions } from "./lpTxn/useLpTransactions"; import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; -import { useDepositWithdrawalTransactions } from "./useDepositWithdrawalTransactions"; import { useTokensToApprove } from "./useTokensToApprove"; import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; import { Operation } from "../types"; @@ -50,6 +50,7 @@ interface Props { glvAndMarketsInfoData: GlvAndGmMarketsInfoData; selectedMarketInfoForGlv?: MarketInfo; paySource: GmPaySource; + isPair: boolean; } const processingTextMap = { @@ -93,6 +94,7 @@ export const useGmSwapSubmitState = ({ isMarketTokenDeposit, glvAndMarketsInfoData, paySource, + isPair, }: Props): SubmitButtonState => { const chainId = useSelector(selectChainId); const hasOutdatedUi = useHasOutdatedUi(); @@ -112,7 +114,7 @@ export const useGmSwapSubmitState = ({ const isFirstBuy = Object.values(marketTokensData ?? {}).every((marketToken) => marketToken.balance === 0n); - const { isSubmitting, onSubmit } = useDepositWithdrawalTransactions({ + const { isSubmitting, onSubmit } = useLpTransactions({ marketInfo, marketToken, operation, @@ -167,6 +169,8 @@ export const useGmSwapSubmitState = ({ priceImpactUsd: fees?.swapPriceImpact?.deltaUsd, marketTokensData, isMarketTokenDeposit, + paySource, + isPair, }); const error = commonError || swapError; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/SelectedPool.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/SelectedPool.tsx index 066e78f39e..b028dfb7c1 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/SelectedPool.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/SelectedPool.tsx @@ -37,7 +37,7 @@ export function SelectedPool({ ); } -function SelectedPoolLabel({ glvOrMarketInfo }: { glvOrMarketInfo: GlvOrMarketInfo | undefined }) { +export function SelectedPoolLabel({ glvOrMarketInfo }: { glvOrMarketInfo: GlvOrMarketInfo | undefined }) { if (!glvOrMarketInfo) return "..."; let name: string; diff --git a/src/components/Synthetics/GmxAccountModal/DepositView.tsx b/src/components/Synthetics/GmxAccountModal/DepositView.tsx index 39aac9cfe2..0176ee2d49 100644 --- a/src/components/Synthetics/GmxAccountModal/DepositView.tsx +++ b/src/components/Synthetics/GmxAccountModal/DepositView.tsx @@ -301,7 +301,7 @@ export const DepositView = () => { srcChainId: depositViewChain, composeGas, dstChainId: settlementChainId, - isDeposit: true, + isToGmx: true, }); }, [account, inputAmount, depositViewChain, composeGas, settlementChainId]); diff --git a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx index d9d58b518e..3820af34bf 100644 --- a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx @@ -235,7 +235,7 @@ export const WithdrawalView = () => { dstChainId: withdrawalViewChain, account, amount: inputAmount, - isDeposit: false, + isToGmx: false, }); }, [account, inputAmount, withdrawalViewChain]); @@ -294,7 +294,7 @@ export const WithdrawalView = () => { dstChainId: withdrawalViewChain, account, amount: fakeInputAmount, - isDeposit: false, + isToGmx: false, srcChainId: chainId, }); }, [account, chainId, unwrappedSelectedTokenSymbol, withdrawalViewChain]); diff --git a/src/components/TokenSelector/MultichainMarketTokenSelector.tsx b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx new file mode 100644 index 0000000000..52c9d60a7d --- /dev/null +++ b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx @@ -0,0 +1,389 @@ +import { t } from "@lingui/macro"; +import cx from "classnames"; +import { useMemo, useState } from "react"; +import { BiChevronDown } from "react-icons/bi"; + +import { getChainName, type AnyChainId, type ContractsChainId, type SourceChainId } from "config/chains"; +import { getChainIcon } from "config/icons"; +import { MULTI_CHAIN_TOKEN_MAPPING } from "config/multichain"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { GlvOrMarketInfo } from "domain/synthetics/markets/types"; +import { convertToUsd } from "domain/tokens"; +import { formatAmount, formatBalanceAmount } from "lib/numbers"; +import { EMPTY_ARRAY, EMPTY_OBJECT } from "lib/objects"; +import { USD_DECIMALS } from "sdk/configs/factors"; +import { getTokenBySymbol } from "sdk/configs/tokens"; +import { getMarketPoolName } from "sdk/utils/markets"; + +import Button from "components/Button/Button"; +import { SlideModal } from "components/Modal/SlideModal"; +import { GmPaySource } from "components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; +import { SelectedPoolLabel } from "components/Synthetics/GmSwap/GmSwapBox/SelectedPool"; +import { ButtonRowScrollFadeContainer } from "components/TableScrollFade/TableScrollFade"; +import TokenIcon from "components/TokenIcon/TokenIcon"; + +import "./TokenSelector.scss"; + +type Props = { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + + label?: string; + className?: string; + + paySource: GmPaySource; + onSelectTokenAddress: (srcChainId: AnyChainId | 0) => void; + + marketInfo: GlvOrMarketInfo | undefined; + marketTokenPrice: bigint | undefined; + tokenBalancesData: Partial>; +}; + +export function MultichainMarketTokenSelector({ + chainId, + srcChainId, + onSelectTokenAddress: propsOnSelectTokenAddress, + paySource, + className, + label, + marketInfo, + marketTokenPrice, + tokenBalancesData, +}: Props) { + const [isModalVisible, setIsModalVisible] = useState(false); + const [activeFilter, setActiveFilter] = useState<"all" | AnyChainId | 0>("all"); + + const NETWORKS_FILTER = useMemo(() => { + const wildCard = { id: "all" as const, name: t`All Networks` }; + const gmxAccount = { id: 0 as const, name: t`GMX Account` }; + const settlementChain = { id: chainId, name: getChainName(chainId) }; + + const chainFilters = Object.keys(MULTI_CHAIN_TOKEN_MAPPING[chainId] ?? EMPTY_OBJECT).map((sourceChainId) => ({ + id: parseInt(sourceChainId) as AnyChainId | 0, + name: getChainName(parseInt(sourceChainId)), + })); + + return [wildCard, settlementChain, gmxAccount, ...chainFilters]; + }, [chainId]); + + const onSelectTokenAddress = (tokenChainId: AnyChainId | 0) => { + setIsModalVisible(false); + propsOnSelectTokenAddress(tokenChainId); + }; + + // useEffect(() => { + // if (isModalVisible) { + // setSearchKeyword(""); + // } + // }, [isModalVisible]); + + // TODO implement + // const _handleKeyDown = (e) => { + // if (e.key === "Enter") { + // e.preventDefault(); + // e.stopPropagation(); + // if (filteredTokens.length > 0) { + // onSelectToken(filteredTokens[0]); + // } + // } + // }; + + // const isGmxAccountEmpty = useMemo(() => { + // if (!tokensData) return true; + + // const allEmpty = Object.values(tokensData).every( + // (token) => token.gmxAccountBalance === undefined || token.gmxAccountBalance === 0n + // ); + + // return allEmpty; + // }, [tokensData]); + + // useEffect(() => { + // if (isModalVisible) { + // setSearchKeyword(""); + + // if (srcChainId === undefined) { + // setActiveFilter("pay"); + // } else { + // if (isGmxAccountEmpty) { + // setActiveFilter("deposit"); + // } else { + // setActiveFilter("pay"); + // } + // } + // } + // }, [isGmxAccountEmpty, isModalVisible, setSearchKeyword, srcChainId]); + + // if (!token) { + // return null; + // } + + return ( +
event.stopPropagation()}> + + +
+ {NETWORKS_FILTER.map((network) => ( + + ))} +
+
+
+ } + contentPadding={false} + > + + +
setIsModalVisible(true)} + > + {marketInfo && ( + + + + + )} + + +
+
+ ); +} + +type DisplayToken = { + symbol: string; + indexTokenAddress: string | undefined; + longTokenAddress: string; + shortTokenAddress: string; + balance: bigint; + balanceUsd: bigint; + chainId: AnyChainId | 0; +}; + +function AvailableToTradeTokenList({ + chainId, + srcChainId, + onSelectTokenAddress, + marketInfo, + tokenBalancesData, + marketTokenPrice, + activeFilter, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + onSelectTokenAddress: (tokenChainId: AnyChainId | 0) => void; + marketInfo: GlvOrMarketInfo | undefined; + tokenBalancesData: Partial>; + marketTokenPrice: bigint | undefined; + activeFilter: AnyChainId | 0 | "all"; +}) { + const { gmStubToken, glvStubToken } = useMemo(() => { + return { + gmStubToken: getTokenBySymbol(chainId, "GM"), + glvStubToken: getTokenBySymbol(chainId, "GLV"), + }; + }, [chainId]); + + const sortedFilteredTokens = useMemo((): DisplayToken[] => { + if (!marketInfo) return EMPTY_ARRAY; + // const concatenatedTokens: DisplayToken[] = []; + + // if (includeMultichainTokensInPay && multichainTokens) { + // for (const token of multichainTokens) { + // if (token.sourceChainBalance === undefined) { + // continue; + // } + + // const balanceUsd = + // convertToUsd(token.sourceChainBalance, token.sourceChainDecimals, token.sourceChainPrices?.maxPrice) ?? 0n; + // concatenatedTokens.push({ + // ...token, + // balance: token.sourceChainBalance, + // balanceUsd, + // chainId: token.sourceChainId, + // }); + // } + // } + + // let filteredTokens: DisplayToken[]; + // if (!searchKeyword.trim()) { + // filteredTokens = concatenatedTokens; + // } else { + // filteredTokens = searchBy( + // concatenatedTokens, + // [ + // (item) => { + // let name = item.name; + + // return stripBlacklistedWords(name); + // }, + // "symbol", + // ], + // searchKeyword + // ); + // } + + // const tokensWithBalance: DisplayToken[] = []; + // const tokensWithoutBalance: DisplayToken[] = []; + + // for (const token of filteredTokens) { + // const balance = token.balance; + + // if (balance !== undefined && balance > 0n) { + // tokensWithBalance.push(token); + // } else { + // tokensWithoutBalance.push(token); + // } + // } + + // const sortedTokensWithBalance: DisplayToken[] = tokensWithBalance.sort((a, b) => { + // if (a.balanceUsd === b.balanceUsd) { + // return 0; + // } + // return b.balanceUsd - a.balanceUsd > 0n ? 1 : -1; + // }); + + // const sortedTokensWithoutBalance: DisplayToken[] = tokensWithoutBalance.sort((a, b) => { + // if (extendedSortSequence) { + // // making sure to use the wrapped address if it exists in the extended sort sequence + // const aAddress = + // a.wrappedAddress && extendedSortSequence.includes(a.wrappedAddress) ? a.wrappedAddress : a.address; + + // const bAddress = + // b.wrappedAddress && extendedSortSequence.includes(b.wrappedAddress) ? b.wrappedAddress : b.address; + + // return extendedSortSequence.indexOf(aAddress) - extendedSortSequence.indexOf(bAddress); + // } + + // return 0; + // }); + + // return [...sortedTokensWithBalance, ...sortedTokensWithoutBalance]; + return Object.entries(tokenBalancesData) + .filter(([chainId]) => { + if (activeFilter === "all") { + return true; + } + return parseInt(chainId) === activeFilter; + }) + .map(([chainId, balance]: [string, bigint | undefined]): DisplayToken | undefined => { + if (balance === undefined) { + return undefined; + } + const symbol = isGlvInfo(marketInfo) ? marketInfo.glvToken.symbol : marketInfo.indexToken.symbol; + const indexTokenAddress = isGlvInfo(marketInfo) ? marketInfo.glvToken.address : marketInfo.indexToken.address; + + return { + balance, + balanceUsd: + convertToUsd( + balance, + isGlvInfo(marketInfo) ? glvStubToken.decimals : gmStubToken.decimals, + marketTokenPrice + ) ?? 0n, + chainId: parseInt(chainId) as AnyChainId | 0, + symbol, + indexTokenAddress, + longTokenAddress: marketInfo.longToken.address, + shortTokenAddress: marketInfo.shortToken.address, + }; + }) + .filter((token): token is DisplayToken => token !== undefined); + }, [activeFilter, glvStubToken.decimals, gmStubToken.decimals, marketInfo, marketTokenPrice, tokenBalancesData]); + + return ( +
+ {sortedFilteredTokens.map((token) => { + return ( +
onSelectTokenAddress(token.chainId)} + > +
+ + + {/* */} + {marketInfo && ( +
+
+ {isGlvInfo(marketInfo) ? ( + marketInfo.name + ) : ( + <> + {marketInfo?.indexToken.symbol} + /USD + + )} +
+
[{getMarketPoolName(marketInfo)}]
+
+ )} +
+
+
+ {token.balance > 0n && + formatBalanceAmount( + token.balance, + isGlvInfo(marketInfo) ? glvStubToken.decimals : gmStubToken.decimals, + isGlvInfo(marketInfo) ? "GLV" : "GM", + { + isStable: false, + } + )} + {token.balance == 0n && "-"} +
+ + + {token.balanceUsd > 0n &&
(${formatAmount(token.balanceUsd, USD_DECIMALS, 2, true)})
} +
+
+
+ ); + })} +
+ ); +} diff --git a/src/components/TokenSelector/MultichainTokenSelector.tsx b/src/components/TokenSelector/MultichainTokenSelector.tsx index dd16fc9f20..19b982d864 100644 --- a/src/components/TokenSelector/MultichainTokenSelector.tsx +++ b/src/components/TokenSelector/MultichainTokenSelector.tsx @@ -33,7 +33,6 @@ type Props = { payChainId: AnyChainId | 0 | undefined; tokensData: TokensData | undefined; - selectedTokenLabel?: ReactNode | string; onSelectTokenAddress: (tokenAddress: string, isGmxAccount: boolean, srcChainId: SourceChainId | undefined) => void; extendedSortSequence?: string[] | undefined; @@ -50,7 +49,6 @@ export function MultichainTokenSelector({ chainId, srcChainId, tokensData, - selectedTokenLabel, extendedSortSequence, footerContent, qa, @@ -209,18 +207,16 @@ export function MultichainTokenSelector({ className="group/hoverable group flex cursor-pointer items-center gap-5 whitespace-nowrap hover:text-blue-300" onClick={() => setIsModalVisible(true)} > - {selectedTokenLabel || ( - - - {token.symbol} - - )} + + + {token.symbol} +
diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index 3bebd13752..bbb7a91dd7 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -2,15 +2,21 @@ import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities"; import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex } from "viem"; import type { RelayParamsPayload } from "domain/synthetics/express"; -import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct } from "domain/synthetics/markets/types"; +import { + CreateDepositParamsStruct, + CreateGlvDepositParamsStruct, + CreateWithdrawalParamsStruct, +} from "domain/synthetics/markets/types"; import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; import { hashString } from "sdk/utils/hash"; import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { + BRIDGE_OUT_PARAMS, CREATE_DEPOSIT_PARAMS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE, + CREATE_WITHDRAWAL_PARAMS_TYPE, RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, } from "./hashParamsAbiItems"; @@ -21,6 +27,8 @@ export enum MultichainActionType { GlvDeposit = 2, BridgeOut = 3, SetTraderReferralCode = 4, + Withdrawal = 5, + GlvWithdrawal = 6, } type CommonActionData = { @@ -53,6 +61,9 @@ type BridgeOutActionData = { provider: string; providerData: string; minAmountOut: bigint; + secondaryProvider: string; + secondaryProviderData: string; + secondaryMinAmountOut: bigint; }; type BridgeOutAction = { @@ -70,7 +81,22 @@ type GlvDepositAction = { actionData: GlvDepositActionData; }; -export type MultichainAction = SetTraderReferralCodeAction | DepositAction | BridgeOutAction | GlvDepositAction; +type WithdrawalActionData = CommonActionData & { + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; +}; + +type WithdrawalAction = { + actionType: MultichainActionType.Withdrawal; + actionData: WithdrawalActionData; +}; + +export type MultichainAction = + | SetTraderReferralCodeAction + | DepositAction + | BridgeOutAction + | GlvDepositAction + | WithdrawalAction; export const GMX_DATA_ACTION_HASH = hashString("GMX_DATA_ACTION"); // TODO MLTCH also implement bytes32 public constant MAX_DATA_LENGTH = keccak256(abi.encode("MAX_DATA_LENGTH")); @@ -104,20 +130,17 @@ export class CodecUiHelper { } public static encodeMultichainActionData(action: MultichainAction): string { + let actionData: Hex | undefined; if (action.actionType === MultichainActionType.SetTraderReferralCode) { - const actionData = encodeAbiParameters( + actionData = encodeAbiParameters( [RELAY_PARAMS_TYPE, { type: "bytes32" }], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, action.actionData.referralCode as Hex, ] ); - - const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); - - return data; } else if (action.actionType === MultichainActionType.Deposit) { - const actionData = encodeAbiParameters( + actionData = encodeAbiParameters( [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_DEPOSIT_PARAMS_TYPE], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, @@ -125,27 +148,24 @@ export class CodecUiHelper { action.actionData.params, ] ); - - const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); - - return data; } else if (action.actionType === MultichainActionType.BridgeOut) { - const actionData = encodeAbiParameters( - [{ type: "uint256" }, { type: "uint256" }, { type: "address" }, { type: "bytes" }, { type: "uint256" }], + actionData = encodeAbiParameters( + [BRIDGE_OUT_PARAMS], [ - BigInt(action.actionData.desChainId), - action.actionData.deadline, - action.actionData.provider as Address, - action.actionData.providerData as Hex, - action.actionData.minAmountOut, + { + desChainId: BigInt(action.actionData.desChainId), + deadline: action.actionData.deadline, + provider: action.actionData.provider as Address, + providerData: action.actionData.providerData as Hex, + minAmountOut: action.actionData.minAmountOut, + secondaryProvider: action.actionData.secondaryProvider as Address, + secondaryProviderData: action.actionData.secondaryProviderData as Hex, + secondaryMinAmountOut: action.actionData.secondaryMinAmountOut, + }, ] ); - - const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); - - return data; } else if (action.actionType === MultichainActionType.GlvDeposit) { - const actionData = encodeAbiParameters( + actionData = encodeAbiParameters( [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, @@ -153,12 +173,23 @@ export class CodecUiHelper { action.actionData.params, ] ); + } else if (action.actionType === MultichainActionType.Withdrawal) { + actionData = encodeAbiParameters( + [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_WITHDRAWAL_PARAMS_TYPE], + [ + { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, + action.actionData.transferRequests, + action.actionData.params, + ] + ); + } - const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); - - return data; + if (!actionData) { + throw new Error("Unsupported multichain action type"); } - throw new Error("Unsupported multichain action type"); + const data = encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [action.actionType, actionData]); + + return data; } } diff --git a/src/domain/multichain/codecs/hashParamsAbiItems.ts b/src/domain/multichain/codecs/hashParamsAbiItems.ts index 7413334f30..f1ced189d0 100644 --- a/src/domain/multichain/codecs/hashParamsAbiItems.ts +++ b/src/domain/multichain/codecs/hashParamsAbiItems.ts @@ -58,7 +58,7 @@ export const TRANSFER_REQUESTS_TYPE = { { type: "address[]", name: "receivers" }, { type: "uint256[]", name: "amounts" }, ], -}; +} as const; export const CREATE_DEPOSIT_PARAMS_TYPE = { type: "tuple", @@ -84,7 +84,7 @@ export const CREATE_DEPOSIT_PARAMS_TYPE = { { type: "uint256", name: "callbackGasLimit" }, { type: "bytes32[]", name: "dataList" }, ], -}; +} as const; export const CREATE_GLV_DEPOSIT_PARAMS_TYPE = { type: "tuple", @@ -112,4 +112,44 @@ export const CREATE_GLV_DEPOSIT_PARAMS_TYPE = { { type: "bool", name: "isMarketTokenDeposit" }, { type: "bytes32[]", name: "dataList" }, ], -}; +} as const; + +export const CREATE_WITHDRAWAL_PARAMS_TYPE = { + type: "tuple", + name: "", + components: [ + { + type: "tuple", + name: "addresses", + components: [ + { type: "address", name: "receiver" }, + { type: "address", name: "callbackContract" }, + { type: "address", name: "uiFeeReceiver" }, + { type: "address", name: "market" }, + { type: "address[]", name: "longTokenSwapPath" }, + { type: "address[]", name: "shortTokenSwapPath" }, + ], + }, + { type: "uint256", name: "minLongTokenAmount" }, + { type: "uint256", name: "minShortTokenAmount" }, + { type: "bool", name: "shouldUnwrapNativeToken" }, + { type: "uint256", name: "executionFee" }, + { type: "uint256", name: "callbackGasLimit" }, + { type: "bytes32[]", name: "dataList" }, + ], +} as const; + +export const BRIDGE_OUT_PARAMS = { + type: "tuple", + name: "", + components: [ + { type: "uint256", name: "desChainId" }, + { type: "uint256", name: "deadline" }, + { type: "address", name: "provider" }, + { type: "bytes", name: "providerData" }, + { type: "uint256", name: "minAmountOut" }, + { type: "address", name: "secondaryProvider" }, + { type: "bytes", name: "secondaryProviderData" }, + { type: "uint256", name: "secondaryMinAmountOut" }, + ], +} as const; diff --git a/src/domain/multichain/getSendParams.ts b/src/domain/multichain/getSendParams.ts index b598ff8c06..0fb1f0bd9a 100644 --- a/src/domain/multichain/getSendParams.ts +++ b/src/domain/multichain/getSendParams.ts @@ -18,15 +18,17 @@ export function getMultichainTransferSendParams({ srcChainId, amount, composeGas, - isDeposit, + isToGmx, action, + isManualGas = false, }: { dstChainId: AnyChainId; account: string; srcChainId?: AnyChainId; amount: bigint; composeGas?: bigint; - isDeposit: boolean; + isToGmx: boolean; + isManualGas?: boolean; action?: MultichainAction; }): SendParamStruct { const oftCmd: OftCmd = new OftCmd(SEND_MODE_TAXI, []); @@ -34,16 +36,16 @@ export function getMultichainTransferSendParams({ const dstEid = getLayerZeroEndpointId(dstChainId); if (dstEid === undefined) { - throw new Error(`No layer zero endpoint for chain id ${dstChainId}`); + throw new Error(`No layer zero endpoint for chain: ${dstChainId}`); } - if (isDeposit && (!isSettlementChain(dstChainId) || composeGas === undefined)) { - throw new Error("LayerZero provider is not supported on this chain"); + if (isToGmx && (!isSettlementChain(dstChainId) || composeGas === undefined)) { + throw new Error(`LayerZero provider is not supported on this chain: ${dstChainId}`); } let to: string; - if (isDeposit) { + if (isToGmx) { to = toHex(addressToBytes32(getContract(dstChainId as ContractsChainId, "LayerZeroProvider"))); } else { to = toHex(addressToBytes32(account)); @@ -52,11 +54,8 @@ export function getMultichainTransferSendParams({ let composeMsg = "0x"; let extraOptions = "0x"; - if (isDeposit) { - if (srcChainId === undefined) { - throw new Error("Source chain is not supported"); - } - if (!isSourceChain(srcChainId)) { + if (isToGmx) { + if (srcChainId === undefined || !isSourceChain(srcChainId)) { throw new Error("Source chain is not supported"); } @@ -64,7 +63,13 @@ export function getMultichainTransferSendParams({ composeMsg = CodecUiHelper.encodeDepositMessage(account, data); const builder = Options.newOptions(); - extraOptions = builder.addExecutorComposeOption(0, composeGas!, 0).toHex(); + + if (isManualGas) { + // TODO MLTCH remove hardcode + extraOptions = builder.addExecutorLzReceiveOption(150_000n).addExecutorComposeOption(0, composeGas!, 0n).toHex(); + } else { + extraOptions = builder.addExecutorComposeOption(0, composeGas!, 0).toHex(); + } } else { const builder = Options.newOptions(); extraOptions = builder.toHex(); diff --git a/src/domain/multichain/getTransferRequests.tsx b/src/domain/multichain/getTransferRequests.tsx new file mode 100644 index 0000000000..c8e1a1d805 --- /dev/null +++ b/src/domain/multichain/getTransferRequests.tsx @@ -0,0 +1,27 @@ +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +export function getTransferRequests( + transfers: { + to: string; + token: string | undefined; + amount: bigint | undefined; + }[] +): IRelayUtils.TransferRequestsStruct { + const requests: IRelayUtils.TransferRequestsStruct = { + tokens: [], + receivers: [], + amounts: [], + }; + + for (const transfer of transfers) { + if (!transfer.token || transfer.amount === undefined || transfer.amount <= 0n) { + continue; + } + + requests.tokens.push(transfer.token); + requests.receivers.push(transfer.to); + requests.amounts.push(transfer.amount); + } + + return requests; +} diff --git a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts index eb46d014e5..c128804ee5 100644 --- a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts +++ b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts @@ -16,7 +16,7 @@ import { useGmxAccountDepositViewChain } from "context/GmxAccountContext/hooks"; import { useChainId } from "lib/chains"; import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { abis } from "sdk/abis"; -import { getToken } from "sdk/configs/tokens"; +import { getToken, isValidTokenSafe } from "sdk/configs/tokens"; import { CodecUiHelper, MultichainAction } from "./codecs/CodecUiHelper"; import { OFTComposeMsgCodec } from "./codecs/OFTComposeMsgCodec"; @@ -104,7 +104,10 @@ export async function estimateMultichainDepositNetworkComposeGas({ throw new Error("Stargate endpoint ID not found"); } - const fakeAmount = FAKE_INPUT_AMOUNT_MAP[getToken(chainId, tokenAddress).symbol] ?? 10n ** 18n; + // TODO get decimals from token config + const fakeAmount = isValidTokenSafe(chainId, tokenAddress) + ? FAKE_INPUT_AMOUNT_MAP[getToken(chainId, tokenAddress).symbol] ?? 10n ** 18n + : 10n ** 18n; const message = OFTComposeMsgCodec.encode(0n, sourceChainEndpointId, fakeAmount, composeFromWithMsg); diff --git a/src/domain/synthetics/markets/createBridgeInTxn.ts b/src/domain/synthetics/markets/createBridgeInTxn.ts new file mode 100644 index 0000000000..43c7d63d26 --- /dev/null +++ b/src/domain/synthetics/markets/createBridgeInTxn.ts @@ -0,0 +1,83 @@ +import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import { encodeFunctionData, Hex, zeroAddress } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { GlobalExpressParams } from "domain/synthetics/express"; +import { sendWalletTransaction } from "lib/transactions"; +import { WalletSigner } from "lib/wallets"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { IStargate, IStargate__factory } from "typechain-types-stargate"; +import { SendParamStruct } from "typechain-types-stargate/IStargate"; + +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + +export async function createBridgeInTxn({ + chainId, + srcChainId, + signer, + account, + tokenAddress, + tokenAmount, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + account: string; + tokenAddress: string; + tokenAmount: bigint; +}) { + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + chainId, + account, + srcChainId, + tokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + amount: tokenAmount, + composeGas, + isToGmx: true, + isManualGas: true, + }); + + const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + functionName: "send", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + }), + value, + msg: t`Sent transfer in transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/domain/synthetics/markets/createBridgeOutTxn.ts b/src/domain/synthetics/markets/createBridgeOutTxn.ts new file mode 100644 index 0000000000..c7c689e69d --- /dev/null +++ b/src/domain/synthetics/markets/createBridgeOutTxn.ts @@ -0,0 +1,103 @@ +import { encodeFunctionData } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { WalletSigner } from "lib/wallets"; +import { abis } from "sdk/abis"; + +import { signCreateBridgeOut } from "./signCreateBridgeOut"; + +type TxnParams = { + chainId: SettlementChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + relayParams: RelayParamsPayload; + emptySignature?: boolean; + tokenAddress: string; + tokenAmount: bigint; + relayerFeeTokenAddress: string; + relayerFeeAmount: bigint; +}; + +async function buildAndSignBridgeOutTxn({ + chainId, + srcChainId, + signer, + relayParams, + emptySignature, + tokenAddress, + tokenAmount, + relayerFeeTokenAddress, + relayerFeeAmount, +}: TxnParams): Promise { + let signature: string; + + if (emptySignature) { + signature = "0x"; + } else { + signature = await signCreateBridgeOut(); + } + + const bridgeOutData = encodeFunctionData({ + abi: abis.MultichainTransferRouter, + functionName: "", + }); +} + +export async function createBridgeOutTxn({ + chainId, + srcChainId, + signer, + account, + tokenAddress, + tokenAmount, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + account: string; + tokenAddress: string; + tokenAmount: bigint; +}) { + // const composeGas = await estimateMultichainDepositNetworkComposeGas({ + // chainId, + // account, + // srcChainId, + // tokenAddress, + // settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + // }); + // const sendParams: SendParamStruct = getMultichainTransferSendParams({ + // dstChainId: chainId, + // account, + // srcChainId, + // amount: tokenAmount, + // composeGas, + // isToGmx: true, + // isManualGas: true, + // }); + // const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); + // if (!sourceChainTokenId) { + // throw new Error("Token ID not found"); + // } + // const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + // const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + // const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + // try { + // const txnResult = await sendWalletTransaction({ + // chainId: srcChainId!, + // to: sourceChainTokenId.stargate, + // signer, + // callData: encodeFunctionData({ + // abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + // functionName: "send", + // args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + // }), + // value, + // msg: t`Sent transfer in transaction`, + // }); + // await txnResult.wait(); + // } catch (error) { + // toastCustomOrStargateError(chainId, error); + // } +} diff --git a/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts index 084d753d5e..48b3641464 100644 --- a/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts @@ -1,10 +1,13 @@ import { t } from "@lingui/macro"; -import { Signer, ethers } from "ethers"; +import { ethers } from "ethers"; import { getContract } from "config/contracts"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; +import { SetPendingWithdrawal } from "context/SyntheticsEvents"; import { callContract } from "lib/contracts"; -import { isAddressZero } from "lib/legacy"; +import { OrderMetricId } from "lib/metrics"; +import { BlockTimestampData } from "lib/useBlockTimestampRequest"; +import { WalletSigner } from "lib/wallets"; import { abis } from "sdk/abis"; import type { ContractsChainId } from "sdk/configs/chains"; import { IGlvWithdrawalUtils } from "typechain-types/GlvRouter"; @@ -14,49 +17,55 @@ import { validateSignerAddress } from "components/Errors/errorToasts"; import { SwapPricingType } from "../orders"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; -import { applySlippageToMinOut } from "../trade"; -import { CreateWithdrawalParams } from "./createWithdrawalTxn"; +import type { TokensData } from "../tokens"; +import type { CreateGlvWithdrawalParamsStruct } from "./types"; -interface GlvWithdrawalParams extends Omit { - glv: string; - selectedGmMarket: string; +type CreateGlvWithdrawalParams = { + chainId: ContractsChainId; + signer: WalletSigner; + executionGasLimit: bigint; + skipSimulation?: boolean; + tokensData: TokensData; + metricId?: OrderMetricId; + blockTimestampData: BlockTimestampData | undefined; + params: CreateGlvWithdrawalParamsStruct; glvTokenAmount: bigint; - glvTokenAddress: string; -} - -export async function createGlvWithdrawalTxn(chainId: ContractsChainId, signer: Signer, p: GlvWithdrawalParams) { - const contract = new ethers.Contract(getContract(chainId, "GlvRouter"), abis.GlvRouter, signer); - const withdrawalVaultAddress = getContract(chainId, "GlvVault"); + setPendingTxns: (txns: any) => void; + setPendingWithdrawal: SetPendingWithdrawal; +}; - const isNativeWithdrawal = isAddressZero(p.initialLongTokenAddress) || isAddressZero(p.initialShortTokenAddress); +export async function createGlvWithdrawalTxn(p: CreateGlvWithdrawalParams) { + const contract = new ethers.Contract(getContract(p.chainId, "GlvRouter"), abis.GlvRouter, p.signer); + const withdrawalVaultAddress = getContract(p.chainId, "GlvVault"); - const wntAmount = p.executionFee; + const wntAmount = p.params.executionFee; - await validateSignerAddress(signer, p.account); + await validateSignerAddress(p.signer, p.params.addresses.receiver); - const minLongTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minLongTokenAmount); - const minShortTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minShortTokenAmount); + // TODO MLTCH: do not forget to apply slippage elsewhere + // const minLongTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minLongTokenAmount); + // const minShortTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minShortTokenAmount); const multicall = [ { method: "sendWnt", params: [withdrawalVaultAddress, wntAmount] }, - { method: "sendTokens", params: [p.glvTokenAddress, withdrawalVaultAddress, p.glvTokenAmount] }, + { method: "sendTokens", params: [p.params.addresses.glv, withdrawalVaultAddress, p.glvTokenAmount] }, { method: "createGlvWithdrawal", params: [ { addresses: { - receiver: p.account, + receiver: p.params.addresses.receiver, callbackContract: ethers.ZeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, - market: p.selectedGmMarket, - glv: p.glv, - longTokenSwapPath: p.longTokenSwapPath, - shortTokenSwapPath: p.shortTokenSwapPath, + market: p.params.addresses.market, + glv: p.params.addresses.glv, + longTokenSwapPath: p.params.addresses.longTokenSwapPath, + shortTokenSwapPath: p.params.addresses.shortTokenSwapPath, }, - minLongTokenAmount, - minShortTokenAmount, - shouldUnwrapNativeToken: isNativeWithdrawal, - executionFee: p.executionFee, + minLongTokenAmount: p.params.minLongTokenAmount, + minShortTokenAmount: p.params.minShortTokenAmount, + shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, + executionFee: p.params.executionFee, callbackGasLimit: 0n, dataList: [], } satisfies IGlvWithdrawalUtils.CreateGlvWithdrawalParamsStruct, @@ -69,8 +78,8 @@ export async function createGlvWithdrawalTxn(chainId: ContractsChainId, signer: .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); const simulationPromise = !p.skipSimulation - ? simulateExecuteTxn(chainId, { - account: p.account, + ? simulateExecuteTxn(p.chainId, { + account: p.params.addresses.receiver, primaryPriceOverrides: {}, tokensData: p.tokensData, createMulticallPayload: encodedPayload, @@ -84,7 +93,7 @@ export async function createGlvWithdrawalTxn(chainId: ContractsChainId, signer: : undefined; const { gasLimit, gasPriceData } = await prepareOrderTxn( - chainId, + p.chainId, contract, "multicall", [encodedPayload], @@ -93,7 +102,7 @@ export async function createGlvWithdrawalTxn(chainId: ContractsChainId, signer: p.metricId ); - return callContract(chainId, contract, "multicall", [encodedPayload], { + return callContract(p.chainId, contract, "multicall", [encodedPayload], { value: wntAmount, hideSentMsg: true, hideSuccessMsg: true, @@ -102,17 +111,17 @@ export async function createGlvWithdrawalTxn(chainId: ContractsChainId, signer: gasPriceData, setPendingTxns: p.setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.executionFee, + estimatedExecutionFee: p.params.executionFee, estimatedExecutionGasLimit: p.executionGasLimit, }, }).then(() => { p.setPendingWithdrawal({ - account: p.account, - marketAddress: p.glv, + account: p.params.addresses.receiver, + marketAddress: p.params.addresses.glv, marketTokenAmount: p.glvTokenAmount, - minLongTokenAmount, - minShortTokenAmount, - shouldUnwrapNativeToken: isNativeWithdrawal, + minLongTokenAmount: p.params.minLongTokenAmount, + minShortTokenAmount: p.params.minShortTokenAmount, + shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, }); }); } diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index 2ba62e10f8..a5a6585495 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -14,7 +14,7 @@ import { CreateDepositParamsStruct } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateDeposit } from "./signCreateDeposit"; -export type CreateMultichainDepositParams = { +type TxnParams = { chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; @@ -38,7 +38,7 @@ export async function buildAndSignMultichainDepositTxn({ emptySignature, relayerFeeTokenAddress, relayerFeeAmount, -}: CreateMultichainDepositParams): Promise { +}: TxnParams): Promise { let signature: string; if (emptySignature) { @@ -89,6 +89,7 @@ export function createMultichainDepositTxn({ srcChainId: SourceChainId | undefined; signer: WalletSigner; transferRequests: IRelayUtils.TransferRequestsStruct; + // TODO MLTCH: make it just ExpressTxnParams asyncExpressTxnResult: AsyncResult; params: CreateDepositParamsStruct; // TODO MLTCH: support pending txns diff --git a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts new file mode 100644 index 0000000000..b05e16a1fd --- /dev/null +++ b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts @@ -0,0 +1,119 @@ +import { encodeFunctionData } from "viem"; + +import { getContract } from "config/contracts"; +import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; +import type { WalletSigner } from "lib/wallets"; +import { abis } from "sdk/abis"; +import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; +import { MultichainGlvRouter } from "typechain-types/MultichainGlvRouter"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { ExpressTxnParams, RelayParamsPayload } from "../express"; +import { signCreateGlvWithdrawal } from "./signCreateGlvWithdrawal"; +import type { CreateGlvWithdrawalParamsStruct } from "./types"; + +type TxnParams = { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + relayParams: RelayParamsPayload; + emptySignature?: boolean; + account: string; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvWithdrawalParamsStruct; + relayerFeeTokenAddress: string; + relayerFeeAmount: bigint; +}; + +export async function buildAndSignMultichainGlvWithdrawalTxn({ + chainId, + srcChainId, + signer, + relayParams, + account, + transferRequests, + params, + emptySignature, + relayerFeeTokenAddress, + relayerFeeAmount, +}: TxnParams): Promise { + let signature: string; + + if (emptySignature) { + signature = "0x"; + } else { + signature = await signCreateGlvWithdrawal({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + } + + const depositData = encodeFunctionData({ + abi: abis.MultichainGlvRouter, + functionName: "createGlvWithdrawal", + args: [ + { + ...relayParams, + signature, + }, + account, + srcChainId ?? chainId, + transferRequests, + params, + ] satisfies Parameters, + }); + + return { + callData: depositData, + to: getContract(chainId, "MultichainGlvRouter"), + feeToken: relayerFeeTokenAddress, + feeAmount: relayerFeeAmount, + }; +} + +export async function createMultichainGlvWithdrawalTxn({ + chainId, + srcChainId, + signer, + transferRequests, + expressTxnParams: expressTxnParams, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + expressTxnParams: ExpressTxnParams; + params: CreateGlvWithdrawalParamsStruct; + // TODO MLTCH: support pending txns + // setPendingTxns, + // setPendingDeposit, +}): Promise { + const txnData = await buildAndSignMultichainGlvWithdrawalTxn({ + chainId, + srcChainId, + signer, + account: params.addresses.receiver, + relayerFeeAmount: expressTxnParams.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: expressTxnParams.gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...expressTxnParams.relayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + transferRequests, + params, + }); + + await sendExpressTransaction({ + chainId, + // TODO MLTCH: pass true when we can + isSponsoredCall: false, + txnData, + }); +} diff --git a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts new file mode 100644 index 0000000000..47f5ab6373 --- /dev/null +++ b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts @@ -0,0 +1,118 @@ +import { encodeFunctionData } from "viem"; + +import { getContract } from "config/contracts"; +import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; +import type { WalletSigner } from "lib/wallets"; +import { abis } from "sdk/abis"; +import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { nowInSeconds } from "sdk/utils/time"; +import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; + +import { CreateWithdrawalParamsStruct } from "."; +import { ExpressTxnParams, RelayParamsPayload } from "../express"; +import { signCreateWithdrawal } from "./signCreateWithdrawal"; + +type TxnParams = { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + relayParams: RelayParamsPayload; + emptySignature?: boolean; + account: string; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; + relayerFeeTokenAddress: string; + relayerFeeAmount: bigint; +}; + +export async function buildAndSignMultichainWithdrawalTxn({ + chainId, + srcChainId, + signer, + relayParams, + account, + transferRequests, + params, + emptySignature, + relayerFeeTokenAddress, + relayerFeeAmount, +}: TxnParams): Promise { + let signature: string; + + if (emptySignature) { + signature = "0x"; + } else { + signature = await signCreateWithdrawal({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + } + + const depositData = encodeFunctionData({ + abi: abis.MultichainGmRouter, + functionName: "createWithdrawal", + args: [ + { + ...relayParams, + signature, + }, + account, + srcChainId ?? chainId, + transferRequests, + params, + ] satisfies Parameters, + }); + + return { + callData: depositData, + to: getContract(chainId, "MultichainGmRouter"), + feeToken: relayerFeeTokenAddress, + feeAmount: relayerFeeAmount, + }; +} + +export async function createMultichainWithdrawalTxn({ + chainId, + srcChainId, + signer, + transferRequests, + expressTxnParams: expressTxnParams, + params, +}: { + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + expressTxnParams: ExpressTxnParams; + params: CreateWithdrawalParamsStruct; + // TODO MLTCH: support pending txns + // setPendingTxns, + // setPendingDeposit, +}): Promise { + const txnData = await buildAndSignMultichainWithdrawalTxn({ + chainId, + srcChainId, + signer, + account: params.addresses.receiver, + relayerFeeAmount: expressTxnParams.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: expressTxnParams.gasPaymentParams.relayerFeeTokenAddress, + relayParams: { + ...expressTxnParams.relayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }, + transferRequests, + params, + }); + + await sendExpressTransaction({ + chainId, + // TODO MLTCH: pass true when we can + isSponsoredCall: false, + txnData, + }); +} diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index 921ec7f5f7..6096156686 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -8,12 +8,7 @@ import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { - getRawRelayerParams, - GlobalExpressParams, - RawRelayParamsPayload, - RelayParamsPayload, -} from "domain/synthetics/express"; +import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateDepositParamsStruct } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; @@ -67,7 +62,7 @@ export async function createSourceChainDepositTxn({ externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], marketsInfoData: globalExpressParams!.marketsInfoData, - }) as RawRelayParamsPayload; + }); const relayParams: RelayParamsPayload = { ...rawRelayParamsPayload, @@ -108,7 +103,7 @@ export async function createSourceChainDepositTxn({ srcChainId, amount: tokenAmount, composeGas: composeGas, - isDeposit: true, + isToGmx: true, action, }); diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts index 61494b00ef..6892a0f03c 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -80,7 +80,7 @@ export async function createSourceChainGlvDepositTxn({ const action: MultichainAction = { actionType: MultichainActionType.GlvDeposit, actionData: { - relayParams: relayParams, + relayParams, transferRequests, params, signature, @@ -102,7 +102,7 @@ export async function createSourceChainGlvDepositTxn({ srcChainId, amount: tokenAmount + relayFeePayload.feeAmount, composeGas: composeGas, - isDeposit: true, + isToGmx: true, action, }); diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts new file mode 100644 index 0000000000..f624400e9a --- /dev/null +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -0,0 +1,147 @@ +import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import { encodeFunctionData, Hex, zeroAddress } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; +import { sendWalletTransaction } from "lib/transactions"; +import { WalletSigner } from "lib/wallets"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { getTokenBySymbol } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { nowInSeconds } from "sdk/utils/time"; +import { IRelayUtils } from "typechain-types/MultichainGmRouter"; +import { IStargate, IStargate__factory } from "typechain-types-stargate"; +import { SendParamStruct } from "typechain-types-stargate/IStargate"; + +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + +import { signCreateWithdrawal } from "./signCreateWithdrawal"; + +export async function createSourceChainWithdrawalTxn({ + chainId, + globalExpressParams, + srcChainId, + signer, + transferRequests, + params, + // account, + // tokenAddress, + tokenAmount, + // executionFee, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; + // account: string; + // tokenAddress: string; + tokenAmount: bigint; + // executionFee: bigint; +}) { + const account = params.addresses.receiver; + const marketTokenAddress = params.addresses.market; + + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: { + // feeToken: globalExpressParams!.relayerFeeTokenAddress, + feeToken: getTokenBySymbol(chainId, "USDC.SG").address, + // TODO MLTCH this is going through the keeper to execute a depost + // so there 100% should be a fee + feeAmount: 2n * 10n ** 6n, + feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }); + + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const signature = await signCreateWithdrawal({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Withdrawal, + actionData: { + relayParams, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress: marketTokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + // TODO MLTCH withdrawal also includes a withdrawal compose gas + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + amount: tokenAmount, + composeGas: composeGas, + isToGmx: true, + isManualGas: true, + action, + }); + + const sourceChainTokenId = getMappedTokenId(chainId, marketTokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (marketTokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + functionName: "send", + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + }), + value, + msg: t`Sent deposit transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/domain/synthetics/markets/createWithdrawalTxn.ts b/src/domain/synthetics/markets/createWithdrawalTxn.ts index 63305df599..d0570a12b8 100644 --- a/src/domain/synthetics/markets/createWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createWithdrawalTxn.ts @@ -3,79 +3,69 @@ import { Signer, ethers } from "ethers"; import { getContract } from "config/contracts"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; -import { SetPendingWithdrawal } from "context/SyntheticsEvents"; +import type { SetPendingWithdrawal } from "context/SyntheticsEvents"; import { callContract } from "lib/contracts"; -import { isAddressZero } from "lib/legacy"; -import { OrderMetricId } from "lib/metrics/types"; -import { BlockTimestampData } from "lib/useBlockTimestampRequest"; +import type { OrderMetricId } from "lib/metrics/types"; +import type { BlockTimestampData } from "lib/useBlockTimestampRequest"; import { abis } from "sdk/abis"; import type { ContractsChainId } from "sdk/configs/chains"; -import type { IWithdrawalUtils } from "typechain-types/ExchangeRouter"; import { validateSignerAddress } from "components/Errors/errorToasts"; import { SwapPricingType } from "../orders"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; -import { TokensData } from "../tokens"; -import { applySlippageToMinOut } from "../trade"; +import type { TokensData } from "../tokens"; +import type { CreateWithdrawalParamsStruct } from "./types"; export type CreateWithdrawalParams = { - account: string; - marketTokenAddress: string; + chainId: ContractsChainId; + signer: Signer; marketTokenAmount: bigint; - initialLongTokenAddress: string; - minLongTokenAmount: bigint; - longTokenSwapPath: string[]; - initialShortTokenAddress: string; - shortTokenSwapPath: string[]; - minShortTokenAmount: bigint; - executionFee: bigint; executionGasLimit: bigint; - allowedSlippage: number; skipSimulation?: boolean; tokensData: TokensData; metricId?: OrderMetricId; blockTimestampData: BlockTimestampData | undefined; + params: CreateWithdrawalParamsStruct; setPendingTxns: (txns: any) => void; setPendingWithdrawal: SetPendingWithdrawal; }; -export async function createWithdrawalTxn(chainId: ContractsChainId, signer: Signer, p: CreateWithdrawalParams) { - const contract = new ethers.Contract(getContract(chainId, "ExchangeRouter"), abis.ExchangeRouter, signer); - const withdrawalVaultAddress = getContract(chainId, "WithdrawalVault"); +export async function createWithdrawalTxn(p: CreateWithdrawalParams) { + const contract = new ethers.Contract(getContract(p.chainId, "ExchangeRouter"), abis.ExchangeRouter, p.signer); + const withdrawalVaultAddress = getContract(p.chainId, "WithdrawalVault"); - const isNativeWithdrawal = isAddressZero(p.initialLongTokenAddress) || isAddressZero(p.initialShortTokenAddress); + await validateSignerAddress(p.signer, p.params.addresses.receiver); - await validateSignerAddress(signer, p.account); + // const wntAmount = p.params.executionFee; - const wntAmount = p.executionFee; - - const minLongTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minLongTokenAmount); - const minShortTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minShortTokenAmount); + // TODO MLTCH: do not forget to apply slippage elsewhere + // const minLongTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.params.minLongTokenAmount); + // const minShortTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.params.minShortTokenAmount); const multicall = [ - { method: "sendWnt", params: [withdrawalVaultAddress, wntAmount] }, - { method: "sendTokens", params: [p.marketTokenAddress, withdrawalVaultAddress, p.marketTokenAmount] }, + { method: "sendWnt", params: [withdrawalVaultAddress, p.params.executionFee] }, + { method: "sendTokens", params: [p.params.addresses.market, withdrawalVaultAddress, p.marketTokenAmount] }, { method: "createWithdrawal", params: [ { addresses: { - receiver: p.account, + receiver: p.params.addresses.receiver, callbackContract: ethers.ZeroAddress, - market: p.marketTokenAddress, - longTokenSwapPath: p.longTokenSwapPath, - shortTokenSwapPath: p.shortTokenSwapPath, + market: p.params.addresses.market, + longTokenSwapPath: p.params.addresses.longTokenSwapPath, + shortTokenSwapPath: p.params.addresses.shortTokenSwapPath, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, }, - minLongTokenAmount, - minShortTokenAmount, - shouldUnwrapNativeToken: isNativeWithdrawal, - executionFee: p.executionFee, + minLongTokenAmount: p.params.minLongTokenAmount, + minShortTokenAmount: p.params.minShortTokenAmount, + shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, + executionFee: p.params.executionFee, callbackGasLimit: 0n, dataList: [], - } satisfies IWithdrawalUtils.CreateWithdrawalParamsStruct, + } satisfies CreateWithdrawalParamsStruct, ], }, ]; @@ -85,14 +75,14 @@ export async function createWithdrawalTxn(chainId: ContractsChainId, signer: Sig .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); const simulationPromise = !p.skipSimulation - ? simulateExecuteTxn(chainId, { - account: p.account, + ? simulateExecuteTxn(p.chainId, { + account: p.params.addresses.receiver, primaryPriceOverrides: {}, tokensData: p.tokensData, createMulticallPayload: encodedPayload, method: "simulateExecuteLatestWithdrawal", errorTitle: t`Withdrawal error.`, - value: wntAmount, + value: p.params.executionFee, swapPricingType: SwapPricingType.TwoStep, metricId: p.metricId, blockTimestampData: p.blockTimestampData, @@ -100,17 +90,17 @@ export async function createWithdrawalTxn(chainId: ContractsChainId, signer: Sig : undefined; const { gasLimit, gasPriceData } = await prepareOrderTxn( - chainId, + p.chainId, contract, "multicall", [encodedPayload], - wntAmount, + p.params.executionFee, simulationPromise, p.metricId ); - return callContract(chainId, contract, "multicall", [encodedPayload], { - value: wntAmount, + return callContract(p.chainId, contract, "multicall", [encodedPayload], { + value: p.params.executionFee, hideSentMsg: true, hideSuccessMsg: true, metricId: p.metricId, @@ -118,17 +108,17 @@ export async function createWithdrawalTxn(chainId: ContractsChainId, signer: Sig gasPriceData, setPendingTxns: p.setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.executionFee, + estimatedExecutionFee: p.params.executionFee, estimatedExecutionGasLimit: p.executionGasLimit, }, }).then(() => { p.setPendingWithdrawal({ - account: p.account, - marketAddress: p.marketTokenAddress, + account: p.params.addresses.receiver, + marketAddress: p.params.addresses.market, marketTokenAmount: p.marketTokenAmount, - minLongTokenAmount, - minShortTokenAmount, - shouldUnwrapNativeToken: isNativeWithdrawal, + minLongTokenAmount: p.params.minLongTokenAmount, + minShortTokenAmount: p.params.minShortTokenAmount, + shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, }); }); } diff --git a/src/domain/synthetics/markets/signCreateBridgeOut.ts b/src/domain/synthetics/markets/signCreateBridgeOut.ts new file mode 100644 index 0000000000..c86faa8705 --- /dev/null +++ b/src/domain/synthetics/markets/signCreateBridgeOut.ts @@ -0,0 +1,66 @@ +import type { AbstractSigner, Wallet } from "ethers"; + +import type { ContractsChainId, SourceChainId } from "config/chains"; +import type { WalletSigner } from "lib/wallets"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { CreateWithdrawalParamsStruct } from "."; +import type { RelayParamsPayload } from "../express/types"; + +export async function signCreateBridgeOut({ + signer, + chainId, + srcChainId, + relayParams, + transferRequests, + params, +}: { + signer: AbstractSigner | WalletSigner | Wallet; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; +}) { + throw new Error("Not implemented"); + // const types = { + // CreateWithdrawal: [ + // { name: "transferTokens", type: "address[]" }, + // { name: "transferReceivers", type: "address[]" }, + // { name: "transferAmounts", type: "uint256[]" }, + // { name: "addresses", type: "CreateWithdrawalAddresses" }, + // { name: "minLongTokenAmount", type: "uint256" }, + // { name: "minShortTokenAmount", type: "uint256" }, + // { name: "shouldUnwrapNativeToken", type: "bool" }, + // { name: "executionFee", type: "uint256" }, + // { name: "callbackGasLimit", type: "uint256" }, + // { name: "dataList", type: "bytes32[]" }, + // { name: "relayParams", type: "bytes32" }, + // ], + // CreateWithdrawalAddresses: [ + // { name: "receiver", type: "address" }, + // { name: "callbackContract", type: "address" }, + // { name: "uiFeeReceiver", type: "address" }, + // { name: "market", type: "address" }, + // { name: "longTokenSwapPath", type: "address[]" }, + // { name: "shortTokenSwapPath", type: "address[]" }, + // ], + // }; + + // const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); + // const typedData = { + // transferTokens: transferRequests.tokens, + // transferReceivers: transferRequests.receivers, + // transferAmounts: transferRequests.amounts, + // addresses: params.addresses, + // minLongTokenAmount: params.minLongTokenAmount, + // minShortTokenAmount: params.minShortTokenAmount, + // shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + // executionFee: params.executionFee, + // callbackGasLimit: params.callbackGasLimit, + // dataList: params.dataList, + // relayParams: hashRelayParams(relayParams), + // }; + + // return signTypedData({ signer, domain, types, typedData }); +} diff --git a/src/domain/synthetics/markets/signCreateDeposit.ts b/src/domain/synthetics/markets/signCreateDeposit.ts index 7c8d3ad1f9..ef666c5fbe 100644 --- a/src/domain/synthetics/markets/signCreateDeposit.ts +++ b/src/domain/synthetics/markets/signCreateDeposit.ts @@ -1,4 +1,4 @@ -import { Wallet } from "ethers"; +import type { Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; diff --git a/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts new file mode 100644 index 0000000000..e4e74433a3 --- /dev/null +++ b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts @@ -0,0 +1,69 @@ +import type { Wallet } from "ethers"; + +import type { ContractsChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { CreateWithdrawalParamsStruct } from "."; +import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; +import type { RelayParamsPayload } from "../express/types"; + +export async function signCreateGlvWithdrawal({ + signer, + chainId, + srcChainId, + relayParams, + transferRequests, + params, +}: { + signer: WalletSigner | Wallet; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; +}) { + const types = { + CreateGlvWithdrawal: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateGlvWithdrawalAddresses" }, + { name: "minLongTokenAmount", type: "uint256" }, + { name: "minShortTokenAmount", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateGlvWithdrawalAddresses: [ + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "market", type: "address" }, + { name: "glv", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGlvRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} diff --git a/src/domain/synthetics/markets/signCreateWithdrawal.ts b/src/domain/synthetics/markets/signCreateWithdrawal.ts new file mode 100644 index 0000000000..4cbe96cb8e --- /dev/null +++ b/src/domain/synthetics/markets/signCreateWithdrawal.ts @@ -0,0 +1,68 @@ +import type { AbstractSigner, Wallet } from "ethers"; + +import type { ContractsChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import type { WalletSigner } from "lib/wallets"; +import { signTypedData } from "lib/wallets/signing"; +import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; + +import type { CreateWithdrawalParamsStruct } from "."; +import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; +import type { RelayParamsPayload } from "../express/types"; + +export async function signCreateWithdrawal({ + signer, + chainId, + srcChainId, + relayParams, + transferRequests, + params, +}: { + signer: AbstractSigner | WalletSigner | Wallet; + relayParams: RelayParamsPayload; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateWithdrawalParamsStruct; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; +}) { + const types = { + CreateWithdrawal: [ + { name: "transferTokens", type: "address[]" }, + { name: "transferReceivers", type: "address[]" }, + { name: "transferAmounts", type: "uint256[]" }, + { name: "addresses", type: "CreateWithdrawalAddresses" }, + { name: "minLongTokenAmount", type: "uint256" }, + { name: "minShortTokenAmount", type: "uint256" }, + { name: "shouldUnwrapNativeToken", type: "bool" }, + { name: "executionFee", type: "uint256" }, + { name: "callbackGasLimit", type: "uint256" }, + { name: "dataList", type: "bytes32[]" }, + { name: "relayParams", type: "bytes32" }, + ], + CreateWithdrawalAddresses: [ + { name: "receiver", type: "address" }, + { name: "callbackContract", type: "address" }, + { name: "uiFeeReceiver", type: "address" }, + { name: "market", type: "address" }, + { name: "longTokenSwapPath", type: "address[]" }, + { name: "shortTokenSwapPath", type: "address[]" }, + ], + }; + + const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); + const typedData = { + transferTokens: transferRequests.tokens, + transferReceivers: transferRequests.receivers, + transferAmounts: transferRequests.amounts, + addresses: params.addresses, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, + callbackGasLimit: params.callbackGasLimit, + dataList: params.dataList, + relayParams: hashRelayParams(relayParams), + }; + + return signTypedData({ signer, domain, types, typedData }); +} diff --git a/src/domain/synthetics/markets/types.ts b/src/domain/synthetics/markets/types.ts index c6b57c9c31..48bf010e11 100644 --- a/src/domain/synthetics/markets/types.ts +++ b/src/domain/synthetics/markets/types.ts @@ -63,7 +63,7 @@ export type ClaimableFundingData = { [marketAddress: string]: ClaimableFunding; }; -export type CreateDepositParamsAddressesStructOutput = { +export type CreateDepositParamsAddressesStruct = { receiver: string; callbackContract: string; uiFeeReceiver: string; @@ -75,7 +75,7 @@ export type CreateDepositParamsAddressesStructOutput = { }; export type CreateDepositParamsStruct = { - addresses: CreateDepositParamsAddressesStructOutput; + addresses: CreateDepositParamsAddressesStruct; minMarketTokens: bigint; shouldUnwrapNativeToken: boolean; executionFee: bigint; @@ -104,3 +104,42 @@ export type CreateGlvDepositParamsStruct = { isMarketTokenDeposit: boolean; dataList: string[]; }; + +export type CreateWithdrawalAddressesStruct = { + receiver: string; + callbackContract: string; + uiFeeReceiver: string; + market: string; + longTokenSwapPath: string[]; + shortTokenSwapPath: string[]; +}; + +export type CreateWithdrawalParamsStruct = { + addresses: CreateWithdrawalAddressesStruct; + minLongTokenAmount: bigint; + minShortTokenAmount: bigint; + shouldUnwrapNativeToken: boolean; + executionFee: bigint; + callbackGasLimit: bigint; + dataList: string[]; +}; + +export type CreateGlvWithdrawalAddressesStruct = { + receiver: string; + callbackContract: string; + uiFeeReceiver: string; + market: string; + glv: string; + longTokenSwapPath: string[]; + shortTokenSwapPath: string[]; +}; + +export type CreateGlvWithdrawalParamsStruct = { + addresses: CreateGlvWithdrawalAddressesStruct; + minLongTokenAmount: bigint; + minShortTokenAmount: bigint; + shouldUnwrapNativeToken: boolean; + executionFee: bigint; + callbackGasLimit: bigint; + dataList: string[]; +}; diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index 8c7eb1a091..c7aee32509 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -32,6 +32,8 @@ import { } from "sdk/types/trade"; import { bigMath } from "sdk/utils/bigmath"; +import type { GmPaySource } from "components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; + import { getMaxUsdBuyableAmountInMarketWithGm, getSellableInfoGlvInMarket, isGlvInfo } from "../../markets/glv"; export type ValidationTooltipName = "maxLeverage"; @@ -662,6 +664,8 @@ export function getGmSwapError(p: { glvInfo?: GlvInfo; marketTokensData?: TokensData; isMarketTokenDeposit?: boolean; + paySource: GmPaySource; + isPair: boolean; }) { const { isDeposit, @@ -684,6 +688,8 @@ export function getGmSwapError(p: { glvInfo, marketTokensData, isMarketTokenDeposit, + paySource, + isPair, } = p; if (!marketInfo || !marketToken) { @@ -692,6 +698,10 @@ export function getGmSwapError(p: { const glvTooltipMessage = t`The buyable cap for the pool GM: ${marketInfo.name} using the pay token selected is reached. Please choose a different pool, reduce the buy size, or pick a different composition of tokens.`; + if (isPair && isDeposit && paySource === "sourceChain") { + return [t`Deposit from source chain support only single token`]; + } + if (isDeposit) { if (priceImpactUsd !== undefined && priceImpactUsd > 0) { const { impactAmount } = applySwapImpactWithCap(marketInfo, priceImpactUsd); diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index 54d5954e55..0f52467a90 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -33,6 +33,7 @@ import Buy16Icon from "img/ic_buy_16.svg?react"; import Sell16Icon from "img/ic_sell_16.svg?react"; import { PoolsDetailsMarketAmount } from "./PoolsDetailsMarketAmount"; +import { TransferInModal } from "./TransferInModal"; type Props = { glvOrMarketInfo: GlvOrMarketInfo | undefined; @@ -50,6 +51,8 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { ? glvOrMarketInfo?.glvToken.symbol : glvOrMarketInfo?.indexToken.symbol; + const [openedTransferModal, setOpenedTransferModal] = useState<"transferIn" | "transferOut" | undefined>(undefined); + const marketPrice = marketToken?.prices?.maxPrice; const marketTotalSupply = marketToken?.totalSupply; @@ -60,12 +63,11 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { const { isMobile, isTablet } = useBreakpoints(); - const { totalBalance, tokenBalancesData, isBalanceDataLoading } = useMultichainMarketTokenBalancesRequest( - chainId, - srcChainId, - account, - marketToken?.address - ); + const { + totalBalance, + tokenBalancesData: tokenBalancesData, + isBalanceDataLoading, + } = useMultichainMarketTokenBalancesRequest(chainId, srcChainId, account, marketToken?.address); const sortedTokenBalancesDataArray = useMemo(() => { return Object.entries(tokenBalancesData) @@ -89,7 +91,7 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { setIsOpen((isOpen) => !isOpen); }, []); - const glOrGm = isGlv ? "GLV" : "GM"; + const glvOrGm = isGlv ? "GLV" : "GM"; return (
- -
+ setOpenedTransferModal(newIsVisible ? "transferIn" : undefined)} + glvOrMarketInfo={glvOrMarketInfo} + />
); } diff --git a/src/pages/PoolsDetails/TransferInModal.tsx b/src/pages/PoolsDetails/TransferInModal.tsx new file mode 100644 index 0000000000..e9e5ce0d0f --- /dev/null +++ b/src/pages/PoolsDetails/TransferInModal.tsx @@ -0,0 +1,182 @@ +import { t } from "@lingui/macro"; +import { useMemo, useState } from "react"; +import { useAccount } from "wagmi"; + +import { AnyChainId, SettlementChainId, SourceChainId } from "config/chains"; +import { isSourceChain } from "config/multichain"; +import { useGmxAccountSettlementChainId } from "context/GmxAccountContext/hooks"; +import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; +import { selectDepositMarketTokensData } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; +import { getGlvOrMarketAddress, GlvOrMarketInfo } from "domain/synthetics/markets"; +import { createBridgeInTxn } from "domain/synthetics/markets/createBridgeInTxn"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { convertToUsd, getMidPrice, getTokenData } from "domain/tokens"; +import { useChainId } from "lib/chains"; +import { getMarketIndexName } from "sdk/utils/markets"; +import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "sdk/utils/numbers"; + +import Button from "components/Button/Button"; +import BuyInputSection from "components/BuyInputSection/BuyInputSection"; +import { SlideModal } from "components/Modal/SlideModal"; +import { useMultichainMarketTokenBalancesRequest } from "components/Synthetics/GmxAccountModal/hooks"; +import { wrapChainAction } from "components/Synthetics/GmxAccountModal/wrapChainAction"; +import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; +import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; +import { ValueTransition } from "components/ValueTransition/ValueTransition"; + +export function TransferInModal({ + isVisible, + setIsVisible, + glvOrMarketInfo, +}: { + isVisible: boolean; + setIsVisible: (isVisible: boolean) => void; + glvOrMarketInfo: GlvOrMarketInfo | undefined; +}) { + const { chainId, srcChainId } = useChainId(); + const [, setSettlementChainId] = useGmxAccountSettlementChainId(); + const globalExpressParams = useSelector(selectExpressGlobalParams); + const [transferInChain, setTransferInChain] = useState(); + const [transferInInputValue, setTransferInInputValue] = useState(""); + + const depositMarketTokensData = useSelector(selectDepositMarketTokensData); + const glvOrMarketAddress = glvOrMarketInfo ? getGlvOrMarketAddress(glvOrMarketInfo) : undefined; + const marketToken = getTokenData(depositMarketTokensData, glvOrMarketAddress); + const isGlv = isGlvInfo(glvOrMarketInfo); + + const marketTokenDecimals = isGlv ? glvOrMarketInfo?.glvToken.decimals : marketToken?.decimals; + let marketTokenPrice: bigint | undefined = undefined; + if (isGlv && glvOrMarketInfo?.glvToken.prices) { + marketTokenPrice = getMidPrice(glvOrMarketInfo?.glvToken.prices); + } else if (marketToken?.prices) { + marketTokenPrice = getMidPrice(marketToken?.prices); + } + + const transferInAmount = useMemo(() => { + return transferInInputValue && marketTokenDecimals !== undefined + ? parseValue(transferInInputValue, marketTokenDecimals) + : undefined; + }, [transferInInputValue, marketTokenDecimals]); + + const transferInUsd = useMemo(() => { + return transferInAmount !== undefined && marketTokenDecimals !== undefined + ? convertToUsd(transferInAmount, marketTokenDecimals, marketTokenPrice) + : undefined; + }, [transferInAmount, marketTokenDecimals, marketTokenPrice]); + + const glvOrGm = isGlv ? "GLV" : "GM"; + const { address: account } = useAccount(); + + const { tokenBalancesData: marketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( + chainId, + srcChainId, + account, + glvOrMarketAddress + ); + + const sourceChainMarketTokenBalancesData: Partial> = useMemo(() => { + return { + ...marketTokenBalancesData, + [chainId]: undefined, + [0]: undefined, + }; + }, [chainId, marketTokenBalancesData]); + + const transferInChainMarketTokenBalance: bigint | undefined = transferInChain + ? marketTokenBalancesData[transferInChain] + : undefined; + + const gmxAccountMarketTokenBalance: bigint | undefined = marketTokenBalancesData[0]; + + const nextGmxAccountMarketTokenBalance: bigint | undefined = + gmxAccountMarketTokenBalance !== undefined && transferInAmount !== undefined + ? gmxAccountMarketTokenBalance + transferInAmount + : undefined; + + if (!glvOrMarketInfo) { + return null; + } + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + if (!account || !glvOrMarketAddress || transferInAmount === undefined || !transferInChain || !globalExpressParams) { + return; + } + await wrapChainAction(transferInChain, setSettlementChainId, async (signer) => { + await createBridgeInTxn({ + chainId: chainId as SettlementChainId, + srcChainId: transferInChain, + account, + tokenAddress: glvOrMarketAddress, + tokenAmount: transferInAmount, + signer, + globalExpressParams, + }); + }); + }; + + return ( + +
+ setTransferInInputValue(e.target.value)} + bottomLeftValue={formatUsd(transferInUsd)} + bottomRightValue={ + transferInChainMarketTokenBalance !== undefined && marketTokenDecimals !== undefined + ? formatBalanceAmount(transferInChainMarketTokenBalance, marketTokenDecimals) + : undefined + } + bottomRightLabel={t`Available`} + onClickMax={() => { + if (transferInChainMarketTokenBalance === undefined || marketTokenDecimals === undefined) { + return; + } + setTransferInInputValue(formatAmountFree(transferInChainMarketTokenBalance, marketTokenDecimals)); + }} + > + { + if (!isSourceChain(newTransferInChain)) { + return; + } + setTransferInChain(newTransferInChain); + }} + marketInfo={glvOrMarketInfo} + marketTokenPrice={marketTokenPrice} + tokenBalancesData={sourceChainMarketTokenBalancesData} + /> + + + + } + /> + +
+ ); +} From 70f24d0ce97bfc3fbe57065f3aad9a942e9c9174 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 22 Sep 2025 14:20:36 +0200 Subject: [PATCH 17/38] Multichain LP init all txn --- .../BridgeModal/BridgeInModal.tsx} | 60 ++-- src/components/BridgeModal/BridgeOutModal.tsx | 276 ++++++++++++++++++ .../GmDepositWithdrawalBox.tsx | 23 +- .../lpTxn/useWithdrawalTransactions.tsx | 114 +++----- .../GmxAccountModal/WithdrawalView.tsx | 15 +- src/domain/multichain/codecs/CodecUiHelper.ts | 37 ++- .../multichain/codecs/hashParamsAbiItems.ts | 26 ++ .../synthetics/express/expressOrderUtils.ts | 1 + .../synthetics/markets/createBridgeOutTxn.ts | 113 ++----- .../createMultichainGlvWithdrawalTxn.ts | 5 +- .../createSourceChainGlvWithdrawalTxn.ts | 143 +++++++++ .../synthetics/markets/signCreateBridgeOut.ts | 66 ----- src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 10 +- 13 files changed, 611 insertions(+), 278 deletions(-) rename src/{pages/PoolsDetails/TransferInModal.tsx => components/BridgeModal/BridgeInModal.tsx} (73%) create mode 100644 src/components/BridgeModal/BridgeOutModal.tsx create mode 100644 src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts delete mode 100644 src/domain/synthetics/markets/signCreateBridgeOut.ts diff --git a/src/pages/PoolsDetails/TransferInModal.tsx b/src/components/BridgeModal/BridgeInModal.tsx similarity index 73% rename from src/pages/PoolsDetails/TransferInModal.tsx rename to src/components/BridgeModal/BridgeInModal.tsx index e9e5ce0d0f..e8eeca8c3d 100644 --- a/src/pages/PoolsDetails/TransferInModal.tsx +++ b/src/components/BridgeModal/BridgeInModal.tsx @@ -25,7 +25,7 @@ import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; import { ValueTransition } from "components/ValueTransition/ValueTransition"; -export function TransferInModal({ +export function BridgeInModal({ isVisible, setIsVisible, glvOrMarketInfo, @@ -37,8 +37,8 @@ export function TransferInModal({ const { chainId, srcChainId } = useChainId(); const [, setSettlementChainId] = useGmxAccountSettlementChainId(); const globalExpressParams = useSelector(selectExpressGlobalParams); - const [transferInChain, setTransferInChain] = useState(); - const [transferInInputValue, setTransferInInputValue] = useState(""); + const [bridgeInChain, setBridgeInChain] = useState(srcChainId); + const [bridgeInInputValue, setBridgeInInputValue] = useState(""); const depositMarketTokensData = useSelector(selectDepositMarketTokensData); const glvOrMarketAddress = glvOrMarketInfo ? getGlvOrMarketAddress(glvOrMarketInfo) : undefined; @@ -53,17 +53,17 @@ export function TransferInModal({ marketTokenPrice = getMidPrice(marketToken?.prices); } - const transferInAmount = useMemo(() => { - return transferInInputValue && marketTokenDecimals !== undefined - ? parseValue(transferInInputValue, marketTokenDecimals) + const bridgeInAmount = useMemo(() => { + return bridgeInInputValue && marketTokenDecimals !== undefined + ? parseValue(bridgeInInputValue, marketTokenDecimals) : undefined; - }, [transferInInputValue, marketTokenDecimals]); + }, [bridgeInInputValue, marketTokenDecimals]); - const transferInUsd = useMemo(() => { - return transferInAmount !== undefined && marketTokenDecimals !== undefined - ? convertToUsd(transferInAmount, marketTokenDecimals, marketTokenPrice) + const bridgeInUsd = useMemo(() => { + return bridgeInAmount !== undefined && marketTokenDecimals !== undefined + ? convertToUsd(bridgeInAmount, marketTokenDecimals, marketTokenPrice) : undefined; - }, [transferInAmount, marketTokenDecimals, marketTokenPrice]); + }, [bridgeInAmount, marketTokenDecimals, marketTokenPrice]); const glvOrGm = isGlv ? "GLV" : "GM"; const { address: account } = useAccount(); @@ -83,15 +83,15 @@ export function TransferInModal({ }; }, [chainId, marketTokenBalancesData]); - const transferInChainMarketTokenBalance: bigint | undefined = transferInChain - ? marketTokenBalancesData[transferInChain] + const bridgeInChainMarketTokenBalance: bigint | undefined = bridgeInChain + ? marketTokenBalancesData[bridgeInChain] : undefined; const gmxAccountMarketTokenBalance: bigint | undefined = marketTokenBalancesData[0]; const nextGmxAccountMarketTokenBalance: bigint | undefined = - gmxAccountMarketTokenBalance !== undefined && transferInAmount !== undefined - ? gmxAccountMarketTokenBalance + transferInAmount + gmxAccountMarketTokenBalance !== undefined && bridgeInAmount !== undefined + ? gmxAccountMarketTokenBalance + bridgeInAmount : undefined; if (!glvOrMarketInfo) { @@ -100,16 +100,16 @@ export function TransferInModal({ const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); - if (!account || !glvOrMarketAddress || transferInAmount === undefined || !transferInChain || !globalExpressParams) { + if (!account || !glvOrMarketAddress || bridgeInAmount === undefined || !bridgeInChain || !globalExpressParams) { return; } - await wrapChainAction(transferInChain, setSettlementChainId, async (signer) => { + await wrapChainAction(bridgeInChain, setSettlementChainId, async (signer) => { await createBridgeInTxn({ chainId: chainId as SettlementChainId, - srcChainId: transferInChain, + srcChainId: bridgeInChain, account, tokenAddress: glvOrMarketAddress, - tokenAmount: transferInAmount, + tokenAmount: bridgeInAmount, signer, globalExpressParams, }); @@ -125,31 +125,31 @@ export function TransferInModal({
setTransferInInputValue(e.target.value)} - bottomLeftValue={formatUsd(transferInUsd)} + inputValue={bridgeInInputValue} + onInputValueChange={(e) => setBridgeInInputValue(e.target.value)} + bottomLeftValue={formatUsd(bridgeInUsd)} bottomRightValue={ - transferInChainMarketTokenBalance !== undefined && marketTokenDecimals !== undefined - ? formatBalanceAmount(transferInChainMarketTokenBalance, marketTokenDecimals) + bridgeInChainMarketTokenBalance !== undefined && marketTokenDecimals !== undefined + ? formatBalanceAmount(bridgeInChainMarketTokenBalance, marketTokenDecimals) : undefined } bottomRightLabel={t`Available`} onClickMax={() => { - if (transferInChainMarketTokenBalance === undefined || marketTokenDecimals === undefined) { + if (bridgeInChainMarketTokenBalance === undefined || marketTokenDecimals === undefined) { return; } - setTransferInInputValue(formatAmountFree(transferInChainMarketTokenBalance, marketTokenDecimals)); + setBridgeInInputValue(formatAmountFree(bridgeInChainMarketTokenBalance, marketTokenDecimals)); }} > { - if (!isSourceChain(newTransferInChain)) { + onSelectTokenAddress={(newBridgeInChain) => { + if (!isSourceChain(newBridgeInChain)) { return; } - setTransferInChain(newTransferInChain); + setBridgeInChain(newBridgeInChain); }} marketInfo={glvOrMarketInfo} marketTokenPrice={marketTokenPrice} diff --git a/src/components/BridgeModal/BridgeOutModal.tsx b/src/components/BridgeModal/BridgeOutModal.tsx new file mode 100644 index 0000000000..98049b4f4a --- /dev/null +++ b/src/components/BridgeModal/BridgeOutModal.tsx @@ -0,0 +1,276 @@ +import { t, Trans } from "@lingui/macro"; +import { useEffect, useMemo, useState } from "react"; +import { Address, encodeAbiParameters } from "viem"; +import { useAccount } from "wagmi"; + +import { AnyChainId, getChainName, SettlementChainId, SourceChainId } from "config/chains"; +import { getLayerZeroEndpointId, getStargatePoolAddress, isSourceChain } from "config/multichain"; +import { useGmxAccountSettlementChainId } from "context/GmxAccountContext/hooks"; +import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; +import { selectDepositMarketTokensData } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; +import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import { BridgeOutParams } from "domain/multichain/types"; +import { buildAndSignBridgeOutTxn } from "domain/synthetics/express/expressOrderUtils"; +import { ExpressTransactionBuilder } from "domain/synthetics/express/types"; +import { getGlvOrMarketAddress, GlvOrMarketInfo } from "domain/synthetics/markets"; +import { createBridgeOutTxn } from "domain/synthetics/markets/createBridgeOutTxn"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { convertToUsd, getMidPrice, getTokenData } from "domain/tokens"; +import { useChainId } from "lib/chains"; +import { helperToast } from "lib/helperToast"; +import { getMarketIndexName } from "sdk/utils/markets"; +import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "sdk/utils/numbers"; + +import Button from "components/Button/Button"; +import BuyInputSection from "components/BuyInputSection/BuyInputSection"; +import { SlideModal } from "components/Modal/SlideModal"; +import { useMultichainMarketTokenBalancesRequest } from "components/Synthetics/GmxAccountModal/hooks"; +import { wrapChainAction } from "components/Synthetics/GmxAccountModal/wrapChainAction"; +import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; +import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; +import { ValueTransition } from "components/ValueTransition/ValueTransition"; + +export function BridgeOutModal({ + isVisible, + setIsVisible, + glvOrMarketInfo, +}: { + isVisible: boolean; + setIsVisible: (isVisible: boolean) => void; + glvOrMarketInfo: GlvOrMarketInfo | undefined; +}) { + const { chainId, srcChainId } = useChainId(); + const [, setSettlementChainId] = useGmxAccountSettlementChainId(); + const globalExpressParams = useSelector(selectExpressGlobalParams); + const [bridgeOutChain, setBridgeOutChain] = useState(srcChainId); + const [bridgeOutInputValue, setBridgeOutInputValue] = useState(""); + + const depositMarketTokensData = useSelector(selectDepositMarketTokensData); + const glvOrMarketAddress = glvOrMarketInfo ? getGlvOrMarketAddress(glvOrMarketInfo) : undefined; + const marketToken = getTokenData(depositMarketTokensData, glvOrMarketAddress); + const isGlv = isGlvInfo(glvOrMarketInfo); + + const marketTokenDecimals = isGlv ? glvOrMarketInfo?.glvToken.decimals : marketToken?.decimals; + let marketTokenPrice: bigint | undefined = undefined; + if (isGlv && glvOrMarketInfo?.glvToken.prices) { + marketTokenPrice = getMidPrice(glvOrMarketInfo?.glvToken.prices); + } else if (marketToken?.prices) { + marketTokenPrice = getMidPrice(marketToken?.prices); + } + + const bridgeOutAmount = useMemo(() => { + return bridgeOutInputValue && marketTokenDecimals !== undefined + ? parseValue(bridgeOutInputValue, marketTokenDecimals) + : undefined; + }, [bridgeOutInputValue, marketTokenDecimals]); + + const bridgeOutUsd = useMemo(() => { + return bridgeOutAmount !== undefined && marketTokenDecimals !== undefined + ? convertToUsd(bridgeOutAmount, marketTokenDecimals, marketTokenPrice) + : undefined; + }, [bridgeOutAmount, marketTokenDecimals, marketTokenPrice]); + + const glvOrGm = isGlv ? "GLV" : "GM"; + const { address: account } = useAccount(); + + const { tokenBalancesData: marketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( + chainId, + srcChainId, + account, + glvOrMarketAddress + ); + + const settlementChainMarketTokenBalancesData: Partial> = useMemo(() => { + return { + [0]: marketTokenBalancesData[0], + }; + }, [marketTokenBalancesData]); + + const gmxAccountMarketTokenBalance: bigint | undefined = settlementChainMarketTokenBalancesData[0]; + + const bridgeOutChainMarketTokenBalance: bigint | undefined = bridgeOutChain + ? marketTokenBalancesData[bridgeOutChain] + : undefined; + + const nextBridgeOutMarketTokenBalance: bigint | undefined = + bridgeOutChainMarketTokenBalance !== undefined && bridgeOutAmount !== undefined + ? bridgeOutChainMarketTokenBalance + bridgeOutAmount + : undefined; + + const bridgeOutParams: BridgeOutParams | undefined = useMemo(() => { + if ( + bridgeOutChain === undefined || + glvOrMarketAddress === undefined || + bridgeOutAmount === undefined || + bridgeOutAmount <= 0n + ) { + return; + } + + const dstEid = getLayerZeroEndpointId(bridgeOutChain); + const stargateAddress = getStargatePoolAddress(chainId, glvOrMarketAddress); + + if (dstEid === undefined || stargateAddress === undefined) { + return; + } + + return { + token: glvOrMarketAddress as Address, + amount: bridgeOutAmount, + minAmountOut: bridgeOutAmount, + data: encodeAbiParameters( + [ + { + type: "uint32", + name: "dstEid", + }, + ], + [dstEid] + ), + provider: stargateAddress, + }; + }, [bridgeOutChain, glvOrMarketAddress, bridgeOutAmount, chainId]); + + const expressTransactionBuilder: ExpressTransactionBuilder | undefined = useMemo(() => { + if ( + account === undefined || + bridgeOutParams === undefined || + // provider === undefined || + bridgeOutChain === undefined + ) { + return; + } + + const expressTransactionBuilder: ExpressTransactionBuilder = async ({ gasPaymentParams, relayParams }) => ({ + txnData: await buildAndSignBridgeOutTxn({ + chainId: chainId as SettlementChainId, + signer: undefined, + account, + relayParamsPayload: relayParams, + params: bridgeOutParams, + emptySignature: true, + relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, + relayerFeeAmount: gasPaymentParams.relayerFeeAmount, + srcChainId: bridgeOutChain, + }), + }); + + return expressTransactionBuilder; + }, [account, bridgeOutChain, bridgeOutParams, chainId]); + + const expressTxnParamsAsyncResult = useArbitraryRelayParamsAndPayload({ + expressTransactionBuilder, + isGmxAccount: true, + }); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + if ( + !account || + !glvOrMarketAddress || + bridgeOutAmount === undefined || + !bridgeOutChain || + !globalExpressParams || + !bridgeOutParams + ) { + return; + } + + const expressTxnParams = await expressTxnParamsAsyncResult.promise; + + if (expressTxnParams === undefined) { + helperToast.error("Missing required parameters"); + return; + } + + await wrapChainAction(bridgeOutChain, setSettlementChainId, async (signer) => { + await createBridgeOutTxn({ + chainId: chainId as SettlementChainId, + srcChainId: bridgeOutChain, + account, + expressTxnParams, + relayerFeeAmount: expressTxnParams.gasPaymentParams.relayerFeeAmount, + relayerFeeTokenAddress: expressTxnParams.gasPaymentParams.relayerFeeTokenAddress, + params: bridgeOutParams, + signer, + }); + }); + }; + + useEffect(() => { + if (bridgeOutChain === undefined && srcChainId !== undefined) { + setBridgeOutChain(srcChainId); + } + }, [bridgeOutChain, srcChainId]); + + if (!glvOrMarketInfo) { + return null; + } + + return ( + + + setBridgeOutInputValue(e.target.value)} + bottomLeftValue={formatUsd(bridgeOutUsd)} + bottomRightValue={ + gmxAccountMarketTokenBalance !== undefined && marketTokenDecimals !== undefined + ? formatBalanceAmount(gmxAccountMarketTokenBalance, marketTokenDecimals) + : undefined + } + bottomRightLabel={t`Available`} + onClickMax={() => { + if (gmxAccountMarketTokenBalance === undefined || marketTokenDecimals === undefined) { + return; + } + setBridgeOutInputValue(formatAmountFree(gmxAccountMarketTokenBalance, marketTokenDecimals)); + }} + > + { + if (!isSourceChain(newBridgeOutChain)) { + return; + } + setBridgeOutChain(newBridgeOutChain); + }} + marketInfo={glvOrMarketInfo} + marketTokenPrice={marketTokenPrice} + tokenBalancesData={settlementChainMarketTokenBalancesData} + /> + + + {bridgeOutChain !== undefined && ( + + } + /> + )} + + + ); +} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 8cdb3fc918..ee5433e7e7 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -466,10 +466,25 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const receiveTokenFormatted = useMemo(() => { const usedMarketToken = glvInfo ? glvToken : marketToken; - return usedMarketToken && usedMarketToken.balance !== undefined - ? formatBalanceAmount(usedMarketToken.balance, usedMarketToken.decimals) - : undefined; - }, [marketToken, glvInfo, glvToken]); + if (!usedMarketToken) { + return undefined; + } + + let balance; + if (paySource === "gmxAccount") { + balance = usedMarketToken.gmxAccountBalance; + } else if (paySource === "sourceChain") { + balance = usedMarketToken.sourceChainBalance; + } else { + balance = usedMarketToken.walletBalance; + } + + if (balance === undefined) { + return undefined; + } + + return formatBalanceAmount(balance, usedMarketToken.decimals); + }, [glvInfo, glvToken, marketToken, paySource]); const receiveTokenUsd = glvInfo ? amounts?.glvTokenUsd ?? 0n diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index c67c8bfb52..d61c1a59ad 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -4,13 +4,7 @@ import { useCallback, useMemo } from "react"; import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; -import { - CHAIN_ID_TO_ENDPOINT_ID, - getLayerZeroEndpointId, - getMultichainTokenId, - getStargatePoolAddress, - isSettlementChain, -} from "config/multichain"; +import { getLayerZeroEndpointId, getStargatePoolAddress, isSettlementChain } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; @@ -27,6 +21,7 @@ import { import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; import { createMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; import { createMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; +import { createSourceChainGlvWithdrawalTxn } from "domain/synthetics/markets/createSourceChainGlvWithdrawalTxn"; import { createSourceChainWithdrawalTxn } from "domain/synthetics/markets/createSourceChainWithdrawalTxn"; import { useChainId } from "lib/chains"; import { helperToast } from "lib/helperToast"; @@ -65,9 +60,7 @@ export const useWithdrawalTransactions = ({ executionFee, selectedMarketInfoForGlv, marketToken, - operation, tokensData, - isMarketTokenDeposit, marketInfo, shouldDisableValidation, }: UseLpTransactionProps) => { @@ -125,8 +118,6 @@ export const useWithdrawalTransactions = ({ !initialLongTokenAddress || !initialShortTokenAddress ) { - console.log("NO GM PARAMS"); - return undefined; } @@ -136,8 +127,6 @@ export const useWithdrawalTransactions = ({ if (paySource === "sourceChain") { if (!srcChainId) { - console.log("NO SRC CHAIN ID"); - return undefined; } @@ -148,17 +137,12 @@ export const useWithdrawalTransactions = ({ ); if (!provider || !secondaryProvider) { - console.log("NO PROVIDER OR SECONDARY PROVIDER", { - initialLongTokenAddress, - initialShortTokenAddress, - }); return undefined; } const dstEid = getLayerZeroEndpointId(srcChainId); if (!dstEid) { - console.log("NO DST EID"); return undefined; } @@ -230,30 +214,41 @@ export const useWithdrawalTransactions = ({ return undefined; } - const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, glvTokenAmount); - let dataList: string[] = EMPTY_ARRAY; if (paySource === "sourceChain") { if (!srcChainId) { return undefined; } - const tokenId = getMultichainTokenId(chainId, glvTokenAddress!); - if (!tokenId) { + const provider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, initialLongTokenAddress, "native")); + const secondaryProvider = getStargatePoolAddress( + chainId, + convertTokenAddress(chainId, initialShortTokenAddress, "native") + ); + + if (!provider || !secondaryProvider) { + return undefined; + } + + const dstEid = getLayerZeroEndpointId(srcChainId); + + if (!dstEid) { return undefined; } + const providerData = numberToHex(dstEid, { size: 32 }); + const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), desChainId: chainId, - minAmountOut: minGlvTokens / 2n, - provider: tokenId.stargate, - providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), - // TODO MLTCH put secondary provider and data - secondaryProvider: zeroAddress, - secondaryProviderData: zeroAddress, + provider: provider, + providerData: providerData, + // TODO MLTCH apply some slippage + minAmountOut: 0n, + secondaryProvider: secondaryProvider, + secondaryProviderData: providerData, secondaryMinAmountOut: 0n, }, }); @@ -389,12 +384,22 @@ export const useWithdrawalTransactions = ({ let promise: Promise; if (paySource === "sourceChain") { - throw new Error("Not implemented"); + if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams) { + throw new Error("An error occurred"); + } + + promise = createSourceChainGlvWithdrawalTxn({ + chainId, + srcChainId, + signer, + globalExpressParams, + transferRequests, + params: glvParams!, + tokenAmount: glvTokenAmount!, + }); } else if (paySource === "gmxAccount") { const expressTxnParams = await multichainWithdrawalExpressTxnParams.promise; if (!expressTxnParams) { - console.log(multichainWithdrawalExpressTxnParams.error); - throw new Error("Express txn params are not set"); } @@ -407,30 +412,6 @@ export const useWithdrawalTransactions = ({ srcChainId, }); } else if (paySource === "settlementChain") { - // promise = createGlvWithdrawalTxn({ - // chainId, - // signer, - // account, - // initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, - // initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, - // longTokenSwapPath: [], - // shortTokenSwapPath: [], - // glvTokenAddress: glvInfo!.glvTokenAddress, - // glvTokenAmount: glvTokenAmount!, - // minLongTokenAmount: longTokenAmount, - // minShortTokenAmount: shortTokenAmount, - // executionFee: executionFee.feeTokenAmount, - // executionGasLimit: executionFee.gasLimit, - // allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, - // skipSimulation: shouldDisableValidation, - // tokensData, - // setPendingTxns, - // setPendingWithdrawal, - // selectedGmMarket: selectedMarketForGlv!, - // glv: glvInfo!.glvTokenAddress, - // blockTimestampData, - // }); - promise = createGlvWithdrawalTxn({ chainId, signer, @@ -461,16 +442,16 @@ export const useWithdrawalTransactions = ({ tokensData, signer, paySource, - multichainWithdrawalExpressTxnParams.promise, - multichainWithdrawalExpressTxnParams.error, chainId, - glvParams, - transferRequests, srcChainId, + globalExpressParams, + transferRequests, + glvParams, + glvTokenAmount, + multichainWithdrawalExpressTxnParams.promise, setPendingTxns, setPendingWithdrawal, blockTimestampData, - glvTokenAmount, ] ); @@ -514,8 +495,6 @@ export const useWithdrawalTransactions = ({ } else if (paySource === "gmxAccount") { const expressTxnParams = await multichainWithdrawalExpressTxnParams.promise; if (!expressTxnParams) { - console.log(multichainWithdrawalExpressTxnParams.error); - throw new Error("Express txn params are not set"); } @@ -531,19 +510,9 @@ export const useWithdrawalTransactions = ({ promise = createWithdrawalTxn({ chainId, signer, - // account, - // initialLongTokenAddress: longTokenAddress || marketInfo.longTokenAddress, - // initialShortTokenAddress: shortTokenAddress || marketInfo.shortTokenAddress, - // longTokenSwapPath: [], - // shortTokenSwapPath: [], marketTokenAmount: marketTokenAmount!, - // minLongTokenAmount: longTokenAmount, - // minShortTokenAmount: shortTokenAmount, - // marketTokenAddress: marketToken.address, - // executionFee: executionFee.feeTokenAmount, executionGasLimit: executionFee.gasLimit, params: gmParams!, - // allowedSlippage: DEFAULT_SLIPPAGE_AMOUNT, tokensData, skipSimulation: shouldDisableValidation, setPendingTxns, @@ -576,7 +545,6 @@ export const useWithdrawalTransactions = ({ gmParams, marketTokenAmount, multichainWithdrawalExpressTxnParams.promise, - multichainWithdrawalExpressTxnParams.error, shouldDisableValidation, setPendingTxns, setPendingWithdrawal, diff --git a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx index 3820af34bf..dcfee0fdd7 100644 --- a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx @@ -362,12 +362,7 @@ export const WithdrawalView = () => { }, [withdrawalViewChain, selectedTokenAddress, unwrappedSelectedTokenAddress, inputAmount, chainId]); const expressTransactionBuilder: ExpressTransactionBuilder | undefined = useMemo(() => { - if ( - account === undefined || - bridgeOutParams === undefined || - provider === undefined || - withdrawalViewChain === undefined - ) { + if (account === undefined || bridgeOutParams === undefined || withdrawalViewChain === undefined) { return; } @@ -376,7 +371,7 @@ export const WithdrawalView = () => { chainId: chainId as SettlementChainId, signer: undefined, account, - relayParamsPayload: relayParams as RawRelayParamsPayload, + relayParamsPayload: relayParams, params: bridgeOutParams, emptySignature: true, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, @@ -386,7 +381,7 @@ export const WithdrawalView = () => { }); return expressTransactionBuilder; - }, [account, bridgeOutParams, chainId, provider, withdrawalViewChain]); + }, [account, bridgeOutParams, chainId, withdrawalViewChain]); const expressTxnParamsAsyncResult = useArbitraryRelayParamsAndPayload({ expressTransactionBuilder, @@ -437,6 +432,7 @@ export const WithdrawalView = () => { networkFee: networkFee, networkFeeUsd: networkFeeUsd, }); + useEffect(() => { if (networkFee !== undefined && networkFeeUsd !== undefined) { setLastValidNetworkFees({ @@ -445,6 +441,7 @@ export const WithdrawalView = () => { }); } }, [networkFee, networkFeeUsd]); + useEffect(() => { if (wrappedNativeTokenAddress === zeroAddress) { setShowWntWarning(false); @@ -520,7 +517,7 @@ export const WithdrawalView = () => { chainId: chainId as SettlementChainId, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, - relayParamsPayload: relayParamsPayload as RawRelayParamsPayload, + relayParamsPayload: relayParamsPayload, params: bridgeOutParams, signer, provider, diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index bbb7a91dd7..6fd08460ac 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -5,6 +5,7 @@ import type { RelayParamsPayload } from "domain/synthetics/express"; import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct, + CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct, } from "domain/synthetics/markets/types"; import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; @@ -16,6 +17,7 @@ import { BRIDGE_OUT_PARAMS, CREATE_DEPOSIT_PARAMS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE, + CREATE_GLV_WITHDRAWAL_PARAMS_TYPE, CREATE_WITHDRAWAL_PARAMS_TYPE, RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, @@ -91,12 +93,23 @@ type WithdrawalAction = { actionData: WithdrawalActionData; }; +type GlvWithdrawalActionData = CommonActionData & { + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvWithdrawalParamsStruct; +}; + +type GlvWithdrawalAction = { + actionType: MultichainActionType.GlvWithdrawal; + actionData: GlvWithdrawalActionData; +}; + export type MultichainAction = | SetTraderReferralCodeAction | DepositAction | BridgeOutAction | GlvDepositAction - | WithdrawalAction; + | WithdrawalAction + | GlvWithdrawalAction; export const GMX_DATA_ACTION_HASH = hashString("GMX_DATA_ACTION"); // TODO MLTCH also implement bytes32 public constant MAX_DATA_LENGTH = keccak256(abi.encode("MAX_DATA_LENGTH")); @@ -129,6 +142,7 @@ export class CodecUiHelper { return layerZeroEndpoint; } + // TODO MLTCH make this type safe public static encodeMultichainActionData(action: MultichainAction): string { let actionData: Hex | undefined; if (action.actionType === MultichainActionType.SetTraderReferralCode) { @@ -144,8 +158,8 @@ export class CodecUiHelper { [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_DEPOSIT_PARAMS_TYPE], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, - action.actionData.transferRequests, - action.actionData.params, + action.actionData.transferRequests as any, + action.actionData.params as any, ] ); } else if (action.actionType === MultichainActionType.BridgeOut) { @@ -169,8 +183,8 @@ export class CodecUiHelper { [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, - action.actionData.transferRequests, - action.actionData.params, + action.actionData.transferRequests as any, + action.actionData.params as any, ] ); } else if (action.actionType === MultichainActionType.Withdrawal) { @@ -178,8 +192,17 @@ export class CodecUiHelper { [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_WITHDRAWAL_PARAMS_TYPE], [ { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, - action.actionData.transferRequests, - action.actionData.params, + action.actionData.transferRequests as any, + action.actionData.params as any, + ] + ); + } else if (action.actionType === MultichainActionType.GlvWithdrawal) { + actionData = encodeAbiParameters( + [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_GLV_WITHDRAWAL_PARAMS_TYPE], + [ + { ...(action.actionData.relayParams as any), signature: action.actionData.signature as Hex }, + action.actionData.transferRequests as any, + action.actionData.params as any, ] ); } diff --git a/src/domain/multichain/codecs/hashParamsAbiItems.ts b/src/domain/multichain/codecs/hashParamsAbiItems.ts index f1ced189d0..66972e3a8b 100644 --- a/src/domain/multichain/codecs/hashParamsAbiItems.ts +++ b/src/domain/multichain/codecs/hashParamsAbiItems.ts @@ -153,3 +153,29 @@ export const BRIDGE_OUT_PARAMS = { { type: "uint256", name: "secondaryMinAmountOut" }, ], } as const; + +export const CREATE_GLV_WITHDRAWAL_PARAMS_TYPE = { + type: "tuple", + name: "", + components: [ + { + type: "tuple", + name: "addresses", + components: [ + { type: "address", name: "receiver" }, + { type: "address", name: "callbackContract" }, + { type: "address", name: "uiFeeReceiver" }, + { type: "address", name: "market" }, + { type: "address", name: "glv" }, + { type: "address[]", name: "longTokenSwapPath" }, + { type: "address[]", name: "shortTokenSwapPath" }, + ], + }, + { type: "uint256", name: "minLongTokenAmount" }, + { type: "uint256", name: "minShortTokenAmount" }, + { type: "bool", name: "shouldUnwrapNativeToken" }, + { type: "uint256", name: "executionFee" }, + { type: "uint256", name: "callbackGasLimit" }, + { type: "bytes32[]", name: "dataList" }, + ], +} as const; diff --git a/src/domain/synthetics/express/expressOrderUtils.ts b/src/domain/synthetics/express/expressOrderUtils.ts index 75c23432b7..57dea9288e 100644 --- a/src/domain/synthetics/express/expressOrderUtils.ts +++ b/src/domain/synthetics/express/expressOrderUtils.ts @@ -794,6 +794,7 @@ export function getOrderRelayRouterAddress( return getContract(chainId, contractName); } +// TODO MLTCH: move to bridge out utils export async function buildAndSignBridgeOutTxn({ chainId, srcChainId, diff --git a/src/domain/synthetics/markets/createBridgeOutTxn.ts b/src/domain/synthetics/markets/createBridgeOutTxn.ts index c7c689e69d..193dd870f3 100644 --- a/src/domain/synthetics/markets/createBridgeOutTxn.ts +++ b/src/domain/synthetics/markets/createBridgeOutTxn.ts @@ -1,103 +1,48 @@ -import { encodeFunctionData } from "viem"; - import { SettlementChainId, SourceChainId } from "config/chains"; -import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { BridgeOutParams } from "domain/multichain/types"; +import { ExpressTxnParams } from "domain/synthetics/express"; +import { sendExpressTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; -import { abis } from "sdk/abis"; -import { signCreateBridgeOut } from "./signCreateBridgeOut"; +import { buildAndSignBridgeOutTxn } from "../express/expressOrderUtils"; type TxnParams = { chainId: SettlementChainId; - srcChainId: SourceChainId | undefined; + srcChainId: SourceChainId; signer: WalletSigner; - relayParams: RelayParamsPayload; - emptySignature?: boolean; - tokenAddress: string; - tokenAmount: bigint; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; + account: string; + params: BridgeOutParams; + expressTxnParams: ExpressTxnParams; }; -async function buildAndSignBridgeOutTxn({ +export async function createBridgeOutTxn({ chainId, srcChainId, signer, - relayParams, - emptySignature, - tokenAddress, - tokenAmount, - relayerFeeTokenAddress, + account, + expressTxnParams, relayerFeeAmount, -}: TxnParams): Promise { - let signature: string; - - if (emptySignature) { - signature = "0x"; - } else { - signature = await signCreateBridgeOut(); - } + relayerFeeTokenAddress, + params, +}: TxnParams) { + const txnData = await buildAndSignBridgeOutTxn({ + chainId, + srcChainId: srcChainId, + relayParamsPayload: expressTxnParams.relayParamsPayload, + params, + signer, + account, + relayerFeeTokenAddress, + relayerFeeAmount, + }); - const bridgeOutData = encodeFunctionData({ - abi: abis.MultichainTransferRouter, - functionName: "", + const receipt = await sendExpressTransaction({ + chainId, + isSponsoredCall: expressTxnParams.isSponsoredCall, + txnData, }); -} -export async function createBridgeOutTxn({ - chainId, - srcChainId, - signer, - account, - tokenAddress, - tokenAmount, -}: { - chainId: SettlementChainId; - globalExpressParams: GlobalExpressParams; - srcChainId: SourceChainId; - signer: WalletSigner; - account: string; - tokenAddress: string; - tokenAmount: bigint; -}) { - // const composeGas = await estimateMultichainDepositNetworkComposeGas({ - // chainId, - // account, - // srcChainId, - // tokenAddress, - // settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - // }); - // const sendParams: SendParamStruct = getMultichainTransferSendParams({ - // dstChainId: chainId, - // account, - // srcChainId, - // amount: tokenAmount, - // composeGas, - // isToGmx: true, - // isManualGas: true, - // }); - // const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); - // if (!sourceChainTokenId) { - // throw new Error("Token ID not found"); - // } - // const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; - // const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - // const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); - // try { - // const txnResult = await sendWalletTransaction({ - // chainId: srcChainId!, - // to: sourceChainTokenId.stargate, - // signer, - // callData: encodeFunctionData({ - // abi: IStargateAbi as unknown as typeof IStargate__factory.abi, - // functionName: "send", - // args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], - // }), - // value, - // msg: t`Sent transfer in transaction`, - // }); - // await txnResult.wait(); - // } catch (error) { - // toastCustomOrStargateError(chainId, error); - // } + await receipt.wait(); } diff --git a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts index b05e16a1fd..2f238f7844 100644 --- a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts @@ -82,7 +82,7 @@ export async function createMultichainGlvWithdrawalTxn({ srcChainId, signer, transferRequests, - expressTxnParams: expressTxnParams, + expressTxnParams, params, }: { chainId: ContractsChainId; @@ -112,8 +112,7 @@ export async function createMultichainGlvWithdrawalTxn({ await sendExpressTransaction({ chainId, - // TODO MLTCH: pass true when we can - isSponsoredCall: false, + isSponsoredCall: expressTxnParams.isSponsoredCall, txnData, }); } diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts new file mode 100644 index 0000000000..d1fe35544e --- /dev/null +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -0,0 +1,143 @@ +import { t } from "@lingui/macro"; +import { getPublicClient } from "@wagmi/core"; +import { Contract } from "ethers"; +import { encodeFunctionData, Hex, zeroAddress } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; +import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { CreateGlvWithdrawalParamsStruct } from "domain/synthetics/markets"; +import { sendWalletTransaction } from "lib/transactions"; +import { WalletSigner } from "lib/wallets"; +import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { getTokenBySymbol } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { nowInSeconds } from "sdk/utils/time"; +import { IRelayUtils } from "typechain-types/MultichainGlvRouter"; +import { IStargate, IStargate__factory } from "typechain-types-stargate"; +import { SendParamStruct } from "typechain-types-stargate/IStargate"; + +import { toastCustomOrStargateError } from "components/Synthetics/GmxAccountModal/toastCustomOrStargateError"; + +import { signCreateGlvWithdrawal } from "./signCreateGlvWithdrawal"; + +export async function createSourceChainGlvWithdrawalTxn({ + chainId, + globalExpressParams, + srcChainId, + signer, + transferRequests, + params, + + tokenAmount, +}: { + chainId: SettlementChainId; + globalExpressParams: GlobalExpressParams; + srcChainId: SourceChainId; + signer: WalletSigner; + transferRequests: IRelayUtils.TransferRequestsStruct; + params: CreateGlvWithdrawalParamsStruct; + tokenAmount: bigint; +}) { + const account = params.addresses.receiver; + const glvTokenAddress = params.addresses.glv; + + const rawRelayParamsPayload = getRawRelayerParams({ + chainId: chainId, + gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, + relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + feeParams: { + feeToken: getTokenBySymbol(chainId, "USDC.SG").address, + // TODO MLTCH this is going through the keeper to execute a depost + // so there 100% should be a fee + feeAmount: 10n * 10n ** 6n, + feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + marketsInfoData: globalExpressParams!.marketsInfoData, + }); + + const relayParams: RelayParamsPayload = { + ...rawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + params.executionFee = params.executionFee * 2n; + + const signature = await signCreateGlvWithdrawal({ + chainId, + srcChainId, + signer, + relayParams, + transferRequests, + params, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.GlvWithdrawal, + actionData: { + relayParams, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress: glvTokenAddress, + settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + }); + + // TODO MLTCH withdrawal also includes a withdrawal compose gas + + const sendParams: SendParamStruct = getMultichainTransferSendParams({ + dstChainId: chainId, + account, + srcChainId, + amount: tokenAmount, + composeGas: composeGas, + isToGmx: true, + isManualGas: true, + action, + }); + + const sourceChainTokenId = getMappedTokenId(chainId, glvTokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Token ID not found"); + } + + const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + + const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + + const value = quoteSend.nativeFee + (glvTokenAddress === zeroAddress ? tokenAmount : 0n); + + try { + const txnResult = await sendWalletTransaction({ + chainId: srcChainId!, + to: sourceChainTokenId.stargate, + signer, + callData: encodeFunctionData({ + abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + functionName: "send", + args: [sendParams as any, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + }), + value, + msg: t`Sent withdrawal transaction`, + }); + + await txnResult.wait(); + } catch (error) { + toastCustomOrStargateError(chainId, error); + } +} diff --git a/src/domain/synthetics/markets/signCreateBridgeOut.ts b/src/domain/synthetics/markets/signCreateBridgeOut.ts deleted file mode 100644 index c86faa8705..0000000000 --- a/src/domain/synthetics/markets/signCreateBridgeOut.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { AbstractSigner, Wallet } from "ethers"; - -import type { ContractsChainId, SourceChainId } from "config/chains"; -import type { WalletSigner } from "lib/wallets"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; - -import type { CreateWithdrawalParamsStruct } from "."; -import type { RelayParamsPayload } from "../express/types"; - -export async function signCreateBridgeOut({ - signer, - chainId, - srcChainId, - relayParams, - transferRequests, - params, -}: { - signer: AbstractSigner | WalletSigner | Wallet; - relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; - params: CreateWithdrawalParamsStruct; - chainId: ContractsChainId; - srcChainId: SourceChainId | undefined; -}) { - throw new Error("Not implemented"); - // const types = { - // CreateWithdrawal: [ - // { name: "transferTokens", type: "address[]" }, - // { name: "transferReceivers", type: "address[]" }, - // { name: "transferAmounts", type: "uint256[]" }, - // { name: "addresses", type: "CreateWithdrawalAddresses" }, - // { name: "minLongTokenAmount", type: "uint256" }, - // { name: "minShortTokenAmount", type: "uint256" }, - // { name: "shouldUnwrapNativeToken", type: "bool" }, - // { name: "executionFee", type: "uint256" }, - // { name: "callbackGasLimit", type: "uint256" }, - // { name: "dataList", type: "bytes32[]" }, - // { name: "relayParams", type: "bytes32" }, - // ], - // CreateWithdrawalAddresses: [ - // { name: "receiver", type: "address" }, - // { name: "callbackContract", type: "address" }, - // { name: "uiFeeReceiver", type: "address" }, - // { name: "market", type: "address" }, - // { name: "longTokenSwapPath", type: "address[]" }, - // { name: "shortTokenSwapPath", type: "address[]" }, - // ], - // }; - - // const domain = getGelatoRelayRouterDomain(srcChainId ?? chainId, getContract(chainId, "MultichainGmRouter")); - // const typedData = { - // transferTokens: transferRequests.tokens, - // transferReceivers: transferRequests.receivers, - // transferAmounts: transferRequests.amounts, - // addresses: params.addresses, - // minLongTokenAmount: params.minLongTokenAmount, - // minShortTokenAmount: params.minShortTokenAmount, - // shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, - // executionFee: params.executionFee, - // callbackGasLimit: params.callbackGasLimit, - // dataList: params.dataList, - // relayParams: hashRelayParams(relayParams), - // }; - - // return signTypedData({ signer, domain, types, typedData }); -} diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index 0f52467a90..f65d91b987 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -24,6 +24,8 @@ import { useBreakpoints } from "lib/useBreakpoints"; import { AnyChainId, getChainName } from "sdk/configs/chains"; import { getNormalizedTokenSymbol } from "sdk/configs/tokens"; +import { BridgeInModal } from "components/BridgeModal/BridgeInModal"; +import { BridgeOutModal } from "components/BridgeModal/BridgeOutModal"; import Button from "components/Button/Button"; import { useMultichainMarketTokenBalancesRequest } from "components/Synthetics/GmxAccountModal/hooks"; import { SyntheticsInfoRow } from "components/Synthetics/SyntheticsInfoRow"; @@ -33,7 +35,6 @@ import Buy16Icon from "img/ic_buy_16.svg?react"; import Sell16Icon from "img/ic_sell_16.svg?react"; import { PoolsDetailsMarketAmount } from "./PoolsDetailsMarketAmount"; -import { TransferInModal } from "./TransferInModal"; type Props = { glvOrMarketInfo: GlvOrMarketInfo | undefined; @@ -211,11 +212,16 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { Deposit {glvOrGm}
- setOpenedTransferModal(newIsVisible ? "transferIn" : undefined)} glvOrMarketInfo={glvOrMarketInfo} /> + setOpenedTransferModal(newIsVisible ? "transferOut" : undefined)} + glvOrMarketInfo={glvOrMarketInfo} + /> ); } From 9e54846e2b4a17f60f5425c92bab6145eae15962 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 23 Sep 2025 15:41:27 +0200 Subject: [PATCH 18/38] Multichain LP single sell --- sdk/src/types/trade.ts | 2 + sdk/src/utils/fees/executionFee.ts | 11 +- .../GmDepositWithdrawalBox.tsx | 120 +++++++++++------- .../lpTxn/useLpTransactions.tsx | 2 + .../lpTxn/useWithdrawalTransactions.tsx | 111 +++++++++++++--- .../useDepositWithdrawalAmounts.tsx | 39 ++++-- .../useDepositWithdrawalFees.tsx | 16 ++- .../useGmSwapSubmitState.tsx | 9 +- .../GmSwapBox/getGmSwapBoxAvailableModes.tsx | 6 +- .../GmxAccountModal/WithdrawalView.tsx | 1 + .../TokenSelector/TokenSelector.tsx | 10 +- src/config/chains.ts | 2 +- src/domain/multichain/codecs/CodecUiHelper.ts | 51 +++++--- .../createSourceChainGlvWithdrawalTxn.ts | 13 +- .../markets/createSourceChainWithdrawalTxn.ts | 19 ++- src/domain/synthetics/trade/types.ts | 28 ---- .../synthetics/trade/utils/withdrawal.ts | 53 ++++++-- 17 files changed, 337 insertions(+), 156 deletions(-) diff --git a/sdk/src/types/trade.ts b/sdk/src/types/trade.ts index 1b165cdf15..4088b58208 100644 --- a/sdk/src/types/trade.ts +++ b/sdk/src/types/trade.ts @@ -147,9 +147,11 @@ export type WithdrawalAmounts = { marketTokenAmount: bigint; marketTokenUsd: bigint; longTokenAmount: bigint; + longTokenSwapPathStats: SwapPathStats | undefined; shortTokenAmount: bigint; longTokenUsd: bigint; shortTokenUsd: bigint; + shortTokenSwapPathStats: SwapPathStats | undefined; glvTokenAmount: bigint; glvTokenUsd: bigint; swapFeeUsd: bigint; diff --git a/sdk/src/utils/fees/executionFee.ts b/sdk/src/utils/fees/executionFee.ts index 312ffee183..9e4cae5b24 100644 --- a/sdk/src/utils/fees/executionFee.ts +++ b/sdk/src/utils/fees/executionFee.ts @@ -298,14 +298,13 @@ export function estimateExecuteGlvWithdrawalGasLimit( */ export function estimateExecuteWithdrawalGasLimit( gasLimits: GasLimitsConfig, - withdrawal: { callbackGasLimit?: bigint } + withdrawal: { callbackGasLimit?: bigint; swapsCount?: number } ) { - // Swap is not used but supported in the contract. - // const gasPerSwap = gasLimits.singleSwap; - // const swapsCount = 0n; - // const gasForSwaps = swapsCount * gasPerSwap; + const gasPerSwap = gasLimits.singleSwap; + const swapsCount = BigInt(withdrawal.swapsCount ?? 0); + const gasForSwaps = swapsCount * gasPerSwap; - return gasLimits.withdrawalMultiToken + (withdrawal.callbackGasLimit ?? 0n); + return gasLimits.withdrawalMultiToken + (withdrawal.callbackGasLimit ?? 0n) + gasForSwaps; } /** diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index ee5433e7e7..e9f482252d 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -2,6 +2,8 @@ import { t } from "@lingui/macro"; import cx from "classnames"; import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; +import pickBy from "lodash/pickBy"; +import uniqBy from "lodash/uniqBy"; import { useCallback, useEffect, useMemo, useState } from "react"; import { useAccount } from "wagmi"; @@ -24,7 +26,7 @@ import { getMarketIndexName, getTokenPoolType, } from "domain/synthetics/markets/utils"; -import { convertToUsd, getMidPrice, getTokenData, TokenData } from "domain/synthetics/tokens"; +import { convertToUsd, getMidPrice, getTokenData } from "domain/synthetics/tokens"; import useSortedPoolsWithIndexToken from "domain/synthetics/trade/useSortedPoolsWithIndexToken"; import { Token, TokenBalanceType } from "domain/tokens"; import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; @@ -32,7 +34,7 @@ import { useChainId } from "lib/chains"; import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "lib/numbers"; import { getByKey } from "lib/objects"; import { switchNetwork } from "lib/wallets"; -import { NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; +import { getNativeToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; @@ -44,6 +46,7 @@ import { useBestGmPoolAddressForGlv } from "components/Synthetics/MarketStats/ho import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; +import TokenSelector from "components/TokenSelector/TokenSelector"; import TooltipWithPortal from "components/Tooltip/TooltipWithPortal"; import type { GmSwapBoxProps } from "../GmSwapBox"; @@ -72,17 +75,24 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const { shouldDisableValidationForTesting } = useSettings(); const { chainId, srcChainId } = useChainId(); const [isMarketForGlvSelectedManually, setIsMarketForGlvSelectedManually] = useState(false); + const { address: account } = useAccount(); // #region Requests + const { marketTokensData: depositMarketTokensData } = useMarketTokensData(chainId, srcChainId, { isDeposit: true }); const { marketTokensData: withdrawalMarketTokensData } = useMarketTokensData(chainId, srcChainId, { isDeposit: false, }); + const { tokenBalancesData: selectedGlvOrMarketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( + chainId, + srcChainId, + account, + selectedGlvOrMarketAddress + ); const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); const { tokenChainDataArray } = useMultichainTokens(); - const { address: account } = useAccount(); const { tokenBalancesData: marketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( chainId, srcChainId, @@ -100,7 +110,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { depositMarketTokensData ); const isDeposit = operation === Operation.Deposit; - const rawTokensData = useTokensData(); + const rawTradeTokensData = useTokensData(); // #region State const { @@ -122,12 +132,12 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #endregion // #region Derived state - const tokensData = useMemo(() => { + const tradeTokensData = useMemo(() => { if (paySource !== "sourceChain") { - return rawTokensData; + return rawTradeTokensData; } - return mapValues(rawTokensData, (token) => { + return mapValues(rawTradeTokensData, (token) => { const sourceChainToken = tokenChainDataArray.find( (t) => t.address === token.address && t.sourceChainId === srcChainId ); @@ -143,7 +153,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { sourceChainBalance: sourceChainToken.sourceChainBalance, }; }); - }, [rawTokensData, tokenChainDataArray, srcChainId, paySource]); + }, [rawTradeTokensData, tokenChainDataArray, srcChainId, paySource]); /** * When buy/sell GM - marketInfo is GM market, glvInfo is undefined @@ -166,7 +176,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }; }, [selectedGlvOrMarketAddress, glvAndMarketsInfoData, marketsInfoData, selectedMarketForGlv]); - const nativeToken = getByKey(tokensData, NATIVE_TOKEN_ADDRESS); + const nativeToken = getByKey(tradeTokensData, NATIVE_TOKEN_ADDRESS); const isWithdrawal = operation === Operation.Withdrawal; const isSingle = mode === Mode.Single; @@ -176,14 +186,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const indexName = useMemo(() => marketInfo && getMarketIndexName(marketInfo), [marketInfo]); const routerAddress = useMemo(() => getContract(chainId, "SyntheticsRouter"), [chainId]); - const allTokensData = useMemo(() => { + const marketAndTradeTokensData = useMemo(() => { return { - ...tokensData, + ...tradeTokensData, ...marketTokensData, }; - }, [tokensData, marketTokensData]); + }, [tradeTokensData, marketTokensData]); - let firstToken = getTokenData(allTokensData, firstTokenAddress); + let firstToken = getTokenData(marketAndTradeTokensData, firstTokenAddress); let firstTokenAmount = parseValue(firstTokenInputValue, firstToken?.decimals || 0); const firstTokenUsd = convertToUsd( firstTokenAmount, @@ -191,7 +201,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isDeposit ? firstToken?.prices?.minPrice : firstToken?.prices?.maxPrice ); - let secondToken = getTokenData(allTokensData, secondTokenAddress); + let secondToken = getTokenData(marketAndTradeTokensData, secondTokenAddress); let secondTokenAmount = parseValue(secondTokenInputValue, secondToken?.decimals || 0); const secondTokenUsd = convertToUsd( secondTokenAmount, @@ -297,22 +307,29 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }; }, [glvInfo, marketInfo, marketTokensData, marketOrGlvTokenInputValue, fromMarketTokenInputState?.amount]); + // TODO MLTCH: remove dependecy from dynamic market info as this hook can more static const tokenOptions: (Token & { isMarketToken?: boolean })[] = useMemo( - function getTokenOptions(): TokenData[] { + function getTokenOptions(): Token[] { const { longToken, shortToken } = marketInfo || {}; if (!longToken || !shortToken) return []; - const result = [longToken]; + const nativeToken = getNativeToken(chainId); - if (glvInfo && !isPair) { - const options = [longToken, shortToken]; + const result: Token[] = []; - const nativeToken = getByKey(tokensData, NATIVE_TOKEN_ADDRESS)!; - - if (options.some((token) => token.isWrapped) && nativeToken) { - options.unshift(nativeToken); + for (const sideToken of [longToken, shortToken]) { + if (paySource === "sourceChain" && sideToken.isWrapped) { + result.push(nativeToken); + } else if (paySource !== "gmxAccount" && paySource !== "sourceChain" && sideToken.isWrapped) { + result.push(sideToken, nativeToken); + } else { + result.push(sideToken); } + } + + if (glvInfo && !isPair) { + const options = [longToken, shortToken]; options.push( ...glvInfo.markets @@ -339,24 +356,21 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return options; } - if (longToken.address !== shortToken.address) { - result.push(shortToken); - } - - // TODO MLTCH: maybe allow to, but change chain - if (srcChainId === undefined || !isPair) { - const nativeToken = getByKey(tokensData, NATIVE_TOKEN_ADDRESS)!; - - if (result.some((token) => token.isWrapped) && nativeToken) { - result.unshift(nativeToken); - } - } - - return result; + return uniqBy(result, (token) => token.address); }, - [marketInfo, glvInfo, isPair, srcChainId, tokensData, marketTokensData, marketsInfoData] + [marketInfo, chainId, glvInfo, isPair, paySource, marketTokensData, marketsInfoData] ); + const availableTokensData = useMemo(() => { + return pickBy(tradeTokensData, (token) => { + return tokenOptions.find((t) => t.address === token.address); + }); + }, [tradeTokensData, tokenOptions]); + + // useEffect(() => { + // console.log({ availableTokensData, tokenOptions }); + // }, [availableTokensData, tokenOptions]); + const { longCollateralLiquidityUsd, shortCollateralLiquidityUsd } = useMemo(() => { if (!marketInfo) { return {}; @@ -385,6 +399,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { marketTokensData, isMarketTokenDeposit, glvInfo, + isPair, }); const { fees, executionFee } = useDepositWithdrawalFees({ @@ -393,7 +408,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { gasLimits, gasPrice, isDeposit, - tokensData, + tokensData: tradeTokensData, glvInfo, isMarketTokenDeposit, }); @@ -415,7 +430,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { operation, glvToken, shouldDisableValidation: shouldDisableValidationForTesting, - tokensData, + tokensData: tradeTokensData, longTokenAddress: longTokenInputState?.address, shortTokenAddress: shortTokenInputState?.address, longTokenLiquidityUsd: longCollateralLiquidityUsd, @@ -463,7 +478,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const marketTokenInputShowMaxButton = isWithdrawal && marketTokenMaxDetails.showClickMax; - const receiveTokenFormatted = useMemo(() => { + const marketTokenBalanceFormatted = useMemo(() => { const usedMarketToken = glvInfo ? glvToken : marketToken; if (!usedMarketToken) { @@ -474,7 +489,9 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { if (paySource === "gmxAccount") { balance = usedMarketToken.gmxAccountBalance; } else if (paySource === "sourceChain") { - balance = usedMarketToken.sourceChainBalance; + if (srcChainId !== undefined) { + balance = selectedGlvOrMarketTokenBalancesData[srcChainId]; + } } else { balance = usedMarketToken.walletBalance; } @@ -484,7 +501,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { } return formatBalanceAmount(balance, usedMarketToken.decimals); - }, [glvInfo, glvToken, marketToken, paySource]); + }, [glvInfo, glvToken, marketToken, paySource, selectedGlvOrMarketTokenBalancesData, srcChainId]); const receiveTokenUsd = glvInfo ? amounts?.glvTokenUsd ?? 0n @@ -516,7 +533,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isStable: firstToken.isStable, }); }, [firstToken, paySource]); - // #endregion // #region Callbacks const onFocusedCollateralInputChange = useCallback( @@ -787,7 +803,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { srcChainId={srcChainId} tokenAddress={firstTokenAddress} payChainId={paySource === "gmxAccount" ? 0 : paySource === "sourceChain" ? srcChainId : undefined} - tokensData={tokensData} + tokensData={availableTokensData} onSelectTokenAddress={async (tokenAddress, isGmxAccount, newSrcChainId) => { if (newSrcChainId !== srcChainId && newSrcChainId !== undefined) { await switchNetwork(newSrcChainId, true); @@ -802,6 +818,20 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { includeMultichainTokensInPay onDepositTokenAddress={noop} /> + ) : isWithdrawal && firstTokenAddress && isSingle && tokenOptions.length > 1 ? ( + { + handleFirstTokenSelect(token.address); + }} + showSymbolImage + showTokenImgInDropdown + tokens={tokenOptions} + chainIdBadge={ + paySource === "gmxAccount" ? 0 : paySource === "sourceChain" ? srcChainId : undefined + } + /> ) : ( firstTokenPlaceholder )} @@ -845,7 +875,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { topLeftLabel={isWithdrawal ? t`Pay` : t`Receive`} bottomLeftValue={formatUsd(receiveTokenUsd ?? 0n)} bottomRightLabel={t`Balance`} - bottomRightValue={receiveTokenFormatted} + bottomRightValue={marketTokenBalanceFormatted} inputValue={marketOrGlvTokenInputValue} onInputValueChange={marketOrGlvTokenInputValueChange} onClickTopRightLabel={marketTokenInputClickTopRightLabel} diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx index 4a479422ac..51bff1b0c9 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx @@ -20,7 +20,9 @@ export interface UseLpTransactionProps { marketTokenAmount: bigint | undefined; marketTokenUsd: bigint | undefined; longTokenAmount: bigint | undefined; + longTokenSwapPath: string[] | undefined; shortTokenAmount: bigint | undefined; + shortTokenSwapPath: string[] | undefined; glvTokenAmount: bigint | undefined; glvTokenUsd: bigint | undefined; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index d61c1a59ad..f3fd8b8e9a 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -12,7 +12,9 @@ import { selectExpressGlobalParams } from "context/SyntheticsStateContext/select import { selectBlockTimestampData } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { useQuoteSend } from "domain/multichain/useQuoteSend"; import { CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct, @@ -33,6 +35,7 @@ import { sendTxnValidationErrorMetric, } from "lib/metrics"; import { EMPTY_ARRAY } from "lib/objects"; +import { useJsonRpcProvider } from "lib/rpc"; import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; @@ -50,6 +53,8 @@ export const useWithdrawalTransactions = ({ longTokenAddress, shortTokenAddress, longTokenAmount, + longTokenSwapPath, + shortTokenSwapPath, shortTokenAmount, marketTokenAmount, marketTokenUsd, @@ -108,15 +113,76 @@ export const useWithdrawalTransactions = ({ ]); }, [chainId, glvTokenAddress, glvTokenAmount, isGlv, marketTokenAddress, marketTokenAmount]); + const { provider: settlementChainRpcProvider } = useJsonRpcProvider(chainId); + + const longTokenProviderTokenAddress = longTokenAddress; + const shortTokenProviderTokenAddress = shortTokenAddress; + const longOftProvider = longTokenProviderTokenAddress + ? getStargatePoolAddress(chainId, convertTokenAddress(chainId, longTokenProviderTokenAddress, "native")) + : undefined; + const shortOftProvider = shortTokenProviderTokenAddress + ? getStargatePoolAddress(chainId, convertTokenAddress(chainId, shortTokenProviderTokenAddress, "native")) + : undefined; + + const longTokenBaseSendParams = useMemo(() => { + if (!srcChainId || !account) { + return undefined; + } + + if (longTokenAmount === undefined || longTokenAmount === 0n) { + return undefined; + } + + return getMultichainTransferSendParams({ + dstChainId: srcChainId, + account, + amount: longTokenAmount, + isToGmx: false, + srcChainId: chainId, + }); + }, [account, chainId, longTokenAmount, srcChainId]); + + const shortTokenBaseSendParams = useMemo(() => { + if (!srcChainId || !account) { + return undefined; + } + + if (shortTokenAmount === undefined || shortTokenAmount === 0n) { + return undefined; + } + + return getMultichainTransferSendParams({ + dstChainId: srcChainId, + account, + amount: shortTokenAmount, + isToGmx: false, + srcChainId: chainId, + }); + }, [account, chainId, shortTokenAmount, srcChainId]); + + const longTokenQuoteSend = useQuoteSend({ + fromChainId: chainId, + toChainId: srcChainId, + sendParams: longTokenBaseSendParams, + fromChainProvider: settlementChainRpcProvider, + fromStargateAddress: longOftProvider, + }); + + const shortTokenQuoteSend = useQuoteSend({ + fromChainId: chainId, + toChainId: srcChainId, + sendParams: shortTokenBaseSendParams, + fromChainProvider: settlementChainRpcProvider, + fromStargateAddress: shortOftProvider, + }); + const gmParams = useMemo((): CreateWithdrawalParamsStruct | undefined => { if ( !account || !marketTokenAddress || marketTokenAmount === undefined || executionFeeTokenAmount === undefined || - isGlv || - !initialLongTokenAddress || - !initialShortTokenAddress + isGlv ) { return undefined; } @@ -125,21 +191,21 @@ export const useWithdrawalTransactions = ({ let dataList: string[] = EMPTY_ARRAY; + let executionFee = executionFeeTokenAmount; + if (paySource === "sourceChain") { if (!srcChainId) { return undefined; } - const provider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, initialLongTokenAddress, "native")); - const secondaryProvider = getStargatePoolAddress( - chainId, - convertTokenAddress(chainId, initialShortTokenAddress, "native") - ); + const provider = longOftProvider ?? shortOftProvider; - if (!provider || !secondaryProvider) { + if (!provider) { return undefined; } + const secondaryProvider = provider === shortOftProvider ? undefined : shortTokenAddress; + const dstEid = getLayerZeroEndpointId(srcChainId); if (!dstEid) { @@ -158,8 +224,8 @@ export const useWithdrawalTransactions = ({ // TODO MLTCH apply some slippage minAmountOut: 0n, // TODO MLTCH put secondary provider and data - secondaryProvider: secondaryProvider, - secondaryProviderData: providerData, + secondaryProvider: secondaryProvider ?? zeroAddress, + secondaryProviderData: secondaryProvider ? providerData : "0x", secondaryMinAmountOut: 0n, }, }); @@ -175,13 +241,17 @@ export const useWithdrawalTransactions = ({ callbackContract: zeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, market: marketTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], + longTokenSwapPath: longTokenSwapPath ?? [], + shortTokenSwapPath: shortTokenSwapPath ?? [], }, - minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), - minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + // TODO MLTCH: do not forget to apply slippage here + // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minLongTokenAmount: 0n, + // TODO MLTCH: do not forget to apply slippage + // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + minShortTokenAmount: 0n, shouldUnwrapNativeToken: false, - executionFee: executionFeeTokenAmount, + executionFee, callbackGasLimit: 0n, dataList, }; @@ -191,14 +261,15 @@ export const useWithdrawalTransactions = ({ account, chainId, executionFeeTokenAmount, - initialLongTokenAddress, - initialShortTokenAddress, isGlv, - longTokenAmount, + longOftProvider, + longTokenSwapPath, marketTokenAddress, marketTokenAmount, paySource, - shortTokenAmount, + shortOftProvider, + shortTokenAddress, + shortTokenSwapPath, srcChainId, ]); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx index 60cd35c5b1..5b471de6d6 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx @@ -1,5 +1,7 @@ import { useMemo } from "react"; +import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; +import { useSelector } from "context/SyntheticsStateContext/utils"; import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; import { TokenData, TokensData } from "domain/synthetics/tokens"; import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; @@ -10,6 +12,7 @@ import { TokenInputState } from "./types"; export function useDepositWithdrawalAmounts({ isDeposit, + isPair, isWithdrawal, marketInfo, marketToken, @@ -25,6 +28,7 @@ export function useDepositWithdrawalAmounts({ glvInfo, }: { isDeposit: boolean; + isPair: boolean; isWithdrawal: boolean; marketInfo: MarketInfo | undefined; marketToken: TokenData | undefined; @@ -41,6 +45,21 @@ export function useDepositWithdrawalAmounts({ }): DepositAmounts | WithdrawalAmounts | undefined { const halfOfLong = longTokenInputState?.amount !== undefined ? longTokenInputState.amount / 2n : undefined; + const hasLongTokenInputState = longTokenInputState !== undefined; + + const receiveTokenAddress = + !isDeposit && !isPair ? longTokenInputState?.address ?? shortTokenInputState?.address : undefined; + + const selectFindSwap = useMemo(() => { + if (!hasLongTokenInputState) { + // long to short swap + return makeSelectFindSwapPath(marketInfo?.longToken.address, marketInfo?.shortToken.address); + } + + return makeSelectFindSwapPath(marketInfo?.shortToken.address, marketInfo?.longToken.address); + }, [hasLongTokenInputState, marketInfo?.longToken.address, marketInfo?.shortToken.address]); + const findSwapPath = useSelector(selectFindSwap); + const amounts = useMemo(() => { if (isDeposit) { if (!marketInfo || !marketToken || !marketTokensData) { @@ -118,26 +137,30 @@ export function useDepositWithdrawalAmounts({ glvInfo, glvTokenAmount, glvToken, + findSwapPath, + receiveTokenAddress, }); } }, [ - focusedInput, - halfOfLong, isDeposit, - isMarketTokenDeposit, isWithdrawal, - marketTokensData, - longTokenInputState?.address, - longTokenInputState?.amount, marketInfo, marketToken, + marketTokensData, + glvInfo, marketTokenAmount, + glvTokenAmount, + longTokenInputState?.address, + longTokenInputState?.amount, shortTokenInputState?.address, shortTokenInputState?.amount, uiFeeFactor, - glvInfo, + focusedInput, + isMarketTokenDeposit, glvToken, - glvTokenAmount, + halfOfLong, + findSwapPath, + receiveTokenAddress, ]); return amounts; diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx index c999c566b5..093aff41d2 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx @@ -1,11 +1,11 @@ import { useMemo } from "react"; import { + estimateDepositOraclePriceCount, estimateExecuteDepositGasLimit, estimateExecuteGlvDepositGasLimit, estimateExecuteGlvWithdrawalGasLimit, estimateExecuteWithdrawalGasLimit, - estimateDepositOraclePriceCount, estimateGlvDepositOraclePriceCount, estimateGlvWithdrawalOraclePriceCount, estimateWithdrawalOraclePriceCount, @@ -16,7 +16,7 @@ import { } from "domain/synthetics/fees"; import { GlvInfo } from "domain/synthetics/markets"; import { TokensData } from "domain/synthetics/tokens"; -import { GmSwapFees } from "domain/synthetics/trade"; +import { GmSwapFees, WithdrawalAmounts } from "domain/synthetics/trade"; import { getExecutionFee } from "sdk/utils/fees/executionFee"; import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; @@ -84,10 +84,18 @@ export const useDepositWithdrawalFees = ({ ? estimateGlvDepositOraclePriceCount(glvMarketsCount) : estimateGlvWithdrawalOraclePriceCount(glvMarketsCount); } else { + const swapPathCount = + ((amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath.length ?? 0) + + ((amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath.length ?? 0); gasLimit = isDeposit ? estimateExecuteDepositGasLimit(gasLimits, {}) - : estimateExecuteWithdrawalGasLimit(gasLimits, {}); - oraclePriceCount = isDeposit ? estimateDepositOraclePriceCount(0) : estimateWithdrawalOraclePriceCount(0); + : estimateExecuteWithdrawalGasLimit(gasLimits, { + swapsCount: swapPathCount, + }); + + oraclePriceCount = isDeposit + ? estimateDepositOraclePriceCount(0) + : estimateWithdrawalOraclePriceCount(swapPathCount); } const executionFee = getExecutionFee(chainId, gasLimits, tokensData, gasLimit, gasPrice, oraclePriceCount); diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 6f5a72181c..6526f06916 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -15,14 +15,15 @@ import { useHasOutdatedUi } from "lib/useHasOutdatedUi"; import { userAnalytics } from "lib/userAnalytics"; import { TokenApproveClickEvent, TokenApproveResultEvent } from "lib/userAnalytics/types"; import useWallet from "lib/wallets/useWallet"; +import { WithdrawalAmounts } from "sdk/types/trade"; +import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; +import { Operation } from "../types"; import { useLpTransactions } from "./lpTxn/useLpTransactions"; +import type { GmPaySource } from "./types"; import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; import { useTokensToApprove } from "./useTokensToApprove"; -import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; -import { Operation } from "../types"; -import type { GmPaySource } from "./types"; interface Props { amounts: ReturnType; @@ -135,6 +136,8 @@ export const useGmSwapSubmitState = ({ marketTokenUsd, isFirstBuy, paySource, + longTokenSwapPath: (amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath, + shortTokenSwapPath: (amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath, }); const onConnectAccount = useCallback(() => { diff --git a/src/components/Synthetics/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes.tsx b/src/components/Synthetics/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes.tsx index 924905c9e6..4ec517c0d9 100644 --- a/src/components/Synthetics/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes.tsx +++ b/src/components/Synthetics/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes.tsx @@ -10,9 +10,5 @@ export const getGmSwapBoxAvailableModes = ( return [Mode.Single]; } - if (operation === Operation.Deposit) { - return [Mode.Single, Mode.Pair]; - } - - return [Mode.Pair]; + return [Mode.Single, Mode.Pair]; }; diff --git a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx index dcfee0fdd7..25100aef30 100644 --- a/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/Synthetics/GmxAccountModal/WithdrawalView.tsx @@ -298,6 +298,7 @@ export const WithdrawalView = () => { srcChainId: chainId, }); }, [account, chainId, unwrappedSelectedTokenSymbol, withdrawalViewChain]); + const isMaxButtonDisabled = useMemo(() => { if (!baseSendParams) { return true; diff --git a/src/components/TokenSelector/TokenSelector.tsx b/src/components/TokenSelector/TokenSelector.tsx index d94261a5fb..a4f6a701db 100644 --- a/src/components/TokenSelector/TokenSelector.tsx +++ b/src/components/TokenSelector/TokenSelector.tsx @@ -51,6 +51,7 @@ type Props = { footerContent?: ReactNode; marketsInfoData?: MarketsInfoData; qa?: string; + chainIdBadge?: number; }; export default function TokenSelector(props: Props) { @@ -81,6 +82,7 @@ export default function TokenSelector(props: Props) { marketsInfoData, chainId, qa, + chainIdBadge, } = props; const visibleTokens = tokens.filter((t) => t && !t.isTempHidden); @@ -297,7 +299,13 @@ export default function TokenSelector(props: Props) { {selectedTokenLabel || ( {showSymbolImage && ( - + )} {showTokenName ? tokenInfo.name : tokenInfo.symbol} diff --git a/src/config/chains.ts b/src/config/chains.ts index cb65a9393a..659ca5e197 100644 --- a/src/config/chains.ts +++ b/src/config/chains.ts @@ -155,7 +155,7 @@ export const RPC_PROVIDERS: Record = "https://optimism-sepolia.drpc.org", "https://optimism-sepolia.therpc.io", ], - [SOURCE_SEPOLIA]: ["https://sepolia.drpc.org"], + [SOURCE_SEPOLIA]: ["https://sepolia.drpc.org", "https://ethereum-sepolia-rpc.publicnode.com"], [BOTANIX]: [ // returns incorrect gas price // "https://rpc.botanixlabs.com", diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index 6fd08460ac..a23a479d2a 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -1,5 +1,5 @@ import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities"; -import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex } from "viem"; +import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex, zeroAddress } from "viem"; import type { RelayParamsPayload } from "domain/synthetics/express"; import { @@ -163,21 +163,40 @@ export class CodecUiHelper { ] ); } else if (action.actionType === MultichainActionType.BridgeOut) { - actionData = encodeAbiParameters( - [BRIDGE_OUT_PARAMS], - [ - { - desChainId: BigInt(action.actionData.desChainId), - deadline: action.actionData.deadline, - provider: action.actionData.provider as Address, - providerData: action.actionData.providerData as Hex, - minAmountOut: action.actionData.minAmountOut, - secondaryProvider: action.actionData.secondaryProvider as Address, - secondaryProviderData: action.actionData.secondaryProviderData as Hex, - secondaryMinAmountOut: action.actionData.secondaryMinAmountOut, - }, - ] - ); + if (action.actionData.secondaryProvider === zeroAddress || action.actionData.secondaryProviderData === "0x") { + actionData = encodeAbiParameters( + [ + { type: "uint256", name: "desChainId" }, + { type: "uint256", name: "deadline" }, + { type: "address", name: "provider" }, + { type: "bytes", name: "providerData" }, + { type: "uint256", name: "minAmountOut" }, + ], + [ + BigInt(action.actionData.desChainId), + action.actionData.deadline, + action.actionData.provider as Address, + action.actionData.providerData as Hex, + action.actionData.minAmountOut, + ] + ); + } else { + actionData = encodeAbiParameters( + [BRIDGE_OUT_PARAMS], + [ + { + desChainId: BigInt(action.actionData.desChainId), + deadline: action.actionData.deadline, + provider: action.actionData.provider as Address, + providerData: action.actionData.providerData as Hex, + minAmountOut: action.actionData.minAmountOut, + secondaryProvider: action.actionData.secondaryProvider as Address, + secondaryProviderData: action.actionData.secondaryProviderData as Hex, + secondaryMinAmountOut: action.actionData.secondaryMinAmountOut, + }, + ] + ); + } } else if (action.actionType === MultichainActionType.GlvDeposit) { actionData = encodeAbiParameters( [RELAY_PARAMS_TYPE, TRANSFER_REQUESTS_TYPE, CREATE_GLV_DEPOSIT_PARAMS_TYPE], diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts index d1fe35544e..27329f22d9 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -42,20 +42,23 @@ export async function createSourceChainGlvWithdrawalTxn({ transferRequests: IRelayUtils.TransferRequestsStruct; params: CreateGlvWithdrawalParamsStruct; tokenAmount: bigint; + // additionalFee: bigint; }) { const account = params.addresses.receiver; const glvTokenAddress = params.addresses.glv; - + // params.executionFee const rawRelayParamsPayload = getRawRelayerParams({ chainId: chainId, gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, feeParams: { - feeToken: getTokenBySymbol(chainId, "USDC.SG").address, + feeToken: getTokenBySymbol(chainId, "WETH").address, // TODO MLTCH this is going through the keeper to execute a depost // so there 100% should be a fee - feeAmount: 10n * 10n ** 6n, - feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + // feeAmount: 10n * 10n ** 6n, + feeAmount: 85022412326765n, // params.executionFee, + // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + feeSwapPath: [], }, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], @@ -67,8 +70,6 @@ export async function createSourceChainGlvWithdrawalTxn({ deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), }; - params.executionFee = params.executionFee * 2n; - const signature = await signCreateGlvWithdrawal({ chainId, srcChainId, diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts index f624400e9a..164a417eea 100644 --- a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -55,13 +55,22 @@ export async function createSourceChainWithdrawalTxn({ chainId: chainId, gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, + // feeParams: { + // // feeToken: globalExpressParams!.relayerFeeTokenAddress, + // feeToken: getTokenBySymbol(chainId, "USDC.SG").address, + // // TODO MLTCH this is going through the keeper to execute a depost + // // so there 100% should be a fee + // feeAmount: 2n * 10n ** 6n, + // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + // }, feeParams: { - // feeToken: globalExpressParams!.relayerFeeTokenAddress, - feeToken: getTokenBySymbol(chainId, "USDC.SG").address, + feeToken: getTokenBySymbol(chainId, "WETH").address, // TODO MLTCH this is going through the keeper to execute a depost // so there 100% should be a fee - feeAmount: 2n * 10n ** 6n, - feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + // feeAmount: 10n * 10n ** 6n, + feeAmount: 639488160000000n, // params.executionFee, + // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + feeSwapPath: [], }, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], @@ -134,7 +143,7 @@ export async function createSourceChainWithdrawalTxn({ callData: encodeFunctionData({ abi: IStargateAbi as unknown as typeof IStargate__factory.abi, functionName: "send", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + args: [sendParams as any, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], }), value, msg: t`Sent deposit transaction`, diff --git a/src/domain/synthetics/trade/types.ts b/src/domain/synthetics/trade/types.ts index d266dcfb3b..658d26f577 100644 --- a/src/domain/synthetics/trade/types.ts +++ b/src/domain/synthetics/trade/types.ts @@ -101,34 +101,6 @@ export type DecreasePositionAmounts = { decreaseSwapType: DecreasePositionSwapType; }; -export type DepositAmounts = { - marketTokenAmount: bigint; - marketTokenUsd: bigint; - longTokenAmount: bigint; - longTokenUsd: bigint; - glvTokenAmount: bigint; - glvTokenUsd: bigint; - shortTokenAmount: bigint; - shortTokenUsd: bigint; - swapFeeUsd: bigint; - uiFeeUsd: bigint; - swapPriceImpactDeltaUsd: bigint; -}; - -export type WithdrawalAmounts = { - marketTokenAmount: bigint; - marketTokenUsd: bigint; - longTokenAmount: bigint; - shortTokenAmount: bigint; - longTokenUsd: bigint; - shortTokenUsd: bigint; - glvTokenAmount: bigint; - glvTokenUsd: bigint; - swapFeeUsd: bigint; - uiFeeUsd: bigint; - swapPriceImpactDeltaUsd: bigint; -}; - export type NextPositionValues = { nextLeverage?: bigint; nextLiqPrice?: bigint; diff --git a/src/domain/synthetics/trade/utils/withdrawal.ts b/src/domain/synthetics/trade/utils/withdrawal.ts index 02db0ff34b..1b8b50dd8d 100644 --- a/src/domain/synthetics/trade/utils/withdrawal.ts +++ b/src/domain/synthetics/trade/utils/withdrawal.ts @@ -1,7 +1,7 @@ import { GlvInfo, MarketInfo, marketTokenAmountToUsd, usdToMarketTokenAmount } from "domain/synthetics/markets"; import { TokenData, convertToTokenAmount, convertToUsd } from "domain/synthetics/tokens"; import { applyFactor } from "lib/numbers"; -import { WithdrawalAmounts } from "sdk/types/trade"; +import { FindSwapPath, WithdrawalAmounts } from "sdk/types/trade"; import { bigMath } from "sdk/utils/bigmath"; export function getWithdrawalAmounts(p: { @@ -10,13 +10,15 @@ export function getWithdrawalAmounts(p: { marketTokenAmount: bigint; longTokenAmount: bigint; shortTokenAmount: bigint; + receiveTokenAddress: string | undefined; uiFeeFactor: bigint; strategy: "byMarketToken" | "byLongCollateral" | "byShortCollateral" | "byCollaterals"; forShift?: boolean; glvInfo?: GlvInfo; glvTokenAmount?: bigint; glvToken?: TokenData; -}) { + findSwapPath: FindSwapPath; +}): WithdrawalAmounts { const { marketInfo, marketToken, @@ -28,6 +30,7 @@ export function getWithdrawalAmounts(p: { glvInfo, glvToken, glvTokenAmount, + findSwapPath, } = p; const { longToken, shortToken } = marketInfo; @@ -52,6 +55,8 @@ export function getWithdrawalAmounts(p: { swapFeeUsd: 0n, uiFeeUsd: 0n, swapPriceImpactDeltaUsd: 0n, + longTokenSwapPathStats: undefined, + shortTokenSwapPathStats: undefined, }; if (totalPoolUsd == 0n) { @@ -92,12 +97,44 @@ export function getWithdrawalAmounts(p: { values.longTokenUsd = values.longTokenUsd - longSwapFeeUsd - longUiFeeUsd; values.shortTokenUsd = values.shortTokenUsd - shortSwapFeeUsd - shortUiFeeUsd; - values.longTokenAmount = convertToTokenAmount(values.longTokenUsd, longToken.decimals, longToken.prices.maxPrice)!; - values.shortTokenAmount = convertToTokenAmount( - values.shortTokenUsd, - shortToken.decimals, - shortToken.prices.maxPrice - )!; + if (!p.receiveTokenAddress) { + values.longTokenAmount = convertToTokenAmount( + values.longTokenUsd, + longToken.decimals, + longToken.prices.maxPrice + )!; + values.shortTokenAmount = convertToTokenAmount( + values.shortTokenUsd, + shortToken.decimals, + shortToken.prices.maxPrice + )!; + } else if (p.receiveTokenAddress === longToken.address) { + const shortToLongSwapPathStats = findSwapPath(values.shortTokenUsd); + if (!shortToLongSwapPathStats) { + throw new Error("Short to long swap path stats is not valid"); + } + values.shortTokenUsd = 0n; + values.shortTokenSwapPathStats = shortToLongSwapPathStats; + values.longTokenUsd += shortToLongSwapPathStats.usdOut; + values.longTokenAmount = convertToTokenAmount( + values.longTokenUsd, + longToken.decimals, + longToken.prices.maxPrice + )!; + } else if (p.receiveTokenAddress === shortToken.address) { + const longToShortSwapPathStats = findSwapPath(values.longTokenUsd); + if (!longToShortSwapPathStats) { + throw new Error("Long to short swap path stats is not valid"); + } + values.longTokenUsd = 0n; + values.longTokenSwapPathStats = longToShortSwapPathStats; + values.shortTokenUsd += longToShortSwapPathStats.usdOut; + values.shortTokenAmount = convertToTokenAmount( + values.shortTokenUsd, + shortToken.decimals, + shortToken.prices.maxPrice + )!; + } } else { if (strategy === "byLongCollateral" && longPoolUsd > 0) { values.longTokenAmount = longTokenAmount; From 20c56d8fe6683da464b1189ced858755fd8321f6 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 25 Sep 2025 16:23:52 +0200 Subject: [PATCH 19/38] Replace icon components --- .../TokenSelector/MultichainMarketTokenSelector.tsx | 5 +++-- src/pages/PoolsDetails/PoolsDetailsHeader.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/TokenSelector/MultichainMarketTokenSelector.tsx b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx index 0f3bb93721..f8b8efebe1 100644 --- a/src/components/TokenSelector/MultichainMarketTokenSelector.tsx +++ b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx @@ -1,7 +1,6 @@ import { t } from "@lingui/macro"; import cx from "classnames"; import { useMemo, useState } from "react"; -import { BiChevronDown } from "react-icons/bi"; import { getChainName, type AnyChainId, type ContractsChainId, type SourceChainId } from "config/chains"; import { getChainIcon } from "config/icons"; @@ -22,6 +21,8 @@ import { SlideModal } from "components/Modal/SlideModal"; import { ButtonRowScrollFadeContainer } from "components/TableScrollFade/TableScrollFade"; import TokenIcon from "components/TokenIcon/TokenIcon"; +import ChevronDownIcon from "img/ic_chevron_down.svg?react"; + import "./TokenSelector.scss"; type Props = { @@ -181,7 +182,7 @@ export function MultichainMarketTokenSelector({ )} - + ); diff --git a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx index 152ad6b41d..0625d87bab 100644 --- a/src/pages/PoolsDetails/PoolsDetailsHeader.tsx +++ b/src/pages/PoolsDetails/PoolsDetailsHeader.tsx @@ -1,7 +1,6 @@ import { t, Trans } from "@lingui/macro"; import cx from "classnames"; import { useCallback, useMemo, useState } from "react"; -import { ImSpinner2 } from "react-icons/im"; import { USD_DECIMALS } from "config/factors"; import { selectAccount } from "context/SyntheticsStateContext/selectors/globalSelectors"; @@ -33,6 +32,7 @@ import TokenIcon from "components/TokenIcon/TokenIcon"; import Buy16Icon from "img/ic_buy_16.svg?react"; import ChevronDownIcon from "img/ic_chevron_down.svg?react"; import Sell16Icon from "img/ic_sell_16.svg?react"; +import SpinnerIcon from "img/ic_spinner.svg?react"; import { PoolsDetailsMarketAmount } from "./PoolsDetailsMarketAmount"; @@ -176,7 +176,8 @@ export function PoolsDetailsHeader({ glvOrMarketInfo, marketToken }: Props) { /> ); })} - {isBalanceDataLoading && } + + {isBalanceDataLoading && } } /> From f3cbcef31a45a9767df0f7a838c946cff3f08140 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Thu, 25 Sep 2025 18:00:57 +0200 Subject: [PATCH 20/38] Multichain lp glv sell to single --- .../utils/fees/estimateOraclePriceCount.ts | 2 +- sdk/src/utils/fees/executionFee.ts | 11 ++- .../GmDepositWithdrawalBox.tsx | 5 +- .../lpTxn/useWithdrawalTransactions.tsx | 97 ++++++++++--------- .../useDepositWithdrawalAmounts.tsx | 11 ++- .../useDepositWithdrawalFees.tsx | 10 +- src/components/TokenIcon/TokenIcon.tsx | 4 +- .../createSourceChainGlvWithdrawalTxn.ts | 2 +- .../markets/createSourceChainWithdrawalTxn.ts | 2 +- .../synthetics/trade/utils/withdrawal.ts | 10 +- 10 files changed, 86 insertions(+), 68 deletions(-) diff --git a/sdk/src/utils/fees/estimateOraclePriceCount.ts b/sdk/src/utils/fees/estimateOraclePriceCount.ts index b1d7c584d9..3dc385e79b 100644 --- a/sdk/src/utils/fees/estimateOraclePriceCount.ts +++ b/sdk/src/utils/fees/estimateOraclePriceCount.ts @@ -3,7 +3,7 @@ export function estimateDepositOraclePriceCount(swapsCount: number): bigint { return 3n + BigInt(swapsCount); } -export function estimateWithdrawalOraclePriceCount(swapsCount: number): bigint { +export function estimateWithdrawalOraclePriceCount(swapsCount: bigint): bigint { return 3n + BigInt(swapsCount); } diff --git a/sdk/src/utils/fees/executionFee.ts b/sdk/src/utils/fees/executionFee.ts index 9e4cae5b24..19421461e0 100644 --- a/sdk/src/utils/fees/executionFee.ts +++ b/sdk/src/utils/fees/executionFee.ts @@ -279,8 +279,10 @@ export function estimateExecuteGlvWithdrawalGasLimit( gasLimits: GasLimitsConfig, { marketsCount, + swapsCount, }: { marketsCount: bigint; + swapsCount: bigint; } ) { const gasPerGlvPerMarket = gasLimits.glvPerMarketGasLimit; @@ -288,7 +290,10 @@ export function estimateExecuteGlvWithdrawalGasLimit( const glvWithdrawalGasLimit = gasLimits.glvWithdrawalGasLimit; const gasLimit = glvWithdrawalGasLimit + gasForGlvMarkets; - return gasLimit + gasLimits.withdrawalMultiToken; + const gasPerSwap = gasLimits.singleSwap; + const gasForSwaps = swapsCount * gasPerSwap; + + return gasLimit + gasLimits.withdrawalMultiToken + gasForSwaps; } /** @@ -298,10 +303,10 @@ export function estimateExecuteGlvWithdrawalGasLimit( */ export function estimateExecuteWithdrawalGasLimit( gasLimits: GasLimitsConfig, - withdrawal: { callbackGasLimit?: bigint; swapsCount?: number } + withdrawal: { callbackGasLimit?: bigint; swapsCount?: bigint } ) { const gasPerSwap = gasLimits.singleSwap; - const swapsCount = BigInt(withdrawal.swapsCount ?? 0); + const swapsCount = withdrawal.swapsCount ?? 0n; const gasForSwaps = swapsCount * gasPerSwap; return gasLimits.withdrawalMultiToken + (withdrawal.callbackGasLimit ?? 0n) + gasForSwaps; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 23ebcb34f2..1ea01295f3 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -325,7 +325,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { } } - if (glvInfo && !isPair) { + if (glvInfo && !isPair && isDeposit) { const options = [longToken, shortToken]; options.push( @@ -355,7 +355,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return uniqBy(result, (token) => token.address); }, - [marketInfo, chainId, glvInfo, isPair, paySource, marketTokensData, marketsInfoData] + [marketInfo, chainId, glvInfo, isPair, isDeposit, paySource, marketTokensData, marketsInfoData] ); const availableTokensData = useMemo(() => { @@ -382,6 +382,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const isMarketTokenDeposit = Boolean(fromMarketTokenInputState); const amounts = useDepositWithdrawalAmounts({ + chainId, isDeposit, marketInfo, marketToken, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index e8a3365e3c..0ea50fde36 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -3,7 +3,6 @@ import chunk from "lodash/chunk"; import { useCallback, useMemo } from "react"; import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; -import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; import { getLayerZeroEndpointId, getStargatePoolAddress, isSettlementChain } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; @@ -38,7 +37,6 @@ import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress } from "sdk/configs/tokens"; import { nowInSeconds } from "sdk/utils/time"; -import { applySlippageToMinOut } from "sdk/utils/trade/trade"; import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { UseLpTransactionProps } from "./useLpTransactions"; @@ -78,17 +76,17 @@ export const useWithdrawalTransactions = ({ const glvTokenAddress = glvInfo?.glvTokenAddress; const glvTokenTotalSupply = glvInfo?.glvToken.totalSupply; const executionFeeTokenAmount = executionFee?.feeTokenAmount; - const initialLongTokenAddress = longTokenAddress - ? convertTokenAddress(chainId, longTokenAddress, "wrapped") - : undefined; - const initialShortTokenAddress = - shortTokenAddress && initialLongTokenAddress - ? convertTokenAddress( - chainId, - marketInfo?.isSameCollaterals ? initialLongTokenAddress : shortTokenAddress, - "wrapped" - ) - : undefined; + // const initialLongTokenAddress = longTokenAddress + // ? convertTokenAddress(chainId, longTokenAddress, "wrapped") + // : undefined; + // const initialShortTokenAddress = + // shortTokenAddress && initialLongTokenAddress + // ? convertTokenAddress( + // chainId, + // marketInfo?.isSameCollaterals ? initialLongTokenAddress : shortTokenAddress, + // "wrapped" + // ) + // : undefined; const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { if (isGlv) { @@ -232,12 +230,17 @@ export const useWithdrawalTransactions = ({ dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; } + let shouldUnwrapNativeToken = false; + if (paySource === "settlementChain") { + shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; + } + const params: CreateWithdrawalParamsStruct = { addresses: { + market: marketTokenAddress, receiver: account, callbackContract: zeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - market: marketTokenAddress, longTokenSwapPath: longTokenSwapPath ?? [], shortTokenSwapPath: shortTokenSwapPath ?? [], }, @@ -247,7 +250,7 @@ export const useWithdrawalTransactions = ({ // TODO MLTCH: do not forget to apply slippage // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), minShortTokenAmount: 0n, - shouldUnwrapNativeToken: false, + shouldUnwrapNativeToken, executionFee, callbackGasLimit: 0n, dataList, @@ -260,6 +263,7 @@ export const useWithdrawalTransactions = ({ executionFeeTokenAmount, isGlv, longOftProvider, + longTokenAddress, longTokenSwapPath, marketTokenAddress, marketTokenAmount, @@ -271,14 +275,7 @@ export const useWithdrawalTransactions = ({ ]); const glvParams = useMemo((): CreateGlvWithdrawalParamsStruct | undefined => { - if ( - !account || - executionFeeTokenAmount === undefined || - !isGlv || - glvTokenAmount === undefined || - !initialLongTokenAddress || - !initialShortTokenAddress - ) { + if (!account || executionFeeTokenAmount === undefined || !isGlv || glvTokenAmount === undefined) { return undefined; } @@ -288,16 +285,14 @@ export const useWithdrawalTransactions = ({ return undefined; } - const provider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, initialLongTokenAddress, "native")); - const secondaryProvider = getStargatePoolAddress( - chainId, - convertTokenAddress(chainId, initialShortTokenAddress, "native") - ); + const provider = longOftProvider ?? shortOftProvider; - if (!provider || !secondaryProvider) { + if (!provider) { return undefined; } + const secondaryProvider = provider === shortOftProvider ? undefined : shortTokenAddress; + const dstEid = getLayerZeroEndpointId(srcChainId); if (!dstEid) { @@ -315,8 +310,8 @@ export const useWithdrawalTransactions = ({ providerData: providerData, // TODO MLTCH apply some slippage minAmountOut: 0n, - secondaryProvider: secondaryProvider, - secondaryProviderData: providerData, + secondaryProvider: secondaryProvider ?? zeroAddress, + secondaryProviderData: secondaryProvider ? providerData : "0x", secondaryMinAmountOut: 0n, }, }); @@ -329,7 +324,7 @@ export const useWithdrawalTransactions = ({ let shouldUnwrapNativeToken = false; if (paySource === "settlementChain") { - shouldUnwrapNativeToken = true; + shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; } const params: CreateGlvWithdrawalParamsStruct = { @@ -339,11 +334,13 @@ export const useWithdrawalTransactions = ({ receiver: glvTokenTotalSupply === 0n ? numberToHex(1, { size: 20 }) : account, callbackContract: zeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], + longTokenSwapPath: longTokenSwapPath ?? [], + shortTokenSwapPath: shortTokenSwapPath ?? [], }, - minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), - minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minLongTokenAmount: 0n, + // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + minShortTokenAmount: 0n, executionFee: executionFeeTokenAmount, callbackGasLimit: 0n, shouldUnwrapNativeToken, @@ -358,13 +355,15 @@ export const useWithdrawalTransactions = ({ glvTokenAddress, glvTokenAmount, glvTokenTotalSupply, - initialLongTokenAddress, - initialShortTokenAddress, isGlv, - longTokenAmount, + longOftProvider, + longTokenAddress, + longTokenSwapPath, paySource, selectedMarketForGlv, - shortTokenAmount, + shortOftProvider, + shortTokenAddress, + shortTokenSwapPath, srcChainId, ]); @@ -442,7 +441,8 @@ export const useWithdrawalTransactions = ({ longTokenAmount === undefined || shortTokenAmount === undefined || !tokensData || - !signer + !signer || + !glvParams ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -462,7 +462,7 @@ export const useWithdrawalTransactions = ({ signer, globalExpressParams, transferRequests, - params: glvParams!, + params: glvParams, tokenAmount: glvTokenAmount!, }); } else if (paySource === "gmxAccount") { @@ -474,7 +474,7 @@ export const useWithdrawalTransactions = ({ promise = createMultichainGlvWithdrawalTxn({ chainId, signer, - params: glvParams!, + params: glvParams, expressTxnParams, transferRequests, srcChainId, @@ -483,7 +483,7 @@ export const useWithdrawalTransactions = ({ promise = createGlvWithdrawalTxn({ chainId, signer, - params: glvParams!, + params: glvParams, executionGasLimit: executionFee.gasLimit, tokensData, setPendingTxns, @@ -535,7 +535,8 @@ export const useWithdrawalTransactions = ({ longTokenAmount === undefined || shortTokenAmount === undefined || !tokensData || - !signer + !signer || + !gmParams ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -557,7 +558,7 @@ export const useWithdrawalTransactions = ({ globalExpressParams, // executionFee: executionFee.feeTokenAmount, transferRequests, - params: gmParams!, + params: gmParams, tokenAmount: marketTokenAmount!, }); } else if (paySource === "gmxAccount") { @@ -569,7 +570,7 @@ export const useWithdrawalTransactions = ({ promise = createMultichainWithdrawalTxn({ chainId, signer, - params: gmParams!, + params: gmParams, expressTxnParams, transferRequests, srcChainId, @@ -580,7 +581,7 @@ export const useWithdrawalTransactions = ({ signer, marketTokenAmount: marketTokenAmount!, executionGasLimit: executionFee.gasLimit, - params: gmParams!, + params: gmParams, tokensData, skipSimulation: shouldDisableValidation, setPendingTxns, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx index 5b471de6d6..7933619860 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx @@ -1,16 +1,19 @@ import { useMemo } from "react"; +import { ContractsChainId } from "config/chains"; import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; import { TokenData, TokensData } from "domain/synthetics/tokens"; import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; import { getWithdrawalAmounts } from "domain/synthetics/trade/utils/withdrawal"; +import { convertTokenAddress } from "sdk/configs/tokens"; import { DepositAmounts, WithdrawalAmounts } from "sdk/types/trade"; import { TokenInputState } from "./types"; export function useDepositWithdrawalAmounts({ + chainId, isDeposit, isPair, isWithdrawal, @@ -27,6 +30,7 @@ export function useDepositWithdrawalAmounts({ isMarketTokenDeposit, glvInfo, }: { + chainId: ContractsChainId; isDeposit: boolean; isPair: boolean; isWithdrawal: boolean; @@ -49,6 +53,9 @@ export function useDepositWithdrawalAmounts({ const receiveTokenAddress = !isDeposit && !isPair ? longTokenInputState?.address ?? shortTokenInputState?.address : undefined; + const wrappedReceiveTokenAddress = receiveTokenAddress + ? convertTokenAddress(chainId, receiveTokenAddress, "wrapped") + : undefined; const selectFindSwap = useMemo(() => { if (!hasLongTokenInputState) { @@ -138,7 +145,7 @@ export function useDepositWithdrawalAmounts({ glvTokenAmount, glvToken, findSwapPath, - receiveTokenAddress, + wrappedReceiveTokenAddress, }); } }, [ @@ -160,7 +167,7 @@ export function useDepositWithdrawalAmounts({ glvToken, halfOfLong, findSwapPath, - receiveTokenAddress, + wrappedReceiveTokenAddress, ]); return amounts; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx index 093aff41d2..241877e27b 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx @@ -67,6 +67,10 @@ export const useDepositWithdrawalFees = ({ let oraclePriceCount; const glvMarketsCount = BigInt(glvInfo?.markets?.length ?? 0); + const swapPathCount = BigInt( + ((amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath.length ?? 0) + + ((amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath.length ?? 0) + ); if (glvInfo) { gasLimit = isDeposit @@ -78,15 +82,13 @@ export const useDepositWithdrawalFees = ({ }) : estimateExecuteGlvWithdrawalGasLimit(gasLimits, { marketsCount: glvMarketsCount, + swapsCount: swapPathCount, }); oraclePriceCount = isDeposit ? estimateGlvDepositOraclePriceCount(glvMarketsCount) - : estimateGlvWithdrawalOraclePriceCount(glvMarketsCount); + : estimateGlvWithdrawalOraclePriceCount(glvMarketsCount, swapPathCount); } else { - const swapPathCount = - ((amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath.length ?? 0) + - ((amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath.length ?? 0); gasLimit = isDeposit ? estimateExecuteDepositGasLimit(gasLimits, {}) : estimateExecuteWithdrawalGasLimit(gasLimits, { diff --git a/src/components/TokenIcon/TokenIcon.tsx b/src/components/TokenIcon/TokenIcon.tsx index 80bab9ebfb..426d195997 100644 --- a/src/components/TokenIcon/TokenIcon.tsx +++ b/src/components/TokenIcon/TokenIcon.tsx @@ -85,7 +85,7 @@ function TokenIcon({ className, symbol, displaySize, importSize = 24, badge, bad src={CHAIN_ID_TO_NETWORK_ICON[chainIdBadge]} width={size} height={size} - className={cx("absolute z-10 box-content rounded-full bg-slate-900", offset)} + className={cx("absolute z-10 box-content rounded-full bg-slate-900", offset)} /> ); } @@ -106,7 +106,7 @@ function TokenIcon({ className, symbol, displaySize, importSize = 24, badge, bad } return ( - + {img} {sub} diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts index 4297b71a7b..5e3ddb6b53 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -56,7 +56,7 @@ export async function createSourceChainGlvWithdrawalTxn({ // TODO MLTCH this is going through the keeper to execute a depost // so there 100% should be a fee // feeAmount: 10n * 10n ** 6n, - feeAmount: 85022412326765n, // params.executionFee, + feeAmount: 1117894200000000n * 2n, // params.executionFee, // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], feeSwapPath: [], }, diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts index c7e2db57be..66ab78a8d6 100644 --- a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -146,7 +146,7 @@ export async function createSourceChainWithdrawalTxn({ args: [sendParams as any, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], }), value, - msg: t`Sent deposit transaction`, + msg: t`Sent withdrawal transaction`, }); await txnResult.wait(); diff --git a/src/domain/synthetics/trade/utils/withdrawal.ts b/src/domain/synthetics/trade/utils/withdrawal.ts index 20fac46780..bdd259036b 100644 --- a/src/domain/synthetics/trade/utils/withdrawal.ts +++ b/src/domain/synthetics/trade/utils/withdrawal.ts @@ -1,5 +1,6 @@ import { GlvInfo, MarketInfo, marketTokenAmountToUsd, usdToMarketTokenAmount } from "domain/synthetics/markets"; import { TokenData, convertToTokenAmount, convertToUsd } from "domain/synthetics/tokens"; +import { ERC20Address } from "domain/tokens"; import { applyFactor } from "lib/numbers"; import { FindSwapPath, WithdrawalAmounts } from "sdk/types/trade"; import { bigMath } from "sdk/utils/bigmath"; @@ -10,7 +11,7 @@ export function getWithdrawalAmounts(p: { marketTokenAmount: bigint; longTokenAmount: bigint; shortTokenAmount: bigint; - receiveTokenAddress?: string; + wrappedReceiveTokenAddress?: ERC20Address; uiFeeFactor: bigint; strategy: "byMarketToken" | "byLongCollateral" | "byShortCollateral" | "byCollaterals"; forShift?: boolean; @@ -31,6 +32,7 @@ export function getWithdrawalAmounts(p: { glvToken, glvTokenAmount, findSwapPath, + wrappedReceiveTokenAddress, } = p; const { longToken, shortToken } = marketInfo; @@ -97,7 +99,7 @@ export function getWithdrawalAmounts(p: { values.longTokenUsd = values.longTokenUsd - longSwapFeeUsd - longUiFeeUsd; values.shortTokenUsd = values.shortTokenUsd - shortSwapFeeUsd - shortUiFeeUsd; - if (!p.receiveTokenAddress) { + if (!wrappedReceiveTokenAddress) { values.longTokenAmount = convertToTokenAmount( values.longTokenUsd, longToken.decimals, @@ -108,7 +110,7 @@ export function getWithdrawalAmounts(p: { shortToken.decimals, shortToken.prices.maxPrice )!; - } else if (p.receiveTokenAddress === longToken.address) { + } else if (wrappedReceiveTokenAddress === longToken.address) { const shortToLongSwapPathStats = findSwapPath!(values.shortTokenUsd); if (!shortToLongSwapPathStats) { throw new Error("Short to long swap path stats is not valid"); @@ -121,7 +123,7 @@ export function getWithdrawalAmounts(p: { longToken.decimals, longToken.prices.maxPrice )!; - } else if (p.receiveTokenAddress === shortToken.address) { + } else if (wrappedReceiveTokenAddress === shortToken.address) { const longToShortSwapPathStats = findSwapPath!(values.longTokenUsd); if (!longToShortSwapPathStats) { throw new Error("Long to short swap path stats is not valid"); From 6f6425fb0a24d527992edba4b8abaff27fcd82c7 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Fri, 26 Sep 2025 11:57:02 +0200 Subject: [PATCH 21/38] Refactor expressTransactionBuilder condition for clarity --- src/components/BridgeModal/BridgeOutModal.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/BridgeModal/BridgeOutModal.tsx b/src/components/BridgeModal/BridgeOutModal.tsx index de739e48a4..031734cd71 100644 --- a/src/components/BridgeModal/BridgeOutModal.tsx +++ b/src/components/BridgeModal/BridgeOutModal.tsx @@ -133,12 +133,7 @@ export function BridgeOutModal({ }, [bridgeOutChain, glvOrMarketAddress, bridgeOutAmount, chainId]); const expressTransactionBuilder: ExpressTransactionBuilder | undefined = useMemo(() => { - if ( - account === undefined || - bridgeOutParams === undefined || - // provider === undefined || - bridgeOutChain === undefined - ) { + if (account === undefined || bridgeOutParams === undefined || bridgeOutChain === undefined) { return; } From ebdbc717b78184261c22dc728805c82a319da6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=C3=A9rt=20de=20Lalye?= Date: Fri, 10 Oct 2025 14:59:46 +0400 Subject: [PATCH 22/38] pass signature to setClaims no matter what type of account is used --- .../UserIncentiveDistributionList/ClaimableAmounts.tsx | 6 ++++-- src/lib/wallets/useAccountType.ts | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/UserIncentiveDistributionList/ClaimableAmounts.tsx b/src/components/UserIncentiveDistributionList/ClaimableAmounts.tsx index 51c6806b9f..7e4d18c58f 100644 --- a/src/components/UserIncentiveDistributionList/ClaimableAmounts.tsx +++ b/src/components/UserIncentiveDistributionList/ClaimableAmounts.tsx @@ -182,12 +182,15 @@ export default function ClaimableAmounts() { setIsClaiming(true); try { + const signature = + claimTermsAcceptedSignature && claimTermsAcceptedSignature !== "0x" ? claimTermsAcceptedSignature : undefined; + await createClaimAmountsTransaction({ tokens: claimableTokens, chainId, signer, account, - signature: isSmartAccount ? undefined : claimTermsAcceptedSignature, + signature, distributionId: GLP_DISTRIBUTION_ID, claimableTokenTitles, callback: claimFundsTransactionCallback, @@ -210,7 +213,6 @@ export default function ClaimableAmounts() { claimFundsTransactionCallback, accountType, isSafeSigValid, - isSmartAccount, ]); const { balancesData } = useTokenBalances(chainId); diff --git a/src/lib/wallets/useAccountType.ts b/src/lib/wallets/useAccountType.ts index 8028b59bf7..1bf0862f10 100644 --- a/src/lib/wallets/useAccountType.ts +++ b/src/lib/wallets/useAccountType.ts @@ -21,17 +21,18 @@ const KNOWN_SAFE_SINGLETONS = new Set( "0xfb1bffc9d739b8d520daf37df666da4c687191ea", // v1.3.0 L2 "0xd9db270c1b5e3bd161e8c8503c55ceabee709552", // v1.3.0 "0x69f4d1788e39c87893c980c06edf4b7f686e2938", // v1.3.0 + "0x41675c099f32341bf84bfc5382af534df5c7461a", // v1.4.1 "0x29fcb43b46531bca003ddc8fcb67ffe91900c762", // v1.4.1 L2 ].map((a) => a.toLowerCase() as Hex) ); async function isSafeAccount( + bytecode: Hex, address: `0x${string}`, client: PublicClient, safeSingletonAddresses: Set ): Promise { - const bytecode = await client.getBytecode({ address }); - if (!bytecode || bytecode === "0x") { + if (bytecode === "0x") { return false; } @@ -59,7 +60,7 @@ async function getAccountType( return AccountType.PostEip7702EOA; } - const isSafe = await isSafeAccount(address, client, safeSingletonAddresses); + const isSafe = await isSafeAccount(bytecode, address, client, safeSingletonAddresses); if (isSafe) { return AccountType.Safe; } From 80dbe5292fb578bb5aeee6fbbbb3331e073412a0 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Fri, 10 Oct 2025 20:43:19 +0200 Subject: [PATCH 23/38] Merge branch 'release-85' into multichain-lp --- .yarn/patches/viem-npm-2.37.1-7013552341 | 25 + landing/tsconfig.json | 2 +- package.json | 6 +- sdk/.gitignore | 1 - sdk/package.json | 6 +- sdk/src/abis/ArbitrumNodeInterface.json | 105 - sdk/src/abis/ArbitrumNodeInterface.ts | 103 + sdk/src/abis/ClaimHandler.json | 424 -- sdk/src/abis/ClaimHandler.ts | 190 + sdk/src/abis/CustomErrors.json | 4432 --------------- sdk/src/abis/CustomErrors.ts | 1882 +++++++ sdk/src/abis/DataStore.json | 1459 ----- sdk/src/abis/DataStore.ts | 637 +++ sdk/src/abis/ERC20PermitInterface.json | 118 - sdk/src/abis/ERC20PermitInterface.ts | 52 + sdk/src/abis/ERC721.json | 442 -- sdk/src/abis/ERC721.ts | 194 + sdk/src/abis/EventEmitter.json | 2060 ------- sdk/src/abis/EventEmitter.ts | 1226 ++++ sdk/src/abis/ExchangeRouter.json | 1706 ------ sdk/src/abis/ExchangeRouter.ts | 758 +++ sdk/src/abis/GelatoRelayRouter.json | 1579 ------ sdk/src/abis/GelatoRelayRouter.ts | 627 +++ sdk/src/abis/GlpManager.json | 592 -- sdk/src/abis/GlpManager.ts | 244 + sdk/src/abis/GlvReader.json | 1471 ----- sdk/src/abis/GlvReader.ts | 641 +++ sdk/src/abis/GlvRouter.json | 764 --- sdk/src/abis/GlvRouter.ts | 351 ++ sdk/src/abis/GmxMigrator.json | 657 --- sdk/src/abis/GmxMigrator.ts | 267 + sdk/src/abis/GovToken.json | 768 --- sdk/src/abis/GovToken.ts | 323 ++ sdk/src/abis/IStargate.ts | 601 ++ sdk/src/abis/LayerZeroProvider.json | 372 -- sdk/src/abis/LayerZeroProvider.ts | 159 + sdk/src/abis/MintableBaseToken.json | 696 --- sdk/src/abis/MintableBaseToken.ts | 321 ++ sdk/src/abis/Multicall.json | 429 -- sdk/src/abis/Multicall.ts | 229 + sdk/src/abis/MultichainClaimsRouter.json | 1266 ----- sdk/src/abis/MultichainClaimsRouter.ts | 514 ++ sdk/src/abis/MultichainGlvRouter.json | 1150 ---- sdk/src/abis/MultichainGlvRouter.ts | 474 ++ sdk/src/abis/MultichainGmRouter.json | 1449 ----- sdk/src/abis/MultichainGmRouter.ts | 597 ++ sdk/src/abis/MultichainOrderRouter.json | 1820 ------ sdk/src/abis/MultichainOrderRouter.ts | 724 +++ sdk/src/abis/MultichainSubaccountRouter.json | 2069 ------- sdk/src/abis/MultichainSubaccountRouter.ts | 795 +++ sdk/src/abis/MultichainTransferRouter.json | 915 --- sdk/src/abis/MultichainTransferRouter.ts | 404 ++ sdk/src/abis/MultichainUtils.ts | 61 + sdk/src/abis/MultichainVault.json | 275 - sdk/src/abis/MultichainVault.ts | 122 + sdk/src/abis/Reader.json | 355 -- sdk/src/abis/Reader.ts | 138 + sdk/src/abis/ReaderV2.json | 630 --- sdk/src/abis/ReaderV2.ts | 257 + sdk/src/abis/ReferralStorage.json | 557 -- sdk/src/abis/ReferralStorage.ts | 259 + sdk/src/abis/RelayParams.json | 147 - sdk/src/abis/RelayParams.ts | 53 + sdk/src/abis/RewardReader.json | 86 - sdk/src/abis/RewardReader.ts | 33 + sdk/src/abis/RewardRouter.json | 1024 ---- sdk/src/abis/RewardRouter.ts | 458 ++ sdk/src/abis/RewardTracker.json | 918 --- sdk/src/abis/RewardTracker.ts | 413 ++ sdk/src/abis/SmartAccount.json | 28 - sdk/src/abis/SmartAccount.ts | 12 + sdk/src/abis/StBTC.json | 1225 ---- sdk/src/abis/StBTC.ts | 511 ++ sdk/src/abis/SubaccountApproval.json | 17 - sdk/src/abis/SubaccountApproval.ts | 15 + sdk/src/abis/SubaccountGelatoRelayRouter.json | 2019 ------- sdk/src/abis/SubaccountGelatoRelayRouter.ts | 775 +++ sdk/src/abis/SubaccountRouter.json | 602 -- sdk/src/abis/SubaccountRouter.ts | 257 + sdk/src/abis/SyntheticsReader.json | 4905 ----------------- sdk/src/abis/SyntheticsReader.ts | 2179 ++++++++ sdk/src/abis/SyntheticsRouter.json | 72 - sdk/src/abis/SyntheticsRouter.ts | 34 + sdk/src/abis/Timelock.json | 1737 ------ sdk/src/abis/Timelock.ts | 776 +++ sdk/src/abis/Token.json | 345 -- sdk/src/abis/Token.ts | 148 + sdk/src/abis/Treasury.json | 411 -- sdk/src/abis/Treasury.ts | 204 + sdk/src/abis/UniPool.json | 89 - sdk/src/abis/UniPool.ts | 34 + sdk/src/abis/UniswapV2.json | 287 - sdk/src/abis/UniswapV2.ts | 285 + sdk/src/abis/UniswapV3Factory.json | 200 - sdk/src/abis/UniswapV3Factory.ts | 198 + sdk/src/abis/UniswapV3Pool.json | 985 ---- sdk/src/abis/UniswapV3Pool.ts | 983 ++++ sdk/src/abis/UniswapV3PositionManager.json | 991 ---- sdk/src/abis/UniswapV3PositionManager.ts | 989 ++++ sdk/src/abis/Vault.json | 3220 ----------- sdk/src/abis/Vault.ts | 1306 +++++ sdk/src/abis/VaultReader.json | 87 - sdk/src/abis/VaultReader.ts | 28 + sdk/src/abis/VaultV2.json | 3019 ---------- sdk/src/abis/VaultV2.ts | 1220 ++++ sdk/src/abis/VaultV2b.json | 3220 ----------- sdk/src/abis/VaultV2b.ts | 1306 +++++ sdk/src/abis/VenusVToken.json | 49 - sdk/src/abis/VenusVToken.ts | 47 + sdk/src/abis/Vester.json | 1031 ---- sdk/src/abis/Vester.ts | 454 ++ sdk/src/abis/WETH.json | 320 -- sdk/src/abis/WETH.ts | 135 + sdk/src/abis/__tests__/abis.spec.ts | 46 - sdk/src/abis/index.ts | 300 +- sdk/src/utils/errors/parseError.ts | 4 +- sdk/src/utils/multicall.ts | 4 +- sdk/src/utils/orderTransactions.ts | 12 +- sdk/src/utils/swap/botanixStaking.ts | 6 +- sdk/tsconfig.json | 2 +- sdk/yarn.lock | 25 +- .../lpTxn/useDepositTransactions.tsx | 4 +- .../useMultichainDepositExpressTxnParams.tsx | 4 +- ...seMultichainWithdrawalExpressTxnParams.tsx | 4 +- .../lpTxn/useWithdrawalTransactions.tsx | 4 +- .../GmxAccountModal/DepositView.tsx | 10 +- .../GmxAccountModal/WithdrawalView.tsx | 9 +- .../toastCustomOrStargateError.ts | 4 +- src/components/Referrals/JoinReferralCode.tsx | 8 +- .../MarketFilterLongShort.tsx | 4 +- .../UserIncentiveDistributionList/utils.tsx | 18 +- src/config/multichain.ts | 4 +- src/domain/multichain/codecs/CodecUiHelper.ts | 10 +- src/domain/multichain/getSendParams.ts | 6 +- src/domain/multichain/getTransferRequests.tsx | 6 +- .../multichain/sendCrossChainDepositTxn.ts | 13 +- src/domain/multichain/types.ts | 59 +- .../useMultichainDepositNetworkComposeGas.ts | 26 +- .../multichain/useMultichainQuoteFeeUsd.ts | 8 +- src/domain/multichain/useQuoteOft.ts | 12 +- src/domain/multichain/useQuoteOftLimits.ts | 6 +- src/domain/multichain/useQuoteSend.ts | 8 +- .../claimHistory/claimPriceImpactRebate.ts | 2 +- .../claims/createClaimTransaction.ts | 4 +- .../synthetics/express/expressOrderUtils.ts | 12 +- .../synthetics/express/relayParamsUtils.ts | 30 +- src/domain/synthetics/express/types.ts | 2 +- .../express/useL1ExpressGasReference.ts | 4 +- .../synthetics/markets/claimFundingFeesTxn.ts | 2 +- .../synthetics/markets/createBridgeInTxn.ts | 4 +- .../markets/createMultichainDepositTxn.ts | 10 +- .../markets/createMultichainGlvDepositTxn.ts | 11 +- .../createMultichainGlvWithdrawalTxn.ts | 11 +- .../markets/createMultichainWithdrawalTxn.ts | 10 +- .../markets/createSourceChainDepositTxn.ts | 7 +- .../markets/createSourceChainGlvDepositTxn.ts | 7 +- .../createSourceChainGlvWithdrawalTxn.ts | 27 +- .../markets/createSourceChainWithdrawalTxn.ts | 27 +- .../synthetics/markets/signCreateDeposit.ts | 4 +- .../markets/signCreateGlvDeposit.ts | 4 +- .../markets/signCreateGlvWithdrawal.ts | 4 +- .../markets/signCreateWithdrawal.ts | 4 +- .../orders/createStakeOrUnStakeTxn.tsx | 10 +- .../synthetics/subaccount/removeSubaccount.ts | 33 +- src/domain/synthetics/subaccount/types.ts | 2 +- src/domain/synthetics/subaccount/utils.ts | 4 +- src/domain/tokens/approveTokens.tsx | 4 +- src/domain/tokens/permitUtils.ts | 35 +- src/lib/multicall/Multicall.ts | 5 +- src/lib/wallets/useAccountType.ts | 4 +- src/locales/de/messages.po | 10 +- src/locales/en/messages.po | 8 - src/locales/es/messages.po | 10 +- src/locales/fr/messages.po | 10 +- src/locales/ja/messages.po | 10 +- src/locales/ko/messages.po | 10 +- src/locales/pseudo/messages.po | 8 - src/locales/ru/messages.po | 10 +- src/locales/zh/messages.po | 8 - tsconfig.json | 2 +- viem-override.d.ts | 12 + yarn.lock | 21 + 182 files changed, 26507 insertions(+), 56158 deletions(-) create mode 100644 .yarn/patches/viem-npm-2.37.1-7013552341 delete mode 100644 sdk/src/abis/ArbitrumNodeInterface.json create mode 100644 sdk/src/abis/ArbitrumNodeInterface.ts delete mode 100644 sdk/src/abis/ClaimHandler.json create mode 100644 sdk/src/abis/ClaimHandler.ts delete mode 100644 sdk/src/abis/CustomErrors.json create mode 100644 sdk/src/abis/CustomErrors.ts delete mode 100644 sdk/src/abis/DataStore.json create mode 100644 sdk/src/abis/DataStore.ts delete mode 100644 sdk/src/abis/ERC20PermitInterface.json create mode 100644 sdk/src/abis/ERC20PermitInterface.ts delete mode 100644 sdk/src/abis/ERC721.json create mode 100644 sdk/src/abis/ERC721.ts delete mode 100644 sdk/src/abis/EventEmitter.json create mode 100644 sdk/src/abis/EventEmitter.ts delete mode 100644 sdk/src/abis/ExchangeRouter.json create mode 100644 sdk/src/abis/ExchangeRouter.ts delete mode 100644 sdk/src/abis/GelatoRelayRouter.json create mode 100644 sdk/src/abis/GelatoRelayRouter.ts delete mode 100644 sdk/src/abis/GlpManager.json create mode 100644 sdk/src/abis/GlpManager.ts delete mode 100644 sdk/src/abis/GlvReader.json create mode 100644 sdk/src/abis/GlvReader.ts delete mode 100644 sdk/src/abis/GlvRouter.json create mode 100644 sdk/src/abis/GlvRouter.ts delete mode 100644 sdk/src/abis/GmxMigrator.json create mode 100644 sdk/src/abis/GmxMigrator.ts delete mode 100644 sdk/src/abis/GovToken.json create mode 100644 sdk/src/abis/GovToken.ts create mode 100644 sdk/src/abis/IStargate.ts delete mode 100644 sdk/src/abis/LayerZeroProvider.json create mode 100644 sdk/src/abis/LayerZeroProvider.ts delete mode 100644 sdk/src/abis/MintableBaseToken.json create mode 100644 sdk/src/abis/MintableBaseToken.ts delete mode 100644 sdk/src/abis/Multicall.json create mode 100644 sdk/src/abis/Multicall.ts delete mode 100644 sdk/src/abis/MultichainClaimsRouter.json create mode 100644 sdk/src/abis/MultichainClaimsRouter.ts delete mode 100644 sdk/src/abis/MultichainGlvRouter.json create mode 100644 sdk/src/abis/MultichainGlvRouter.ts delete mode 100644 sdk/src/abis/MultichainGmRouter.json create mode 100644 sdk/src/abis/MultichainGmRouter.ts delete mode 100644 sdk/src/abis/MultichainOrderRouter.json create mode 100644 sdk/src/abis/MultichainOrderRouter.ts delete mode 100644 sdk/src/abis/MultichainSubaccountRouter.json create mode 100644 sdk/src/abis/MultichainSubaccountRouter.ts delete mode 100644 sdk/src/abis/MultichainTransferRouter.json create mode 100644 sdk/src/abis/MultichainTransferRouter.ts create mode 100644 sdk/src/abis/MultichainUtils.ts delete mode 100644 sdk/src/abis/MultichainVault.json create mode 100644 sdk/src/abis/MultichainVault.ts delete mode 100644 sdk/src/abis/Reader.json create mode 100644 sdk/src/abis/Reader.ts delete mode 100644 sdk/src/abis/ReaderV2.json create mode 100644 sdk/src/abis/ReaderV2.ts delete mode 100644 sdk/src/abis/ReferralStorage.json create mode 100644 sdk/src/abis/ReferralStorage.ts delete mode 100644 sdk/src/abis/RelayParams.json create mode 100644 sdk/src/abis/RelayParams.ts delete mode 100644 sdk/src/abis/RewardReader.json create mode 100644 sdk/src/abis/RewardReader.ts delete mode 100644 sdk/src/abis/RewardRouter.json create mode 100644 sdk/src/abis/RewardRouter.ts delete mode 100644 sdk/src/abis/RewardTracker.json create mode 100644 sdk/src/abis/RewardTracker.ts delete mode 100644 sdk/src/abis/SmartAccount.json create mode 100644 sdk/src/abis/SmartAccount.ts delete mode 100644 sdk/src/abis/StBTC.json create mode 100644 sdk/src/abis/StBTC.ts delete mode 100644 sdk/src/abis/SubaccountApproval.json create mode 100644 sdk/src/abis/SubaccountApproval.ts delete mode 100644 sdk/src/abis/SubaccountGelatoRelayRouter.json create mode 100644 sdk/src/abis/SubaccountGelatoRelayRouter.ts delete mode 100644 sdk/src/abis/SubaccountRouter.json create mode 100644 sdk/src/abis/SubaccountRouter.ts delete mode 100644 sdk/src/abis/SyntheticsReader.json create mode 100644 sdk/src/abis/SyntheticsReader.ts delete mode 100644 sdk/src/abis/SyntheticsRouter.json create mode 100644 sdk/src/abis/SyntheticsRouter.ts delete mode 100644 sdk/src/abis/Timelock.json create mode 100644 sdk/src/abis/Timelock.ts delete mode 100644 sdk/src/abis/Token.json create mode 100644 sdk/src/abis/Token.ts delete mode 100644 sdk/src/abis/Treasury.json create mode 100644 sdk/src/abis/Treasury.ts delete mode 100644 sdk/src/abis/UniPool.json create mode 100644 sdk/src/abis/UniPool.ts delete mode 100644 sdk/src/abis/UniswapV2.json create mode 100644 sdk/src/abis/UniswapV2.ts delete mode 100644 sdk/src/abis/UniswapV3Factory.json create mode 100644 sdk/src/abis/UniswapV3Factory.ts delete mode 100644 sdk/src/abis/UniswapV3Pool.json create mode 100644 sdk/src/abis/UniswapV3Pool.ts delete mode 100644 sdk/src/abis/UniswapV3PositionManager.json create mode 100644 sdk/src/abis/UniswapV3PositionManager.ts delete mode 100644 sdk/src/abis/Vault.json create mode 100644 sdk/src/abis/Vault.ts delete mode 100644 sdk/src/abis/VaultReader.json create mode 100644 sdk/src/abis/VaultReader.ts delete mode 100644 sdk/src/abis/VaultV2.json create mode 100644 sdk/src/abis/VaultV2.ts delete mode 100644 sdk/src/abis/VaultV2b.json create mode 100644 sdk/src/abis/VaultV2b.ts delete mode 100644 sdk/src/abis/VenusVToken.json create mode 100644 sdk/src/abis/VenusVToken.ts delete mode 100644 sdk/src/abis/Vester.json create mode 100644 sdk/src/abis/Vester.ts delete mode 100644 sdk/src/abis/WETH.json create mode 100644 sdk/src/abis/WETH.ts delete mode 100644 sdk/src/abis/__tests__/abis.spec.ts create mode 100644 viem-override.d.ts diff --git a/.yarn/patches/viem-npm-2.37.1-7013552341 b/.yarn/patches/viem-npm-2.37.1-7013552341 new file mode 100644 index 0000000000..6bef3d9ef7 --- /dev/null +++ b/.yarn/patches/viem-npm-2.37.1-7013552341 @@ -0,0 +1,25 @@ +diff --git a/_types/types/misc.d.ts b/_types/types/misc.d.ts +index 2fa2d166d6e708ad2adea724a2e20f40b0b9ac88..032498f54ab08dfba43dd125637f0c70b19a93ae 100644 +--- a/_types/types/misc.d.ts ++++ b/_types/types/misc.d.ts +@@ -1,6 +1,6 @@ + import type { OneOf } from './utils.js'; + export type ByteArray = Uint8Array; +-export type Hex = `0x${string}`; ++export type Hex = string + export type Hash = `0x${string}`; + export type LogTopic = Hex | Hex[] | null; + export type SignableMessage = string | { +diff --git a/types/misc.ts b/types/misc.ts +index 625ba085cc64d197faff2f981ff06e706c2898a0..59e49bec00ac4a7a2f351c1406a356760f4a7e47 100644 +--- a/types/misc.ts ++++ b/types/misc.ts +@@ -1,7 +1,7 @@ + import type { OneOf } from './utils.js' + + export type ByteArray = Uint8Array +-export type Hex = `0x${string}` ++export type Hex = string + export type Hash = `0x${string}` + export type LogTopic = Hex | Hex[] | null + export type SignableMessage = diff --git a/landing/tsconfig.json b/landing/tsconfig.json index d5fc9eb647..af35d14aa0 100644 --- a/landing/tsconfig.json +++ b/landing/tsconfig.json @@ -29,5 +29,5 @@ } }, "references": [{ "path": "../sdk" }], - "include": ["src", "../sdk", "../src"] + "include": ["src", "../sdk", "../src", "../viem-override.d.ts"] } diff --git a/package.json b/package.json index 66a192677d..a5d4b75b2c 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,8 @@ "ts:clean": "tsc --build --clean && tsc --build", "tscheck": "yarn ts:clean && tsc -p tsconfig.json --noEmit", "prettier": "prettier --write src/**/*.{js,ts,jsx,tsx,css,scss}", - "typechain": "typechain --target ethers-v6 --out-dir ./src/typechain-types './sdk/src/abis/*.json'", "typechain:stargate": "typechain --target ethers-v6 --out-dir ./src/typechain-types-stargate './node_modules/@stargatefinance/stg-evm-sdk-v2/artifacts/src/interfaces/IStargate.sol/IStargate.json'", - "postinstall": "yarn typechain && cd ./sdk && echo \"Building SDK\" && yarn && yarn build", + "postinstall": "cd ./sdk && echo \"Building SDK\" && yarn && yarn build", "prebuild": "cd ./sdk && yarn tsx scripts/prebuild" }, "dependencies": { @@ -110,7 +109,8 @@ "react-error-overlay": "6.0.9", "@coinbase/wallet-sdk": "4.3.0", "ethers@6.12.1": "patch:ethers@npm:6.12.1#.yarn/patches/ethers-npm-6.12.1-7d4a09a25c", - "jest-runner": "patch:jest-runner@npm:27.5.1#.yarn/patches/jest-runner-npm-27.5.1-2ed2c1cda8" + "jest-runner": "patch:jest-runner@npm:27.5.1#.yarn/patches/jest-runner-npm-27.5.1-2ed2c1cda8", + "viem@2.37.1": "patch:viem@npm:2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341" }, "eslintConfig": { "extends": [ diff --git a/sdk/.gitignore b/sdk/.gitignore index a529792d46..d62c46b176 100644 --- a/sdk/.gitignore +++ b/sdk/.gitignore @@ -5,7 +5,6 @@ /.pnp .pnp.js .vscode -.yarn # lingui /src/locales/**/*.js diff --git a/sdk/package.json b/sdk/package.json index 3af6000877..0464bb41c3 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -86,10 +86,14 @@ "ts-patch": "3.2.1", "tsx": "4.19.0", "typescript-transform-paths": "3.5.1", + "viem": "2.37.1", "vitest": "3.0.4" }, "files": [ "build" ], - "packageManager": "yarn@3.1.0" + "packageManager": "yarn@3.1.0", + "resolutions": { + "viem@2.37.1": "patch:viem@npm:2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341" + } } diff --git a/sdk/src/abis/ArbitrumNodeInterface.json b/sdk/src/abis/ArbitrumNodeInterface.json deleted file mode 100644 index a6ccbc188f..0000000000 --- a/sdk/src/abis/ArbitrumNodeInterface.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { "internalType": "uint64", "name": "size", "type": "uint64" }, - { "internalType": "uint64", "name": "leaf", "type": "uint64" } - ], - "name": "constructOutboxProof", - "outputs": [ - { "internalType": "bytes32", "name": "send", "type": "bytes32" }, - { "internalType": "bytes32", "name": "root", "type": "bytes32" }, - { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "uint256", "name": "deposit", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "estimateRetryableTicket", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint64", "name": "blockNum", "type": "uint64" }], - "name": "findBatchContainingBlock", - "outputs": [{ "internalType": "uint64", "name": "batch", "type": "uint64" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bool", "name": "contractCreation", "type": "bool" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "gasEstimateComponents", - "outputs": [ - { "internalType": "uint64", "name": "gasEstimate", "type": "uint64" }, - { "internalType": "uint64", "name": "gasEstimateForL1", "type": "uint64" }, - { "internalType": "uint256", "name": "baseFee", "type": "uint256" }, - { "internalType": "uint256", "name": "l1BaseFeeEstimate", "type": "uint256" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bool", "name": "contractCreation", "type": "bool" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "gasEstimateL1Component", - "outputs": [ - { "internalType": "uint64", "name": "gasEstimateForL1", "type": "uint64" }, - { "internalType": "uint256", "name": "baseFee", "type": "uint256" }, - { "internalType": "uint256", "name": "l1BaseFeeEstimate", "type": "uint256" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }], - "name": "getL1Confirmations", - "outputs": [{ "internalType": "uint64", "name": "confirmations", "type": "uint64" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "batchNum", "type": "uint256" }, - { "internalType": "uint64", "name": "index", "type": "uint64" } - ], - "name": "legacyLookupMessageBatchProof", - "outputs": [ - { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" }, - { "internalType": "uint256", "name": "path", "type": "uint256" }, - { "internalType": "address", "name": "l2Sender", "type": "address" }, - { "internalType": "address", "name": "l1Dest", "type": "address" }, - { "internalType": "uint256", "name": "l2Block", "type": "uint256" }, - { "internalType": "uint256", "name": "l1Block", "type": "uint256" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "bytes", "name": "calldataForL1", "type": "bytes" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nitroGenesisBlock", - "outputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], - "stateMutability": "pure", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/ArbitrumNodeInterface.ts b/sdk/src/abis/ArbitrumNodeInterface.ts new file mode 100644 index 0000000000..0a46aa7228 --- /dev/null +++ b/sdk/src/abis/ArbitrumNodeInterface.ts @@ -0,0 +1,103 @@ +export default [ + { + inputs: [ + { internalType: "uint64", name: "size", type: "uint64" }, + { internalType: "uint64", name: "leaf", type: "uint64" }, + ], + name: "constructOutboxProof", + outputs: [ + { internalType: "bytes32", name: "send", type: "bytes32" }, + { internalType: "bytes32", name: "root", type: "bytes32" }, + { internalType: "bytes32[]", name: "proof", type: "bytes32[]" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "uint256", name: "deposit", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "estimateRetryableTicket", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint64", name: "blockNum", type: "uint64" }], + name: "findBatchContainingBlock", + outputs: [{ internalType: "uint64", name: "batch", type: "uint64" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "bool", name: "contractCreation", type: "bool" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "gasEstimateComponents", + outputs: [ + { internalType: "uint64", name: "gasEstimate", type: "uint64" }, + { internalType: "uint64", name: "gasEstimateForL1", type: "uint64" }, + { internalType: "uint256", name: "baseFee", type: "uint256" }, + { internalType: "uint256", name: "l1BaseFeeEstimate", type: "uint256" }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "bool", name: "contractCreation", type: "bool" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "gasEstimateL1Component", + outputs: [ + { internalType: "uint64", name: "gasEstimateForL1", type: "uint64" }, + { internalType: "uint256", name: "baseFee", type: "uint256" }, + { internalType: "uint256", name: "l1BaseFeeEstimate", type: "uint256" }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }], + name: "getL1Confirmations", + outputs: [{ internalType: "uint64", name: "confirmations", type: "uint64" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "batchNum", type: "uint256" }, + { internalType: "uint64", name: "index", type: "uint64" }, + ], + name: "legacyLookupMessageBatchProof", + outputs: [ + { internalType: "bytes32[]", name: "proof", type: "bytes32[]" }, + { internalType: "uint256", name: "path", type: "uint256" }, + { internalType: "address", name: "l2Sender", type: "address" }, + { internalType: "address", name: "l1Dest", type: "address" }, + { internalType: "uint256", name: "l2Block", type: "uint256" }, + { internalType: "uint256", name: "l1Block", type: "uint256" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "bytes", name: "calldataForL1", type: "bytes" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "nitroGenesisBlock", + outputs: [{ internalType: "uint256", name: "number", type: "uint256" }], + stateMutability: "pure", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ClaimHandler.json b/sdk/src/abis/ClaimHandler.json deleted file mode 100644 index b38721ec29..0000000000 --- a/sdk/src/abis/ClaimHandler.json +++ /dev/null @@ -1,424 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract ClaimVault", - "name": "_claimVault", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "existingDistributionId", - "type": "uint256" - } - ], - "name": "DuplicateClaimTerms", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyAccount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyClaimableAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InsufficientFunds", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recoveredSigner", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidClaimTermsSignature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidClaimTermsSignatureForContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "InvalidParams", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "termsSignature", - "type": "bytes" - } - ], - "internalType": "struct ClaimHandler.ClaimParam[]", - "name": "params", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimFunds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "claimVault", - "outputs": [ - { - "internalType": "contract ClaimVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "internalType": "struct ClaimHandler.DepositParam[]", - "name": "params", - "type": "tuple[]" - } - ], - "name": "depositFunds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "distributionIds", - "type": "uint256[]" - } - ], - "name": "getClaimableAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getTotalClaimableAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - } - ], - "name": "removeTerms", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "terms", - "type": "string" - } - ], - "name": "setTerms", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "fromAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "toAccount", - "type": "address" - } - ], - "internalType": "struct ClaimHandler.TransferClaimParam[]", - "name": "params", - "type": "tuple[]" - } - ], - "name": "transferClaim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "distributionId", - "type": "uint256" - } - ], - "internalType": "struct ClaimHandler.WithdrawParam[]", - "name": "params", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "withdrawFunds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/ClaimHandler.ts b/sdk/src/abis/ClaimHandler.ts new file mode 100644 index 0000000000..8cfc250eb1 --- /dev/null +++ b/sdk/src/abis/ClaimHandler.ts @@ -0,0 +1,190 @@ +export default [ + { + inputs: [ + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract ClaimVault", name: "_claimVault", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { + inputs: [{ internalType: "uint256", name: "existingDistributionId", type: "uint256" }], + name: "DuplicateClaimTerms", + type: "error", + }, + { inputs: [], name: "EmptyAccount", type: "error" }, + { inputs: [], name: "EmptyAmount", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyClaimableAmount", + type: "error", + }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { inputs: [], name: "EmptyToken", type: "error" }, + { inputs: [{ internalType: "address", name: "token", type: "address" }], name: "InsufficientFunds", type: "error" }, + { + inputs: [ + { internalType: "address", name: "recoveredSigner", type: "address" }, + { internalType: "address", name: "expectedSigner", type: "address" }, + ], + name: "InvalidClaimTermsSignature", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "expectedSigner", type: "address" }], + name: "InvalidClaimTermsSignatureForContract", + type: "error", + }, + { inputs: [{ internalType: "string", name: "reason", type: "string" }], name: "InvalidParams", type: "error" }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "distributionId", type: "uint256" }, + { internalType: "bytes", name: "termsSignature", type: "bytes" }, + ], + internalType: "struct ClaimHandler.ClaimParam[]", + name: "params", + type: "tuple[]", + }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "claimVault", + outputs: [{ internalType: "contract ClaimVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "distributionId", type: "uint256" }, + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + internalType: "struct ClaimHandler.DepositParam[]", + name: "params", + type: "tuple[]", + }, + ], + name: "depositFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256[]", name: "distributionIds", type: "uint256[]" }, + ], + name: "getClaimableAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "getTotalClaimableAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "distributionId", type: "uint256" }], + name: "removeTerms", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "distributionId", type: "uint256" }, + { internalType: "string", name: "terms", type: "string" }, + ], + name: "setTerms", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "distributionId", type: "uint256" }, + { internalType: "address", name: "fromAccount", type: "address" }, + { internalType: "address", name: "toAccount", type: "address" }, + ], + internalType: "struct ClaimHandler.TransferClaimParam[]", + name: "params", + type: "tuple[]", + }, + ], + name: "transferClaim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "distributionId", type: "uint256" }, + ], + internalType: "struct ClaimHandler.WithdrawParam[]", + name: "params", + type: "tuple[]", + }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "withdrawFunds", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/CustomErrors.json b/sdk/src/abis/CustomErrors.json deleted file mode 100644 index 0124d633c5..0000000000 --- a/sdk/src/abis/CustomErrors.json +++ /dev/null @@ -1,4432 +0,0 @@ -{ - "abi": [ - { - "inputs": [], - "name": "ActionAlreadySignalled", - "type": "error" - }, - { - "inputs": [], - "name": "ActionNotSignalled", - "type": "error" - }, - { - "inputs": [], - "name": "AdlNotEnabled", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "pnlToPoolFactor", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "maxPnlFactorForAdl", - "type": "uint256" - } - ], - "name": "AdlNotRequired", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "values", - "type": "bytes[]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "string", - "name": "label", - "type": "string" - } - ], - "name": "ArrayOutOfBoundsBytes", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "string", - "name": "label", - "type": "string" - } - ], - "name": "ArrayOutOfBoundsUint256", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "buybackToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "AvailableFeeAmountIsZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minOracleBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevMinOracleBlockNumber", - "type": "uint256" - } - ], - "name": "BlockNumbersNotSorted", - "type": "error" - }, - { - "inputs": [], - "name": "BridgeOutNotSupportedDuringShift", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "buybackToken", - "type": "address" - } - ], - "name": "BuybackAndFeeTokenAreEqual", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "heartbeatDuration", - "type": "uint256" - } - ], - "name": "ChainlinkPriceFeedNotUpdated", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "adjustedClaimableAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimedAmount", - "type": "uint256" - } - ], - "name": "CollateralAlreadyClaimed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "compactedValues", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "slotIndex", - "type": "uint256" - }, - { - "internalType": "string", - "name": "label", - "type": "string" - } - ], - "name": "CompactedArrayOutOfBounds", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "baseKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "ConfigValueExceedsAllowedRange", - "type": "error" - }, - { - "inputs": [], - "name": "DataListLengthExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "DataStreamIdAlreadyExistsForToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DepositNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "DisabledMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "existingDistributionId", - "type": "uint256" - } - ], - "name": "DuplicateClaimTerms", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "string", - "name": "label", - "type": "string" - } - ], - "name": "DuplicatedIndex", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "DuplicatedMarketInSwapPath", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EdgeDataStreamIdAlreadyExistsForToken", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyAccount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyAddressInMarketTokenBalanceValidation", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyChainlinkPriceFeed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyChainlinkPriceFeedMultiplier", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyClaimFeesMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyClaimableAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyDataStreamFeedId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyDataStreamMultiplier", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyDeposit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyDepositAmounts", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyDepositAmountsAfterSwap", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyFundingAccount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - } - ], - "name": "EmptyGlv", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvDeposit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvDepositAmounts", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvMarketAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvTokenSupply", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvWithdrawal", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvWithdrawalAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "EmptyMarketPrice", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyMarketTokenSupply", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyMultichainTransferInAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyMultichainTransferOutAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyPosition", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyPositionImpactWithdrawalAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyPrimaryPrice", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReduceLentAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyRelayFeeAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyShift", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyShiftAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EmptySizeDeltaInTokens", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyTarget", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyValidatedPrices", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyWithdrawal", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyWithdrawalAmount", - "type": "error" - }, - { - "inputs": [], - "name": "EndOfOracleSimulation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "key", - "type": "string" - } - ], - "name": "EventItemNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "ExternalCallFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "FeeBatchNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - } - ], - "name": "GlvAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "GlvDepositNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvDisabledMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvEnabledMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "uint256", - "name": "marketTokenBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - } - ], - "name": "GlvInsufficientMarketTokenBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "provided", - "type": "address" - }, - { - "internalType": "address", - "name": "expected", - "type": "address" - } - ], - "name": "GlvInvalidLongToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "provided", - "type": "address" - }, - { - "internalType": "address", - "name": "expected", - "type": "address" - } - ], - "name": "GlvInvalidShortToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvMarketAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "uint256", - "name": "glvMaxMarketCount", - "type": "uint256" - } - ], - "name": "GlvMaxMarketCountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxMarketTokenBalanceAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "marketTokenBalanceAmount", - "type": "uint256" - } - ], - "name": "GlvMaxMarketTokenBalanceAmountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "uint256", - "name": "maxMarketTokenBalanceUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "marketTokenBalanceUsd", - "type": "uint256" - } - ], - "name": "GlvMaxMarketTokenBalanceUsdExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "GlvNameTooLong", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvNegativeMarketPoolValue", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvNonZeroMarketBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "key", - "type": "address" - } - ], - "name": "GlvNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastGlvShiftExecutedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "glvShiftMinInterval", - "type": "uint256" - } - ], - "name": "GlvShiftIntervalNotYetPassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "effectivePriceImpactFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "glvMaxShiftPriceImpactFactor", - "type": "uint256" - } - ], - "name": "GlvShiftMaxPriceImpactExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "GlvShiftNotFound", - "type": "error" - }, - { - "inputs": [], - "name": "GlvSymbolTooLong", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvUnsupportedMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "GlvWithdrawalNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "signerIndex", - "type": "uint256" - } - ], - "name": "GmEmptySigner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minOracleBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentBlockNumber", - "type": "uint256" - } - ], - "name": "GmInvalidBlockNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minOracleBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxOracleBlockNumber", - "type": "uint256" - } - ], - "name": "GmInvalidMinMaxBlockNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "oracleSigners", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxOracleSigners", - "type": "uint256" - } - ], - "name": "GmMaxOracleSigners", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevPrice", - "type": "uint256" - } - ], - "name": "GmMaxPricesNotSorted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "signerIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSignerIndex", - "type": "uint256" - } - ], - "name": "GmMaxSignerIndex", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "oracleSigners", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOracleSigners", - "type": "uint256" - } - ], - "name": "GmMinOracleSigners", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevPrice", - "type": "uint256" - } - ], - "name": "GmMinPricesNotSorted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "buybackToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "outputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - } - ], - "name": "InsufficientBuybackOutputAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "collateralDeltaAmount", - "type": "int256" - } - ], - "name": "InsufficientCollateralAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "remainingCollateralUsd", - "type": "int256" - } - ], - "name": "InsufficientCollateralUsd", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minExecutionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - } - ], - "name": "InsufficientExecutionFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "startingGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "estimatedGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAdditionalGasForExecution", - "type": "uint256" - } - ], - "name": "InsufficientExecutionGas", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "startingGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minHandleErrorGas", - "type": "uint256" - } - ], - "name": "InsufficientExecutionGasForErrorHandling", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeProvided", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeRequired", - "type": "uint256" - } - ], - "name": "InsufficientFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InsufficientFunds", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "remainingCostUsd", - "type": "uint256" - }, - { - "internalType": "string", - "name": "step", - "type": "string" - } - ], - "name": "InsufficientFundsToPayForCosts", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minHandleExecutionErrorGas", - "type": "uint256" - } - ], - "name": "InsufficientGasForAutoCancellation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minHandleExecutionErrorGas", - "type": "uint256" - } - ], - "name": "InsufficientGasForCancellation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "estimatedGasLimit", - "type": "uint256" - } - ], - "name": "InsufficientGasLeft", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasToBeForwarded", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - } - ], - "name": "InsufficientGasLeftForCallback", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minHandleExecutionErrorGas", - "type": "uint256" - } - ], - "name": "InsufficientHandleExecutionErrorGas", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "withdrawalAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolValue", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "totalPendingImpactAmount", - "type": "int256" - } - ], - "name": "InsufficientImpactPoolValueForWithdrawal", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - } - ], - "name": "InsufficientMarketTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "InsufficientMultichainBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "outputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - } - ], - "name": "InsufficientOutputAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "poolAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "InsufficientPoolAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reservedUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxReservedUsd", - "type": "uint256" - } - ], - "name": "InsufficientReserve", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reservedUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxReservedUsd", - "type": "uint256" - } - ], - "name": "InsufficientReserveForOpenInterest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "outputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - } - ], - "name": "InsufficientSwapOutputAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "wntAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - } - ], - "name": "InsufficientWntAmountForExecutionFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "nextPnlToPoolFactor", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlToPoolFactor", - "type": "int256" - } - ], - "name": "InvalidAdl", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainingAmount", - "type": "uint256" - } - ], - "name": "InvalidAmountInForFeeBatch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "baseKey", - "type": "bytes32" - } - ], - "name": "InvalidBaseKey", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "largestMinBlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "smallestMaxBlockNumber", - "type": "uint256" - } - ], - "name": "InvalidBlockRangeSet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidBridgeOutToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "buybackToken", - "type": "address" - } - ], - "name": "InvalidBuybackToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedCancellationReceiver", - "type": "address" - } - ], - "name": "InvalidCancellationReceiverForSubaccountOrder", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - } - ], - "name": "InvalidClaimAffiliateRewardsInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeKeysLength", - "type": "uint256" - } - ], - "name": "InvalidClaimCollateralInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - } - ], - "name": "InvalidClaimFundingFeesInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recoveredSigner", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidClaimTermsSignature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidClaimTermsSignatureForContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - } - ], - "name": "InvalidClaimUiFeesInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "InvalidClaimableFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "InvalidClaimableReductionFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidCollateralTokenForMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidContributorToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "int192", - "name": "bid", - "type": "int192" - }, - { - "internalType": "int192", - "name": "ask", - "type": "int192" - } - ], - "name": "InvalidDataStreamBidAsk", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "feedId", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "expectedFeedId", - "type": "bytes32" - } - ], - "name": "InvalidDataStreamFeedId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "int192", - "name": "bid", - "type": "int192" - }, - { - "internalType": "int192", - "name": "ask", - "type": "int192" - } - ], - "name": "InvalidDataStreamPrices", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "spreadReductionFactor", - "type": "uint256" - } - ], - "name": "InvalidDataStreamSpreadReductionFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - } - ], - "name": "InvalidDecreaseOrderSize", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "decreasePositionSwapType", - "type": "uint256" - } - ], - "name": "InvalidDecreasePositionSwapType", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ask", - "type": "uint256" - } - ], - "name": "InvalidEdgeDataStreamBidAsk", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "expo", - "type": "int256" - } - ], - "name": "InvalidEdgeDataStreamExpo", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ask", - "type": "uint256" - } - ], - "name": "InvalidEdgeDataStreamPrices", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "recoverError", - "type": "uint256" - } - ], - "name": "InvalidEdgeSignature", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidEdgeSigner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "eid", - "type": "uint256" - } - ], - "name": "InvalidEid", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minExecutionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxExecutionFee", - "type": "uint256" - } - ], - "name": "InvalidExecutionFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "totalExecutionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "msgValue", - "type": "uint256" - } - ], - "name": "InvalidExecutionFeeForMigration", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "targetsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "dataListLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCallInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "InvalidExternalCallTarget", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "refundTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "refundReceiversLength", - "type": "uint256" - } - ], - "name": "InvalidExternalReceiversInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeBatchTokensLength", - "type": "uint256" - } - ], - "name": "InvalidFeeBatchTokenIndex", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "InvalidFeeReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "int256", - "name": "price", - "type": "int256" - } - ], - "name": "InvalidFeedPrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "totalGlpAmountToRedeem", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalGlpAmount", - "type": "uint256" - } - ], - "name": "InvalidGlpAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - } - ], - "name": "InvalidGlvDepositInitialLongToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - } - ], - "name": "InvalidGlvDepositInitialShortToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "longTokenSwapPathLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenSwapPathLength", - "type": "uint256" - } - ], - "name": "InvalidGlvDepositSwapPath", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPrice", - "type": "uint256" - } - ], - "name": "InvalidGmMedianMinMaxPrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidGmOraclePrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recoveredSigner", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidGmSignature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPrice", - "type": "uint256" - } - ], - "name": "InvalidGmSignerMinMaxPrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "InvalidHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidInitializer", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "keeper", - "type": "address" - } - ], - "name": "InvalidKeeperForFrozenOrder", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedMinBalance", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableFundingFeeAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForClaimableFunding", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForCollateralAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedMinGlvTokens", - "type": "uint256" - } - ], - "name": "InvalidMinGlvTokensForFirstGlvDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedMinMarketTokens", - "type": "uint256" - } - ], - "name": "InvalidMinMarketTokensForFirstDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "InvalidMinMaxForPrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "endpoint", - "type": "address" - } - ], - "name": "InvalidMultichainEndpoint", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "InvalidMultichainProvider", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - } - ], - "name": "InvalidNativeTokenSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "InvalidOracleProvider", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedProvider", - "type": "address" - } - ], - "name": "InvalidOracleProviderForToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "dataLength", - "type": "uint256" - } - ], - "name": "InvalidOracleSetPricesDataParam", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "providersLength", - "type": "uint256" - } - ], - "name": "InvalidOracleSetPricesProvidersParam", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "signer", - "type": "address" - } - ], - "name": "InvalidOracleSigner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "primaryPriceMin", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "primaryPriceMax", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "InvalidOrderPrices", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedTokenOut", - "type": "address" - } - ], - "name": "InvalidOutputToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "reason", - "type": "string" - } - ], - "name": "InvalidParams", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "poolValue", - "type": "int256" - } - ], - "name": "InvalidPoolValueForDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "poolValue", - "type": "int256" - } - ], - "name": "InvalidPoolValueForWithdrawal", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "distributionAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionImpactPoolAmount", - "type": "uint256" - } - ], - "name": "InvalidPositionImpactPoolDistributionRate", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "InvalidPositionMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - } - ], - "name": "InvalidPositionSizeValues", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "primaryTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "primaryPricesLength", - "type": "uint256" - } - ], - "name": "InvalidPrimaryPricesForSimulation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "InvalidReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedReceiver", - "type": "address" - } - ], - "name": "InvalidReceiverForFirstDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedReceiver", - "type": "address" - } - ], - "name": "InvalidReceiverForFirstGlvDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedReceiver", - "type": "address" - } - ], - "name": "InvalidReceiverForSubaccountOrder", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "signatureType", - "type": "string" - }, - { - "internalType": "address", - "name": "recovered", - "type": "address" - }, - { - "internalType": "address", - "name": "recoveredFromMinified", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSigner", - "type": "address" - } - ], - "name": "InvalidRecoveredSigner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountsLength", - "type": "uint256" - } - ], - "name": "InvalidSetContributorPaymentInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountsLength", - "type": "uint256" - } - ], - "name": "InvalidSetMaxTotalContributorTokenAmountInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "signatureType", - "type": "string" - } - ], - "name": "InvalidSignature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - } - ], - "name": "InvalidSizeDeltaForAdl", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidSubaccountApprovalDesChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "storedNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "InvalidSubaccountApprovalNonce", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidSubaccountApprovalSubaccount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "InvalidSwapMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "outputToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedOutputToken", - "type": "address" - } - ], - "name": "InvalidSwapOutputToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "path", - "type": "address[]" - }, - { - "internalType": "address", - "name": "bridgingToken", - "type": "address" - } - ], - "name": "InvalidSwapPathForV1", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timelockDelay", - "type": "uint256" - } - ], - "name": "InvalidTimelockDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "InvalidTokenIn", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTransferRequestsLength", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTrustedSignerAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "uiFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxUiFeeFactor", - "type": "uint256" - } - ], - "name": "InvalidUiFeeFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "version", - "type": "uint256" - } - ], - "name": "InvalidVersion", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "internalType": "int256", - "name": "remainingCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsdForLeverage", - "type": "int256" - } - ], - "name": "LiquidatablePosition", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "fromMarketLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarketLongToken", - "type": "address" - } - ], - "name": "LongTokensAreNotEqual", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "existingMarketAddress", - "type": "address" - } - ], - "name": "MarketAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "key", - "type": "address" - } - ], - "name": "MarketNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "string", - "name": "label", - "type": "string" - } - ], - "name": "MaskIndexOutOfBounds", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAutoCancelOrders", - "type": "uint256" - } - ], - "name": "MaxAutoCancelOrdersExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "priceTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "buybackMaxPriceAge", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - } - ], - "name": "MaxBuybackPriceAgeExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxCallbackGasLimit", - "type": "uint256" - } - ], - "name": "MaxCallbackGasLimitExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "dataLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxDataLength", - "type": "uint256" - } - ], - "name": "MaxDataListLengthExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "maxFundingFactorPerSecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - } - ], - "name": "MaxFundingFactorPerSecondLimitExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "poolUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxLendableUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lentUsd", - "type": "uint256" - } - ], - "name": "MaxLendableFactorForWithdrawalsExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "openInterest", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxOpenInterest", - "type": "uint256" - } - ], - "name": "MaxOpenInterestExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "range", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxRange", - "type": "uint256" - } - ], - "name": "MaxOracleTimestampRangeExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "poolAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPoolAmount", - "type": "uint256" - } - ], - "name": "MaxPoolAmountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "poolUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPoolUsdForDeposit", - "type": "uint256" - } - ], - "name": "MaxPoolUsdForDepositExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "oracleTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - } - ], - "name": "MaxPriceAgeExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "refPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxRefPriceDeviationFactor", - "type": "uint256" - } - ], - "name": "MaxRefPriceDeviationExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxCount", - "type": "uint256" - } - ], - "name": "MaxSubaccountActionCountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "swapPathLengh", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSwapPathLength", - "type": "uint256" - } - ], - "name": "MaxSwapPathLengthExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timelockDelay", - "type": "uint256" - } - ], - "name": "MaxTimelockDelayExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "totalCallbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTotalCallbackGasLimit", - "type": "uint256" - } - ], - "name": "MaxTotalCallbackGasLimitForAutoCancelOrdersExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTotalAmount", - "type": "uint256" - } - ], - "name": "MaxTotalContributorTokenAmountExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "interval", - "type": "uint256" - } - ], - "name": "MinContributorPaymentIntervalBelowAllowedRange", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minPaymentInterval", - "type": "uint256" - } - ], - "name": "MinContributorPaymentIntervalNotYetPassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - } - ], - "name": "MinGlvTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - } - ], - "name": "MinLongTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - } - ], - "name": "MinMarketTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minPositionSizeUsd", - "type": "uint256" - } - ], - "name": "MinPositionSize", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - } - ], - "name": "MinShortTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "executionPrice", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - } - ], - "name": "NegativeExecutionPrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "NonAtomicOracleProvider", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensWithPricesLength", - "type": "uint256" - } - ], - "name": "NonEmptyTokensWithPrices", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "OpenInterestCannotBeUpdatedForSwapOnlyMarket", - "type": "error" - }, - { - "inputs": [], - "name": "OraclePriceOutdated", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "oracle", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "OracleProviderAlreadyExistsForToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "OracleProviderMinChangeDelayNotYetPassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "maxOracleTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestExpirationTime", - "type": "uint256" - } - ], - "name": "OracleTimestampsAreLargerThanRequestExpirationTime", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minOracleTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedTimestamp", - "type": "uint256" - } - ], - "name": "OracleTimestampsAreSmallerThanRequired", - "type": "error" - }, - { - "inputs": [], - "name": "OrderAlreadyFrozen", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "OrderNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - } - ], - "name": "OrderNotFulfillableAtAcceptablePrice", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "OrderNotUpdatable", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "OrderTypeCannotBeCreated", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - } - ], - "name": "OrderValidFromTimeNotReached", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "pnlToPoolFactor", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "maxPnlFactor", - "type": "uint256" - } - ], - "name": "PnlFactorExceededForLongs", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "pnlToPoolFactor", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "maxPnlFactor", - "type": "uint256" - } - ], - "name": "PnlFactorExceededForShorts", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "nextPnlToPoolFactor", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "minPnlFactorForAdl", - "type": "uint256" - } - ], - "name": "PnlOvercorrected", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "PositionNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "internalType": "int256", - "name": "remainingCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsdForLeverage", - "type": "int256" - } - ], - "name": "PositionShouldNotBeLiquidated", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "minPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPrice", - "type": "uint256" - } - ], - "name": "PriceAlreadySet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "PriceFeedAlreadyExistsForToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - } - ], - "name": "PriceImpactLargerThanOrderSize", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "lentAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalReductionAmount", - "type": "uint256" - } - ], - "name": "ReductionExceedsLentAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "calldataLength", - "type": "uint256" - } - ], - "name": "RelayCalldataTooLong", - "type": "error" - }, - { - "inputs": [], - "name": "RelayEmptyBatch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestAge", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestExpirationAge", - "type": "uint256" - }, - { - "internalType": "string", - "name": "requestType", - "type": "string" - } - ], - "name": "RequestNotYetCancellable", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "SelfTransferNotSupported", - "type": "error" - }, - { - "inputs": [], - "name": "SequencerDown", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timeSinceUp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sequencerGraceDuration", - "type": "uint256" - } - ], - "name": "SequencerGraceDurationNotYetPassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "ShiftFromAndToMarketAreEqual", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ShiftNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "fromMarketLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarketLongToken", - "type": "address" - } - ], - "name": "ShortTokensAreNotEqual", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "signalTime", - "type": "uint256" - } - ], - "name": "SignalTimeNotYetPassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "SubaccountApprovalDeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - } - ], - "name": "SubaccountApprovalExpired", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - } - ], - "name": "SubaccountIntegrationIdDisabled", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - } - ], - "name": "SubaccountNotAuthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountAfterFees", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "negativeImpactAmount", - "type": "int256" - } - ], - "name": "SwapPriceImpactExceedsAmountIn", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "longTokenSwapPathLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenSwapPathLength", - "type": "uint256" - } - ], - "name": "SwapsNotAllowedForAtomicWithdrawal", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "parametersLength", - "type": "uint256" - } - ], - "name": "SyncConfigInvalidInputLengths", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "marketFromData", - "type": "address" - } - ], - "name": "SyncConfigInvalidMarketFromData", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "SyncConfigUpdatesDisabledForMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "string", - "name": "parameter", - "type": "string" - } - ], - "name": "SyncConfigUpdatesDisabledForMarketParameter", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "parameter", - "type": "string" - } - ], - "name": "SyncConfigUpdatesDisabledForParameter", - "type": "error" - }, - { - "inputs": [], - "name": "ThereMustBeAtLeastOneRoleAdmin", - "type": "error" - }, - { - "inputs": [], - "name": "ThereMustBeAtLeastOneTimelockMultiSig", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "length", - "type": "uint256" - } - ], - "name": "Uint256AsBytesLengthExceeds32Bytes", - "type": "error" - }, - { - "inputs": [], - "name": "UnableToGetBorrowingFactorEmptyPoolUsd", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "UnableToGetCachedTokenPrice", - "type": "error" - }, - { - "inputs": [], - "name": "UnableToGetFundingFactorEmptyOpenInterest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "inputToken", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "UnableToGetOppositeToken", - "type": "error" - }, - { - "inputs": [], - "name": "UnableToPayOrderFee", - "type": "error" - }, - { - "inputs": [], - "name": "UnableToPayOrderFeeFromCollateral", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "estimatedRemainingCollateralUsd", - "type": "int256" - } - ], - "name": "UnableToWithdrawCollateral", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "positionBorrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cumulativeBorrowingFactor", - "type": "uint256" - } - ], - "name": "UnexpectedBorrowingFactor", - "type": "error" - }, - { - "inputs": [], - "name": "UnexpectedMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "poolValue", - "type": "int256" - } - ], - "name": "UnexpectedPoolValue", - "type": "error" - }, - { - "inputs": [], - "name": "UnexpectedPositionState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeTokenAfterSwap", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "UnexpectedTokenForVirtualInventory", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "UnexpectedValidFromTime", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "UnsupportedOrderType", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "orderType", - "type": "uint256" - } - ], - "name": "UnsupportedOrderTypeForAutoCancellation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "usdDelta", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "longOpenInterest", - "type": "uint256" - } - ], - "name": "UsdDeltaExceedsLongOpenInterest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "usdDelta", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "poolUsd", - "type": "uint256" - } - ], - "name": "UsdDeltaExceedsPoolValue", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "int256", - "name": "usdDelta", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "shortOpenInterest", - "type": "uint256" - } - ], - "name": "UsdDeltaExceedsShortOpenInterest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "WithdrawalNotFound", - "type": "error" - } - ] -} diff --git a/sdk/src/abis/CustomErrors.ts b/sdk/src/abis/CustomErrors.ts new file mode 100644 index 0000000000..e3169dd54b --- /dev/null +++ b/sdk/src/abis/CustomErrors.ts @@ -0,0 +1,1882 @@ +export default [ + { inputs: [], name: "ActionAlreadySignalled", type: "error" }, + { inputs: [], name: "ActionNotSignalled", type: "error" }, + { inputs: [], name: "AdlNotEnabled", type: "error" }, + { + inputs: [ + { internalType: "int256", name: "pnlToPoolFactor", type: "int256" }, + { internalType: "uint256", name: "maxPnlFactorForAdl", type: "uint256" }, + ], + name: "AdlNotRequired", + type: "error", + }, + { + inputs: [ + { internalType: "bytes[]", name: "values", type: "bytes[]" }, + { internalType: "uint256", name: "index", type: "uint256" }, + { internalType: "string", name: "label", type: "string" }, + ], + name: "ArrayOutOfBoundsBytes", + type: "error", + }, + { + inputs: [ + { internalType: "uint256[]", name: "values", type: "uint256[]" }, + { internalType: "uint256", name: "index", type: "uint256" }, + { internalType: "string", name: "label", type: "string" }, + ], + name: "ArrayOutOfBoundsUint256", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "buybackToken", type: "address" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "AvailableFeeAmountIsZero", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minOracleBlockNumber", type: "uint256" }, + { internalType: "uint256", name: "prevMinOracleBlockNumber", type: "uint256" }, + ], + name: "BlockNumbersNotSorted", + type: "error", + }, + { inputs: [], name: "BridgeOutNotSupportedDuringShift", type: "error" }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "buybackToken", type: "address" }, + ], + name: "BuybackAndFeeTokenAreEqual", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "uint256", name: "heartbeatDuration", type: "uint256" }, + ], + name: "ChainlinkPriceFeedNotUpdated", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "adjustedClaimableAmount", type: "uint256" }, + { internalType: "uint256", name: "claimedAmount", type: "uint256" }, + ], + name: "CollateralAlreadyClaimed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256[]", name: "compactedValues", type: "uint256[]" }, + { internalType: "uint256", name: "index", type: "uint256" }, + { internalType: "uint256", name: "slotIndex", type: "uint256" }, + { internalType: "string", name: "label", type: "string" }, + ], + name: "CompactedArrayOutOfBounds", + type: "error", + }, + { + inputs: [ + { internalType: "bytes32", name: "baseKey", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "ConfigValueExceedsAllowedRange", + type: "error", + }, + { inputs: [], name: "DataListLengthExceeded", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "DataStreamIdAlreadyExistsForToken", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DepositNotFound", type: "error" }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [{ internalType: "address", name: "market", type: "address" }], name: "DisabledMarket", type: "error" }, + { + inputs: [{ internalType: "uint256", name: "existingDistributionId", type: "uint256" }], + name: "DuplicateClaimTerms", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "index", type: "uint256" }, + { internalType: "string", name: "label", type: "string" }, + ], + name: "DuplicatedIndex", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "market", type: "address" }], + name: "DuplicatedMarketInSwapPath", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EdgeDataStreamIdAlreadyExistsForToken", + type: "error", + }, + { inputs: [], name: "EmptyAccount", type: "error" }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyAddressInMarketTokenBalanceValidation", + type: "error", + }, + { inputs: [], name: "EmptyAmount", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyChainlinkPriceFeed", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyChainlinkPriceFeedMultiplier", + type: "error", + }, + { inputs: [], name: "EmptyClaimFeesMarket", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyClaimableAmount", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyDataStreamFeedId", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyDataStreamMultiplier", + type: "error", + }, + { inputs: [], name: "EmptyDeposit", type: "error" }, + { inputs: [], name: "EmptyDepositAmounts", type: "error" }, + { inputs: [], name: "EmptyDepositAmountsAfterSwap", type: "error" }, + { inputs: [], name: "EmptyFundingAccount", type: "error" }, + { inputs: [{ internalType: "address", name: "glv", type: "address" }], name: "EmptyGlv", type: "error" }, + { inputs: [], name: "EmptyGlvDeposit", type: "error" }, + { inputs: [], name: "EmptyGlvDepositAmounts", type: "error" }, + { inputs: [], name: "EmptyGlvMarketAmount", type: "error" }, + { inputs: [], name: "EmptyGlvTokenSupply", type: "error" }, + { inputs: [], name: "EmptyGlvWithdrawal", type: "error" }, + { inputs: [], name: "EmptyGlvWithdrawalAmount", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyMarket", type: "error" }, + { inputs: [{ internalType: "address", name: "market", type: "address" }], name: "EmptyMarketPrice", type: "error" }, + { inputs: [], name: "EmptyMarketTokenSupply", type: "error" }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyMultichainTransferInAmount", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyMultichainTransferOutAmount", + type: "error", + }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyPosition", type: "error" }, + { inputs: [], name: "EmptyPositionImpactWithdrawalAmount", type: "error" }, + { inputs: [{ internalType: "address", name: "token", type: "address" }], name: "EmptyPrimaryPrice", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { inputs: [], name: "EmptyReduceLentAmount", type: "error" }, + { inputs: [], name: "EmptyRelayFeeAddress", type: "error" }, + { inputs: [], name: "EmptyShift", type: "error" }, + { inputs: [], name: "EmptyShiftAmount", type: "error" }, + { inputs: [], name: "EmptySizeDeltaInTokens", type: "error" }, + { inputs: [], name: "EmptyTarget", type: "error" }, + { inputs: [], name: "EmptyToken", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { inputs: [], name: "EmptyValidatedPrices", type: "error" }, + { inputs: [], name: "EmptyWithdrawal", type: "error" }, + { inputs: [], name: "EmptyWithdrawalAmount", type: "error" }, + { inputs: [], name: "EndOfOracleSimulation", type: "error" }, + { inputs: [{ internalType: "string", name: "key", type: "string" }], name: "EventItemNotFound", type: "error" }, + { inputs: [{ internalType: "bytes", name: "data", type: "bytes" }], name: "ExternalCallFailed", type: "error" }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "FeeBatchNotFound", type: "error" }, + { + inputs: [ + { internalType: "bytes32", name: "salt", type: "bytes32" }, + { internalType: "address", name: "glv", type: "address" }, + ], + name: "GlvAlreadyExists", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "GlvDepositNotFound", type: "error" }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvDisabledMarket", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvEnabledMarket", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "uint256", name: "marketTokenBalance", type: "uint256" }, + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + ], + name: "GlvInsufficientMarketTokenBalance", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "provided", type: "address" }, + { internalType: "address", name: "expected", type: "address" }, + ], + name: "GlvInvalidLongToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "provided", type: "address" }, + { internalType: "address", name: "expected", type: "address" }, + ], + name: "GlvInvalidShortToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvMarketAlreadyExists", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "uint256", name: "glvMaxMarketCount", type: "uint256" }, + ], + name: "GlvMaxMarketCountExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "uint256", name: "maxMarketTokenBalanceAmount", type: "uint256" }, + { internalType: "uint256", name: "marketTokenBalanceAmount", type: "uint256" }, + ], + name: "GlvMaxMarketTokenBalanceAmountExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "uint256", name: "maxMarketTokenBalanceUsd", type: "uint256" }, + { internalType: "uint256", name: "marketTokenBalanceUsd", type: "uint256" }, + ], + name: "GlvMaxMarketTokenBalanceUsdExceeded", + type: "error", + }, + { inputs: [], name: "GlvNameTooLong", type: "error" }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvNegativeMarketPoolValue", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvNonZeroMarketBalance", + type: "error", + }, + { inputs: [{ internalType: "address", name: "key", type: "address" }], name: "GlvNotFound", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "lastGlvShiftExecutedAt", type: "uint256" }, + { internalType: "uint256", name: "glvShiftMinInterval", type: "uint256" }, + ], + name: "GlvShiftIntervalNotYetPassed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "effectivePriceImpactFactor", type: "uint256" }, + { internalType: "uint256", name: "glvMaxShiftPriceImpactFactor", type: "uint256" }, + ], + name: "GlvShiftMaxPriceImpactExceeded", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "GlvShiftNotFound", type: "error" }, + { inputs: [], name: "GlvSymbolTooLong", type: "error" }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvUnsupportedMarket", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "GlvWithdrawalNotFound", type: "error" }, + { inputs: [{ internalType: "uint256", name: "signerIndex", type: "uint256" }], name: "GmEmptySigner", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "minOracleBlockNumber", type: "uint256" }, + { internalType: "uint256", name: "currentBlockNumber", type: "uint256" }, + ], + name: "GmInvalidBlockNumber", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minOracleBlockNumber", type: "uint256" }, + { internalType: "uint256", name: "maxOracleBlockNumber", type: "uint256" }, + ], + name: "GmInvalidMinMaxBlockNumber", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "oracleSigners", type: "uint256" }, + { internalType: "uint256", name: "maxOracleSigners", type: "uint256" }, + ], + name: "GmMaxOracleSigners", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "price", type: "uint256" }, + { internalType: "uint256", name: "prevPrice", type: "uint256" }, + ], + name: "GmMaxPricesNotSorted", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "signerIndex", type: "uint256" }, + { internalType: "uint256", name: "maxSignerIndex", type: "uint256" }, + ], + name: "GmMaxSignerIndex", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "oracleSigners", type: "uint256" }, + { internalType: "uint256", name: "minOracleSigners", type: "uint256" }, + ], + name: "GmMinOracleSigners", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "price", type: "uint256" }, + { internalType: "uint256", name: "prevPrice", type: "uint256" }, + ], + name: "GmMinPricesNotSorted", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "buybackToken", type: "address" }, + { internalType: "uint256", name: "outputAmount", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + ], + name: "InsufficientBuybackOutputAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "collateralDeltaAmount", type: "int256" }, + ], + name: "InsufficientCollateralAmount", + type: "error", + }, + { + inputs: [{ internalType: "int256", name: "remainingCollateralUsd", type: "int256" }], + name: "InsufficientCollateralUsd", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minExecutionFee", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + ], + name: "InsufficientExecutionFee", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "startingGas", type: "uint256" }, + { internalType: "uint256", name: "estimatedGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minAdditionalGasForExecution", type: "uint256" }, + ], + name: "InsufficientExecutionGas", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "startingGas", type: "uint256" }, + { internalType: "uint256", name: "minHandleErrorGas", type: "uint256" }, + ], + name: "InsufficientExecutionGasForErrorHandling", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "feeProvided", type: "uint256" }, + { internalType: "uint256", name: "feeRequired", type: "uint256" }, + ], + name: "InsufficientFee", + type: "error", + }, + { inputs: [{ internalType: "address", name: "token", type: "address" }], name: "InsufficientFunds", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "remainingCostUsd", type: "uint256" }, + { internalType: "string", name: "step", type: "string" }, + ], + name: "InsufficientFundsToPayForCosts", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "gas", type: "uint256" }, + { internalType: "uint256", name: "minHandleExecutionErrorGas", type: "uint256" }, + ], + name: "InsufficientGasForAutoCancellation", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "gas", type: "uint256" }, + { internalType: "uint256", name: "minHandleExecutionErrorGas", type: "uint256" }, + ], + name: "InsufficientGasForCancellation", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "gas", type: "uint256" }, + { internalType: "uint256", name: "estimatedGasLimit", type: "uint256" }, + ], + name: "InsufficientGasLeft", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "gasToBeForwarded", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + ], + name: "InsufficientGasLeftForCallback", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "gas", type: "uint256" }, + { internalType: "uint256", name: "minHandleExecutionErrorGas", type: "uint256" }, + ], + name: "InsufficientHandleExecutionErrorGas", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "withdrawalAmount", type: "uint256" }, + { internalType: "uint256", name: "poolValue", type: "uint256" }, + { internalType: "int256", name: "totalPendingImpactAmount", type: "int256" }, + ], + name: "InsufficientImpactPoolValueForWithdrawal", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "expected", type: "uint256" }, + ], + name: "InsufficientMarketTokens", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "InsufficientMultichainBalance", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "outputAmount", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + ], + name: "InsufficientOutputAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "poolAmount", type: "uint256" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "InsufficientPoolAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "reservedUsd", type: "uint256" }, + { internalType: "uint256", name: "maxReservedUsd", type: "uint256" }, + ], + name: "InsufficientReserve", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "reservedUsd", type: "uint256" }, + { internalType: "uint256", name: "maxReservedUsd", type: "uint256" }, + ], + name: "InsufficientReserveForOpenInterest", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "outputAmount", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + ], + name: "InsufficientSwapOutputAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "wntAmount", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + ], + name: "InsufficientWntAmountForExecutionFee", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "nextPnlToPoolFactor", type: "int256" }, + { internalType: "int256", name: "pnlToPoolFactor", type: "int256" }, + ], + name: "InvalidAdl", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "amountIn", type: "uint256" }, + { internalType: "uint256", name: "remainingAmount", type: "uint256" }, + ], + name: "InvalidAmountInForFeeBatch", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "baseKey", type: "bytes32" }], name: "InvalidBaseKey", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "largestMinBlockNumber", type: "uint256" }, + { internalType: "uint256", name: "smallestMaxBlockNumber", type: "uint256" }, + ], + name: "InvalidBlockRangeSet", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "InvalidBridgeOutToken", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "buybackToken", type: "address" }], + name: "InvalidBuybackToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "expectedCancellationReceiver", type: "address" }, + ], + name: "InvalidCancellationReceiverForSubaccountOrder", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + ], + name: "InvalidClaimAffiliateRewardsInput", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "timeKeysLength", type: "uint256" }, + ], + name: "InvalidClaimCollateralInput", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + ], + name: "InvalidClaimFundingFeesInput", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "recoveredSigner", type: "address" }, + { internalType: "address", name: "expectedSigner", type: "address" }, + ], + name: "InvalidClaimTermsSignature", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "expectedSigner", type: "address" }], + name: "InvalidClaimTermsSignatureForContract", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + ], + name: "InvalidClaimUiFeesInput", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "value", type: "uint256" }], + name: "InvalidClaimableFactor", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "value", type: "uint256" }], + name: "InvalidClaimableReductionFactor", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "InvalidCollateralTokenForMarket", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "InvalidContributorToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "int192", name: "bid", type: "int192" }, + { internalType: "int192", name: "ask", type: "int192" }, + ], + name: "InvalidDataStreamBidAsk", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "bytes32", name: "feedId", type: "bytes32" }, + { internalType: "bytes32", name: "expectedFeedId", type: "bytes32" }, + ], + name: "InvalidDataStreamFeedId", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "int192", name: "bid", type: "int192" }, + { internalType: "int192", name: "ask", type: "int192" }, + ], + name: "InvalidDataStreamPrices", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "spreadReductionFactor", type: "uint256" }, + ], + name: "InvalidDataStreamSpreadReductionFactor", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "positionSizeInUsd", type: "uint256" }, + ], + name: "InvalidDecreaseOrderSize", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "decreasePositionSwapType", type: "uint256" }], + name: "InvalidDecreasePositionSwapType", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "bid", type: "uint256" }, + { internalType: "uint256", name: "ask", type: "uint256" }, + ], + name: "InvalidEdgeDataStreamBidAsk", + type: "error", + }, + { + inputs: [{ internalType: "int256", name: "expo", type: "int256" }], + name: "InvalidEdgeDataStreamExpo", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "bid", type: "uint256" }, + { internalType: "uint256", name: "ask", type: "uint256" }, + ], + name: "InvalidEdgeDataStreamPrices", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "recoverError", type: "uint256" }], + name: "InvalidEdgeSignature", + type: "error", + }, + { inputs: [], name: "InvalidEdgeSigner", type: "error" }, + { inputs: [{ internalType: "uint256", name: "eid", type: "uint256" }], name: "InvalidEid", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "minExecutionFee", type: "uint256" }, + { internalType: "uint256", name: "maxExecutionFee", type: "uint256" }, + ], + name: "InvalidExecutionFee", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "totalExecutionFee", type: "uint256" }, + { internalType: "uint256", name: "msgValue", type: "uint256" }, + ], + name: "InvalidExecutionFeeForMigration", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "targetsLength", type: "uint256" }, + { internalType: "uint256", name: "dataListLength", type: "uint256" }, + ], + name: "InvalidExternalCallInput", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "target", type: "address" }], + name: "InvalidExternalCallTarget", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "refundTokensLength", type: "uint256" }, + { internalType: "uint256", name: "refundReceiversLength", type: "uint256" }, + ], + name: "InvalidExternalReceiversInput", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "tokenIndex", type: "uint256" }, + { internalType: "uint256", name: "feeBatchTokensLength", type: "uint256" }, + ], + name: "InvalidFeeBatchTokenIndex", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "receiver", type: "address" }], + name: "InvalidFeeReceiver", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "int256", name: "price", type: "int256" }, + ], + name: "InvalidFeedPrice", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "totalGlpAmountToRedeem", type: "uint256" }, + { internalType: "uint256", name: "totalGlpAmount", type: "uint256" }, + ], + name: "InvalidGlpAmount", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "initialLongToken", type: "address" }], + name: "InvalidGlvDepositInitialLongToken", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "initialShortToken", type: "address" }], + name: "InvalidGlvDepositInitialShortToken", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "longTokenSwapPathLength", type: "uint256" }, + { internalType: "uint256", name: "shortTokenSwapPathLength", type: "uint256" }, + ], + name: "InvalidGlvDepositSwapPath", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minPrice", type: "uint256" }, + { internalType: "uint256", name: "maxPrice", type: "uint256" }, + ], + name: "InvalidGmMedianMinMaxPrice", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "InvalidGmOraclePrice", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "recoveredSigner", type: "address" }, + { internalType: "address", name: "expectedSigner", type: "address" }, + ], + name: "InvalidGmSignature", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minPrice", type: "uint256" }, + { internalType: "uint256", name: "maxPrice", type: "uint256" }, + ], + name: "InvalidGmSignerMinMaxPrice", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "InvalidHoldingAddress", + type: "error", + }, + { inputs: [], name: "InvalidInitializer", type: "error" }, + { + inputs: [{ internalType: "address", name: "keeper", type: "address" }], + name: "InvalidKeeperForFrozenOrder", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "expectedMinBalance", type: "uint256" }, + ], + name: "InvalidMarketTokenBalance", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "claimableFundingFeeAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForClaimableFunding", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForCollateralAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "expectedMinGlvTokens", type: "uint256" }, + ], + name: "InvalidMinGlvTokensForFirstGlvDeposit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "expectedMinMarketTokens", type: "uint256" }, + ], + name: "InvalidMinMarketTokensForFirstDeposit", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + name: "InvalidMinMaxForPrice", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "endpoint", type: "address" }], + name: "InvalidMultichainEndpoint", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "provider", type: "address" }], + name: "InvalidMultichainProvider", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "msgSender", type: "address" }], + name: "InvalidNativeTokenSender", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "provider", type: "address" }], + name: "InvalidOracleProvider", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "expectedProvider", type: "address" }, + ], + name: "InvalidOracleProviderForToken", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "dataLength", type: "uint256" }, + ], + name: "InvalidOracleSetPricesDataParam", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "providersLength", type: "uint256" }, + ], + name: "InvalidOracleSetPricesProvidersParam", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "signer", type: "address" }], + name: "InvalidOracleSigner", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "primaryPriceMin", type: "uint256" }, + { internalType: "uint256", name: "primaryPriceMax", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "orderType", type: "uint256" }, + ], + name: "InvalidOrderPrices", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "tokenOut", type: "address" }, + { internalType: "address", name: "expectedTokenOut", type: "address" }, + ], + name: "InvalidOutputToken", + type: "error", + }, + { inputs: [{ internalType: "string", name: "reason", type: "string" }], name: "InvalidParams", type: "error" }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "int256", name: "poolValue", type: "int256" }], + name: "InvalidPoolValueForDeposit", + type: "error", + }, + { + inputs: [{ internalType: "int256", name: "poolValue", type: "int256" }], + name: "InvalidPoolValueForWithdrawal", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "distributionAmount", type: "uint256" }, + { internalType: "uint256", name: "positionImpactPoolAmount", type: "uint256" }, + ], + name: "InvalidPositionImpactPoolDistributionRate", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "market", type: "address" }], + name: "InvalidPositionMarket", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + ], + name: "InvalidPositionSizeValues", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "primaryTokensLength", type: "uint256" }, + { internalType: "uint256", name: "primaryPricesLength", type: "uint256" }, + ], + name: "InvalidPrimaryPricesForSimulation", + type: "error", + }, + { inputs: [{ internalType: "address", name: "receiver", type: "address" }], name: "InvalidReceiver", type: "error" }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "expectedReceiver", type: "address" }, + ], + name: "InvalidReceiverForFirstDeposit", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "expectedReceiver", type: "address" }, + ], + name: "InvalidReceiverForFirstGlvDeposit", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "expectedReceiver", type: "address" }, + ], + name: "InvalidReceiverForSubaccountOrder", + type: "error", + }, + { + inputs: [ + { internalType: "string", name: "signatureType", type: "string" }, + { internalType: "address", name: "recovered", type: "address" }, + { internalType: "address", name: "recoveredFromMinified", type: "address" }, + { internalType: "address", name: "expectedSigner", type: "address" }, + ], + name: "InvalidRecoveredSigner", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "amountsLength", type: "uint256" }, + ], + name: "InvalidSetContributorPaymentInput", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "amountsLength", type: "uint256" }, + ], + name: "InvalidSetMaxTotalContributorTokenAmountInput", + type: "error", + }, + { + inputs: [{ internalType: "string", name: "signatureType", type: "string" }], + name: "InvalidSignature", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "positionSizeInUsd", type: "uint256" }, + ], + name: "InvalidSizeDeltaForAdl", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidSubaccountApprovalDesChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "storedNonce", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + ], + name: "InvalidSubaccountApprovalNonce", + type: "error", + }, + { inputs: [], name: "InvalidSubaccountApprovalSubaccount", type: "error" }, + { inputs: [{ internalType: "address", name: "market", type: "address" }], name: "InvalidSwapMarket", type: "error" }, + { + inputs: [ + { internalType: "address", name: "outputToken", type: "address" }, + { internalType: "address", name: "expectedOutputToken", type: "address" }, + ], + name: "InvalidSwapOutputToken", + type: "error", + }, + { + inputs: [ + { internalType: "address[]", name: "path", type: "address[]" }, + { internalType: "address", name: "bridgingToken", type: "address" }, + ], + name: "InvalidSwapPathForV1", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "timelockDelay", type: "uint256" }], + name: "InvalidTimelockDelay", + type: "error", + }, + { inputs: [{ internalType: "address", name: "token", type: "address" }], name: "InvalidToken", type: "error" }, + { + inputs: [ + { internalType: "address", name: "tokenIn", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "InvalidTokenIn", + type: "error", + }, + { inputs: [], name: "InvalidTransferRequestsLength", type: "error" }, + { inputs: [], name: "InvalidTrustedSignerAddress", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "uiFeeFactor", type: "uint256" }, + { internalType: "uint256", name: "maxUiFeeFactor", type: "uint256" }, + ], + name: "InvalidUiFeeFactor", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { inputs: [{ internalType: "uint256", name: "version", type: "uint256" }], name: "InvalidVersion", type: "error" }, + { + inputs: [ + { internalType: "string", name: "reason", type: "string" }, + { internalType: "int256", name: "remainingCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsdForLeverage", type: "int256" }, + ], + name: "LiquidatablePosition", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "fromMarketLongToken", type: "address" }, + { internalType: "address", name: "toMarketLongToken", type: "address" }, + ], + name: "LongTokensAreNotEqual", + type: "error", + }, + { + inputs: [ + { internalType: "bytes32", name: "salt", type: "bytes32" }, + { internalType: "address", name: "existingMarketAddress", type: "address" }, + ], + name: "MarketAlreadyExists", + type: "error", + }, + { inputs: [{ internalType: "address", name: "key", type: "address" }], name: "MarketNotFound", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "index", type: "uint256" }, + { internalType: "string", name: "label", type: "string" }, + ], + name: "MaskIndexOutOfBounds", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "count", type: "uint256" }, + { internalType: "uint256", name: "maxAutoCancelOrders", type: "uint256" }, + ], + name: "MaxAutoCancelOrdersExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "priceTimestamp", type: "uint256" }, + { internalType: "uint256", name: "buybackMaxPriceAge", type: "uint256" }, + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + ], + name: "MaxBuybackPriceAgeExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxCallbackGasLimit", type: "uint256" }, + ], + name: "MaxCallbackGasLimitExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "dataLength", type: "uint256" }, + { internalType: "uint256", name: "maxDataLength", type: "uint256" }, + ], + name: "MaxDataListLengthExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "maxFundingFactorPerSecond", type: "uint256" }, + { internalType: "uint256", name: "limit", type: "uint256" }, + ], + name: "MaxFundingFactorPerSecondLimitExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "poolUsd", type: "uint256" }, + { internalType: "uint256", name: "maxLendableUsd", type: "uint256" }, + { internalType: "uint256", name: "lentUsd", type: "uint256" }, + ], + name: "MaxLendableFactorForWithdrawalsExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "openInterest", type: "uint256" }, + { internalType: "uint256", name: "maxOpenInterest", type: "uint256" }, + ], + name: "MaxOpenInterestExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "range", type: "uint256" }, + { internalType: "uint256", name: "maxRange", type: "uint256" }, + ], + name: "MaxOracleTimestampRangeExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "poolAmount", type: "uint256" }, + { internalType: "uint256", name: "maxPoolAmount", type: "uint256" }, + ], + name: "MaxPoolAmountExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "poolUsd", type: "uint256" }, + { internalType: "uint256", name: "maxPoolUsdForDeposit", type: "uint256" }, + ], + name: "MaxPoolUsdForDepositExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "oracleTimestamp", type: "uint256" }, + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + ], + name: "MaxPriceAgeExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "price", type: "uint256" }, + { internalType: "uint256", name: "refPrice", type: "uint256" }, + { internalType: "uint256", name: "maxRefPriceDeviationFactor", type: "uint256" }, + ], + name: "MaxRefPriceDeviationExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "uint256", name: "count", type: "uint256" }, + { internalType: "uint256", name: "maxCount", type: "uint256" }, + ], + name: "MaxSubaccountActionCountExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "swapPathLengh", type: "uint256" }, + { internalType: "uint256", name: "maxSwapPathLength", type: "uint256" }, + ], + name: "MaxSwapPathLengthExceeded", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "timelockDelay", type: "uint256" }], + name: "MaxTimelockDelayExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "totalCallbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxTotalCallbackGasLimit", type: "uint256" }, + ], + name: "MaxTotalCallbackGasLimitForAutoCancelOrdersExceeded", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "totalAmount", type: "uint256" }, + { internalType: "uint256", name: "maxTotalAmount", type: "uint256" }, + ], + name: "MaxTotalContributorTokenAmountExceeded", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "interval", type: "uint256" }], + name: "MinContributorPaymentIntervalBelowAllowedRange", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "minPaymentInterval", type: "uint256" }], + name: "MinContributorPaymentIntervalNotYetPassed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "received", type: "uint256" }, + { internalType: "uint256", name: "expected", type: "uint256" }, + ], + name: "MinGlvTokens", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "received", type: "uint256" }, + { internalType: "uint256", name: "expected", type: "uint256" }, + ], + name: "MinLongTokens", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "received", type: "uint256" }, + { internalType: "uint256", name: "expected", type: "uint256" }, + ], + name: "MinMarketTokens", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "positionSizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "minPositionSizeUsd", type: "uint256" }, + ], + name: "MinPositionSize", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "received", type: "uint256" }, + { internalType: "uint256", name: "expected", type: "uint256" }, + ], + name: "MinShortTokens", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "executionPrice", type: "int256" }, + { internalType: "uint256", name: "price", type: "uint256" }, + { internalType: "uint256", name: "positionSizeInUsd", type: "uint256" }, + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + ], + name: "NegativeExecutionPrice", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "provider", type: "address" }], + name: "NonAtomicOracleProvider", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { + inputs: [{ internalType: "uint256", name: "tokensWithPricesLength", type: "uint256" }], + name: "NonEmptyTokensWithPrices", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "market", type: "address" }], + name: "OpenInterestCannotBeUpdatedForSwapOnlyMarket", + type: "error", + }, + { inputs: [], name: "OraclePriceOutdated", type: "error" }, + { + inputs: [ + { internalType: "address", name: "oracle", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "OracleProviderAlreadyExistsForToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "provider", type: "address" }, + ], + name: "OracleProviderMinChangeDelayNotYetPassed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "maxOracleTimestamp", type: "uint256" }, + { internalType: "uint256", name: "requestTimestamp", type: "uint256" }, + { internalType: "uint256", name: "requestExpirationTime", type: "uint256" }, + ], + name: "OracleTimestampsAreLargerThanRequestExpirationTime", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "minOracleTimestamp", type: "uint256" }, + { internalType: "uint256", name: "expectedTimestamp", type: "uint256" }, + ], + name: "OracleTimestampsAreSmallerThanRequired", + type: "error", + }, + { inputs: [], name: "OrderAlreadyFrozen", type: "error" }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "OrderNotFound", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "price", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + ], + name: "OrderNotFulfillableAtAcceptablePrice", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "orderType", type: "uint256" }], + name: "OrderNotUpdatable", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "orderType", type: "uint256" }], + name: "OrderTypeCannotBeCreated", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + ], + name: "OrderValidFromTimeNotReached", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "pnlToPoolFactor", type: "int256" }, + { internalType: "uint256", name: "maxPnlFactor", type: "uint256" }, + ], + name: "PnlFactorExceededForLongs", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "pnlToPoolFactor", type: "int256" }, + { internalType: "uint256", name: "maxPnlFactor", type: "uint256" }, + ], + name: "PnlFactorExceededForShorts", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "nextPnlToPoolFactor", type: "int256" }, + { internalType: "uint256", name: "minPnlFactorForAdl", type: "uint256" }, + ], + name: "PnlOvercorrected", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "PositionNotFound", type: "error" }, + { + inputs: [ + { internalType: "string", name: "reason", type: "string" }, + { internalType: "int256", name: "remainingCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsdForLeverage", type: "int256" }, + ], + name: "PositionShouldNotBeLiquidated", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "minPrice", type: "uint256" }, + { internalType: "uint256", name: "maxPrice", type: "uint256" }, + ], + name: "PriceAlreadySet", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "PriceFeedAlreadyExistsForToken", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + ], + name: "PriceImpactLargerThanOrderSize", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "lentAmount", type: "uint256" }, + { internalType: "uint256", name: "totalReductionAmount", type: "uint256" }, + ], + name: "ReductionExceedsLentAmount", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "calldataLength", type: "uint256" }], + name: "RelayCalldataTooLong", + type: "error", + }, + { inputs: [], name: "RelayEmptyBatch", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "requestAge", type: "uint256" }, + { internalType: "uint256", name: "requestExpirationAge", type: "uint256" }, + { internalType: "string", name: "requestType", type: "string" }, + ], + name: "RequestNotYetCancellable", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "receiver", type: "address" }], + name: "SelfTransferNotSupported", + type: "error", + }, + { inputs: [], name: "SequencerDown", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "timeSinceUp", type: "uint256" }, + { internalType: "uint256", name: "sequencerGraceDuration", type: "uint256" }, + ], + name: "SequencerGraceDurationNotYetPassed", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "market", type: "address" }], + name: "ShiftFromAndToMarketAreEqual", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "ShiftNotFound", type: "error" }, + { + inputs: [ + { internalType: "address", name: "fromMarketLongToken", type: "address" }, + { internalType: "address", name: "toMarketLongToken", type: "address" }, + ], + name: "ShortTokensAreNotEqual", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "signalTime", type: "uint256" }], + name: "SignalTimeNotYetPassed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "SubaccountApprovalDeadlinePassed", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + ], + name: "SubaccountApprovalExpired", + type: "error", + }, + { + inputs: [{ internalType: "bytes32", name: "integrationId", type: "bytes32" }], + name: "SubaccountIntegrationIdDisabled", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + ], + name: "SubaccountNotAuthorized", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "amountAfterFees", type: "uint256" }, + { internalType: "int256", name: "negativeImpactAmount", type: "int256" }, + ], + name: "SwapPriceImpactExceedsAmountIn", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "longTokenSwapPathLength", type: "uint256" }, + { internalType: "uint256", name: "shortTokenSwapPathLength", type: "uint256" }, + ], + name: "SwapsNotAllowedForAtomicWithdrawal", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "parametersLength", type: "uint256" }, + ], + name: "SyncConfigInvalidInputLengths", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "marketFromData", type: "address" }, + ], + name: "SyncConfigInvalidMarketFromData", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "market", type: "address" }], + name: "SyncConfigUpdatesDisabledForMarket", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "string", name: "parameter", type: "string" }, + ], + name: "SyncConfigUpdatesDisabledForMarketParameter", + type: "error", + }, + { + inputs: [{ internalType: "string", name: "parameter", type: "string" }], + name: "SyncConfigUpdatesDisabledForParameter", + type: "error", + }, + { inputs: [], name: "ThereMustBeAtLeastOneRoleAdmin", type: "error" }, + { inputs: [], name: "ThereMustBeAtLeastOneTimelockMultiSig", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "length", type: "uint256" }], + name: "Uint256AsBytesLengthExceeds32Bytes", + type: "error", + }, + { inputs: [], name: "UnableToGetBorrowingFactorEmptyPoolUsd", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "UnableToGetCachedTokenPrice", + type: "error", + }, + { inputs: [], name: "UnableToGetFundingFactorEmptyOpenInterest", type: "error" }, + { + inputs: [ + { internalType: "address", name: "inputToken", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "UnableToGetOppositeToken", + type: "error", + }, + { inputs: [], name: "UnableToPayOrderFee", type: "error" }, + { inputs: [], name: "UnableToPayOrderFeeFromCollateral", type: "error" }, + { + inputs: [{ internalType: "int256", name: "estimatedRemainingCollateralUsd", type: "int256" }], + name: "UnableToWithdrawCollateral", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "positionBorrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "cumulativeBorrowingFactor", type: "uint256" }, + ], + name: "UnexpectedBorrowingFactor", + type: "error", + }, + { inputs: [], name: "UnexpectedMarket", type: "error" }, + { + inputs: [{ internalType: "int256", name: "poolValue", type: "int256" }], + name: "UnexpectedPoolValue", + type: "error", + }, + { inputs: [], name: "UnexpectedPositionState", type: "error" }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeTokenAfterSwap", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "UnexpectedTokenForVirtualInventory", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "orderType", type: "uint256" }], + name: "UnexpectedValidFromTime", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "orderType", type: "uint256" }], + name: "UnsupportedOrderType", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "orderType", type: "uint256" }], + name: "UnsupportedOrderTypeForAutoCancellation", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "usdDelta", type: "int256" }, + { internalType: "uint256", name: "longOpenInterest", type: "uint256" }, + ], + name: "UsdDeltaExceedsLongOpenInterest", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "usdDelta", type: "int256" }, + { internalType: "uint256", name: "poolUsd", type: "uint256" }, + ], + name: "UsdDeltaExceedsPoolValue", + type: "error", + }, + { + inputs: [ + { internalType: "int256", name: "usdDelta", type: "int256" }, + { internalType: "uint256", name: "shortOpenInterest", type: "uint256" }, + ], + name: "UsdDeltaExceedsShortOpenInterest", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "WithdrawalNotFound", type: "error" }, +] as const; diff --git a/sdk/src/abis/DataStore.json b/sdk/src/abis/DataStore.json deleted file mode 100644 index af4759dd50..0000000000 --- a/sdk/src/abis/DataStore.json +++ /dev/null @@ -1,1459 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "name": "addAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "name": "addBytes32", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "addUint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "addressArrayValues", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "addressValues", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "name": "applyBoundedDeltaToUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "name": "applyDeltaToInt", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - }, - { - "internalType": "string", - "name": "errorMessage", - "type": "string" - } - ], - "name": "applyDeltaToUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "applyDeltaToUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "boolArrayValues", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "boolValues", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bytes32ArrayValues", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "bytes32Values", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "name": "containsAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "name": "containsBytes32", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "containsUint", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "name": "decrementInt", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "decrementUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getAddressArray", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - } - ], - "name": "getAddressCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAddressValuesAt", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getBool", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getBoolArray", - "outputs": [ - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getBytes32", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getBytes32Array", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - } - ], - "name": "getBytes32Count", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getBytes32ValuesAt", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getInt", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getIntArray", - "outputs": [ - { - "internalType": "int256[]", - "name": "", - "type": "int256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getStringArray", - "outputs": [ - { - "internalType": "string[]", - "name": "", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getUintArray", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - } - ], - "name": "getUintCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getUintValuesAt", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "name": "incrementInt", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "incrementUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "intArrayValues", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "intValues", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "name": "removeAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeAddressArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeBool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeBoolArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "name": "removeBytes32", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeBytes32", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeBytes32Array", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeInt", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeIntArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeString", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeStringArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeUint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "setKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "removeUint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "removeUintArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "name": "setAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "name": "setAddressArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "name": "setBool", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "name": "setBoolArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "name": "setBytes32", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "name": "setBytes32Array", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "name": "setInt", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "name": "setIntArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "name": "setString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "name": "setStringArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setUint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "name": "setUintArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stringArrayValues", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "stringValues", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "uintArrayValues", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "uintValues", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/DataStore.ts b/sdk/src/abis/DataStore.ts new file mode 100644 index 0000000000..606d07fb6b --- /dev/null +++ b/sdk/src/abis/DataStore.ts @@ -0,0 +1,637 @@ +export default [ + { + inputs: [{ internalType: "contract RoleStore", name: "_roleStore", type: "address" }], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "address", name: "value", type: "address" }, + ], + name: "addAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + name: "addBytes32", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "addUint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "addressArrayValues", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "addressValues", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + name: "applyBoundedDeltaToUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + name: "applyDeltaToInt", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + { internalType: "string", name: "errorMessage", type: "string" }, + ], + name: "applyDeltaToUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "applyDeltaToUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "boolArrayValues", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "boolValues", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "bytes32ArrayValues", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "bytes32Values", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "address", name: "value", type: "address" }, + ], + name: "containsAddress", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + name: "containsBytes32", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "containsUint", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + name: "decrementInt", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "decrementUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getAddress", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getAddressArray", + outputs: [{ internalType: "address[]", name: "", type: "address[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "setKey", type: "bytes32" }], + name: "getAddressCount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAddressValuesAt", + outputs: [{ internalType: "address[]", name: "", type: "address[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getBool", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getBoolArray", + outputs: [{ internalType: "bool[]", name: "", type: "bool[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getBytes32", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getBytes32Array", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "setKey", type: "bytes32" }], + name: "getBytes32Count", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getBytes32ValuesAt", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getInt", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getIntArray", + outputs: [{ internalType: "int256[]", name: "", type: "int256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getString", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getStringArray", + outputs: [{ internalType: "string[]", name: "", type: "string[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "getUintArray", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "setKey", type: "bytes32" }], + name: "getUintCount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getUintValuesAt", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + name: "incrementInt", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "incrementUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "intArrayValues", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "intValues", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "address", name: "value", type: "address" }, + ], + name: "removeAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeAddressArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeBool", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeBoolArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + name: "removeBytes32", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeBytes32", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeBytes32Array", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeInt", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeIntArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeString", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeStringArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeUint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "setKey", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "removeUint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "removeUintArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "address", name: "value", type: "address" }, + ], + name: "setAddress", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + name: "setAddressArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + name: "setBool", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + name: "setBoolArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + name: "setBytes32", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + name: "setBytes32Array", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + name: "setInt", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + name: "setIntArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "string", name: "value", type: "string" }, + ], + name: "setString", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + name: "setStringArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "setUint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + name: "setUintArray", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "stringArrayValues", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "stringValues", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "uintArrayValues", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "uintValues", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ERC20PermitInterface.json b/sdk/src/abis/ERC20PermitInterface.json deleted file mode 100644 index d7396d024f..0000000000 --- a/sdk/src/abis/ERC20PermitInterface.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "abi": [ - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/ERC20PermitInterface.ts b/sdk/src/abis/ERC20PermitInterface.ts new file mode 100644 index 0000000000..66212bf5ee --- /dev/null +++ b/sdk/src/abis/ERC20PermitInterface.ts @@ -0,0 +1,52 @@ +export default [ + { + inputs: [], + name: "PERMIT_TYPEHASH", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "owner", type: "address" }], + name: "nonces", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ERC721.json b/sdk/src/abis/ERC721.json deleted file mode 100644 index 77a715e376..0000000000 --- a/sdk/src/abis/ERC721.json +++ /dev/null @@ -1,442 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ERC721", - "sourceName": "contracts/libraries/token/ERC721/ERC721.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "baseURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/ERC721.ts b/sdk/src/abis/ERC721.ts new file mode 100644 index 0000000000..d2a2b3ab27 --- /dev/null +++ b/sdk/src/abis/ERC721.ts @@ -0,0 +1,194 @@ +export default [ + { + inputs: [ + { internalType: "string", name: "name", type: "string" }, + { internalType: "string", name: "symbol", type: "string" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "approved", type: "address" }, + { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "operator", type: "address" }, + { indexed: false, internalType: "bool", name: "approved", type: "bool" }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: true, internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "owner", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "baseURI", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], + name: "getApproved", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "operator", type: "address" }, + ], + name: "isApprovedForAll", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], + name: "ownerOf", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + { internalType: "bytes", name: "_data", type: "bytes" }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "operator", type: "address" }, + { internalType: "bool", name: "approved", type: "bool" }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "index", type: "uint256" }], + name: "tokenByIndex", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "uint256", name: "index", type: "uint256" }, + ], + name: "tokenOfOwnerByIndex", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], + name: "tokenURI", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/EventEmitter.json b/sdk/src/abis/EventEmitter.json deleted file mode 100644 index db462aed3f..0000000000 --- a/sdk/src/abis/EventEmitter.json +++ /dev/null @@ -1,2060 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "indexed": true, - "internalType": "string", - "name": "eventNameHash", - "type": "string" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "indexed": false, - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "EventLog", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "indexed": true, - "internalType": "string", - "name": "eventNameHash", - "type": "string" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "indexed": false, - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "EventLog1", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "indexed": true, - "internalType": "string", - "name": "eventNameHash", - "type": "string" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "topic2", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "indexed": false, - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "EventLog2", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "emitDataLog1", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic2", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "emitDataLog2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic2", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic3", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "emitDataLog3", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic2", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic3", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic4", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "emitDataLog4", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "emitEventLog", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "emitEventLog1", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "eventName", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "topic1", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "topic2", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address", - "name": "value", - "type": "address" - } - ], - "internalType": "struct EventUtils.AddressKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "address[]", - "name": "value", - "type": "address[]" - } - ], - "internalType": "struct EventUtils.AddressArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.AddressItems", - "name": "addressItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct EventUtils.UintKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "uint256[]", - "name": "value", - "type": "uint256[]" - } - ], - "internalType": "struct EventUtils.UintArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.UintItems", - "name": "uintItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256", - "name": "value", - "type": "int256" - } - ], - "internalType": "struct EventUtils.IntKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "int256[]", - "name": "value", - "type": "int256[]" - } - ], - "internalType": "struct EventUtils.IntArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.IntItems", - "name": "intItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool", - "name": "value", - "type": "bool" - } - ], - "internalType": "struct EventUtils.BoolKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bool[]", - "name": "value", - "type": "bool[]" - } - ], - "internalType": "struct EventUtils.BoolArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BoolItems", - "name": "boolItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct EventUtils.Bytes32KeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes32[]", - "name": "value", - "type": "bytes32[]" - } - ], - "internalType": "struct EventUtils.Bytes32ArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.Bytes32Items", - "name": "bytes32Items", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "internalType": "struct EventUtils.BytesKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "bytes[]", - "name": "value", - "type": "bytes[]" - } - ], - "internalType": "struct EventUtils.BytesArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.BytesItems", - "name": "bytesItems", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string", - "name": "value", - "type": "string" - } - ], - "internalType": "struct EventUtils.StringKeyValue[]", - "name": "items", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "string", - "name": "key", - "type": "string" - }, - { - "internalType": "string[]", - "name": "value", - "type": "string[]" - } - ], - "internalType": "struct EventUtils.StringArrayKeyValue[]", - "name": "arrayItems", - "type": "tuple[]" - } - ], - "internalType": "struct EventUtils.StringItems", - "name": "stringItems", - "type": "tuple" - } - ], - "internalType": "struct EventUtils.EventLogData", - "name": "eventData", - "type": "tuple" - } - ], - "name": "emitEventLog2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/EventEmitter.ts b/sdk/src/abis/EventEmitter.ts new file mode 100644 index 0000000000..0fc380002d --- /dev/null +++ b/sdk/src/abis/EventEmitter.ts @@ -0,0 +1,1226 @@ +export default [ + { + inputs: [{ internalType: "contract RoleStore", name: "_roleStore", type: "address" }], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "msgSender", type: "address" }, + { indexed: false, internalType: "string", name: "eventName", type: "string" }, + { indexed: true, internalType: "string", name: "eventNameHash", type: "string" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + indexed: false, + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "EventLog", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "msgSender", type: "address" }, + { indexed: false, internalType: "string", name: "eventName", type: "string" }, + { indexed: true, internalType: "string", name: "eventNameHash", type: "string" }, + { indexed: true, internalType: "bytes32", name: "topic1", type: "bytes32" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + indexed: false, + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "EventLog1", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "msgSender", type: "address" }, + { indexed: false, internalType: "string", name: "eventName", type: "string" }, + { indexed: true, internalType: "string", name: "eventNameHash", type: "string" }, + { indexed: true, internalType: "bytes32", name: "topic1", type: "bytes32" }, + { indexed: true, internalType: "bytes32", name: "topic2", type: "bytes32" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + indexed: false, + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "EventLog2", + type: "event", + }, + { + inputs: [ + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "emitDataLog1", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { internalType: "bytes32", name: "topic2", type: "bytes32" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "emitDataLog2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { internalType: "bytes32", name: "topic2", type: "bytes32" }, + { internalType: "bytes32", name: "topic3", type: "bytes32" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "emitDataLog3", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { internalType: "bytes32", name: "topic2", type: "bytes32" }, + { internalType: "bytes32", name: "topic3", type: "bytes32" }, + { internalType: "bytes32", name: "topic4", type: "bytes32" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "emitDataLog4", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "string", name: "eventName", type: "string" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "emitEventLog", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "string", name: "eventName", type: "string" }, + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "emitEventLog1", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "string", name: "eventName", type: "string" }, + { internalType: "bytes32", name: "topic1", type: "bytes32" }, + { internalType: "bytes32", name: "topic2", type: "bytes32" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address", name: "value", type: "address" }, + ], + internalType: "struct EventUtils.AddressKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "address[]", name: "value", type: "address[]" }, + ], + internalType: "struct EventUtils.AddressArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.AddressItems", + name: "addressItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + internalType: "struct EventUtils.UintKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "uint256[]", name: "value", type: "uint256[]" }, + ], + internalType: "struct EventUtils.UintArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.UintItems", + name: "uintItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256", name: "value", type: "int256" }, + ], + internalType: "struct EventUtils.IntKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "int256[]", name: "value", type: "int256[]" }, + ], + internalType: "struct EventUtils.IntArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.IntItems", + name: "intItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool", name: "value", type: "bool" }, + ], + internalType: "struct EventUtils.BoolKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bool[]", name: "value", type: "bool[]" }, + ], + internalType: "struct EventUtils.BoolArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BoolItems", + name: "boolItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32", name: "value", type: "bytes32" }, + ], + internalType: "struct EventUtils.Bytes32KeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes32[]", name: "value", type: "bytes32[]" }, + ], + internalType: "struct EventUtils.Bytes32ArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.Bytes32Items", + name: "bytes32Items", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes", name: "value", type: "bytes" }, + ], + internalType: "struct EventUtils.BytesKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "bytes[]", name: "value", type: "bytes[]" }, + ], + internalType: "struct EventUtils.BytesArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.BytesItems", + name: "bytesItems", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string", name: "value", type: "string" }, + ], + internalType: "struct EventUtils.StringKeyValue[]", + name: "items", + type: "tuple[]", + }, + { + components: [ + { internalType: "string", name: "key", type: "string" }, + { internalType: "string[]", name: "value", type: "string[]" }, + ], + internalType: "struct EventUtils.StringArrayKeyValue[]", + name: "arrayItems", + type: "tuple[]", + }, + ], + internalType: "struct EventUtils.StringItems", + name: "stringItems", + type: "tuple", + }, + ], + internalType: "struct EventUtils.EventLogData", + name: "eventData", + type: "tuple", + }, + ], + name: "emitEventLog2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ExchangeRouter.json b/sdk/src/abis/ExchangeRouter.json deleted file mode 100644 index c1f7703a6d..0000000000 --- a/sdk/src/abis/ExchangeRouter.json +++ /dev/null @@ -1,1706 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract Router", - "name": "_router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract IDepositHandler", - "name": "_depositHandler", - "type": "address" - }, - { - "internalType": "contract IWithdrawalHandler", - "name": "_withdrawalHandler", - "type": "address" - }, - { - "internalType": "contract IShiftHandler", - "name": "_shiftHandler", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "_orderHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "_externalHandler", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "adjustedClaimableAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimedAmount", - "type": "uint256" - } - ], - "name": "CollateralAlreadyClaimed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "DisabledMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyAddressInMarketTokenBalanceValidation", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyDeposit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyMarket", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeKeysLength", - "type": "uint256" - } - ], - "name": "InvalidClaimCollateralInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "InvalidClaimableFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedMinBalance", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableFundingFeeAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForClaimableFunding", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForCollateralAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "uiFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxUiFeeFactor", - "type": "uint256" - } - ], - "name": "InvalidUiFeeFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelShift", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimAffiliateRewards", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "timeKeys", - "type": "uint256[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimCollateral", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimFundingFees", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimUiFees", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IDepositUtils.CreateDepositParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IDepositUtils.CreateDepositParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createDeposit", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "fromMarket", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarket", - "type": "address" - } - ], - "internalType": "struct IShiftUtils.CreateShiftParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IShiftUtils.CreateShiftParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createShift", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createWithdrawal", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositHandler", - "outputs": [ - { - "internalType": "contract IDepositHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParams", - "name": "params", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - } - ], - "name": "executeAtomicWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "name": "makeExternalCalls", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - } - ], - "name": "setSavedCallbackContract", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "uiFeeFactor", - "type": "uint256" - } - ], - "name": "setUiFeeFactor", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "shiftHandler", - "outputs": [ - { - "internalType": "contract IShiftHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteLatestDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteLatestOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteLatestShift", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - }, - { - "internalType": "enum ISwapPricingUtils.SwapPricingType", - "name": "swapPricingType", - "type": "uint8" - } - ], - "name": "simulateExecuteLatestWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteShift", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - }, - { - "internalType": "enum ISwapPricingUtils.SwapPricingType", - "name": "swapPricingType", - "type": "uint8" - } - ], - "name": "simulateExecuteWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "withdrawalHandler", - "outputs": [ - { - "internalType": "contract IWithdrawalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/ExchangeRouter.ts b/sdk/src/abis/ExchangeRouter.ts new file mode 100644 index 0000000000..6afd49d03d --- /dev/null +++ b/sdk/src/abis/ExchangeRouter.ts @@ -0,0 +1,758 @@ +export default [ + { + inputs: [ + { internalType: "contract Router", name: "_router", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract IDepositHandler", name: "_depositHandler", type: "address" }, + { internalType: "contract IWithdrawalHandler", name: "_withdrawalHandler", type: "address" }, + { internalType: "contract IShiftHandler", name: "_shiftHandler", type: "address" }, + { internalType: "contract IOrderHandler", name: "_orderHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "_externalHandler", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "adjustedClaimableAmount", type: "uint256" }, + { internalType: "uint256", name: "claimedAmount", type: "uint256" }, + ], + name: "CollateralAlreadyClaimed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [{ internalType: "address", name: "market", type: "address" }], name: "DisabledMarket", type: "error" }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyAddressInMarketTokenBalanceValidation", + type: "error", + }, + { inputs: [], name: "EmptyDeposit", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyMarket", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "timeKeysLength", type: "uint256" }, + ], + name: "InvalidClaimCollateralInput", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "value", type: "uint256" }], + name: "InvalidClaimableFactor", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "expectedMinBalance", type: "uint256" }, + ], + name: "InvalidMarketTokenBalance", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "claimableFundingFeeAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForClaimableFunding", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForCollateralAmount", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "uiFeeFactor", type: "uint256" }, + { internalType: "uint256", name: "maxUiFeeFactor", type: "uint256" }, + ], + name: "InvalidUiFeeFactor", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelShift", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimAffiliateRewards", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "uint256[]", name: "timeKeys", type: "uint256[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimCollateral", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimFundingFees", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimUiFees", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IDepositUtils.CreateDepositParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IDepositUtils.CreateDepositParams", + name: "params", + type: "tuple", + }, + ], + name: "createDeposit", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "fromMarket", type: "address" }, + { internalType: "address", name: "toMarket", type: "address" }, + ], + internalType: "struct IShiftUtils.CreateShiftParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IShiftUtils.CreateShiftParams", + name: "params", + type: "tuple", + }, + ], + name: "createShift", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParams", + name: "params", + type: "tuple", + }, + ], + name: "createWithdrawal", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "depositHandler", + outputs: [{ internalType: "contract IDepositHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParams", + name: "params", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + ], + name: "executeAtomicWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + name: "makeExternalCalls", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + ], + name: "setSavedCallbackContract", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "uiFeeFactor", type: "uint256" }], + name: "setUiFeeFactor", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "shiftHandler", + outputs: [{ internalType: "contract IShiftHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteLatestDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteLatestOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteLatestShift", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + { internalType: "enum ISwapPricingUtils.SwapPricingType", name: "swapPricingType", type: "uint8" }, + ], + name: "simulateExecuteLatestWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteShift", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + { internalType: "enum ISwapPricingUtils.SwapPricingType", name: "swapPricingType", type: "uint8" }, + ], + name: "simulateExecuteWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "withdrawalHandler", + outputs: [{ internalType: "contract IWithdrawalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/GelatoRelayRouter.json b/sdk/src/abis/GelatoRelayRouter.json deleted file mode 100644 index 0aacebef81..0000000000 --- a/sdk/src/abis/GelatoRelayRouter.json +++ /dev/null @@ -1,1579 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract Router", - "name": "_router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "_oracle", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "_orderHandler", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "_orderVault", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "_swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "_externalHandler", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "RelayEmptyBatch", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams[]", - "name": "createOrderParamsList", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams[]", - "name": "updateOrderParamsList", - "type": "tuple[]" - }, - { - "internalType": "bytes32[]", - "name": "cancelOrderKeys", - "type": "bytes32[]" - } - ], - "internalType": "struct IRelayUtils.BatchParams", - "name": "params", - "type": "tuple" - } - ], - "name": "batch", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/GelatoRelayRouter.ts b/sdk/src/abis/GelatoRelayRouter.ts new file mode 100644 index 0000000000..6bddc590cf --- /dev/null +++ b/sdk/src/abis/GelatoRelayRouter.ts @@ -0,0 +1,627 @@ +export default [ + { + inputs: [ + { internalType: "contract Router", name: "_router", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "_oracle", type: "address" }, + { internalType: "contract IOrderHandler", name: "_orderHandler", type: "address" }, + { internalType: "contract OrderVault", name: "_orderVault", type: "address" }, + { internalType: "contract ISwapHandler", name: "_swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "_externalHandler", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "RelayEmptyBatch", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams[]", + name: "createOrderParamsList", + type: "tuple[]", + }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams[]", + name: "updateOrderParamsList", + type: "tuple[]", + }, + { internalType: "bytes32[]", name: "cancelOrderKeys", type: "bytes32[]" }, + ], + internalType: "struct IRelayUtils.BatchParams", + name: "params", + type: "tuple", + }, + ], + name: "batch", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "cancelOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/GlpManager.json b/sdk/src/abis/GlpManager.json deleted file mode 100644 index 487a2fc670..0000000000 --- a/sdk/src/abis/GlpManager.json +++ /dev/null @@ -1,592 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "GlpManager", - "sourceName": "contracts/core/GlpManager.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_usdg", - "type": "address" - }, - { - "internalType": "address", - "name": "_glp", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_cooldownDuration", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "aumInUsdg", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "glpSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "mintAmount", - "type": "uint256" - } - ], - "name": "AddLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "glpAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "aumInUsdg", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "glpSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - } - ], - "name": "RemoveLiquidity", - "type": "event" - }, - { - "inputs": [], - "name": "MAX_COOLDOWN_DURATION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USDG_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minUsdg", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minGlp", - "type": "uint256" - } - ], - "name": "addLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fundingAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minUsdg", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minGlp", - "type": "uint256" - } - ], - "name": "addLiquidityForAccount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "aumAddition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "aumDeduction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "cooldownDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "maximise", - "type": "bool" - } - ], - "name": "getAum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "maximise", - "type": "bool" - } - ], - "name": "getAumInUsdg", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAums", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glp", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastAddedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_glpAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "removeLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_glpAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "removeLiquidityForAccount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_aumAddition", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_aumDeduction", - "type": "uint256" - } - ], - "name": "setAumAdjustment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_cooldownDuration", - "type": "uint256" - } - ], - "name": "setCooldownDuration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateMode", - "type": "bool" - } - ], - "name": "setInPrivateMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "usdg", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "vault", - "outputs": [ - { - "internalType": "contract IVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/GlpManager.ts b/sdk/src/abis/GlpManager.ts new file mode 100644 index 0000000000..0a27f37c44 --- /dev/null +++ b/sdk/src/abis/GlpManager.ts @@ -0,0 +1,244 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_usdg", type: "address" }, + { internalType: "address", name: "_glp", type: "address" }, + { internalType: "uint256", name: "_cooldownDuration", type: "uint256" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "aumInUsdg", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "glpSupply", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "mintAmount", type: "uint256" }, + ], + name: "AddLiquidity", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "glpAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "aumInUsdg", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "glpSupply", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOut", type: "uint256" }, + ], + name: "RemoveLiquidity", + type: "event", + }, + { + inputs: [], + name: "MAX_COOLDOWN_DURATION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "USDG_DECIMALS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_minUsdg", type: "uint256" }, + { internalType: "uint256", name: "_minGlp", type: "uint256" }, + ], + name: "addLiquidity", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_fundingAccount", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_minUsdg", type: "uint256" }, + { internalType: "uint256", name: "_minGlp", type: "uint256" }, + ], + name: "addLiquidityForAccount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "aumAddition", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "aumDeduction", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "cooldownDuration", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "maximise", type: "bool" }], + name: "getAum", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "maximise", type: "bool" }], + name: "getAumInUsdg", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getAums", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glp", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lastAddedAt", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_glpAmount", type: "uint256" }, + { internalType: "uint256", name: "_minOut", type: "uint256" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "removeLiquidity", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_glpAmount", type: "uint256" }, + { internalType: "uint256", name: "_minOut", type: "uint256" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "removeLiquidityForAccount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_aumAddition", type: "uint256" }, + { internalType: "uint256", name: "_aumDeduction", type: "uint256" }, + ], + name: "setAumAdjustment", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_cooldownDuration", type: "uint256" }], + name: "setCooldownDuration", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateMode", type: "bool" }], + name: "setInPrivateMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "usdg", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "vault", + outputs: [{ internalType: "contract IVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/GlvReader.json b/sdk/src/abis/GlvReader.json deleted file mode 100644 index 3bc53bb885..0000000000 --- a/sdk/src/abis/GlvReader.json +++ /dev/null @@ -1,1471 +0,0 @@ -{ - "abi": [ - { - "inputs": [], - "name": "EmptyMarketTokenSupply", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "GlvNegativeMarketPoolValue", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountGlvDeposits", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvDeposit.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvDeposit.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isMarketTokenDeposit", - "type": "bool" - } - ], - "internalType": "struct GlvDeposit.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvDeposit.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountGlvWithdrawals", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvWithdrawal.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "glvTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvWithdrawal.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct GlvWithdrawal.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvWithdrawal.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - } - ], - "name": "getGlv", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "glvToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Glv.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "getGlvBySalt", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "glvToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Glv.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getGlvDeposit", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvDeposit.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvDeposit.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isMarketTokenDeposit", - "type": "bool" - } - ], - "internalType": "struct GlvDeposit.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvDeposit.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getGlvDeposits", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvDeposit.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvDeposit.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isMarketTokenDeposit", - "type": "bool" - } - ], - "internalType": "struct GlvDeposit.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvDeposit.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - } - ], - "name": "getGlvInfo", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glvToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Glv.Props", - "name": "glv", - "type": "tuple" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - } - ], - "internalType": "struct GlvReader.GlvInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getGlvInfoList", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glvToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Glv.Props", - "name": "glv", - "type": "tuple" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - } - ], - "internalType": "struct GlvReader.GlvInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getGlvShift", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "fromMarket", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarket", - "type": "address" - } - ], - "internalType": "struct GlvShift.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - } - ], - "internalType": "struct GlvShift.Numbers", - "name": "numbers", - "type": "tuple" - } - ], - "internalType": "struct GlvShift.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getGlvShifts", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "fromMarket", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarket", - "type": "address" - } - ], - "internalType": "struct GlvShift.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - } - ], - "internalType": "struct GlvShift.Numbers", - "name": "numbers", - "type": "tuple" - } - ], - "internalType": "struct GlvShift.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address[]", - "name": "marketAddresses", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "indexTokenPrices", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getGlvTokenPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address[]", - "name": "marketAddresses", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "indexTokenPrices", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getGlvValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getGlvWithdrawal", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvWithdrawal.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "glvTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvWithdrawal.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct GlvWithdrawal.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvWithdrawal.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getGlvWithdrawals", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct GlvWithdrawal.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "glvTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct GlvWithdrawal.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct GlvWithdrawal.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct GlvWithdrawal.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getGlvs", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "glvToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Glv.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/GlvReader.ts b/sdk/src/abis/GlvReader.ts new file mode 100644 index 0000000000..fda6acfd62 --- /dev/null +++ b/sdk/src/abis/GlvReader.ts @@ -0,0 +1,641 @@ +export default [ + { inputs: [], name: "EmptyMarketTokenSupply", type: "error" }, + { + inputs: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "GlvNegativeMarketPoolValue", + type: "error", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAccountGlvDeposits", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvDeposit.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvDeposit.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isMarketTokenDeposit", type: "bool" }, + ], + internalType: "struct GlvDeposit.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvDeposit.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAccountGlvWithdrawals", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvWithdrawal.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "glvTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvWithdrawal.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }], + internalType: "struct GlvWithdrawal.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvWithdrawal.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "glv", type: "address" }, + ], + name: "getGlv", + outputs: [ + { + components: [ + { internalType: "address", name: "glvToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Glv.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "salt", type: "bytes32" }, + ], + name: "getGlvBySalt", + outputs: [ + { + components: [ + { internalType: "address", name: "glvToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Glv.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getGlvDeposit", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvDeposit.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvDeposit.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isMarketTokenDeposit", type: "bool" }, + ], + internalType: "struct GlvDeposit.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvDeposit.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getGlvDeposits", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvDeposit.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvDeposit.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isMarketTokenDeposit", type: "bool" }, + ], + internalType: "struct GlvDeposit.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvDeposit.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "glv", type: "address" }, + ], + name: "getGlvInfo", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glvToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Glv.Props", + name: "glv", + type: "tuple", + }, + { internalType: "address[]", name: "markets", type: "address[]" }, + ], + internalType: "struct GlvReader.GlvInfo", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getGlvInfoList", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glvToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Glv.Props", + name: "glv", + type: "tuple", + }, + { internalType: "address[]", name: "markets", type: "address[]" }, + ], + internalType: "struct GlvReader.GlvInfo[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getGlvShift", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "fromMarket", type: "address" }, + { internalType: "address", name: "toMarket", type: "address" }, + ], + internalType: "struct GlvShift.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + ], + internalType: "struct GlvShift.Numbers", + name: "numbers", + type: "tuple", + }, + ], + internalType: "struct GlvShift.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getGlvShifts", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "fromMarket", type: "address" }, + { internalType: "address", name: "toMarket", type: "address" }, + ], + internalType: "struct GlvShift.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + ], + internalType: "struct GlvShift.Numbers", + name: "numbers", + type: "tuple", + }, + ], + internalType: "struct GlvShift.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address[]", name: "marketAddresses", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "indexTokenPrices", + type: "tuple[]", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + { internalType: "address", name: "glv", type: "address" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getGlvTokenPrice", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address[]", name: "marketAddresses", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "indexTokenPrices", + type: "tuple[]", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + { internalType: "address", name: "glv", type: "address" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getGlvValue", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getGlvWithdrawal", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvWithdrawal.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "glvTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvWithdrawal.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }], + internalType: "struct GlvWithdrawal.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvWithdrawal.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getGlvWithdrawals", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct GlvWithdrawal.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "glvTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct GlvWithdrawal.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }], + internalType: "struct GlvWithdrawal.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct GlvWithdrawal.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getGlvs", + outputs: [ + { + components: [ + { internalType: "address", name: "glvToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Glv.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/GlvRouter.json b/sdk/src/abis/GlvRouter.json deleted file mode 100644 index 18b56776b1..0000000000 --- a/sdk/src/abis/GlvRouter.json +++ /dev/null @@ -1,764 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract Router", - "name": "_router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract IGlvDepositHandler", - "name": "_glvDepositHandler", - "type": "address" - }, - { - "internalType": "contract IGlvWithdrawalHandler", - "name": "_glvWithdrawalHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "_externalHandler", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EmptyGlvDeposit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyGlvWithdrawal", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - } - ], - "name": "InvalidNativeTokenSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelGlvDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelGlvWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IGlvDepositUtils.CreateGlvDepositParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isMarketTokenDeposit", - "type": "bool" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IGlvDepositUtils.CreateGlvDepositParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createGlvDeposit", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createGlvWithdrawal", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glvDepositHandler", - "outputs": [ - { - "internalType": "contract IGlvDepositHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glvWithdrawalHandler", - "outputs": [ - { - "internalType": "contract IGlvWithdrawalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "name": "makeExternalCalls", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteGlvDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteGlvWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteLatestGlvDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "primaryTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props[]", - "name": "primaryPrices", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "minTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTimestamp", - "type": "uint256" - } - ], - "internalType": "struct OracleUtils.SimulatePricesParams", - "name": "simulatedOracleParams", - "type": "tuple" - } - ], - "name": "simulateExecuteLatestGlvWithdrawal", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] -} diff --git a/sdk/src/abis/GlvRouter.ts b/sdk/src/abis/GlvRouter.ts new file mode 100644 index 0000000000..d3712aed41 --- /dev/null +++ b/sdk/src/abis/GlvRouter.ts @@ -0,0 +1,351 @@ +export default [ + { + inputs: [ + { internalType: "contract Router", name: "_router", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract IGlvDepositHandler", name: "_glvDepositHandler", type: "address" }, + { internalType: "contract IGlvWithdrawalHandler", name: "_glvWithdrawalHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "_externalHandler", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [], name: "EmptyGlvDeposit", type: "error" }, + { inputs: [], name: "EmptyGlvWithdrawal", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "msgSender", type: "address" }], + name: "InvalidNativeTokenSender", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelGlvDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelGlvWithdrawal", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IGlvDepositUtils.CreateGlvDepositParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isMarketTokenDeposit", type: "bool" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IGlvDepositUtils.CreateGlvDepositParams", + name: "params", + type: "tuple", + }, + ], + name: "createGlvDeposit", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParams", + name: "params", + type: "tuple", + }, + ], + name: "createGlvWithdrawal", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glvDepositHandler", + outputs: [{ internalType: "contract IGlvDepositHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glvWithdrawalHandler", + outputs: [{ internalType: "contract IGlvWithdrawalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + name: "makeExternalCalls", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteGlvDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteGlvWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteLatestGlvDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address[]", name: "primaryTokens", type: "address[]" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props[]", + name: "primaryPrices", + type: "tuple[]", + }, + { internalType: "uint256", name: "minTimestamp", type: "uint256" }, + { internalType: "uint256", name: "maxTimestamp", type: "uint256" }, + ], + internalType: "struct OracleUtils.SimulatePricesParams", + name: "simulatedOracleParams", + type: "tuple", + }, + ], + name: "simulateExecuteLatestGlvWithdrawal", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; diff --git a/sdk/src/abis/GmxMigrator.json b/sdk/src/abis/GmxMigrator.json deleted file mode 100644 index 3db58dc1fc..0000000000 --- a/sdk/src/abis/GmxMigrator.json +++ /dev/null @@ -1,657 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "GmxMigrator", - "sourceName": "contracts/gmx/GmxMigrator.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minAuthorizations", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "ClearAction", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "SignAction", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "SignalApprove", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "SignalPendingAction", - "type": "event" - }, - { - "inputs": [], - "name": "actionsNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ammRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_nonce", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "caps", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "endMigration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getIouToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenAmounts", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getTokenPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmxPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_ammRouter", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_gmxPrice", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_signers", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_whitelistedTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_iouTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_prices", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "_caps", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "_lpTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_lpTokenAs", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_lpTokenBs", - "type": "address[]" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "iouTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isMigrationActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isSigner", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lpTokenAs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lpTokenBs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lpTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenAmount", - "type": "uint256" - } - ], - "name": "migrate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "minAuthorizations", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "pendingActions", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "prices", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_nonce", - "type": "uint256" - } - ], - "name": "signApprove", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "signalApprove", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "signedActions", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "signers", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "whitelistedTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/GmxMigrator.ts b/sdk/src/abis/GmxMigrator.ts new file mode 100644 index 0000000000..b38d1df6f6 --- /dev/null +++ b/sdk/src/abis/GmxMigrator.ts @@ -0,0 +1,267 @@ +export default [ + { + inputs: [{ internalType: "uint256", name: "_minAuthorizations", type: "uint256" }], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" }, + ], + name: "ClearAction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" }, + ], + name: "SignAction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" }, + ], + name: "SignalApprove", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" }, + ], + name: "SignalPendingAction", + type: "event", + }, + { + inputs: [], + name: "actionsNonce", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "admin", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "ammRouter", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_nonce", type: "uint256" }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "caps", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "endMigration", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getIouToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_tokens", type: "address[]" }], + name: "getTokenAmounts", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getTokenPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmxPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_ammRouter", type: "address" }, + { internalType: "uint256", name: "_gmxPrice", type: "uint256" }, + { internalType: "address[]", name: "_signers", type: "address[]" }, + { internalType: "address[]", name: "_whitelistedTokens", type: "address[]" }, + { internalType: "address[]", name: "_iouTokens", type: "address[]" }, + { internalType: "uint256[]", name: "_prices", type: "uint256[]" }, + { internalType: "uint256[]", name: "_caps", type: "uint256[]" }, + { internalType: "address[]", name: "_lpTokens", type: "address[]" }, + { internalType: "address[]", name: "_lpTokenAs", type: "address[]" }, + { internalType: "address[]", name: "_lpTokenBs", type: "address[]" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "iouTokens", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isMigrationActive", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isSigner", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lpTokenAs", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lpTokenBs", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lpTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenAmount", type: "uint256" }, + ], + name: "migrate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "minAuthorizations", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "pendingActions", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "prices", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_nonce", type: "uint256" }, + ], + name: "signApprove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "signalApprove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "bytes32", name: "", type: "bytes32" }, + ], + name: "signedActions", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "signers", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "whitelistedTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/GovToken.json b/sdk/src/abis/GovToken.json deleted file mode 100644 index 88796b1360..0000000000 --- a/sdk/src/abis/GovToken.json +++ /dev/null @@ -1,768 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "roleStore_", - "type": "address" - }, - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint32", - "name": "pos", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "fromBlock", - "type": "uint32" - }, - { - "internalType": "uint224", - "name": "votes", - "type": "uint224" - } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/GovToken.ts b/sdk/src/abis/GovToken.ts new file mode 100644 index 0000000000..a029dd7ba9 --- /dev/null +++ b/sdk/src/abis/GovToken.ts @@ -0,0 +1,323 @@ +export default [ + { + inputs: [ + { internalType: "contract RoleStore", name: "roleStore_", type: "address" }, + { internalType: "string", name: "name_", type: "string" }, + { internalType: "string", name: "symbol_", type: "string" }, + { internalType: "uint8", name: "decimals_", type: "uint8" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [], name: "InvalidShortString", type: "error" }, + { inputs: [{ internalType: "string", name: "str", type: "string" }], name: "StringTooLong", type: "error" }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "delegator", type: "address" }, + { indexed: true, internalType: "address", name: "fromDelegate", type: "address" }, + { indexed: true, internalType: "address", name: "toDelegate", type: "address" }, + ], + name: "DelegateChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "delegate", type: "address" }, + { indexed: false, internalType: "uint256", name: "previousBalance", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "newBalance", type: "uint256" }, + ], + name: "DelegateVotesChanged", + type: "event", + }, + { anonymous: false, inputs: [], name: "EIP712DomainChanged", type: "event" }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [], + name: "CLOCK_MODE", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint32", name: "pos", type: "uint32" }, + ], + name: "checkpoints", + outputs: [ + { + components: [ + { internalType: "uint32", name: "fromBlock", type: "uint32" }, + { internalType: "uint224", name: "votes", type: "uint224" }, + ], + internalType: "struct ERC20Votes.Checkpoint", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "clock", + outputs: [{ internalType: "uint48", name: "", type: "uint48" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "delegatee", type: "address" }], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "delegatee", type: "address" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "expiry", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + ], + name: "delegateBySig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "delegates", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { internalType: "bytes1", name: "fields", type: "bytes1" }, + { internalType: "string", name: "name", type: "string" }, + { internalType: "string", name: "version", type: "string" }, + { internalType: "uint256", name: "chainId", type: "uint256" }, + { internalType: "address", name: "verifyingContract", type: "address" }, + { internalType: "bytes32", name: "salt", type: "bytes32" }, + { internalType: "uint256[]", name: "extensions", type: "uint256[]" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "timepoint", type: "uint256" }], + name: "getPastTotalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "timepoint", type: "uint256" }, + ], + name: "getPastVotes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "getVotes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "owner", type: "address" }], + name: "nonces", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "numCheckpoints", + outputs: [{ internalType: "uint32", name: "", type: "uint32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/IStargate.ts b/sdk/src/abis/IStargate.ts new file mode 100644 index 0000000000..3a67ea259c --- /dev/null +++ b/sdk/src/abis/IStargate.ts @@ -0,0 +1,601 @@ +export default [ + { + inputs: [], + name: "InvalidLocalDecimals", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + ], + name: "SlippageExceeded", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "guid", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint32", + name: "srcEid", + type: "uint32", + }, + { + indexed: true, + internalType: "address", + name: "toAddress", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amountReceivedLD", + type: "uint256", + }, + ], + name: "OFTReceived", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "guid", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint32", + name: "dstEid", + type: "uint32", + }, + { + indexed: true, + internalType: "address", + name: "fromAddress", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amountSentLD", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amountReceivedLD", + type: "uint256", + }, + ], + name: "OFTSent", + type: "event", + }, + { + inputs: [], + name: "approvalRequired", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oftVersion", + outputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + { + internalType: "uint64", + name: "version", + type: "uint64", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint32", + name: "dstEid", + type: "uint32", + }, + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "amountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + { + internalType: "bytes", + name: "extraOptions", + type: "bytes", + }, + { + internalType: "bytes", + name: "composeMsg", + type: "bytes", + }, + { + internalType: "bytes", + name: "oftCmd", + type: "bytes", + }, + ], + internalType: "struct SendParam", + name: "_sendParam", + type: "tuple", + }, + ], + name: "quoteOFT", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxAmountLD", + type: "uint256", + }, + ], + internalType: "struct OFTLimit", + name: "", + type: "tuple", + }, + { + components: [ + { + internalType: "int256", + name: "feeAmountLD", + type: "int256", + }, + { + internalType: "string", + name: "description", + type: "string", + }, + ], + internalType: "struct OFTFeeDetail[]", + name: "oftFeeDetails", + type: "tuple[]", + }, + { + components: [ + { + internalType: "uint256", + name: "amountSentLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "amountReceivedLD", + type: "uint256", + }, + ], + internalType: "struct OFTReceipt", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint32", + name: "dstEid", + type: "uint32", + }, + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "amountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + { + internalType: "bytes", + name: "extraOptions", + type: "bytes", + }, + { + internalType: "bytes", + name: "composeMsg", + type: "bytes", + }, + { + internalType: "bytes", + name: "oftCmd", + type: "bytes", + }, + ], + internalType: "struct SendParam", + name: "_sendParam", + type: "tuple", + }, + { + internalType: "bool", + name: "_payInLzToken", + type: "bool", + }, + ], + name: "quoteSend", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "nativeFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "lzTokenFee", + type: "uint256", + }, + ], + internalType: "struct MessagingFee", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint32", + name: "dstEid", + type: "uint32", + }, + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "amountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + { + internalType: "bytes", + name: "extraOptions", + type: "bytes", + }, + { + internalType: "bytes", + name: "composeMsg", + type: "bytes", + }, + { + internalType: "bytes", + name: "oftCmd", + type: "bytes", + }, + ], + internalType: "struct SendParam", + name: "_sendParam", + type: "tuple", + }, + { + components: [ + { + internalType: "uint256", + name: "nativeFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "lzTokenFee", + type: "uint256", + }, + ], + internalType: "struct MessagingFee", + name: "_fee", + type: "tuple", + }, + { + internalType: "address", + name: "_refundAddress", + type: "address", + }, + ], + name: "send", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "guid", + type: "bytes32", + }, + { + internalType: "uint64", + name: "nonce", + type: "uint64", + }, + { + components: [ + { + internalType: "uint256", + name: "nativeFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "lzTokenFee", + type: "uint256", + }, + ], + internalType: "struct MessagingFee", + name: "fee", + type: "tuple", + }, + ], + internalType: "struct MessagingReceipt", + name: "", + type: "tuple", + }, + { + components: [ + { + internalType: "uint256", + name: "amountSentLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "amountReceivedLD", + type: "uint256", + }, + ], + internalType: "struct OFTReceipt", + name: "", + type: "tuple", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint32", + name: "dstEid", + type: "uint32", + }, + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "amountLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "minAmountLD", + type: "uint256", + }, + { + internalType: "bytes", + name: "extraOptions", + type: "bytes", + }, + { + internalType: "bytes", + name: "composeMsg", + type: "bytes", + }, + { + internalType: "bytes", + name: "oftCmd", + type: "bytes", + }, + ], + internalType: "struct SendParam", + name: "_sendParam", + type: "tuple", + }, + { + components: [ + { + internalType: "uint256", + name: "nativeFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "lzTokenFee", + type: "uint256", + }, + ], + internalType: "struct MessagingFee", + name: "_fee", + type: "tuple", + }, + { + internalType: "address", + name: "_refundAddress", + type: "address", + }, + ], + name: "sendToken", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "guid", + type: "bytes32", + }, + { + internalType: "uint64", + name: "nonce", + type: "uint64", + }, + { + components: [ + { + internalType: "uint256", + name: "nativeFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "lzTokenFee", + type: "uint256", + }, + ], + internalType: "struct MessagingFee", + name: "fee", + type: "tuple", + }, + ], + internalType: "struct MessagingReceipt", + name: "msgReceipt", + type: "tuple", + }, + { + components: [ + { + internalType: "uint256", + name: "amountSentLD", + type: "uint256", + }, + { + internalType: "uint256", + name: "amountReceivedLD", + type: "uint256", + }, + ], + internalType: "struct OFTReceipt", + name: "oftReceipt", + type: "tuple", + }, + { + components: [ + { + internalType: "uint72", + name: "ticketId", + type: "uint72", + }, + { + internalType: "bytes", + name: "passengerBytes", + type: "bytes", + }, + ], + internalType: "struct Ticket", + name: "ticket", + type: "tuple", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "sharedDecimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stargateType", + outputs: [ + { + internalType: "enum StargateType", + name: "", + type: "uint8", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "token", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/LayerZeroProvider.json b/sdk/src/abis/LayerZeroProvider.json deleted file mode 100644 index 32c9841a0d..0000000000 --- a/sdk/src/abis/LayerZeroProvider.json +++ /dev/null @@ -1,372 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "_multichainVault", - "type": "address" - }, - { - "internalType": "contract IMultichainGmRouter", - "name": "_multichainGmRouter", - "type": "address" - }, - { - "internalType": "contract IMultichainGlvRouter", - "name": "_multichainGlvRouter", - "type": "address" - }, - { - "internalType": "contract IMultichainOrderRouter", - "name": "_multichainOrderRouter", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyWithdrawalAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "estimatedGasLimit", - "type": "uint256" - } - ], - "name": "InsufficientGasLeft", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "InvalidBridgeOutToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "eid", - "type": "uint256" - } - ], - "name": "InvalidEid", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct IRelayUtils.BridgeOutParams", - "name": "params", - "type": "tuple" - } - ], - "name": "bridgeOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "lzCompose", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainGlvRouter", - "outputs": [ - { - "internalType": "contract IMultichainGlvRouter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "multichainGmRouter", - "outputs": [ - { - "internalType": "contract IMultichainGmRouter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "multichainOrderRouter", - "outputs": [ - { - "internalType": "contract IMultichainOrderRouter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] -} diff --git a/sdk/src/abis/LayerZeroProvider.ts b/sdk/src/abis/LayerZeroProvider.ts new file mode 100644 index 0000000000..0d576608e3 --- /dev/null +++ b/sdk/src/abis/LayerZeroProvider.ts @@ -0,0 +1,159 @@ +export default [ + { + inputs: [ + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract MultichainVault", name: "_multichainVault", type: "address" }, + { internalType: "contract IMultichainGmRouter", name: "_multichainGmRouter", type: "address" }, + { internalType: "contract IMultichainGlvRouter", name: "_multichainGlvRouter", type: "address" }, + { internalType: "contract IMultichainOrderRouter", name: "_multichainOrderRouter", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { inputs: [], name: "EmptyWithdrawalAmount", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "gas", type: "uint256" }, + { internalType: "uint256", name: "estimatedGasLimit", type: "uint256" }, + ], + name: "InsufficientGasLeft", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "InvalidBridgeOutToken", + type: "error", + }, + { inputs: [{ internalType: "uint256", name: "eid", type: "uint256" }], name: "InvalidEid", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "uint256", name: "minAmountOut", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + internalType: "struct IRelayUtils.BridgeOutParams", + name: "params", + type: "tuple", + }, + ], + name: "bridgeOut", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "bytes", name: "message", type: "bytes" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "bytes", name: "", type: "bytes" }, + ], + name: "lzCompose", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainGlvRouter", + outputs: [{ internalType: "contract IMultichainGlvRouter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multichainGmRouter", + outputs: [{ internalType: "contract IMultichainGmRouter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multichainOrderRouter", + outputs: [{ internalType: "contract IMultichainOrderRouter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "withdrawTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; diff --git a/sdk/src/abis/MintableBaseToken.json b/sdk/src/abis/MintableBaseToken.json deleted file mode 100644 index a9542d5d3e..0000000000 --- a/sdk/src/abis/MintableBaseToken.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "MintableBaseToken", - "sourceName": "contracts/tokens/MintableBaseToken.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "internalType": "uint256", - "name": "_initialSupply", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "addNonStakingAccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "admins", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateTransferMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isMinter", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonStakingAccounts", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nonStakingSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "recoverClaim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "removeNonStakingAccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateTransferMode", - "type": "bool" - } - ], - "name": "setInPrivateTransferMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - } - ], - "name": "setInfo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_minter", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setMinter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_yieldTrackers", - "type": "address[]" - } - ], - "name": "setYieldTrackers", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "stakedBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "yieldTrackers", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/MintableBaseToken.ts b/sdk/src/abis/MintableBaseToken.ts new file mode 100644 index 0000000000..ada792d53b --- /dev/null +++ b/sdk/src/abis/MintableBaseToken.ts @@ -0,0 +1,321 @@ +export default [ + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_symbol", type: "string" }, + { internalType: "uint256", name: "_initialSupply", type: "uint256" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "addAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "addNonStakingAccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "admins", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_owner", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "allowances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "balances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_receiver", type: "address" }], + name: "claim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateTransferMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isMinter", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "nonStakingAccounts", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "nonStakingSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "recoverClaim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "removeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "removeNonStakingAccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateTransferMode", type: "bool" }], + name: "setInPrivateTransferMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_symbol", type: "string" }, + ], + name: "setInfo", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_minter", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setMinter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_yieldTrackers", type: "address[]" }], + name: "setYieldTrackers", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "stakedBalance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalStaked", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_recipient", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_sender", type: "address" }, + { internalType: "address", name: "_recipient", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "yieldTrackers", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Multicall.json b/sdk/src/abis/Multicall.json deleted file mode 100644 index 2f892a241e..0000000000 --- a/sdk/src/abis/Multicall.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "aggregate", - "outputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "returnData", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowFailure", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call3[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "aggregate3", - "outputs": [ - { - "components": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "returnData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Result[]", - "name": "returnData", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowFailure", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call3Value[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "aggregate3Value", - "outputs": [ - { - "components": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "returnData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Result[]", - "name": "returnData", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "blockAndAggregate", - "outputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "returnData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Result[]", - "name": "returnData", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getBasefee", - "outputs": [ - { - "internalType": "uint256", - "name": "basefee", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getBlockHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getBlockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getChainId", - "outputs": [ - { - "internalType": "uint256", - "name": "chainid", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentBlockCoinbase", - "outputs": [ - { - "internalType": "address", - "name": "coinbase", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentBlockGasLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "gaslimit", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentBlockTimestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "getEthBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLastBlockHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "requireSuccess", - "type": "bool" - }, - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "tryAggregate", - "outputs": [ - { - "components": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "returnData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Result[]", - "name": "returnData", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "requireSuccess", - "type": "bool" - }, - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Call[]", - "name": "calls", - "type": "tuple[]" - } - ], - "name": "tryBlockAndAggregate", - "outputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "returnData", - "type": "bytes" - } - ], - "internalType": "struct Multicall3.Result[]", - "name": "returnData", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/Multicall.ts b/sdk/src/abis/Multicall.ts new file mode 100644 index 0000000000..8c940ac397 --- /dev/null +++ b/sdk/src/abis/Multicall.ts @@ -0,0 +1,229 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate", + outputs: [ + { internalType: "uint256", name: "blockNumber", type: "uint256" }, + { internalType: "bytes[]", name: "returnData", type: "bytes[]" }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bool", name: "allowFailure", type: "bool" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call3[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate3", + outputs: [ + { + components: [ + { internalType: "bool", name: "success", type: "bool" }, + { internalType: "bytes", name: "returnData", type: "bytes" }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bool", name: "allowFailure", type: "bool" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call3Value[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "aggregate3Value", + outputs: [ + { + components: [ + { internalType: "bool", name: "success", type: "bool" }, + { internalType: "bytes", name: "returnData", type: "bytes" }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "blockAndAggregate", + outputs: [ + { internalType: "uint256", name: "blockNumber", type: "uint256" }, + { internalType: "bytes32", name: "blockHash", type: "bytes32" }, + { + components: [ + { internalType: "bool", name: "success", type: "bool" }, + { internalType: "bytes", name: "returnData", type: "bytes" }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "getBasefee", + outputs: [{ internalType: "uint256", name: "basefee", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }], + name: "getBlockHash", + outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getBlockNumber", + outputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getChainId", + outputs: [{ internalType: "uint256", name: "chainid", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockCoinbase", + outputs: [{ internalType: "address", name: "coinbase", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockGasLimit", + outputs: [{ internalType: "uint256", name: "gaslimit", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentBlockTimestamp", + outputs: [{ internalType: "uint256", name: "timestamp", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "addr", type: "address" }], + name: "getEthBalance", + outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getLastBlockHash", + outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bool", name: "requireSuccess", type: "bool" }, + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "tryAggregate", + outputs: [ + { + components: [ + { internalType: "bool", name: "success", type: "bool" }, + { internalType: "bytes", name: "returnData", type: "bytes" }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bool", name: "requireSuccess", type: "bool" }, + { + components: [ + { internalType: "address", name: "target", type: "address" }, + { internalType: "bytes", name: "callData", type: "bytes" }, + ], + internalType: "struct Multicall3.Call[]", + name: "calls", + type: "tuple[]", + }, + ], + name: "tryBlockAndAggregate", + outputs: [ + { internalType: "uint256", name: "blockNumber", type: "uint256" }, + { internalType: "bytes32", name: "blockHash", type: "bytes32" }, + { + components: [ + { internalType: "bool", name: "success", type: "bool" }, + { internalType: "bytes", name: "returnData", type: "bytes" }, + ], + internalType: "struct Multicall3.Result[]", + name: "returnData", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainClaimsRouter.json b/sdk/src/abis/MultichainClaimsRouter.json deleted file mode 100644 index 36a153ae8f..0000000000 --- a/sdk/src/abis/MultichainClaimsRouter.json +++ /dev/null @@ -1,1266 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "adjustedClaimableAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimedAmount", - "type": "uint256" - } - ], - "name": "CollateralAlreadyClaimed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "DisabledMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyAddressInMarketTokenBalanceValidation", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyMarket", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "marketsLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeKeysLength", - "type": "uint256" - } - ], - "name": "InvalidClaimCollateralInput", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "InvalidClaimableFactor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectedMinBalance", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableFundingFeeAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForClaimableFunding", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - } - ], - "name": "InvalidMarketTokenBalanceForCollateralAmount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimAffiliateRewards", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "timeKeys", - "type": "uint256[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimCollateral", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "claimFundingFees", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainClaimsRouter.ts b/sdk/src/abis/MultichainClaimsRouter.ts new file mode 100644 index 0000000000..c15f1bdfa0 --- /dev/null +++ b/sdk/src/abis/MultichainClaimsRouter.ts @@ -0,0 +1,514 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "adjustedClaimableAmount", type: "uint256" }, + { internalType: "uint256", name: "claimedAmount", type: "uint256" }, + ], + name: "CollateralAlreadyClaimed", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [{ internalType: "address", name: "market", type: "address" }], name: "DisabledMarket", type: "error" }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyAddressInMarketTokenBalanceValidation", + type: "error", + }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyMarket", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "marketsLength", type: "uint256" }, + { internalType: "uint256", name: "tokensLength", type: "uint256" }, + { internalType: "uint256", name: "timeKeysLength", type: "uint256" }, + ], + name: "InvalidClaimCollateralInput", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "value", type: "uint256" }], + name: "InvalidClaimableFactor", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "expectedMinBalance", type: "uint256" }, + ], + name: "InvalidMarketTokenBalance", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "claimableFundingFeeAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForClaimableFunding", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + ], + name: "InvalidMarketTokenBalanceForCollateralAmount", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimAffiliateRewards", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "uint256[]", name: "timeKeys", type: "uint256[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimCollateral", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address[]", name: "markets", type: "address[]" }, + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "claimFundingFees", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainGlvRouter.json b/sdk/src/abis/MultichainGlvRouter.json deleted file mode 100644 index 27765a600d..0000000000 --- a/sdk/src/abis/MultichainGlvRouter.json +++ /dev/null @@ -1,1150 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - }, - { - "internalType": "contract IGlvDepositHandler", - "name": "_glvDepositHandler", - "type": "address" - }, - { - "internalType": "contract IGlvWithdrawalHandler", - "name": "_glvWithdrawalHandler", - "type": "address" - }, - { - "internalType": "contract GlvVault", - "name": "_glvVault", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTransferRequestsLength", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "receivers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IRelayUtils.TransferRequests", - "name": "transferRequests", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IGlvDepositUtils.CreateGlvDepositParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minGlvTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isMarketTokenDeposit", - "type": "bool" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IGlvDepositUtils.CreateGlvDepositParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createGlvDeposit", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "receivers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IRelayUtils.TransferRequests", - "name": "transferRequests", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "glv", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createGlvWithdrawal", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glvDepositHandler", - "outputs": [ - { - "internalType": "contract IGlvDepositHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glvVault", - "outputs": [ - { - "internalType": "contract GlvVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glvWithdrawalHandler", - "outputs": [ - { - "internalType": "contract IGlvWithdrawalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainGlvRouter.ts b/sdk/src/abis/MultichainGlvRouter.ts new file mode 100644 index 0000000000..0921146a0c --- /dev/null +++ b/sdk/src/abis/MultichainGlvRouter.ts @@ -0,0 +1,474 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + { internalType: "contract IGlvDepositHandler", name: "_glvDepositHandler", type: "address" }, + { internalType: "contract IGlvWithdrawalHandler", name: "_glvWithdrawalHandler", type: "address" }, + { internalType: "contract GlvVault", name: "_glvVault", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [], name: "InvalidTransferRequestsLength", type: "error" }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "receivers", type: "address[]" }, + { internalType: "uint256[]", name: "amounts", type: "uint256[]" }, + ], + internalType: "struct IRelayUtils.TransferRequests", + name: "transferRequests", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IGlvDepositUtils.CreateGlvDepositParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minGlvTokens", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isMarketTokenDeposit", type: "bool" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IGlvDepositUtils.CreateGlvDepositParams", + name: "params", + type: "tuple", + }, + ], + name: "createGlvDeposit", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "receivers", type: "address[]" }, + { internalType: "uint256[]", name: "amounts", type: "uint256[]" }, + ], + internalType: "struct IRelayUtils.TransferRequests", + name: "transferRequests", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "glv", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IGlvWithdrawalUtils.CreateGlvWithdrawalParams", + name: "params", + type: "tuple", + }, + ], + name: "createGlvWithdrawal", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glvDepositHandler", + outputs: [{ internalType: "contract IGlvDepositHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glvVault", + outputs: [{ internalType: "contract GlvVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glvWithdrawalHandler", + outputs: [{ internalType: "contract IGlvWithdrawalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainGmRouter.json b/sdk/src/abis/MultichainGmRouter.json deleted file mode 100644 index bbe4f182ec..0000000000 --- a/sdk/src/abis/MultichainGmRouter.json +++ /dev/null @@ -1,1449 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - }, - { - "internalType": "contract DepositVault", - "name": "_depositVault", - "type": "address" - }, - { - "internalType": "contract IDepositHandler", - "name": "_depositHandler", - "type": "address" - }, - { - "internalType": "contract WithdrawalVault", - "name": "_withdrawalVault", - "type": "address" - }, - { - "internalType": "contract IWithdrawalHandler", - "name": "_withdrawalHandler", - "type": "address" - }, - { - "internalType": "contract ShiftVault", - "name": "_shiftVault", - "type": "address" - }, - { - "internalType": "contract IShiftHandler", - "name": "_shiftHandler", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTransferRequestsLength", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "receivers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IRelayUtils.TransferRequests", - "name": "transferRequests", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IDepositUtils.CreateDepositParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IDepositUtils.CreateDepositParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createDeposit", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "receivers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IRelayUtils.TransferRequests", - "name": "transferRequests", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "fromMarket", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarket", - "type": "address" - } - ], - "internalType": "struct IShiftUtils.CreateShiftParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IShiftUtils.CreateShiftParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createShift", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "receivers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IRelayUtils.TransferRequests", - "name": "transferRequests", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IWithdrawalUtils.CreateWithdrawalParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createWithdrawal", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositHandler", - "outputs": [ - { - "internalType": "contract IDepositHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositVault", - "outputs": [ - { - "internalType": "contract DepositVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "shiftHandler", - "outputs": [ - { - "internalType": "contract IShiftHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "shiftVault", - "outputs": [ - { - "internalType": "contract ShiftVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "withdrawalHandler", - "outputs": [ - { - "internalType": "contract IWithdrawalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "withdrawalVault", - "outputs": [ - { - "internalType": "contract WithdrawalVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainGmRouter.ts b/sdk/src/abis/MultichainGmRouter.ts new file mode 100644 index 0000000000..5d34ccf5e4 --- /dev/null +++ b/sdk/src/abis/MultichainGmRouter.ts @@ -0,0 +1,597 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + { internalType: "contract DepositVault", name: "_depositVault", type: "address" }, + { internalType: "contract IDepositHandler", name: "_depositHandler", type: "address" }, + { internalType: "contract WithdrawalVault", name: "_withdrawalVault", type: "address" }, + { internalType: "contract IWithdrawalHandler", name: "_withdrawalHandler", type: "address" }, + { internalType: "contract ShiftVault", name: "_shiftVault", type: "address" }, + { internalType: "contract IShiftHandler", name: "_shiftHandler", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [], name: "InvalidTransferRequestsLength", type: "error" }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "receivers", type: "address[]" }, + { internalType: "uint256[]", name: "amounts", type: "uint256[]" }, + ], + internalType: "struct IRelayUtils.TransferRequests", + name: "transferRequests", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IDepositUtils.CreateDepositParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IDepositUtils.CreateDepositParams", + name: "params", + type: "tuple", + }, + ], + name: "createDeposit", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "receivers", type: "address[]" }, + { internalType: "uint256[]", name: "amounts", type: "uint256[]" }, + ], + internalType: "struct IRelayUtils.TransferRequests", + name: "transferRequests", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "fromMarket", type: "address" }, + { internalType: "address", name: "toMarket", type: "address" }, + ], + internalType: "struct IShiftUtils.CreateShiftParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IShiftUtils.CreateShiftParams", + name: "params", + type: "tuple", + }, + ], + name: "createShift", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "receivers", type: "address[]" }, + { internalType: "uint256[]", name: "amounts", type: "uint256[]" }, + ], + internalType: "struct IRelayUtils.TransferRequests", + name: "transferRequests", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParamsAddresses", + name: "addresses", + type: "tuple", + }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IWithdrawalUtils.CreateWithdrawalParams", + name: "params", + type: "tuple", + }, + ], + name: "createWithdrawal", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "depositHandler", + outputs: [{ internalType: "contract IDepositHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "depositVault", + outputs: [{ internalType: "contract DepositVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "shiftHandler", + outputs: [{ internalType: "contract IShiftHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "shiftVault", + outputs: [{ internalType: "contract ShiftVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "withdrawalHandler", + outputs: [{ internalType: "contract IWithdrawalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "withdrawalVault", + outputs: [{ internalType: "contract WithdrawalVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainOrderRouter.json b/sdk/src/abis/MultichainOrderRouter.json deleted file mode 100644 index 2d61d313e0..0000000000 --- a/sdk/src/abis/MultichainOrderRouter.json +++ /dev/null @@ -1,1820 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - }, - { - "internalType": "contract IReferralStorage", - "name": "_referralStorage", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "RelayEmptyBatch", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams[]", - "name": "createOrderParamsList", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams[]", - "name": "updateOrderParamsList", - "type": "tuple[]" - }, - { - "internalType": "bytes32[]", - "name": "cancelOrderKeys", - "type": "bytes32[]" - } - ], - "internalType": "struct IRelayUtils.BatchParams", - "name": "params", - "type": "tuple" - } - ], - "name": "batch", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "referralStorage", - "outputs": [ - { - "internalType": "contract IReferralStorage", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - } - ], - "name": "setTraderReferralCode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainOrderRouter.ts b/sdk/src/abis/MultichainOrderRouter.ts new file mode 100644 index 0000000000..3631cc0d03 --- /dev/null +++ b/sdk/src/abis/MultichainOrderRouter.ts @@ -0,0 +1,724 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + { internalType: "contract IReferralStorage", name: "_referralStorage", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "RelayEmptyBatch", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams[]", + name: "createOrderParamsList", + type: "tuple[]", + }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams[]", + name: "updateOrderParamsList", + type: "tuple[]", + }, + { internalType: "bytes32[]", name: "cancelOrderKeys", type: "bytes32[]" }, + ], + internalType: "struct IRelayUtils.BatchParams", + name: "params", + type: "tuple", + }, + ], + name: "batch", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "cancelOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "referralStorage", + outputs: [{ internalType: "contract IReferralStorage", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + ], + name: "setTraderReferralCode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainSubaccountRouter.json b/sdk/src/abis/MultichainSubaccountRouter.json deleted file mode 100644 index 6f827b1350..0000000000 --- a/sdk/src/abis/MultichainSubaccountRouter.json +++ /dev/null @@ -1,2069 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "RelayEmptyBatch", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams[]", - "name": "createOrderParamsList", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams[]", - "name": "updateOrderParamsList", - "type": "tuple[]" - }, - { - "internalType": "bytes32[]", - "name": "cancelOrderKeys", - "type": "bytes32[]" - } - ], - "internalType": "struct IRelayUtils.BatchParams", - "name": "params", - "type": "tuple" - } - ], - "name": "batch", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - } - ], - "name": "removeSubaccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "subaccountApprovalNonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainSubaccountRouter.ts b/sdk/src/abis/MultichainSubaccountRouter.ts new file mode 100644 index 0000000000..60669e3c01 --- /dev/null +++ b/sdk/src/abis/MultichainSubaccountRouter.ts @@ -0,0 +1,795 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "RelayEmptyBatch", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams[]", + name: "createOrderParamsList", + type: "tuple[]", + }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams[]", + name: "updateOrderParamsList", + type: "tuple[]", + }, + { internalType: "bytes32[]", name: "cancelOrderKeys", type: "bytes32[]" }, + ], + internalType: "struct IRelayUtils.BatchParams", + name: "params", + type: "tuple", + }, + ], + name: "batch", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "cancelOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address", name: "subaccount", type: "address" }, + ], + name: "removeSubaccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "subaccountApprovalNonces", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainTransferRouter.json b/sdk/src/abis/MultichainTransferRouter.json deleted file mode 100644 index ccc2d3ba91..0000000000 --- a/sdk/src/abis/MultichainTransferRouter.json +++ /dev/null @@ -1,915 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "components": [ - { - "internalType": "contract Router", - "name": "router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "oracle", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "orderVault", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "orderHandler", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "contract MultichainVault", - "name": "multichainVault", - "type": "address" - } - ], - "internalType": "struct MultichainRouter.BaseConstructorParams", - "name": "params", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidInitializer", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "InvalidMultichainProvider", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "bridgeIn", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct IRelayUtils.BridgeOutParams", - "name": "params", - "type": "tuple" - } - ], - "name": "bridgeOut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct IRelayUtils.BridgeOutParams", - "name": "params", - "type": "tuple" - } - ], - "name": "bridgeOutFromController", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_multichainProvider", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "multichainProvider", - "outputs": [ - { - "internalType": "contract IMultichainProvider", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "multichainVault", - "outputs": [ - { - "internalType": "contract MultichainVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct IRelayUtils.BridgeOutParams", - "name": "params", - "type": "tuple" - } - ], - "name": "transferOut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/MultichainTransferRouter.ts b/sdk/src/abis/MultichainTransferRouter.ts new file mode 100644 index 0000000000..b9ec75fcb5 --- /dev/null +++ b/sdk/src/abis/MultichainTransferRouter.ts @@ -0,0 +1,404 @@ +export default [ + { + inputs: [ + { + components: [ + { internalType: "contract Router", name: "router", type: "address" }, + { internalType: "contract RoleStore", name: "roleStore", type: "address" }, + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "oracle", type: "address" }, + { internalType: "contract OrderVault", name: "orderVault", type: "address" }, + { internalType: "contract IOrderHandler", name: "orderHandler", type: "address" }, + { internalType: "contract ISwapHandler", name: "swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "externalHandler", type: "address" }, + { internalType: "contract MultichainVault", name: "multichainVault", type: "address" }, + ], + internalType: "struct MultichainRouter.BaseConstructorParams", + name: "params", + type: "tuple", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { inputs: [], name: "InvalidInitializer", type: "error" }, + { + inputs: [{ internalType: "address", name: "provider", type: "address" }], + name: "InvalidMultichainProvider", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "bridgeIn", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "uint256", name: "minAmountOut", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + internalType: "struct IRelayUtils.BridgeOutParams", + name: "params", + type: "tuple", + }, + ], + name: "bridgeOut", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "uint256", name: "minAmountOut", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + internalType: "struct IRelayUtils.BridgeOutParams", + name: "params", + type: "tuple", + }, + ], + name: "bridgeOutFromController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_multichainProvider", type: "address" }], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "multichainProvider", + outputs: [{ internalType: "contract IMultichainProvider", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "multichainVault", + outputs: [{ internalType: "contract MultichainVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "uint256", name: "minAmountOut", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + internalType: "struct IRelayUtils.BridgeOutParams", + name: "params", + type: "tuple", + }, + ], + name: "transferOut", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainUtils.ts b/sdk/src/abis/MultichainUtils.ts new file mode 100644 index 0000000000..e71c1ef6b8 --- /dev/null +++ b/sdk/src/abis/MultichainUtils.ts @@ -0,0 +1,61 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "EmptyMultichainTransferInAmount", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "InsufficientMultichainBalance", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "endpoint", type: "address" }], + name: "InvalidMultichainEndpoint", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "provider", type: "address" }], + name: "InvalidMultichainProvider", + type: "error", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "DataStore" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "token", type: "address" }, + ], + name: "getMultichainBalanceAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "DataStore" }, + { internalType: "address", name: "endpoint", type: "address" }, + ], + name: "validateMultichainEndpoint", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "DataStore" }, + { internalType: "address", name: "provider", type: "address" }, + ], + name: "validateMultichainProvider", + outputs: [], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/MultichainVault.json b/sdk/src/abis/MultichainVault.json deleted file mode 100644 index aec87386dd..0000000000 --- a/sdk/src/abis/MultichainVault.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - } - ], - "name": "InvalidNativeTokenSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "SelfTransferNotSupported", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "recordTransferIn", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "syncTokenBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferOut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "name": "transferOut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferOutNativeToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] -} diff --git a/sdk/src/abis/MultichainVault.ts b/sdk/src/abis/MultichainVault.ts new file mode 100644 index 0000000000..cba19e9e48 --- /dev/null +++ b/sdk/src/abis/MultichainVault.ts @@ -0,0 +1,122 @@ +export default [ + { + inputs: [ + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "msgSender", type: "address" }], + name: "InvalidNativeTokenSender", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "receiver", type: "address" }], + name: "SelfTransferNotSupported", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "recordTransferIn", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "syncTokenBalance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenBalances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferOut", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + ], + name: "transferOut", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferOutNativeToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; diff --git a/sdk/src/abis/Reader.json b/sdk/src/abis/Reader.json deleted file mode 100644 index 113526b301..0000000000 --- a/sdk/src/abis/Reader.json +++ /dev/null @@ -1,355 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Reader", - "sourceName": "contracts/peripherals/Reader.sol", - "abi": [ - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVault", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amountIn", - "type": "uint256" - } - ], - "name": "getAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getFees", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getFundingRates", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVault", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - } - ], - "name": "getMaxAmountIn", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_factory", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getPairInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_collateralTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_indexTokens", - "type": "address[]" - }, - { - "internalType": "bool[]", - "name": "_isLong", - "type": "bool[]" - } - ], - "name": "getPositions", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_yieldTrackers", - "type": "address[]" - } - ], - "name": "getStakingInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenBalancesWithSupplies", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_excludedAccounts", - "type": "address[]" - } - ], - "name": "getTokenSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_yieldTokens", - "type": "address[]" - } - ], - "name": "getTotalStaked", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getVaultTokenInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Reader.ts b/sdk/src/abis/Reader.ts new file mode 100644 index 0000000000..c17b3b4de8 --- /dev/null +++ b/sdk/src/abis/Reader.ts @@ -0,0 +1,138 @@ +export default [ + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVault", name: "_vault", type: "address" }, + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_amountIn", type: "uint256" }, + ], + name: "getAmountOut", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getFees", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getFundingRates", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVault", name: "_vault", type: "address" }, + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + ], + name: "getMaxAmountIn", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_factory", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getPairInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_collateralTokens", type: "address[]" }, + { internalType: "address[]", name: "_indexTokens", type: "address[]" }, + { internalType: "bool[]", name: "_isLong", type: "bool[]" }, + ], + name: "getPositions", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_yieldTrackers", type: "address[]" }, + ], + name: "getStakingInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getTokenBalances", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getTokenBalancesWithSupplies", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IERC20", name: "_token", type: "address" }, + { internalType: "address[]", name: "_excludedAccounts", type: "address[]" }, + ], + name: "getTokenSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_yieldTokens", type: "address[]" }], + name: "getTotalStaked", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getVaultTokenInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ReaderV2.json b/sdk/src/abis/ReaderV2.json deleted file mode 100644 index bc9c809e66..0000000000 --- a/sdk/src/abis/ReaderV2.json +++ /dev/null @@ -1,630 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Reader", - "sourceName": "contracts/peripherals/Reader.sol", - "abi": [ - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "POSITION_PROPS_LENGTH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USDG_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVault", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amountIn", - "type": "uint256" - } - ], - "name": "getAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVault", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amountIn", - "type": "uint256" - } - ], - "name": "getFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getFees", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getFullVaultTokenInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getFundingRates", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVault", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - } - ], - "name": "getMaxAmountIn", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_factory", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getPairInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_collateralTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_indexTokens", - "type": "address[]" - }, - { - "internalType": "bool[]", - "name": "_isLong", - "type": "bool[]" - } - ], - "name": "getPositions", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVaultPriceFeed", - "name": "_priceFeed", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getPrices", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_yieldTrackers", - "type": "address[]" - } - ], - "name": "getStakingInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenBalancesWithSupplies", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_excludedAccounts", - "type": "address[]" - } - ], - "name": "getTokenSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - } - ], - "name": "getTotalBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_yieldTokens", - "type": "address[]" - } - ], - "name": "getTotalStaked", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getVaultTokenInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getVaultTokenInfoV2", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_vesters", - "type": "address[]" - } - ], - "name": "getVestingInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasMaxGlobalShortSizes", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_hasMaxGlobalShortSizes", - "type": "bool" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/ReaderV2.ts b/sdk/src/abis/ReaderV2.ts new file mode 100644 index 0000000000..4b81c1c697 --- /dev/null +++ b/sdk/src/abis/ReaderV2.ts @@ -0,0 +1,257 @@ +export default [ + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "POSITION_PROPS_LENGTH", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "USDG_DECIMALS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVault", name: "_vault", type: "address" }, + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_amountIn", type: "uint256" }, + ], + name: "getAmountOut", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVault", name: "_vault", type: "address" }, + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_amountIn", type: "uint256" }, + ], + name: "getFeeBasisPoints", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getFees", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getFullVaultTokenInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getFundingRates", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVault", name: "_vault", type: "address" }, + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + ], + name: "getMaxAmountIn", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_factory", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getPairInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_collateralTokens", type: "address[]" }, + { internalType: "address[]", name: "_indexTokens", type: "address[]" }, + { internalType: "bool[]", name: "_isLong", type: "bool[]" }, + ], + name: "getPositions", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IVaultPriceFeed", name: "_priceFeed", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getPrices", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_yieldTrackers", type: "address[]" }, + ], + name: "getStakingInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getTokenBalances", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getTokenBalancesWithSupplies", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IERC20", name: "_token", type: "address" }, + { internalType: "address[]", name: "_excludedAccounts", type: "address[]" }, + ], + name: "getTokenSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract IERC20", name: "_token", type: "address" }, + { internalType: "address[]", name: "_accounts", type: "address[]" }, + ], + name: "getTotalBalance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_yieldTokens", type: "address[]" }], + name: "getTotalStaked", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getVaultTokenInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getVaultTokenInfoV2", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_vesters", type: "address[]" }, + ], + name: "getVestingInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasMaxGlobalShortSizes", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_hasMaxGlobalShortSizes", type: "bool" }], + name: "setConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/ReferralStorage.json b/sdk/src/abis/ReferralStorage.json deleted file mode 100644 index edfad6e67a..0000000000 --- a/sdk/src/abis/ReferralStorage.json +++ /dev/null @@ -1,557 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "code", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAccount", - "type": "address" - } - ], - "name": "GovSetCodeOwner", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "code", - "type": "bytes32" - } - ], - "name": "RegisterCode", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "code", - "type": "bytes32" - } - ], - "name": "SetCodeOwner", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "prevGov", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "nextGov", - "type": "address" - } - ], - "name": "SetGov", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "handler", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "name": "SetHandler", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "referrer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "discountShare", - "type": "uint256" - } - ], - "name": "SetReferrerDiscountShare", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "referrer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tierId", - "type": "uint256" - } - ], - "name": "SetReferrerTier", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "tierId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalRebate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "discountShare", - "type": "uint256" - } - ], - "name": "SetTier", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "code", - "type": "bytes32" - } - ], - "name": "SetTraderReferralCode", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "codeOwners", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "getTraderReferralInfo", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_newAccount", - "type": "address" - } - ], - "name": "govSetCodeOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "referrerDiscountShares", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "referrerTiers", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - } - ], - "name": "registerCode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_newAccount", - "type": "address" - } - ], - "name": "setCodeOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_discountShare", - "type": "uint256" - } - ], - "name": "setReferrerDiscountShare", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_referrer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tierId", - "type": "uint256" - } - ], - "name": "setReferrerTier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tierId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_totalRebate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_discountShare", - "type": "uint256" - } - ], - "name": "setTier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - } - ], - "name": "setTraderReferralCode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - } - ], - "name": "setTraderReferralCodeByUser", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tiers", - "outputs": [ - { - "internalType": "uint256", - "name": "totalRebate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "discountShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "traderReferralCodes", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newGov", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/ReferralStorage.ts b/sdk/src/abis/ReferralStorage.ts new file mode 100644 index 0000000000..e996694135 --- /dev/null +++ b/sdk/src/abis/ReferralStorage.ts @@ -0,0 +1,259 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "code", type: "bytes32" }, + { indexed: false, internalType: "address", name: "newAccount", type: "address" }, + ], + name: "GovSetCodeOwner", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "bytes32", name: "code", type: "bytes32" }, + ], + name: "RegisterCode", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "newAccount", type: "address" }, + { indexed: false, internalType: "bytes32", name: "code", type: "bytes32" }, + ], + name: "SetCodeOwner", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "prevGov", type: "address" }, + { indexed: false, internalType: "address", name: "nextGov", type: "address" }, + ], + name: "SetGov", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "handler", type: "address" }, + { indexed: false, internalType: "bool", name: "isActive", type: "bool" }, + ], + name: "SetHandler", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "referrer", type: "address" }, + { indexed: false, internalType: "uint256", name: "discountShare", type: "uint256" }, + ], + name: "SetReferrerDiscountShare", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "referrer", type: "address" }, + { indexed: false, internalType: "uint256", name: "tierId", type: "uint256" }, + ], + name: "SetReferrerTier", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "tierId", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "totalRebate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "discountShare", type: "uint256" }, + ], + name: "SetTier", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "bytes32", name: "code", type: "bytes32" }, + ], + name: "SetTraderReferralCode", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "acceptOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "codeOwners", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "getTraderReferralInfo", + outputs: [ + { internalType: "bytes32", name: "", type: "bytes32" }, + { internalType: "address", name: "", type: "address" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "_code", type: "bytes32" }, + { internalType: "address", name: "_newAccount", type: "address" }, + ], + name: "govSetCodeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pendingGov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "referrerDiscountShares", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "referrerTiers", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "_code", type: "bytes32" }], + name: "registerCode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "_code", type: "bytes32" }, + { internalType: "address", name: "_newAccount", type: "address" }, + ], + name: "setCodeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_discountShare", type: "uint256" }], + name: "setReferrerDiscountShare", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_referrer", type: "address" }, + { internalType: "uint256", name: "_tierId", type: "uint256" }, + ], + name: "setReferrerTier", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_tierId", type: "uint256" }, + { internalType: "uint256", name: "_totalRebate", type: "uint256" }, + { internalType: "uint256", name: "_discountShare", type: "uint256" }, + ], + name: "setTier", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "bytes32", name: "_code", type: "bytes32" }, + ], + name: "setTraderReferralCode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "_code", type: "bytes32" }], + name: "setTraderReferralCodeByUser", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "tiers", + outputs: [ + { internalType: "uint256", name: "totalRebate", type: "uint256" }, + { internalType: "uint256", name: "discountShare", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "traderReferralCodes", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_newGov", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/RelayParams.json b/sdk/src/abis/RelayParams.json deleted file mode 100644 index 56922f895f..0000000000 --- a/sdk/src/abis/RelayParams.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "abi": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ] -} diff --git a/sdk/src/abis/RelayParams.ts b/sdk/src/abis/RelayParams.ts new file mode 100644 index 0000000000..f51eb62044 --- /dev/null +++ b/sdk/src/abis/RelayParams.ts @@ -0,0 +1,53 @@ +export default [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, +] as const; diff --git a/sdk/src/abis/RewardReader.json b/sdk/src/abis/RewardReader.json deleted file mode 100644 index f1c11d8808..0000000000 --- a/sdk/src/abis/RewardReader.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "RewardReader", - "sourceName": "contracts/peripherals/RewardReader.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_depositTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_rewardTrackers", - "type": "address[]" - } - ], - "name": "getDepositBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_rewardTrackers", - "type": "address[]" - } - ], - "name": "getStakingInfo", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_vesters", - "type": "address[]" - } - ], - "name": "getVestingInfoV2", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/RewardReader.ts b/sdk/src/abis/RewardReader.ts new file mode 100644 index 0000000000..acd99583f5 --- /dev/null +++ b/sdk/src/abis/RewardReader.ts @@ -0,0 +1,33 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_depositTokens", type: "address[]" }, + { internalType: "address[]", name: "_rewardTrackers", type: "address[]" }, + ], + name: "getDepositBalances", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_rewardTrackers", type: "address[]" }, + ], + name: "getStakingInfo", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address[]", name: "_vesters", type: "address[]" }, + ], + name: "getVestingInfoV2", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/RewardRouter.json b/sdk/src/abis/RewardRouter.json deleted file mode 100644 index 02c6e6606d..0000000000 --- a/sdk/src/abis/RewardRouter.json +++ /dev/null @@ -1,1024 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "RewardRouterV2", - "sourceName": "contracts/staking/RewardRouterV2.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "StakeGlp", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "StakeGmx", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "UnstakeGlp", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "UnstakeGmx", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sender", - "type": "address" - } - ], - "name": "acceptTransfer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - } - ], - "name": "batchCompoundForAccounts", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - } - ], - "name": "batchRestakeForAccounts", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_amounts", - "type": "uint256[]" - } - ], - "name": "batchStakeGmxForAccounts", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "bnGmx", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bonusGmxTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "claimEsGmx", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "claimFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "compound", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "esGmx", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "extendedGmxTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGlpTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGmxTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glp", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glpManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "glpVester", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmx", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmxVester", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "govToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_shouldClaimGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldClaimEsGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeEsGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeMultiplierPoints", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldClaimWeth", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldConvertWethToEth", - "type": "bool" - } - ], - "name": "handleRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gmxReceiver", - "type": "address" - }, - { - "internalType": "bool", - "name": "_shouldClaimGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldClaimEsGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeEsGmx", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldStakeMultiplierPoints", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldClaimWeth", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_shouldConvertWethToEth", - "type": "bool" - } - ], - "name": "handleRewardsV2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "inRestakingMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inStrictTransferMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "weth", - "type": "address" - }, - { - "internalType": "address", - "name": "gmx", - "type": "address" - }, - { - "internalType": "address", - "name": "esGmx", - "type": "address" - }, - { - "internalType": "address", - "name": "bnGmx", - "type": "address" - }, - { - "internalType": "address", - "name": "glp", - "type": "address" - }, - { - "internalType": "address", - "name": "stakedGmxTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "bonusGmxTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "extendedGmxTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "feeGmxTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "feeGlpTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "stakedGlpTracker", - "type": "address" - }, - { - "internalType": "address", - "name": "glpManager", - "type": "address" - }, - { - "internalType": "address", - "name": "gmxVester", - "type": "address" - }, - { - "internalType": "address", - "name": "glpVester", - "type": "address" - }, - { - "internalType": "address", - "name": "externalHandler", - "type": "address" - }, - { - "internalType": "address", - "name": "govToken", - "type": "address" - } - ], - "internalType": "struct RewardRouterV2.InitializeParams", - "name": "_initializeParams", - "type": "tuple" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "name": "makeExternalCalls", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxBoostBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minUsdg", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minGlp", - "type": "uint256" - } - ], - "name": "mintAndStakeGlp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minUsdg", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minGlp", - "type": "uint256" - } - ], - "name": "mintAndStakeGlpETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingReceivers", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_govToken", - "type": "address" - } - ], - "name": "setGovToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inRestakingMode", - "type": "bool" - } - ], - "name": "setInRestakingMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inStrictTransferMode", - "type": "bool" - } - ], - "name": "setInStrictTransferMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxBoostBasisPoints", - "type": "uint256" - } - ], - "name": "setMaxBoostBasisPoints", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum RewardRouterV2.VotingPowerType", - "name": "_votingPowerType", - "type": "uint8" - } - ], - "name": "setVotingPowerType", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "signalTransfer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "stakeEsGmx", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "stakeGmx", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "stakedGlpTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stakedGmxTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_glpAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minOut", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "unstakeAndRedeemGlp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_glpAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minOut", - "type": "uint256" - }, - { - "internalType": "address payable", - "name": "_receiver", - "type": "address" - } - ], - "name": "unstakeAndRedeemGlpETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unstakeEsGmx", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unstakeGmx", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "votingPowerType", - "outputs": [ - { - "internalType": "enum RewardRouterV2.VotingPowerType", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "weth", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/RewardRouter.ts b/sdk/src/abis/RewardRouter.ts new file mode 100644 index 0000000000..c4eee74383 --- /dev/null +++ b/sdk/src/abis/RewardRouter.ts @@ -0,0 +1,458 @@ +export default [ + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "StakeGlp", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "StakeGmx", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "UnstakeGlp", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "UnstakeGmx", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_sender", type: "address" }], + name: "acceptTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_accounts", type: "address[]" }], + name: "batchCompoundForAccounts", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_accounts", type: "address[]" }], + name: "batchRestakeForAccounts", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "_accounts", type: "address[]" }, + { internalType: "uint256[]", name: "_amounts", type: "uint256[]" }, + ], + name: "batchStakeGmxForAccounts", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "bnGmx", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "bonusGmxTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "claim", outputs: [], stateMutability: "nonpayable", type: "function" }, + { inputs: [], name: "claimEsGmx", outputs: [], stateMutability: "nonpayable", type: "function" }, + { inputs: [], name: "claimFees", outputs: [], stateMutability: "nonpayable", type: "function" }, + { inputs: [], name: "compound", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "esGmx", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "extendedGmxTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeGlpTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeGmxTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glp", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glpManager", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "glpVester", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmx", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmxVester", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "govToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "bool", name: "_shouldClaimGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeGmx", type: "bool" }, + { internalType: "bool", name: "_shouldClaimEsGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeEsGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeMultiplierPoints", type: "bool" }, + { internalType: "bool", name: "_shouldClaimWeth", type: "bool" }, + { internalType: "bool", name: "_shouldConvertWethToEth", type: "bool" }, + ], + name: "handleRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_gmxReceiver", type: "address" }, + { internalType: "bool", name: "_shouldClaimGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeGmx", type: "bool" }, + { internalType: "bool", name: "_shouldClaimEsGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeEsGmx", type: "bool" }, + { internalType: "bool", name: "_shouldStakeMultiplierPoints", type: "bool" }, + { internalType: "bool", name: "_shouldClaimWeth", type: "bool" }, + { internalType: "bool", name: "_shouldConvertWethToEth", type: "bool" }, + ], + name: "handleRewardsV2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "inRestakingMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inStrictTransferMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "address", name: "weth", type: "address" }, + { internalType: "address", name: "gmx", type: "address" }, + { internalType: "address", name: "esGmx", type: "address" }, + { internalType: "address", name: "bnGmx", type: "address" }, + { internalType: "address", name: "glp", type: "address" }, + { internalType: "address", name: "stakedGmxTracker", type: "address" }, + { internalType: "address", name: "bonusGmxTracker", type: "address" }, + { internalType: "address", name: "extendedGmxTracker", type: "address" }, + { internalType: "address", name: "feeGmxTracker", type: "address" }, + { internalType: "address", name: "feeGlpTracker", type: "address" }, + { internalType: "address", name: "stakedGlpTracker", type: "address" }, + { internalType: "address", name: "glpManager", type: "address" }, + { internalType: "address", name: "gmxVester", type: "address" }, + { internalType: "address", name: "glpVester", type: "address" }, + { internalType: "address", name: "externalHandler", type: "address" }, + { internalType: "address", name: "govToken", type: "address" }, + ], + internalType: "struct RewardRouterV2.InitializeParams", + name: "_initializeParams", + type: "tuple", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + name: "makeExternalCalls", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "maxBoostBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_minUsdg", type: "uint256" }, + { internalType: "uint256", name: "_minGlp", type: "uint256" }, + ], + name: "mintAndStakeGlp", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_minUsdg", type: "uint256" }, + { internalType: "uint256", name: "_minGlp", type: "uint256" }, + ], + name: "mintAndStakeGlpETH", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "pendingReceivers", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_govToken", type: "address" }], + name: "setGovToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inRestakingMode", type: "bool" }], + name: "setInRestakingMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inStrictTransferMode", type: "bool" }], + name: "setInStrictTransferMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxBoostBasisPoints", type: "uint256" }], + name: "setMaxBoostBasisPoints", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "enum RewardRouterV2.VotingPowerType", name: "_votingPowerType", type: "uint8" }], + name: "setVotingPowerType", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_receiver", type: "address" }], + name: "signalTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], + name: "stakeEsGmx", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], + name: "stakeGmx", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "stakedGlpTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stakedGmxTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "uint256", name: "_glpAmount", type: "uint256" }, + { internalType: "uint256", name: "_minOut", type: "uint256" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "unstakeAndRedeemGlp", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_glpAmount", type: "uint256" }, + { internalType: "uint256", name: "_minOut", type: "uint256" }, + { internalType: "address payable", name: "_receiver", type: "address" }, + ], + name: "unstakeAndRedeemGlpETH", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], + name: "unstakeEsGmx", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], + name: "unstakeGmx", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "votingPowerType", + outputs: [{ internalType: "enum RewardRouterV2.VotingPowerType", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "weth", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; diff --git a/sdk/src/abis/RewardTracker.json b/sdk/src/abis/RewardTracker.json deleted file mode 100644 index e8ba86491d..0000000000 --- a/sdk/src/abis/RewardTracker.json +++ /dev/null @@ -1,918 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "RewardTracker", - "sourceName": "contracts/staking/RewardTracker.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Claim", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "averageStakedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "claim", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "claimForAccount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "claimable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "claimableReward", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "cumulativeRewardPerToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "depositBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "distributor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateClaimingMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateStakingMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateTransferMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_depositTokens", - "type": "address[]" - }, - { - "internalType": "address", - "name": "_distributor", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isDepositToken", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "previousCumulatedRewardPerToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isDepositToken", - "type": "bool" - } - ], - "name": "setDepositToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateClaimingMode", - "type": "bool" - } - ], - "name": "setInPrivateClaimingMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateStakingMode", - "type": "bool" - } - ], - "name": "setInPrivateStakingMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateTransferMode", - "type": "bool" - } - ], - "name": "setInPrivateTransferMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fundingAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_depositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "stakeForAccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokensPerInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalDepositSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_depositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "unstakeForAccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "updateRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/RewardTracker.ts b/sdk/src/abis/RewardTracker.ts new file mode 100644 index 0000000000..b7c62b7935 --- /dev/null +++ b/sdk/src/abis/RewardTracker.ts @@ -0,0 +1,413 @@ +export default [ + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_symbol", type: "string" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "Claim", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_owner", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "allowances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "averageStakedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "balances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_receiver", type: "address" }], + name: "claim", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "claimForAccount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "claimable", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "claimableReward", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "cumulativeRewardPerToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeRewards", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "depositBalances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "distributor", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateClaimingMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateStakingMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateTransferMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "_depositTokens", type: "address[]" }, + { internalType: "address", name: "_distributor", type: "address" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isDepositToken", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "previousCumulatedRewardPerToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewardToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_depositToken", type: "address" }, + { internalType: "bool", name: "_isDepositToken", type: "bool" }, + ], + name: "setDepositToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateClaimingMode", type: "bool" }], + name: "setInPrivateClaimingMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateStakingMode", type: "bool" }], + name: "setInPrivateStakingMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateTransferMode", type: "bool" }], + name: "setInPrivateTransferMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_depositToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "stake", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_fundingAccount", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_depositToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "stakeForAccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "stakedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tokensPerInterval", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "totalDepositSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_recipient", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_sender", type: "address" }, + { internalType: "address", name: "_recipient", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_depositToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "unstake", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_depositToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "unstakeForAccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "updateRewards", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/SmartAccount.json b/sdk/src/abis/SmartAccount.json deleted file mode 100644 index bc707d8deb..0000000000 --- a/sdk/src/abis/SmartAccount.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "abi": [ - { - "name": "isValidSignature", - "inputs": [ - { - "internalType": "bytes32", - "name": "_hash", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "_signature", - "type": "bytes" - } - ], - "outputs": [ - { - "internalType": "bytes4", - "name": "magicValue", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/SmartAccount.ts b/sdk/src/abis/SmartAccount.ts new file mode 100644 index 0000000000..8b3798639a --- /dev/null +++ b/sdk/src/abis/SmartAccount.ts @@ -0,0 +1,12 @@ +export default [ + { + name: "isValidSignature", + inputs: [ + { internalType: "bytes32", name: "_hash", type: "bytes32" }, + { internalType: "bytes", name: "_signature", type: "bytes" }, + ], + outputs: [{ internalType: "bytes4", name: "magicValue", type: "bytes4" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/StBTC.json b/sdk/src/abis/StBTC.json deleted file mode 100644 index 326271bd23..0000000000 --- a/sdk/src/abis/StBTC.json +++ /dev/null @@ -1,1225 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "StBTC", - "sourceName": "contracts/stBTC.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allowance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "needed", - "type": "uint256" - } - ], - "name": "ERC20InsufficientAllowance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "needed", - "type": "uint256" - } - ], - "name": "ERC20InsufficientBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "approver", - "type": "address" - } - ], - "name": "ERC20InvalidApprover", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "ERC20InvalidReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "ERC20InvalidSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "ERC20InvalidSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ERC4626ExceededMaxDeposit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ERC4626ExceededMaxMint", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ERC4626ExceededMaxRedeem", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ERC4626ExceededMaxWithdraw", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidInitialization", - "type": "error" - }, - { - "inputs": [], - "name": "NoRewards", - "type": "error" - }, - { - "inputs": [], - "name": "NotFeeReceiver", - "type": "error" - }, - { - "inputs": [], - "name": "NotInitializing", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "OwnableInvalidOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "OwnableUnauthorizedAccount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "ValueMismatch", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroShares", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Harvest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "version", - "type": "uint64" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "asset", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "assetsPerShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "convertToAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - } - ], - "name": "convertToShares", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "deposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "directDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "earned", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeReceiver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_asset", - "type": "address" - }, - { - "internalType": "address", - "name": "_initialOwner", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lastTimeRewardApplicable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastUpdateTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "maxRedeem", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "maxWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "notifyRewardAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "periodFinish", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - } - ], - "name": "previewDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "previewMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "previewRedeem", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - } - ], - "name": "previewWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "redeem", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerTokenPaid", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerTokenStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newFeeReceiver", - "type": "address" - } - ], - "name": "setFeeReceiver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "assets", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/StBTC.ts b/sdk/src/abis/StBTC.ts new file mode 100644 index 0000000000..a1041c6443 --- /dev/null +++ b/sdk/src/abis/StBTC.ts @@ -0,0 +1,511 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "allowance", type: "uint256" }, + { internalType: "uint256", name: "needed", type: "uint256" }, + ], + name: "ERC20InsufficientAllowance", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "uint256", name: "balance", type: "uint256" }, + { internalType: "uint256", name: "needed", type: "uint256" }, + ], + name: "ERC20InsufficientBalance", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "approver", type: "address" }], + name: "ERC20InvalidApprover", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "receiver", type: "address" }], + name: "ERC20InvalidReceiver", + type: "error", + }, + { inputs: [{ internalType: "address", name: "sender", type: "address" }], name: "ERC20InvalidSender", type: "error" }, + { + inputs: [{ internalType: "address", name: "spender", type: "address" }], + name: "ERC20InvalidSpender", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "assets", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + name: "ERC4626ExceededMaxDeposit", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "shares", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + name: "ERC4626ExceededMaxMint", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "uint256", name: "shares", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + name: "ERC4626ExceededMaxRedeem", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "uint256", name: "assets", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + name: "ERC4626ExceededMaxWithdraw", + type: "error", + }, + { inputs: [], name: "InvalidInitialization", type: "error" }, + { inputs: [], name: "NoRewards", type: "error" }, + { inputs: [], name: "NotFeeReceiver", type: "error" }, + { inputs: [], name: "NotInitializing", type: "error" }, + { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "OwnableUnauthorizedAccount", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "SafeERC20FailedOperation", + type: "error", + }, + { inputs: [], name: "ValueMismatch", type: "error" }, + { inputs: [], name: "ZeroAddress", type: "error" }, + { inputs: [], name: "ZeroShares", type: "error" }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "sender", type: "address" }, + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: false, internalType: "uint256", name: "assets", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "shares", type: "uint256" }, + ], + name: "Deposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "caller", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Harvest", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, + { indexed: true, internalType: "address", name: "newOwner", type: "address" }, + ], + name: "OwnershipTransferStarted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, + { indexed: true, internalType: "address", name: "newOwner", type: "address" }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "uint256", name: "reward", type: "uint256" }], + name: "RewardAdded", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "sender", type: "address" }, + { indexed: true, internalType: "address", name: "receiver", type: "address" }, + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: false, internalType: "uint256", name: "assets", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "shares", type: "uint256" }, + ], + name: "Withdraw", + type: "event", + }, + { inputs: [], name: "acceptOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "asset", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "assetsPerShare", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "shares", type: "uint256" }], + name: "convertToAssets", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "assets", type: "uint256" }], + name: "convertToShares", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "assets", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "deposit", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "assets", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "directDeposit", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "earned", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeReceiver", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "harvest", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [ + { internalType: "contract IERC20", name: "_asset", type: "address" }, + { internalType: "address", name: "_initialOwner", type: "address" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "lastTimeRewardApplicable", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "lastUpdateTime", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxDeposit", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxMint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "owner", type: "address" }], + name: "maxRedeem", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "owner", type: "address" }], + name: "maxWithdraw", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "shares", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + name: "mint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "notifyRewardAmount", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pendingOwner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "periodFinish", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "assets", type: "uint256" }], + name: "previewDeposit", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "shares", type: "uint256" }], + name: "previewMint", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "shares", type: "uint256" }], + name: "previewRedeem", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "assets", type: "uint256" }], + name: "previewWithdraw", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "shares", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "owner", type: "address" }, + ], + name: "redeem", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "rewardPerToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewardPerTokenPaid", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewardPerTokenStored", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewardRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewards", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_newFeeReceiver", type: "address" }], + name: "setFeeReceiver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalAssets", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalStaked", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "newOwner", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "assets", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "owner", type: "address" }, + ], + name: "withdraw", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/SubaccountApproval.json b/sdk/src/abis/SubaccountApproval.json deleted file mode 100644 index 13bbad2fae..0000000000 --- a/sdk/src/abis/SubaccountApproval.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "abi": [ - { - "type": "tuple", - "components": [ - { "name": "subaccount", "type": "address" }, - { "name": "shouldAdd", "type": "bool" }, - { "name": "expiresAt", "type": "uint256" }, - { "name": "maxAllowedCount", "type": "uint256" }, - { "name": "actionType", "type": "bytes32" }, - { "name": "nonce", "type": "uint256" }, - { "name": "deadline", "type": "uint256" }, - { "name": "signature", "type": "bytes" } - ] - } - ] -} diff --git a/sdk/src/abis/SubaccountApproval.ts b/sdk/src/abis/SubaccountApproval.ts new file mode 100644 index 0000000000..df5b96ad44 --- /dev/null +++ b/sdk/src/abis/SubaccountApproval.ts @@ -0,0 +1,15 @@ +export default [ + { + type: "tuple", + components: [ + { name: "subaccount", type: "address" }, + { name: "shouldAdd", type: "bool" }, + { name: "expiresAt", type: "uint256" }, + { name: "maxAllowedCount", type: "uint256" }, + { name: "actionType", type: "bytes32" }, + { name: "nonce", type: "uint256" }, + { name: "deadline", type: "uint256" }, + { name: "signature", type: "bytes" }, + ], + }, +] as const; diff --git a/sdk/src/abis/SubaccountGelatoRelayRouter.json b/sdk/src/abis/SubaccountGelatoRelayRouter.json deleted file mode 100644 index a1ed16bf23..0000000000 --- a/sdk/src/abis/SubaccountGelatoRelayRouter.json +++ /dev/null @@ -1,2019 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract Router", - "name": "_router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOracle", - "name": "_oracle", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "_orderHandler", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "_orderVault", - "type": "address" - }, - { - "internalType": "contract ISwapHandler", - "name": "_swapHandler", - "type": "address" - }, - { - "internalType": "contract IExternalHandler", - "name": "_externalHandler", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "DeadlinePassed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requiredRelayFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableFeeAmount", - "type": "uint256" - } - ], - "name": "InsufficientRelayFee", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "name": "InvalidDestinationChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "sendTokensLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sendAmountsLength", - "type": "uint256" - } - ], - "name": "InvalidExternalCalls", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedSpender", - "type": "address" - } - ], - "name": "InvalidPermitSpender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "name": "InvalidSrcChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "digest", - "type": "bytes32" - } - ], - "name": "InvalidUserDigest", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeeUsd", - "type": "uint256" - } - ], - "name": "MaxRelayFeeSwapForSubaccountExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NonEmptyExternalCallsForSubaccountOrder", - "type": "error" - }, - { - "inputs": [], - "name": "RelayEmptyBatch", - "type": "error" - }, - { - "inputs": [], - "name": "TokenPermitsNotAllowedForMultichain", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnexpectedRelayFeeToken", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedFeeToken", - "type": "address" - } - ], - "name": "UnsupportedRelayFeeToken", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams[]", - "name": "createOrderParamsList", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams[]", - "name": "updateOrderParamsList", - "type": "tuple[]" - }, - { - "internalType": "bytes32[]", - "name": "cancelOrderKeys", - "type": "bytes32[]" - } - ], - "internalType": "struct IRelayUtils.BatchParams", - "name": "params", - "type": "tuple" - } - ], - "name": "batch", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "digests", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "externalHandler", - "outputs": [ - { - "internalType": "contract IExternalHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - } - ], - "name": "removeSubaccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "subaccountApprovalNonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "swapHandler", - "outputs": [ - { - "internalType": "contract ISwapHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "providers", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "internalType": "struct OracleUtils.SetPricesParams", - "name": "oracleParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sendTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "sendAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "externalCallTargets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "externalCallDataList", - "type": "bytes[]" - }, - { - "internalType": "address[]", - "name": "refundTokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "refundReceivers", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.ExternalCalls", - "name": "externalCalls", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "internalType": "struct IRelayUtils.TokenPermit[]", - "name": "tokenPermits", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "feeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "feeSwapPath", - "type": "address[]" - } - ], - "internalType": "struct IRelayUtils.FeeParams", - "name": "fee", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "userNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.RelayParams", - "name": "relayParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "shouldAdd", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "desChainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct SubaccountApproval", - "name": "subaccountApproval", - "type": "tuple" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "executionFeeIncrease", - "type": "uint256" - } - ], - "internalType": "struct IRelayUtils.UpdateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/SubaccountGelatoRelayRouter.ts b/sdk/src/abis/SubaccountGelatoRelayRouter.ts new file mode 100644 index 0000000000..1ec42aecc5 --- /dev/null +++ b/sdk/src/abis/SubaccountGelatoRelayRouter.ts @@ -0,0 +1,775 @@ +export default [ + { + inputs: [ + { internalType: "contract Router", name: "_router", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract IOracle", name: "_oracle", type: "address" }, + { internalType: "contract IOrderHandler", name: "_orderHandler", type: "address" }, + { internalType: "contract OrderVault", name: "_orderVault", type: "address" }, + { internalType: "contract ISwapHandler", name: "_swapHandler", type: "address" }, + { internalType: "contract IExternalHandler", name: "_externalHandler", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "uint256", name: "currentTimestamp", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + ], + name: "DeadlinePassed", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "requiredRelayFee", type: "uint256" }, + { internalType: "uint256", name: "availableFeeAmount", type: "uint256" }, + ], + name: "InsufficientRelayFee", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "desChainId", type: "uint256" }], + name: "InvalidDestinationChainId", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "sendTokensLength", type: "uint256" }, + { internalType: "uint256", name: "sendAmountsLength", type: "uint256" }, + ], + name: "InvalidExternalCalls", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "address", name: "expectedSpender", type: "address" }, + ], + name: "InvalidPermitSpender", + type: "error", + }, + { + inputs: [{ internalType: "uint256", name: "srcChainId", type: "uint256" }], + name: "InvalidSrcChainId", + type: "error", + }, + { inputs: [{ internalType: "bytes32", name: "digest", type: "bytes32" }], name: "InvalidUserDigest", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "feeUsd", type: "uint256" }, + { internalType: "uint256", name: "maxFeeUsd", type: "uint256" }, + ], + name: "MaxRelayFeeSwapForSubaccountExceeded", + type: "error", + }, + { inputs: [], name: "NonEmptyExternalCallsForSubaccountOrder", type: "error" }, + { inputs: [], name: "RelayEmptyBatch", type: "error" }, + { inputs: [], name: "TokenPermitsNotAllowedForMultichain", type: "error" }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnexpectedRelayFeeToken", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "address", name: "expectedFeeToken", type: "address" }, + ], + name: "UnsupportedRelayFeeToken", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams[]", + name: "createOrderParamsList", + type: "tuple[]", + }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams[]", + name: "updateOrderParamsList", + type: "tuple[]", + }, + { internalType: "bytes32[]", name: "cancelOrderKeys", type: "bytes32[]" }, + ], + internalType: "struct IRelayUtils.BatchParams", + name: "params", + type: "tuple", + }, + ], + name: "batch", + outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "cancelOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "digests", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "externalHandler", + outputs: [{ internalType: "contract IExternalHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "oracle", + outputs: [{ internalType: "contract IOracle", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + ], + name: "removeSubaccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "subaccountApprovalNonces", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "swapHandler", + outputs: [{ internalType: "contract ISwapHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { internalType: "address[]", name: "tokens", type: "address[]" }, + { internalType: "address[]", name: "providers", type: "address[]" }, + { internalType: "bytes[]", name: "data", type: "bytes[]" }, + ], + internalType: "struct OracleUtils.SetPricesParams", + name: "oracleParams", + type: "tuple", + }, + { + components: [ + { internalType: "address[]", name: "sendTokens", type: "address[]" }, + { internalType: "uint256[]", name: "sendAmounts", type: "uint256[]" }, + { internalType: "address[]", name: "externalCallTargets", type: "address[]" }, + { internalType: "bytes[]", name: "externalCallDataList", type: "bytes[]" }, + { internalType: "address[]", name: "refundTokens", type: "address[]" }, + { internalType: "address[]", name: "refundReceivers", type: "address[]" }, + ], + internalType: "struct IRelayUtils.ExternalCalls", + name: "externalCalls", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + { internalType: "address", name: "token", type: "address" }, + ], + internalType: "struct IRelayUtils.TokenPermit[]", + name: "tokenPermits", + type: "tuple[]", + }, + { + components: [ + { internalType: "address", name: "feeToken", type: "address" }, + { internalType: "uint256", name: "feeAmount", type: "uint256" }, + { internalType: "address[]", name: "feeSwapPath", type: "address[]" }, + ], + internalType: "struct IRelayUtils.FeeParams", + name: "fee", + type: "tuple", + }, + { internalType: "uint256", name: "userNonce", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + ], + internalType: "struct IRelayUtils.RelayParams", + name: "relayParams", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bool", name: "shouldAdd", type: "bool" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "desChainId", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + { internalType: "bytes", name: "signature", type: "bytes" }, + ], + internalType: "struct SubaccountApproval", + name: "subaccountApproval", + type: "tuple", + }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "subaccount", type: "address" }, + { + components: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "uint256", name: "executionFeeIncrease", type: "uint256" }, + ], + internalType: "struct IRelayUtils.UpdateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/SubaccountRouter.json b/sdk/src/abis/SubaccountRouter.json deleted file mode 100644 index 8f55ca8aef..0000000000 --- a/sdk/src/abis/SubaccountRouter.json +++ /dev/null @@ -1,602 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract Router", - "name": "_router", - "type": "address" - }, - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - }, - { - "internalType": "contract DataStore", - "name": "_dataStore", - "type": "address" - }, - { - "internalType": "contract EventEmitter", - "name": "_eventEmitter", - "type": "address" - }, - { - "internalType": "contract IOrderHandler", - "name": "_orderHandler", - "type": "address" - }, - { - "internalType": "contract OrderVault", - "name": "_orderVault", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "DisabledFeature", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyHoldingAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyOrder", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "EmptyTokenTranferGasLimit", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - } - ], - "name": "InvalidNativeTokenSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenTransferError", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "reason", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "returndata", - "type": "bytes" - } - ], - "name": "TokenTransferReverted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - } - ], - "name": "addSubaccount", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsAddresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParamsNumbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - }, - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "bytes32[]", - "name": "dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct IBaseOrderUtils.CreateOrderParams", - "name": "params", - "type": "tuple" - } - ], - "name": "createOrder", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "dataStore", - "outputs": [ - { - "internalType": "contract DataStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eventEmitter", - "outputs": [ - { - "internalType": "contract EventEmitter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "orderHandler", - "outputs": [ - { - "internalType": "contract IOrderHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "orderVault", - "outputs": [ - { - "internalType": "contract OrderVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - } - ], - "name": "removeSubaccount", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "contract Router", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendNativeToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "sendWnt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "integrationId", - "type": "bytes32" - } - ], - "name": "setIntegrationId", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "maxAllowedCount", - "type": "uint256" - } - ], - "name": "setMaxAllowedSubaccountActionCount", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setSubaccountAutoTopUpAmount", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "subaccount", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "actionType", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "setSubaccountExpiresAt", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - } - ], - "name": "updateOrder", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] -} diff --git a/sdk/src/abis/SubaccountRouter.ts b/sdk/src/abis/SubaccountRouter.ts new file mode 100644 index 0000000000..a8bdd21c6b --- /dev/null +++ b/sdk/src/abis/SubaccountRouter.ts @@ -0,0 +1,257 @@ +export default [ + { + inputs: [ + { internalType: "contract Router", name: "_router", type: "address" }, + { internalType: "contract RoleStore", name: "_roleStore", type: "address" }, + { internalType: "contract DataStore", name: "_dataStore", type: "address" }, + { internalType: "contract EventEmitter", name: "_eventEmitter", type: "address" }, + { internalType: "contract IOrderHandler", name: "_orderHandler", type: "address" }, + { internalType: "contract OrderVault", name: "_orderVault", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], name: "DisabledFeature", type: "error" }, + { inputs: [], name: "EmptyHoldingAddress", type: "error" }, + { inputs: [], name: "EmptyOrder", type: "error" }, + { inputs: [], name: "EmptyReceiver", type: "error" }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "EmptyTokenTranferGasLimit", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "msgSender", type: "address" }], + name: "InvalidNativeTokenSender", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "TokenTransferError", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "string", name: "reason", type: "string" }, + { indexed: false, internalType: "bytes", name: "returndata", type: "bytes" }, + ], + name: "TokenTransferReverted", + type: "event", + }, + { + inputs: [{ internalType: "address", name: "subaccount", type: "address" }], + name: "addSubaccount", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "key", type: "bytes32" }], + name: "cancelOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { + components: [ + { + components: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsAddresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParamsNumbers", + name: "numbers", + type: "tuple", + }, + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "bytes32[]", name: "dataList", type: "bytes32[]" }, + ], + internalType: "struct IBaseOrderUtils.CreateOrderParams", + name: "params", + type: "tuple", + }, + ], + name: "createOrder", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "dataStore", + outputs: [{ internalType: "contract DataStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "eventEmitter", + outputs: [{ internalType: "contract EventEmitter", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }], + name: "multicall", + outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "orderHandler", + outputs: [{ internalType: "contract IOrderHandler", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "orderVault", + outputs: [{ internalType: "contract OrderVault", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "subaccount", type: "address" }], + name: "removeSubaccount", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "contract Router", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendNativeToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendTokens", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "sendWnt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bytes32", name: "integrationId", type: "bytes32" }, + ], + name: "setIntegrationId", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "maxAllowedCount", type: "uint256" }, + ], + name: "setMaxAllowedSubaccountActionCount", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "setSubaccountAutoTopUpAmount", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "subaccount", type: "address" }, + { internalType: "bytes32", name: "actionType", type: "bytes32" }, + { internalType: "uint256", name: "expiresAt", type: "uint256" }, + ], + name: "setSubaccountExpiresAt", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "key", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + ], + name: "updateOrder", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; diff --git a/sdk/src/abis/SyntheticsReader.json b/sdk/src/abis/SyntheticsReader.json deleted file mode 100644 index 762bafb2cc..0000000000 --- a/sdk/src/abis/SyntheticsReader.json +++ /dev/null @@ -1,4905 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountOrders", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "orderKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct Order.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct Order.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - } - ], - "internalType": "struct Order.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct Order.Props", - "name": "order", - "type": "tuple" - } - ], - "internalType": "struct ReaderUtils.OrderInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices[]", - "name": "marketPrices", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountPositionInfoList", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtTime", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "position", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "affiliate", - "type": "address" - }, - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRebateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "adjustedAffiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalRebateAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionReferralFees", - "name": "referral", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "traderTier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionProFees", - "name": "pro", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "fundingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestFundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestLongTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestShortTokenClaimableFundingAmountPerSize", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFundingFees", - "name": "funding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "borrowingFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionBorrowingFees", - "name": "borrowing", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionUiFees", - "name": "ui", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionLiquidationFees", - "name": "liquidation", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "collateralTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmountExcludingFunding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFees", - "name": "fees", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "balanceWasImproved", - "type": "bool" - }, - { - "internalType": "int256", - "name": "proportionalPendingImpactUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "totalImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "executionPriceResult", - "type": "tuple" - }, - { - "internalType": "int256", - "name": "basePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "uncappedBasePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlAfterPriceImpactUsd", - "type": "int256" - } - ], - "internalType": "struct ReaderPositionUtils.PositionInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountPositions", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtTime", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - } - ], - "name": "getAdlState", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getDeposit", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct Deposit.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "initialLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct Deposit.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct Deposit.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct Deposit.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "longTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "enum ISwapPricingUtils.SwapPricingType", - "name": "swapPricingType", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "includeVirtualInventoryImpact", - "type": "bool" - } - ], - "name": "getDepositAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionSizeInTokens", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "sizeDeltaUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "name": "getExecutionPrice", - "outputs": [ - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "balanceWasImproved", - "type": "bool" - }, - { - "internalType": "int256", - "name": "proportionalPendingImpactUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "totalImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "key", - "type": "address" - } - ], - "name": "getMarket", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "getMarketBySalt", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - } - ], - "name": "getMarketInfo", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForLongs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForShorts", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSize", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSize", - "type": "tuple" - } - ], - "internalType": "struct ReaderUtils.BaseFundingValues", - "name": "baseFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "longsPayShorts", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "fundingFactorPerSecond", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "nextSavedFundingFactorPerSecond", - "type": "int256" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSizeDelta", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSizeDelta", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", - "name": "nextFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "virtualPoolAmountForLongToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "virtualPoolAmountForShortToken", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "virtualInventoryForPositions", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.VirtualInventory", - "name": "virtualInventory", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isDisabled", - "type": "bool" - } - ], - "internalType": "struct ReaderUtils.MarketInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices[]", - "name": "marketPricesList", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getMarketInfoList", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForLongs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForShorts", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSize", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSize", - "type": "tuple" - } - ], - "internalType": "struct ReaderUtils.BaseFundingValues", - "name": "baseFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "longsPayShorts", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "fundingFactorPerSecond", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "nextSavedFundingFactorPerSecond", - "type": "int256" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSizeDelta", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSizeDelta", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", - "name": "nextFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "virtualPoolAmountForLongToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "virtualPoolAmountForShortToken", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "virtualInventoryForPositions", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.VirtualInventory", - "name": "virtualInventory", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isDisabled", - "type": "bool" - } - ], - "internalType": "struct ReaderUtils.MarketInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "pnlFactorType", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getMarketTokenPrice", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "components": [ - { - "internalType": "int256", - "name": "poolValue", - "type": "int256" - }, - { - "internalType": "int256", - "name": "longPnl", - "type": "int256" - }, - { - "internalType": "int256", - "name": "shortPnl", - "type": "int256" - }, - { - "internalType": "int256", - "name": "netPnl", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "longTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowingFees", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeePoolFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "impactPoolAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lentImpactPoolAmount", - "type": "uint256" - } - ], - "internalType": "struct MarketPoolValueInfo.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getMarkets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getNetPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getOpenInterestWithPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getOrder", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "cancellationReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct Order.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validFromTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct Order.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - }, - { - "internalType": "bool", - "name": "autoCancel", - "type": "bool" - } - ], - "internalType": "struct Order.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct Order.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "getPendingPositionImpactPoolDistributionAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketAddress", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getPnlToPoolFactor", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getPosition", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtTime", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "bool", - "name": "usePositionSizeAsSizeDeltaUsd", - "type": "bool" - } - ], - "name": "getPositionInfo", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtTime", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "position", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "affiliate", - "type": "address" - }, - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRebateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "adjustedAffiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalRebateAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionReferralFees", - "name": "referral", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "traderTier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionProFees", - "name": "pro", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "fundingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestFundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestLongTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestShortTokenClaimableFundingAmountPerSize", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFundingFees", - "name": "funding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "borrowingFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionBorrowingFees", - "name": "borrowing", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionUiFees", - "name": "ui", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionLiquidationFees", - "name": "liquidation", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "collateralTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmountExcludingFunding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFees", - "name": "fees", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "balanceWasImproved", - "type": "bool" - }, - { - "internalType": "int256", - "name": "proportionalPendingImpactUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "totalImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "executionPriceResult", - "type": "tuple" - }, - { - "internalType": "int256", - "name": "basePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "uncappedBasePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlAfterPriceImpactUsd", - "type": "int256" - } - ], - "internalType": "struct ReaderPositionUtils.PositionInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "bytes32[]", - "name": "positionKeys", - "type": "bytes32[]" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices[]", - "name": "prices", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getPositionInfoList", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "pendingImpactAmount", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtTime", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "position", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "affiliate", - "type": "address" - }, - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRebateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "adjustedAffiliateRewardFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalRebateAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionReferralFees", - "name": "referral", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "traderTier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionProFees", - "name": "pro", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "fundingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestFundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestLongTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestShortTokenClaimableFundingAmountPerSize", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFundingFees", - "name": "funding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "borrowingFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionBorrowingFees", - "name": "borrowing", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionUiFees", - "name": "ui", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionLiquidationFees", - "name": "liquidation", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "collateralTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmountExcludingFunding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalDiscountAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFees", - "name": "fees", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "balanceWasImproved", - "type": "bool" - }, - { - "internalType": "int256", - "name": "proportionalPendingImpactUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "totalImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "executionPriceResult", - "type": "tuple" - }, - { - "internalType": "int256", - "name": "basePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "uncappedBasePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlAfterPriceImpactUsd", - "type": "int256" - } - ], - "internalType": "struct ReaderPositionUtils.PositionInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - } - ], - "name": "getPositionPnlUsd", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getShift", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "fromMarket", - "type": "address" - }, - { - "internalType": "address", - "name": "toMarket", - "type": "address" - } - ], - "internalType": "struct Shift.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct Shift.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct Shift.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getSwapAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountAfterFees", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct SwapPricingUtils.SwapFees", - "name": "fees", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "tokenInPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "tokenOutPrice", - "type": "tuple" - } - ], - "name": "getSwapPriceImpact", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getWithdrawal", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct Withdrawal.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "srcChainId", - "type": "uint256" - } - ], - "internalType": "struct Withdrawal.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct Withdrawal.Flags", - "name": "flags", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_dataList", - "type": "bytes32[]" - } - ], - "internalType": "struct Withdrawal.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "enum ISwapPricingUtils.SwapPricingType", - "name": "swapPricingType", - "type": "uint8" - } - ], - "name": "getWithdrawalAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "shouldValidateMinCollateralUsd", - "type": "bool" - }, - { - "internalType": "bool", - "name": "forLiquidation", - "type": "bool" - } - ], - "name": "isPositionLiquidatable", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "components": [ - { - "internalType": "int256", - "name": "remainingCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "minCollateralUsdForLeverage", - "type": "int256" - } - ], - "internalType": "struct PositionUtils.IsPositionLiquidatableInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/SyntheticsReader.ts b/sdk/src/abis/SyntheticsReader.ts new file mode 100644 index 0000000000..ba99d18a16 --- /dev/null +++ b/sdk/src/abis/SyntheticsReader.ts @@ -0,0 +1,2179 @@ +export default [ + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAccountOrders", + outputs: [ + { + components: [ + { internalType: "bytes32", name: "orderKey", type: "bytes32" }, + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct Order.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { + internalType: "enum Order.DecreasePositionSwapType", + name: "decreasePositionSwapType", + type: "uint8", + }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct Order.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isFrozen", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + ], + internalType: "struct Order.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct Order.Props", + name: "order", + type: "tuple", + }, + ], + internalType: "struct ReaderUtils.OrderInfo[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract IReferralStorage", name: "referralStorage", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address[]", name: "markets", type: "address[]" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices[]", + name: "marketPrices", + type: "tuple[]", + }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAccountPositionInfoList", + outputs: [ + { + components: [ + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "collateralToken", type: "address" }, + ], + internalType: "struct Position.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "uint256", name: "borrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "fundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "longTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "shortTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "increasedAtTime", type: "uint256" }, + { internalType: "uint256", name: "decreasedAtTime", type: "uint256" }, + ], + internalType: "struct Position.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "isLong", type: "bool" }], + internalType: "struct Position.Flags", + name: "flags", + type: "tuple", + }, + ], + internalType: "struct Position.Props", + name: "position", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "address", name: "affiliate", type: "address" }, + { internalType: "address", name: "trader", type: "address" }, + { internalType: "uint256", name: "totalRebateFactor", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "adjustedAffiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "totalRebateAmount", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionReferralFees", + name: "referral", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "traderTier", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionProFees", + name: "pro", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "fundingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "latestFundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestLongTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestShortTokenClaimableFundingAmountPerSize", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFundingFees", + name: "funding", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "borrowingFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionBorrowingFees", + name: "borrowing", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "uint256", name: "uiFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "uiFeeAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionUiFees", + name: "ui", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionLiquidationFees", + name: "liquidation", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "collateralTokenPrice", + type: "tuple", + }, + { internalType: "uint256", name: "positionFeeFactor", type: "uint256" }, + { internalType: "uint256", name: "protocolFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "positionFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "feeReceiverAmount", type: "uint256" }, + { internalType: "uint256", name: "feeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmountExcludingFunding", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmount", type: "uint256" }, + { internalType: "uint256", name: "totalDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFees", + name: "fees", + type: "tuple", + }, + { + components: [ + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "executionPrice", type: "uint256" }, + { internalType: "bool", name: "balanceWasImproved", type: "bool" }, + { internalType: "int256", name: "proportionalPendingImpactUsd", type: "int256" }, + { internalType: "int256", name: "totalImpactUsd", type: "int256" }, + { internalType: "uint256", name: "priceImpactDiffUsd", type: "uint256" }, + ], + internalType: "struct ReaderPricingUtils.ExecutionPriceResult", + name: "executionPriceResult", + type: "tuple", + }, + { internalType: "int256", name: "basePnlUsd", type: "int256" }, + { internalType: "int256", name: "uncappedBasePnlUsd", type: "int256" }, + { internalType: "int256", name: "pnlAfterPriceImpactUsd", type: "int256" }, + ], + internalType: "struct ReaderPositionUtils.PositionInfo[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getAccountPositions", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "collateralToken", type: "address" }, + ], + internalType: "struct Position.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "uint256", name: "borrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "fundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "longTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "shortTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "increasedAtTime", type: "uint256" }, + { internalType: "uint256", name: "decreasedAtTime", type: "uint256" }, + ], + internalType: "struct Position.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "isLong", type: "bool" }], + internalType: "struct Position.Flags", + name: "flags", + type: "tuple", + }, + ], + internalType: "struct Position.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "bool", name: "isLong", type: "bool" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + ], + name: "getAdlState", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bool", name: "", type: "bool" }, + { internalType: "int256", name: "", type: "int256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getDeposit", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialLongToken", type: "address" }, + { internalType: "address", name: "initialShortToken", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct Deposit.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "initialLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "initialShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct Deposit.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }], + internalType: "struct Deposit.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct Deposit.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "uint256", name: "longTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "shortTokenAmount", type: "uint256" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "enum ISwapPricingUtils.SwapPricingType", name: "swapPricingType", type: "uint8" }, + { internalType: "bool", name: "includeVirtualInventoryImpact", type: "bool" }, + ], + name: "getDepositAmountOut", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "marketKey", type: "address" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "uint256", name: "positionSizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "positionSizeInTokens", type: "uint256" }, + { internalType: "int256", name: "sizeDeltaUsd", type: "int256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "bool", name: "isLong", type: "bool" }, + ], + name: "getExecutionPrice", + outputs: [ + { + components: [ + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "executionPrice", type: "uint256" }, + { internalType: "bool", name: "balanceWasImproved", type: "bool" }, + { internalType: "int256", name: "proportionalPendingImpactUsd", type: "int256" }, + { internalType: "int256", name: "totalImpactUsd", type: "int256" }, + { internalType: "uint256", name: "priceImpactDiffUsd", type: "uint256" }, + ], + internalType: "struct ReaderPricingUtils.ExecutionPriceResult", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "key", type: "address" }, + ], + name: "getMarket", + outputs: [ + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "salt", type: "bytes32" }, + ], + name: "getMarketBySalt", + outputs: [ + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "address", name: "marketKey", type: "address" }, + ], + name: "getMarketInfo", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { internalType: "uint256", name: "borrowingFactorPerSecondForLongs", type: "uint256" }, + { internalType: "uint256", name: "borrowingFactorPerSecondForShorts", type: "uint256" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "fundingFeeAmountPerSize", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "claimableFundingAmountPerSize", + type: "tuple", + }, + ], + internalType: "struct ReaderUtils.BaseFundingValues", + name: "baseFunding", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "longsPayShorts", type: "bool" }, + { internalType: "uint256", name: "fundingFactorPerSecond", type: "uint256" }, + { internalType: "int256", name: "nextSavedFundingFactorPerSecond", type: "int256" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "fundingFeeAmountPerSizeDelta", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "claimableFundingAmountPerSizeDelta", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.GetNextFundingAmountPerSizeResult", + name: "nextFunding", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "virtualPoolAmountForLongToken", type: "uint256" }, + { internalType: "uint256", name: "virtualPoolAmountForShortToken", type: "uint256" }, + { internalType: "int256", name: "virtualInventoryForPositions", type: "int256" }, + ], + internalType: "struct ReaderUtils.VirtualInventory", + name: "virtualInventory", + type: "tuple", + }, + { internalType: "bool", name: "isDisabled", type: "bool" }, + ], + internalType: "struct ReaderUtils.MarketInfo", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices[]", + name: "marketPricesList", + type: "tuple[]", + }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getMarketInfoList", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { internalType: "uint256", name: "borrowingFactorPerSecondForLongs", type: "uint256" }, + { internalType: "uint256", name: "borrowingFactorPerSecondForShorts", type: "uint256" }, + { + components: [ + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "fundingFeeAmountPerSize", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "claimableFundingAmountPerSize", + type: "tuple", + }, + ], + internalType: "struct ReaderUtils.BaseFundingValues", + name: "baseFunding", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "longsPayShorts", type: "bool" }, + { internalType: "uint256", name: "fundingFactorPerSecond", type: "uint256" }, + { internalType: "int256", name: "nextSavedFundingFactorPerSecond", type: "int256" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "fundingFeeAmountPerSizeDelta", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "long", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "longToken", type: "uint256" }, + { internalType: "uint256", name: "shortToken", type: "uint256" }, + ], + internalType: "struct MarketUtils.CollateralType", + name: "short", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.PositionType", + name: "claimableFundingAmountPerSizeDelta", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.GetNextFundingAmountPerSizeResult", + name: "nextFunding", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "virtualPoolAmountForLongToken", type: "uint256" }, + { internalType: "uint256", name: "virtualPoolAmountForShortToken", type: "uint256" }, + { internalType: "int256", name: "virtualInventoryForPositions", type: "int256" }, + ], + internalType: "struct ReaderUtils.VirtualInventory", + name: "virtualInventory", + type: "tuple", + }, + { internalType: "bool", name: "isDisabled", type: "bool" }, + ], + internalType: "struct ReaderUtils.MarketInfo[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + { internalType: "bytes32", name: "pnlFactorType", type: "bytes32" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getMarketTokenPrice", + outputs: [ + { internalType: "int256", name: "", type: "int256" }, + { + components: [ + { internalType: "int256", name: "poolValue", type: "int256" }, + { internalType: "int256", name: "longPnl", type: "int256" }, + { internalType: "int256", name: "shortPnl", type: "int256" }, + { internalType: "int256", name: "netPnl", type: "int256" }, + { internalType: "uint256", name: "longTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "shortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "longTokenUsd", type: "uint256" }, + { internalType: "uint256", name: "shortTokenUsd", type: "uint256" }, + { internalType: "uint256", name: "totalBorrowingFees", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeePoolFactor", type: "uint256" }, + { internalType: "uint256", name: "impactPoolAmount", type: "uint256" }, + { internalType: "uint256", name: "lentImpactPoolAmount", type: "uint256" }, + ], + internalType: "struct MarketPoolValueInfo.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "uint256", name: "start", type: "uint256" }, + { internalType: "uint256", name: "end", type: "uint256" }, + ], + name: "getMarkets", + outputs: [ + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getNetPnl", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getOpenInterestWithPnl", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getOrder", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "cancellationReceiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "initialCollateralToken", type: "address" }, + { internalType: "address[]", name: "swapPath", type: "address[]" }, + ], + internalType: "struct Order.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "enum Order.OrderType", name: "orderType", type: "uint8" }, + { internalType: "enum Order.DecreasePositionSwapType", name: "decreasePositionSwapType", type: "uint8" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "uint256", name: "initialCollateralDeltaAmount", type: "uint256" }, + { internalType: "uint256", name: "triggerPrice", type: "uint256" }, + { internalType: "uint256", name: "acceptablePrice", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "minOutputAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "validFromTime", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct Order.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [ + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }, + { internalType: "bool", name: "isFrozen", type: "bool" }, + { internalType: "bool", name: "autoCancel", type: "bool" }, + ], + internalType: "struct Order.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct Order.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + ], + name: "getPendingPositionImpactPoolDistributionAmount", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getPnl", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "marketAddress", type: "address" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "bool", name: "isLong", type: "bool" }, + { internalType: "bool", name: "maximize", type: "bool" }, + ], + name: "getPnlToPoolFactor", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getPosition", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "collateralToken", type: "address" }, + ], + internalType: "struct Position.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "uint256", name: "borrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "fundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "longTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "shortTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "increasedAtTime", type: "uint256" }, + { internalType: "uint256", name: "decreasedAtTime", type: "uint256" }, + ], + internalType: "struct Position.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "isLong", type: "bool" }], + internalType: "struct Position.Flags", + name: "flags", + type: "tuple", + }, + ], + internalType: "struct Position.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract IReferralStorage", name: "referralStorage", type: "address" }, + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "bool", name: "usePositionSizeAsSizeDeltaUsd", type: "bool" }, + ], + name: "getPositionInfo", + outputs: [ + { + components: [ + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "collateralToken", type: "address" }, + ], + internalType: "struct Position.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "uint256", name: "borrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "fundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "longTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "shortTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "increasedAtTime", type: "uint256" }, + { internalType: "uint256", name: "decreasedAtTime", type: "uint256" }, + ], + internalType: "struct Position.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "isLong", type: "bool" }], + internalType: "struct Position.Flags", + name: "flags", + type: "tuple", + }, + ], + internalType: "struct Position.Props", + name: "position", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "address", name: "affiliate", type: "address" }, + { internalType: "address", name: "trader", type: "address" }, + { internalType: "uint256", name: "totalRebateFactor", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "adjustedAffiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "totalRebateAmount", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionReferralFees", + name: "referral", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "traderTier", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionProFees", + name: "pro", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "fundingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "latestFundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestLongTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestShortTokenClaimableFundingAmountPerSize", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFundingFees", + name: "funding", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "borrowingFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionBorrowingFees", + name: "borrowing", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "uint256", name: "uiFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "uiFeeAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionUiFees", + name: "ui", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionLiquidationFees", + name: "liquidation", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "collateralTokenPrice", + type: "tuple", + }, + { internalType: "uint256", name: "positionFeeFactor", type: "uint256" }, + { internalType: "uint256", name: "protocolFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "positionFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "feeReceiverAmount", type: "uint256" }, + { internalType: "uint256", name: "feeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmountExcludingFunding", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmount", type: "uint256" }, + { internalType: "uint256", name: "totalDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFees", + name: "fees", + type: "tuple", + }, + { + components: [ + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "executionPrice", type: "uint256" }, + { internalType: "bool", name: "balanceWasImproved", type: "bool" }, + { internalType: "int256", name: "proportionalPendingImpactUsd", type: "int256" }, + { internalType: "int256", name: "totalImpactUsd", type: "int256" }, + { internalType: "uint256", name: "priceImpactDiffUsd", type: "uint256" }, + ], + internalType: "struct ReaderPricingUtils.ExecutionPriceResult", + name: "executionPriceResult", + type: "tuple", + }, + { internalType: "int256", name: "basePnlUsd", type: "int256" }, + { internalType: "int256", name: "uncappedBasePnlUsd", type: "int256" }, + { internalType: "int256", name: "pnlAfterPriceImpactUsd", type: "int256" }, + ], + internalType: "struct ReaderPositionUtils.PositionInfo", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract IReferralStorage", name: "referralStorage", type: "address" }, + { internalType: "bytes32[]", name: "positionKeys", type: "bytes32[]" }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices[]", + name: "prices", + type: "tuple[]", + }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + ], + name: "getPositionInfoList", + outputs: [ + { + components: [ + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address", name: "collateralToken", type: "address" }, + ], + internalType: "struct Position.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "sizeInUsd", type: "uint256" }, + { internalType: "uint256", name: "sizeInTokens", type: "uint256" }, + { internalType: "uint256", name: "collateralAmount", type: "uint256" }, + { internalType: "int256", name: "pendingImpactAmount", type: "int256" }, + { internalType: "uint256", name: "borrowingFactor", type: "uint256" }, + { internalType: "uint256", name: "fundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "longTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "shortTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "increasedAtTime", type: "uint256" }, + { internalType: "uint256", name: "decreasedAtTime", type: "uint256" }, + ], + internalType: "struct Position.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "isLong", type: "bool" }], + internalType: "struct Position.Flags", + name: "flags", + type: "tuple", + }, + ], + internalType: "struct Position.Props", + name: "position", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "bytes32", name: "referralCode", type: "bytes32" }, + { internalType: "address", name: "affiliate", type: "address" }, + { internalType: "address", name: "trader", type: "address" }, + { internalType: "uint256", name: "totalRebateFactor", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "adjustedAffiliateRewardFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "totalRebateAmount", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + { internalType: "uint256", name: "affiliateRewardAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionReferralFees", + name: "referral", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "traderTier", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountFactor", type: "uint256" }, + { internalType: "uint256", name: "traderDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionProFees", + name: "pro", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "fundingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "claimableShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "latestFundingFeeAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestLongTokenClaimableFundingAmountPerSize", type: "uint256" }, + { internalType: "uint256", name: "latestShortTokenClaimableFundingAmountPerSize", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFundingFees", + name: "funding", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "borrowingFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "borrowingFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionBorrowingFees", + name: "borrowing", + type: "tuple", + }, + { + components: [ + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "uint256", name: "uiFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "uiFeeAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionUiFees", + name: "ui", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "liquidationFeeAmountForFeeReceiver", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionLiquidationFees", + name: "liquidation", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "collateralTokenPrice", + type: "tuple", + }, + { internalType: "uint256", name: "positionFeeFactor", type: "uint256" }, + { internalType: "uint256", name: "protocolFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "positionFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "feeReceiverAmount", type: "uint256" }, + { internalType: "uint256", name: "feeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "positionFeeAmount", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmountExcludingFunding", type: "uint256" }, + { internalType: "uint256", name: "totalCostAmount", type: "uint256" }, + { internalType: "uint256", name: "totalDiscountAmount", type: "uint256" }, + ], + internalType: "struct PositionPricingUtils.PositionFees", + name: "fees", + type: "tuple", + }, + { + components: [ + { internalType: "int256", name: "priceImpactUsd", type: "int256" }, + { internalType: "uint256", name: "executionPrice", type: "uint256" }, + { internalType: "bool", name: "balanceWasImproved", type: "bool" }, + { internalType: "int256", name: "proportionalPendingImpactUsd", type: "int256" }, + { internalType: "int256", name: "totalImpactUsd", type: "int256" }, + { internalType: "uint256", name: "priceImpactDiffUsd", type: "uint256" }, + ], + internalType: "struct ReaderPricingUtils.ExecutionPriceResult", + name: "executionPriceResult", + type: "tuple", + }, + { internalType: "int256", name: "basePnlUsd", type: "int256" }, + { internalType: "int256", name: "uncappedBasePnlUsd", type: "int256" }, + { internalType: "int256", name: "pnlAfterPriceImpactUsd", type: "int256" }, + ], + internalType: "struct ReaderPositionUtils.PositionInfo[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { internalType: "uint256", name: "sizeDeltaUsd", type: "uint256" }, + ], + name: "getPositionPnlUsd", + outputs: [ + { internalType: "int256", name: "", type: "int256" }, + { internalType: "int256", name: "", type: "int256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getShift", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "fromMarket", type: "address" }, + { internalType: "address", name: "toMarket", type: "address" }, + ], + internalType: "struct Shift.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minMarketTokens", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct Shift.Numbers", + name: "numbers", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct Shift.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "address", name: "tokenIn", type: "address" }, + { internalType: "uint256", name: "amountIn", type: "uint256" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + ], + name: "getSwapAmountOut", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "int256", name: "", type: "int256" }, + { + components: [ + { internalType: "uint256", name: "feeReceiverAmount", type: "uint256" }, + { internalType: "uint256", name: "feeAmountForPool", type: "uint256" }, + { internalType: "uint256", name: "amountAfterFees", type: "uint256" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "uint256", name: "uiFeeReceiverFactor", type: "uint256" }, + { internalType: "uint256", name: "uiFeeAmount", type: "uint256" }, + ], + internalType: "struct SwapPricingUtils.SwapFees", + name: "fees", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "address", name: "marketKey", type: "address" }, + { internalType: "address", name: "tokenIn", type: "address" }, + { internalType: "address", name: "tokenOut", type: "address" }, + { internalType: "uint256", name: "amountIn", type: "uint256" }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "tokenInPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "tokenOutPrice", + type: "tuple", + }, + ], + name: "getSwapPriceImpact", + outputs: [ + { internalType: "int256", name: "", type: "int256" }, + { internalType: "int256", name: "", type: "int256" }, + { internalType: "int256", name: "", type: "int256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "bytes32", name: "key", type: "bytes32" }, + ], + name: "getWithdrawal", + outputs: [ + { + components: [ + { + components: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "address", name: "callbackContract", type: "address" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "address", name: "market", type: "address" }, + { internalType: "address[]", name: "longTokenSwapPath", type: "address[]" }, + { internalType: "address[]", name: "shortTokenSwapPath", type: "address[]" }, + ], + internalType: "struct Withdrawal.Addresses", + name: "addresses", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minLongTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "minShortTokenAmount", type: "uint256" }, + { internalType: "uint256", name: "updatedAtTime", type: "uint256" }, + { internalType: "uint256", name: "executionFee", type: "uint256" }, + { internalType: "uint256", name: "callbackGasLimit", type: "uint256" }, + { internalType: "uint256", name: "srcChainId", type: "uint256" }, + ], + internalType: "struct Withdrawal.Numbers", + name: "numbers", + type: "tuple", + }, + { + components: [{ internalType: "bool", name: "shouldUnwrapNativeToken", type: "bool" }], + internalType: "struct Withdrawal.Flags", + name: "flags", + type: "tuple", + }, + { internalType: "bytes32[]", name: "_dataList", type: "bytes32[]" }, + ], + internalType: "struct Withdrawal.Props", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "uint256", name: "marketTokenAmount", type: "uint256" }, + { internalType: "address", name: "uiFeeReceiver", type: "address" }, + { internalType: "enum ISwapPricingUtils.SwapPricingType", name: "swapPricingType", type: "uint8" }, + ], + name: "getWithdrawalAmountOut", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract DataStore", name: "dataStore", type: "address" }, + { internalType: "contract IReferralStorage", name: "referralStorage", type: "address" }, + { internalType: "bytes32", name: "positionKey", type: "bytes32" }, + { + components: [ + { internalType: "address", name: "marketToken", type: "address" }, + { internalType: "address", name: "indexToken", type: "address" }, + { internalType: "address", name: "longToken", type: "address" }, + { internalType: "address", name: "shortToken", type: "address" }, + ], + internalType: "struct Market.Props", + name: "market", + type: "tuple", + }, + { + components: [ + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "indexTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "longTokenPrice", + type: "tuple", + }, + { + components: [ + { internalType: "uint256", name: "min", type: "uint256" }, + { internalType: "uint256", name: "max", type: "uint256" }, + ], + internalType: "struct Price.Props", + name: "shortTokenPrice", + type: "tuple", + }, + ], + internalType: "struct MarketUtils.MarketPrices", + name: "prices", + type: "tuple", + }, + { internalType: "bool", name: "shouldValidateMinCollateralUsd", type: "bool" }, + { internalType: "bool", name: "forLiquidation", type: "bool" }, + ], + name: "isPositionLiquidatable", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "string", name: "", type: "string" }, + { + components: [ + { internalType: "int256", name: "remainingCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsd", type: "int256" }, + { internalType: "int256", name: "minCollateralUsdForLeverage", type: "int256" }, + ], + internalType: "struct PositionUtils.IsPositionLiquidatableInfo", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/SyntheticsRouter.json b/sdk/src/abis/SyntheticsRouter.json deleted file mode 100644 index 612b779bd3..0000000000 --- a/sdk/src/abis/SyntheticsRouter.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "contract RoleStore", - "name": "_roleStore", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "msgSender", - "type": "address" - }, - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "pluginTransfer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "roleStore", - "outputs": [ - { - "internalType": "contract RoleStore", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/SyntheticsRouter.ts b/sdk/src/abis/SyntheticsRouter.ts new file mode 100644 index 0000000000..d48b9d58af --- /dev/null +++ b/sdk/src/abis/SyntheticsRouter.ts @@ -0,0 +1,34 @@ +export default [ + { + inputs: [{ internalType: "contract RoleStore", name: "_roleStore", type: "address" }], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { internalType: "address", name: "msgSender", type: "address" }, + { internalType: "string", name: "role", type: "string" }, + ], + name: "Unauthorized", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "receiver", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "pluginTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "roleStore", + outputs: [{ internalType: "contract RoleStore", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Timelock.json b/sdk/src/abis/Timelock.json deleted file mode 100644 index b16cde8017..0000000000 --- a/sdk/src/abis/Timelock.json +++ /dev/null @@ -1,1737 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Timelock", - "sourceName": "contracts/peripherals/Timelock.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_buffer", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_tokenManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_mintReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "_glpManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_rewardRouter", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_maxTokenSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxMarginFeeBasisPoints", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "ClearAction", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalApprove", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalMint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalPendingAction", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "vault", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "SignalRedeemUsdg", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "gov", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalSetGov", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "handler", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isActive", - "type": "bool" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalSetHandler", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "vault", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "priceFeed", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalSetPriceFeed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "vault", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenDecimals", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenWeight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "minProfitBps", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "maxUsdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isStable", - "type": "bool" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isShortable", - "type": "bool" - } - ], - "name": "SignalVaultSetTokenConfig", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "action", - "type": "bytes32" - } - ], - "name": "SignalWithdrawToken", - "type": "event" - }, - { - "inputs": [], - "name": "MAX_BUFFER", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FUNDING_RATE_FACTOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_LEVERAGE_VALIDATION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vester", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_amounts", - "type": "uint256[]" - } - ], - "name": "batchSetBonusRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "batchWithdrawFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "buffer", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_action", - "type": "bytes32" - } - ], - "name": "cancelAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - } - ], - "name": "disableLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - } - ], - "name": "enableLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "glpManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_referralStorage", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_code", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_newAccount", - "type": "address" - } - ], - "name": "govSetCodeOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "initGlpManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "initRewardRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isKeeper", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "marginFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxMarginFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxTokenSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintReceiver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "pendingActions", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "processMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "redeemUsdg", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_admin", - "type": "address" - } - ], - "name": "setAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_buffer", - "type": "uint256" - } - ], - "name": "setBuffer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setContractHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_admin", - "type": "address" - } - ], - "name": "setExternalAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableTaxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mintBurnFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_swapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableSwapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_hasDynamicFees", - "type": "bool" - } - ], - "name": "setFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_fundingInterval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "setFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_cooldownDuration", - "type": "uint256" - } - ], - "name": "setGlpCooldownDuration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "_inPrivateLiquidationMode", - "type": "bool" - } - ], - "name": "setInPrivateLiquidationMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "bool", - "name": "_inPrivateTransferMode", - "type": "bool" - } - ], - "name": "setInPrivateTransferMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLeverageEnabled", - "type": "bool" - } - ], - "name": "setIsLeverageEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isSwapEnabled", - "type": "bool" - } - ], - "name": "setIsSwapEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setKeeper", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setLiquidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxMarginFeeBasisPoints", - "type": "uint256" - } - ], - "name": "setMarginFeeBasisPoints", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_maxGasPrice", - "type": "uint256" - } - ], - "name": "setMaxGasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setMaxGlobalShortSize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_maxLeverage", - "type": "uint256" - } - ], - "name": "setMaxLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - } - ], - "name": "setPriceFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_referralStorage", - "type": "address" - }, - { - "internalType": "address", - "name": "_referrer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tierId", - "type": "uint256" - } - ], - "name": "setReferrerTier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_shortsTrackerAveragePriceWeight", - "type": "uint256" - } - ], - "name": "setShortsTrackerAveragePriceWeight", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_shouldToggleIsLeverageEnabled", - "type": "bool" - } - ], - "name": "setShouldToggleIsLeverageEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableTaxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mintBurnFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_swapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableSwapFeeBasisPoints", - "type": "uint256" - } - ], - "name": "setSwapFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_referralStorage", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tierId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_totalRebate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_discountShare", - "type": "uint256" - } - ], - "name": "setTier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_bufferAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - } - ], - "name": "setTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_usdgAmounts", - "type": "uint256[]" - } - ], - "name": "setUsdgAmounts", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "contract IVaultUtils", - "name": "_vaultUtils", - "type": "address" - } - ], - "name": "setVaultUtils", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "shouldToggleIsLeverageEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "signalApprove", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "signalMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "signalRedeemUsdg", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "signalSetGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "signalSetHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - } - ], - "name": "signalSetPriceFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenDecimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isStable", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_isShortable", - "type": "bool" - } - ], - "name": "signalVaultSetTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "signalWithdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transferIn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - } - ], - "name": "updateUsdgSupply", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenDecimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isStable", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_isShortable", - "type": "bool" - } - ], - "name": "vaultSetTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Timelock.ts b/sdk/src/abis/Timelock.ts new file mode 100644 index 0000000000..f1097beaaf --- /dev/null +++ b/sdk/src/abis/Timelock.ts @@ -0,0 +1,776 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "_admin", type: "address" }, + { internalType: "uint256", name: "_buffer", type: "uint256" }, + { internalType: "address", name: "_tokenManager", type: "address" }, + { internalType: "address", name: "_mintReceiver", type: "address" }, + { internalType: "address", name: "_glpManager", type: "address" }, + { internalType: "address", name: "_rewardRouter", type: "address" }, + { internalType: "uint256", name: "_maxTokenSupply", type: "uint256" }, + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_maxMarginFeeBasisPoints", type: "uint256" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }], + name: "ClearAction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalApprove", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalMint", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }], + name: "SignalPendingAction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "vault", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "SignalRedeemUsdg", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "target", type: "address" }, + { indexed: false, internalType: "address", name: "gov", type: "address" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalSetGov", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "target", type: "address" }, + { indexed: false, internalType: "address", name: "handler", type: "address" }, + { indexed: false, internalType: "bool", name: "isActive", type: "bool" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalSetHandler", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "vault", type: "address" }, + { indexed: false, internalType: "address", name: "priceFeed", type: "address" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalSetPriceFeed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "vault", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "tokenDecimals", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "tokenWeight", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "minProfitBps", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "maxUsdgAmount", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isStable", type: "bool" }, + { indexed: false, internalType: "bool", name: "isShortable", type: "bool" }, + ], + name: "SignalVaultSetTokenConfig", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "target", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "action", type: "bytes32" }, + ], + name: "SignalWithdrawToken", + type: "event", + }, + { + inputs: [], + name: "MAX_BUFFER", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FUNDING_RATE_FACTOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_LEVERAGE_VALIDATION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "admin", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vester", type: "address" }, + { internalType: "address[]", name: "_accounts", type: "address[]" }, + { internalType: "uint256[]", name: "_amounts", type: "uint256[]" }, + ], + name: "batchSetBonusRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "batchWithdrawFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "buffer", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "_action", type: "bytes32" }], + name: "cancelAction", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_vault", type: "address" }], + name: "disableLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_vault", type: "address" }], + name: "enableLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "glpManager", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_referralStorage", type: "address" }, + { internalType: "bytes32", name: "_code", type: "bytes32" }, + { internalType: "address", name: "_newAccount", type: "address" }, + ], + name: "govSetCodeOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "initGlpManager", outputs: [], stateMutability: "nonpayable", type: "function" }, + { inputs: [], name: "initRewardRouter", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isKeeper", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "marginFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxMarginFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxTokenSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "mintReceiver", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "pendingActions", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "processMint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "redeemUsdg", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + ], + name: "removeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "rewardRouter", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_admin", type: "address" }], + name: "setAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_buffer", type: "uint256" }], + name: "setBuffer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setContractHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_admin", type: "address" }, + ], + name: "setExternalAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableTaxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_mintBurnFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_swapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableSwapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_minProfitTime", type: "uint256" }, + { internalType: "bool", name: "_hasDynamicFees", type: "bool" }, + ], + name: "setFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "uint256", name: "_fundingInterval", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "setFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_cooldownDuration", type: "uint256" }], + name: "setGlpCooldownDuration", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_gov", type: "address" }, + ], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "bool", name: "_inPrivateLiquidationMode", type: "bool" }, + ], + name: "setInPrivateLiquidationMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "bool", name: "_inPrivateTransferMode", type: "bool" }, + ], + name: "setInPrivateTransferMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "bool", name: "_isLeverageEnabled", type: "bool" }, + ], + name: "setIsLeverageEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "bool", name: "_isSwapEnabled", type: "bool" }, + ], + name: "setIsSwapEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_keeper", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setKeeper", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_liquidator", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setLiquidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_maxMarginFeeBasisPoints", type: "uint256" }, + ], + name: "setMarginFeeBasisPoints", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "uint256", name: "_maxGasPrice", type: "uint256" }, + ], + name: "setMaxGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setMaxGlobalShortSize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "uint256", name: "_maxLeverage", type: "uint256" }, + ], + name: "setMaxLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_priceFeed", type: "address" }, + ], + name: "setPriceFeed", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_referralStorage", type: "address" }, + { internalType: "address", name: "_referrer", type: "address" }, + { internalType: "uint256", name: "_tierId", type: "uint256" }, + ], + name: "setReferrerTier", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_shortsTrackerAveragePriceWeight", type: "uint256" }], + name: "setShortsTrackerAveragePriceWeight", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_shouldToggleIsLeverageEnabled", type: "bool" }], + name: "setShouldToggleIsLeverageEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableTaxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_mintBurnFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_swapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableSwapFeeBasisPoints", type: "uint256" }, + ], + name: "setSwapFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_referralStorage", type: "address" }, + { internalType: "uint256", name: "_tierId", type: "uint256" }, + { internalType: "uint256", name: "_totalRebate", type: "uint256" }, + { internalType: "uint256", name: "_discountShare", type: "uint256" }, + ], + name: "setTier", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "uint256", name: "_bufferAmount", type: "uint256" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + ], + name: "setTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + { internalType: "uint256[]", name: "_usdgAmounts", type: "uint256[]" }, + ], + name: "setUsdgAmounts", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "contract IVaultUtils", name: "_vaultUtils", type: "address" }, + ], + name: "setVaultUtils", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "shouldToggleIsLeverageEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_spender", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "signalApprove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "signalMint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "signalRedeemUsdg", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_gov", type: "address" }, + ], + name: "signalSetGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "signalSetHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_priceFeed", type: "address" }, + ], + name: "signalSetPriceFeed", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenDecimals", type: "uint256" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "bool", name: "_isStable", type: "bool" }, + { internalType: "bool", name: "_isShortable", type: "bool" }, + ], + name: "signalVaultSetTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "signalWithdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "tokenManager", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_sender", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "transferIn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "usdgAmount", type: "uint256" }], + name: "updateUsdgSupply", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenDecimals", type: "uint256" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "bool", name: "_isStable", type: "bool" }, + { internalType: "bool", name: "_isShortable", type: "bool" }, + ], + name: "vaultSetTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "withdrawFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_target", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Token.json b/sdk/src/abis/Token.json deleted file mode 100644 index bf997056aa..0000000000 --- a/sdk/src/abis/Token.json +++ /dev/null @@ -1,345 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Token", - "sourceName": "contracts/tokens/Token.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Token.ts b/sdk/src/abis/Token.ts new file mode 100644 index 0000000000..bff07840fe --- /dev/null +++ b/sdk/src/abis/Token.ts @@ -0,0 +1,148 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "deposit", outputs: [], stateMutability: "payable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "token", type: "address" }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Treasury.json b/sdk/src/abis/Treasury.json deleted file mode 100644 index dfb36b749e..0000000000 --- a/sdk/src/abis/Treasury.json +++ /dev/null @@ -1,411 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Treasury", - "sourceName": "contracts/gambit-token/Treasury.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "addLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - } - ], - "name": "addWhitelists", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "busd", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "busdBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "busdHardCap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "busdReceived", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "busdSlotCap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "endSwap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_unlockTime", - "type": "uint256" - } - ], - "name": "extendUnlockTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "fund", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmt", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmtListingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gmtPresalePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_busdBasisPoints", - "type": "uint256" - } - ], - "name": "increaseBusdBasisPoints", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_addresses", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_values", - "type": "uint256[]" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isLiquidityAdded", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isSwapActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_accounts", - "type": "address[]" - } - ], - "name": "removeWhitelists", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fund", - "type": "address" - } - ], - "name": "setFund", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_busdAmount", - "type": "uint256" - } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "swapAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "swapWhitelist", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unlockTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "prevAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "nextAccount", - "type": "address" - } - ], - "name": "updateWhitelist", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Treasury.ts b/sdk/src/abis/Treasury.ts new file mode 100644 index 0000000000..d83f1b7c7d --- /dev/null +++ b/sdk/src/abis/Treasury.ts @@ -0,0 +1,204 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { inputs: [], name: "addLiquidity", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address[]", name: "_accounts", type: "address[]" }], + name: "addWhitelists", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "busd", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "busdBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "busdHardCap", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "busdReceived", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "busdSlotCap", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "endSwap", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "uint256", name: "_unlockTime", type: "uint256" }], + name: "extendUnlockTime", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fund", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmt", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmtListingPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gmtPresalePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_busdBasisPoints", type: "uint256" }], + name: "increaseBusdBasisPoints", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "_addresses", type: "address[]" }, + { internalType: "uint256[]", name: "_values", type: "uint256[]" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isLiquidityAdded", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isSwapActive", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address[]", name: "_accounts", type: "address[]" }], + name: "removeWhitelists", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_fund", type: "address" }], + name: "setFund", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_busdAmount", type: "uint256" }], + name: "swap", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "swapAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "swapWhitelist", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "unlockTime", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "prevAccount", type: "address" }, + { internalType: "address", name: "nextAccount", type: "address" }, + ], + name: "updateWhitelist", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/UniPool.json b/sdk/src/abis/UniPool.json deleted file mode 100644 index f03081271a..0000000000 --- a/sdk/src/abis/UniPool.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "UniPool", - "sourceName": "contracts/amm/UniPool.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "uint32[]", - "name": "", - "type": "uint32[]" - } - ], - "name": "observe", - "outputs": [ - { - "internalType": "int56[]", - "name": "tickCumulatives", - "type": "int56[]" - }, - { - "internalType": "uint160[]", - "name": "secondsPerLiquidityCumulativeX128s", - "type": "uint160[]" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "slot0", - "outputs": [ - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "internalType": "int24", - "name": "tick", - "type": "int24" - }, - { - "internalType": "uint16", - "name": "observationIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinality", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - }, - { - "internalType": "uint8", - "name": "feeProtocol", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "unlocked", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickSpacing", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "pure", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/UniPool.ts b/sdk/src/abis/UniPool.ts new file mode 100644 index 0000000000..7adfac77ff --- /dev/null +++ b/sdk/src/abis/UniPool.ts @@ -0,0 +1,34 @@ +export default [ + { + inputs: [{ internalType: "uint32[]", name: "", type: "uint32[]" }], + name: "observe", + outputs: [ + { internalType: "int56[]", name: "tickCumulatives", type: "int56[]" }, + { internalType: "uint160[]", name: "secondsPerLiquidityCumulativeX128s", type: "uint160[]" }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "slot0", + outputs: [ + { internalType: "uint160", name: "sqrtPriceX96", type: "uint160" }, + { internalType: "int24", name: "tick", type: "int24" }, + { internalType: "uint16", name: "observationIndex", type: "uint16" }, + { internalType: "uint16", name: "observationCardinality", type: "uint16" }, + { internalType: "uint16", name: "observationCardinalityNext", type: "uint16" }, + { internalType: "uint8", name: "feeProtocol", type: "uint8" }, + { internalType: "bool", name: "unlocked", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tickSpacing", + outputs: [{ internalType: "int24", name: "", type: "int24" }], + stateMutability: "pure", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/UniswapV2.json b/sdk/src/abis/UniswapV2.json deleted file mode 100644 index 0473efb8ad..0000000000 --- a/sdk/src/abis/UniswapV2.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "abi": [ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/UniswapV2.ts b/sdk/src/abis/UniswapV2.ts new file mode 100644 index 0000000000..d2a192775c --- /dev/null +++ b/sdk/src/abis/UniswapV2.ts @@ -0,0 +1,285 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "sender", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount0", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amount1", type: "uint256" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + ], + name: "Burn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "sender", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount0", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amount1", type: "uint256" }, + ], + name: "Mint", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "sender", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount0In", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amount1In", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amount0Out", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amount1Out", type: "uint256" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + ], + name: "Swap", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint112", name: "reserve0", type: "uint112" }, + { indexed: false, internalType: "uint112", name: "reserve1", type: "uint112" }, + ], + name: "Sync", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MINIMUM_LIQUIDITY", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PERMIT_TYPEHASH", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "to", type: "address" }], + name: "burn", + outputs: [ + { internalType: "uint256", name: "amount0", type: "uint256" }, + { internalType: "uint256", name: "amount1", type: "uint256" }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "factory", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getReserves", + outputs: [ + { internalType: "uint112", name: "_reserve0", type: "uint112" }, + { internalType: "uint112", name: "_reserve1", type: "uint112" }, + { internalType: "uint32", name: "_blockTimestampLast", type: "uint32" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token0", type: "address" }, + { internalType: "address", name: "_token1", type: "address" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "kLast", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "to", type: "address" }], + name: "mint", + outputs: [{ internalType: "uint256", name: "liquidity", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "nonces", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "uint256", name: "deadline", type: "uint256" }, + { internalType: "uint8", name: "v", type: "uint8" }, + { internalType: "bytes32", name: "r", type: "bytes32" }, + { internalType: "bytes32", name: "s", type: "bytes32" }, + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "price0CumulativeLast", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "price1CumulativeLast", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "to", type: "address" }], + name: "skim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "amount0Out", type: "uint256" }, + { internalType: "uint256", name: "amount1Out", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "swap", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "sync", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "token0", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "token1", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/UniswapV3Factory.json b/sdk/src/abis/UniswapV3Factory.json deleted file mode 100644 index c712812f49..0000000000 --- a/sdk/src/abis/UniswapV3Factory.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickSpacing", - "type": "int24" - } - ], - "name": "FeeAmountEnabled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnerChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "indexed": false, - "internalType": "int24", - "name": "tickSpacing", - "type": "int24" - }, - { - "indexed": false, - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "PoolCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenA", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenB", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "name": "createPool", - "outputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickSpacing", - "type": "int24" - } - ], - "name": "enableFeeAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "name": "feeAmountTickSpacing", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenA", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenB", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "name": "getPool", - "outputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "setOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/sdk/src/abis/UniswapV3Factory.ts b/sdk/src/abis/UniswapV3Factory.ts new file mode 100644 index 0000000000..645c2b8dfa --- /dev/null +++ b/sdk/src/abis/UniswapV3Factory.ts @@ -0,0 +1,198 @@ +export default [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + indexed: true, + internalType: "int24", + name: "tickSpacing", + type: "int24", + }, + ], + name: "FeeAmountEnabled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnerChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "token0", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "token1", + type: "address", + }, + { + indexed: true, + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + indexed: false, + internalType: "int24", + name: "tickSpacing", + type: "int24", + }, + { + indexed: false, + internalType: "address", + name: "pool", + type: "address", + }, + ], + name: "PoolCreated", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address", + }, + { + internalType: "address", + name: "tokenB", + type: "address", + }, + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + ], + name: "createPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + internalType: "int24", + name: "tickSpacing", + type: "int24", + }, + ], + name: "enableFeeAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + ], + name: "feeAmountTickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenA", + type: "address", + }, + { + internalType: "address", + name: "tokenB", + type: "address", + }, + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + ], + name: "getPool", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/UniswapV3Pool.json b/sdk/src/abis/UniswapV3Pool.json deleted file mode 100644 index 28ef0c4f85..0000000000 --- a/sdk/src/abis/UniswapV3Pool.json +++ /dev/null @@ -1,985 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "name": "Collect", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "name": "CollectProtocol", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "paid0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "paid1", - "type": "uint256" - } - ], - "name": "Flash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "observationCardinalityNextOld", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint16", - "name": "observationCardinalityNextNew", - "type": "uint16" - } - ], - "name": "IncreaseObservationCardinalityNext", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "indexed": false, - "internalType": "int24", - "name": "tick", - "type": "int24" - } - ], - "name": "Initialize", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol0Old", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol1Old", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol0New", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol1New", - "type": "uint8" - } - ], - "name": "SetFeeProtocol", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "int256", - "name": "amount0", - "type": "int256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "amount1", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "int24", - "name": "tick", - "type": "int24" - } - ], - "name": "Swap", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - } - ], - "name": "burn", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount0Requested", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Requested", - "type": "uint128" - } - ], - "name": "collect", - "outputs": [ - { - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint128", - "name": "amount0Requested", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Requested", - "type": "uint128" - } - ], - "name": "collectProtocol", - "outputs": [ - { - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint24", - "name": "", - "type": "uint24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGrowthGlobal0X128", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGrowthGlobal1X128", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "flash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - } - ], - "name": "increaseObservationCardinalityNext", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "liquidity", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLiquidityPerTick", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "observations", - "outputs": [ - { - "internalType": "uint32", - "name": "blockTimestamp", - "type": "uint32" - }, - { - "internalType": "int56", - "name": "tickCumulative", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityCumulativeX128", - "type": "uint160" - }, - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32[]", - "name": "secondsAgos", - "type": "uint32[]" - } - ], - "name": "observe", - "outputs": [ - { - "internalType": "int56[]", - "name": "tickCumulatives", - "type": "int56[]" - }, - { - "internalType": "uint160[]", - "name": "secondsPerLiquidityCumulativeX128s", - "type": "uint160[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint128", - "name": "_liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "tokensOwed0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "tokensOwed1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "protocolFees", - "outputs": [ - { - "internalType": "uint128", - "name": "token0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "token1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "feeProtocol0", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "feeProtocol1", - "type": "uint8" - } - ], - "name": "setFeeProtocol", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "slot0", - "outputs": [ - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "internalType": "int24", - "name": "tick", - "type": "int24" - }, - { - "internalType": "uint16", - "name": "observationIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinality", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - }, - { - "internalType": "uint8", - "name": "feeProtocol", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "unlocked", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - } - ], - "name": "snapshotCumulativesInside", - "outputs": [ - { - "internalType": "int56", - "name": "tickCumulativeInside", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityInsideX128", - "type": "uint160" - }, - { - "internalType": "uint32", - "name": "secondsInside", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "zeroForOne", - "type": "bool" - }, - { - "internalType": "int256", - "name": "amountSpecified", - "type": "int256" - }, - { - "internalType": "uint160", - "name": "sqrtPriceLimitX96", - "type": "uint160" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "int256", - "name": "amount0", - "type": "int256" - }, - { - "internalType": "int256", - "name": "amount1", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int16", - "name": "wordPosition", - "type": "int16" - } - ], - "name": "tickBitmap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickSpacing", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "tick", - "type": "int24" - } - ], - "name": "ticks", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidityGross", - "type": "uint128" - }, - { - "internalType": "int128", - "name": "liquidityNet", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "feeGrowthOutside0X128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthOutside1X128", - "type": "uint256" - }, - { - "internalType": "int56", - "name": "tickCumulativeOutside", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityOutsideX128", - "type": "uint160" - }, - { - "internalType": "uint32", - "name": "secondsOutside", - "type": "uint32" - }, - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/sdk/src/abis/UniswapV3Pool.ts b/sdk/src/abis/UniswapV3Pool.ts new file mode 100644 index 0000000000..f43d31a95a --- /dev/null +++ b/sdk/src/abis/UniswapV3Pool.ts @@ -0,0 +1,983 @@ +export default [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + name: "Burn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128", + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128", + }, + ], + name: "Collect", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint128", + name: "amount0", + type: "uint128", + }, + { + indexed: false, + internalType: "uint128", + name: "amount1", + type: "uint128", + }, + ], + name: "CollectProtocol", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "paid0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "paid1", + type: "uint256", + }, + ], + name: "Flash", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextOld", + type: "uint16", + }, + { + indexed: false, + internalType: "uint16", + name: "observationCardinalityNextNew", + type: "uint16", + }, + ], + name: "IncreaseObservationCardinalityNext", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160", + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24", + }, + ], + name: "Initialize", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + indexed: true, + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + indexed: false, + internalType: "uint128", + name: "amount", + type: "uint128", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + name: "Mint", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0Old", + type: "uint8", + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1Old", + type: "uint8", + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol0New", + type: "uint8", + }, + { + indexed: false, + internalType: "uint8", + name: "feeProtocol1New", + type: "uint8", + }, + ], + name: "SetFeeProtocol", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "int256", + name: "amount0", + type: "int256", + }, + { + indexed: false, + internalType: "int256", + name: "amount1", + type: "int256", + }, + { + indexed: false, + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160", + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + indexed: false, + internalType: "int24", + name: "tick", + type: "int24", + }, + ], + name: "Swap", + type: "event", + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + internalType: "uint128", + name: "amount", + type: "uint128", + }, + ], + name: "burn", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128", + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128", + }, + ], + name: "collect", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128", + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint128", + name: "amount0Requested", + type: "uint128", + }, + { + internalType: "uint128", + name: "amount1Requested", + type: "uint128", + }, + ], + name: "collectProtocol", + outputs: [ + { + internalType: "uint128", + name: "amount0", + type: "uint128", + }, + { + internalType: "uint128", + name: "amount1", + type: "uint128", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint24", + name: "", + type: "uint24", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeGrowthGlobal0X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeGrowthGlobal1X128", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "flash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16", + }, + ], + name: "increaseObservationCardinalityNext", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "liquidity", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxLiquidityPerTick", + outputs: [ + { + internalType: "uint128", + name: "", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + internalType: "uint128", + name: "amount", + type: "uint128", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "observations", + outputs: [ + { + internalType: "uint32", + name: "blockTimestamp", + type: "uint32", + }, + { + internalType: "int56", + name: "tickCumulative", + type: "int56", + }, + { + internalType: "uint160", + name: "secondsPerLiquidityCumulativeX128", + type: "uint160", + }, + { + internalType: "bool", + name: "initialized", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32[]", + name: "secondsAgos", + type: "uint32[]", + }, + ], + name: "observe", + outputs: [ + { + internalType: "int56[]", + name: "tickCumulatives", + type: "int56[]", + }, + { + internalType: "uint160[]", + name: "secondsPerLiquidityCumulativeX128s", + type: "uint160[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32", + }, + ], + name: "positions", + outputs: [ + { + internalType: "uint128", + name: "_liquidity", + type: "uint128", + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256", + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256", + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128", + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "protocolFees", + outputs: [ + { + internalType: "uint128", + name: "token0", + type: "uint128", + }, + { + internalType: "uint128", + name: "token1", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint8", + name: "feeProtocol0", + type: "uint8", + }, + { + internalType: "uint8", + name: "feeProtocol1", + type: "uint8", + }, + ], + name: "setFeeProtocol", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "slot0", + outputs: [ + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160", + }, + { + internalType: "int24", + name: "tick", + type: "int24", + }, + { + internalType: "uint16", + name: "observationIndex", + type: "uint16", + }, + { + internalType: "uint16", + name: "observationCardinality", + type: "uint16", + }, + { + internalType: "uint16", + name: "observationCardinalityNext", + type: "uint16", + }, + { + internalType: "uint8", + name: "feeProtocol", + type: "uint8", + }, + { + internalType: "bool", + name: "unlocked", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + ], + name: "snapshotCumulativesInside", + outputs: [ + { + internalType: "int56", + name: "tickCumulativeInside", + type: "int56", + }, + { + internalType: "uint160", + name: "secondsPerLiquidityInsideX128", + type: "uint160", + }, + { + internalType: "uint32", + name: "secondsInside", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "bool", + name: "zeroForOne", + type: "bool", + }, + { + internalType: "int256", + name: "amountSpecified", + type: "int256", + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "swap", + outputs: [ + { + internalType: "int256", + name: "amount0", + type: "int256", + }, + { + internalType: "int256", + name: "amount1", + type: "int256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "int16", + name: "wordPosition", + type: "int16", + }, + ], + name: "tickBitmap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tickSpacing", + outputs: [ + { + internalType: "int24", + name: "", + type: "int24", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "int24", + name: "tick", + type: "int24", + }, + ], + name: "ticks", + outputs: [ + { + internalType: "uint128", + name: "liquidityGross", + type: "uint128", + }, + { + internalType: "int128", + name: "liquidityNet", + type: "int128", + }, + { + internalType: "uint256", + name: "feeGrowthOutside0X128", + type: "uint256", + }, + { + internalType: "uint256", + name: "feeGrowthOutside1X128", + type: "uint256", + }, + { + internalType: "int56", + name: "tickCumulativeOutside", + type: "int56", + }, + { + internalType: "uint160", + name: "secondsPerLiquidityOutsideX128", + type: "uint160", + }, + { + internalType: "uint32", + name: "secondsOutside", + type: "uint32", + }, + { + internalType: "bool", + name: "initialized", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "token0", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "token1", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/UniswapV3PositionManager.json b/sdk/src/abis/UniswapV3PositionManager.json deleted file mode 100644 index 4ef07013d2..0000000000 --- a/sdk/src/abis/UniswapV3PositionManager.json +++ /dev/null @@ -1,991 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Collect", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "DecreaseLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "IncreaseLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "WETH9", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint128", - "name": "amount0Max", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Max", - "type": "uint128" - } - ], - "internalType": "struct INonfungiblePositionManager.CollectParams", - "name": "params", - "type": "tuple" - } - ], - "name": "collect", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - } - ], - "name": "createAndInitializePoolIfNecessary", - "outputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "internalType": "struct INonfungiblePositionManager.DecreaseLiquidityParams", - "name": "params", - "type": "tuple" - } - ], - "name": "decreaseLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "internalType": "struct INonfungiblePositionManager.IncreaseLiquidityParams", - "name": "params", - "type": "tuple" - } - ], - "name": "increaseLiquidity", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint256", - "name": "amount0Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "internalType": "struct INonfungiblePositionManager.MintParams", - "name": "params", - "type": "tuple" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint96", - "name": "nonce", - "type": "uint96" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "tokensOwed0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "tokensOwed1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "refundETH", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountMinimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "sweepToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountMinimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "unwrapWETH9", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/sdk/src/abis/UniswapV3PositionManager.ts b/sdk/src/abis/UniswapV3PositionManager.ts new file mode 100644 index 0000000000..af97d23d33 --- /dev/null +++ b/sdk/src/abis/UniswapV3PositionManager.ts @@ -0,0 +1,989 @@ +export default [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool", + }, + ], + name: "ApprovalForAll", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + name: "Collect", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + name: "DecreaseLiquidity", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + name: "IncreaseLiquidity", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PERMIT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "WETH9", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "burn", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint128", + name: "amount0Max", + type: "uint128", + }, + { + internalType: "uint128", + name: "amount1Max", + type: "uint128", + }, + ], + internalType: "struct INonfungiblePositionManager.CollectParams", + name: "params", + type: "tuple", + }, + ], + name: "collect", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token0", + type: "address", + }, + { + internalType: "address", + name: "token1", + type: "address", + }, + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160", + }, + ], + name: "createAndInitializePoolIfNecessary", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256", + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + ], + internalType: "struct INonfungiblePositionManager.DecreaseLiquidityParams", + name: "params", + type: "tuple", + }, + ], + name: "decreaseLiquidity", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount0Desired", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1Desired", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256", + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + ], + internalType: "struct INonfungiblePositionManager.IncreaseLiquidityParams", + name: "params", + type: "tuple", + }, + ], + name: "increaseLiquidity", + outputs: [ + { + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "token0", + type: "address", + }, + { + internalType: "address", + name: "token1", + type: "address", + }, + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + internalType: "uint256", + name: "amount0Desired", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1Desired", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + ], + internalType: "struct INonfungiblePositionManager.MintParams", + name: "params", + type: "tuple", + }, + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + { + internalType: "uint8", + name: "v", + type: "uint8", + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32", + }, + ], + name: "permit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "positions", + outputs: [ + { + internalType: "uint96", + name: "nonce", + type: "uint96", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "address", + name: "token0", + type: "address", + }, + { + internalType: "address", + name: "token1", + type: "address", + }, + { + internalType: "uint24", + name: "fee", + type: "uint24", + }, + { + internalType: "int24", + name: "tickLower", + type: "int24", + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24", + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128", + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256", + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256", + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128", + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "refundETH", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address", + }, + { + internalType: "bool", + name: "_approved", + type: "bool", + }, + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + ], + name: "sweepToken", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + ], + name: "unwrapWETH9", + outputs: [], + stateMutability: "payable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Vault.json b/sdk/src/abis/Vault.json deleted file mode 100644 index a787d83959..0000000000 --- a/sdk/src/abis/Vault.json +++ /dev/null @@ -1,3220 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Vault", - "sourceName": "contracts/core/Vault.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "BuyUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - } - ], - "name": "ClosePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectMarginFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectSwapFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "DecreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DirectPoolDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "IncreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "markPrice", - "type": "uint256" - } - ], - "name": "LiquidatePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "SellUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOutAfterFees", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fundingRate", - "type": "uint256" - } - ], - "name": "UpdateFundingRate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "hasProfit", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "delta", - "type": "uint256" - } - ], - "name": "UpdatePnl", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "markPrice", - "type": "uint256" - } - ], - "name": "UpdatePosition", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FUNDING_RATE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE_BASIS_POINTS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FUNDING_RATE_FACTOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_LIQUIDATION_FEE_USD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_FUNDING_RATE_INTERVAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_LEVERAGE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USDG_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "addRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_tokenDiv", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenMul", - "type": "address" - } - ], - "name": "adjustForDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allWhitelistedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "allWhitelistedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "approvedRouters", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bufferAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "buyUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "clearTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeFundingRates", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "decreasePosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "directPoolDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "errorController", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "errors", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "feeReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getEntryFundingRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_feeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_increment", - "type": "bool" - } - ], - "name": "getFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_entryFundingRate", - "type": "uint256" - } - ], - "name": "getFundingFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getGlobalShortDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMaxPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMinPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getNextAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getNextFundingRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getNextGlobalShortAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getPositionFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionKey", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - } - ], - "name": "getRedemptionAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateralUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getTargetUsdgAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getUtilisation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortAveragePrices", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortSizes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "guaranteedUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasDynamicFees", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inManagerMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateLiquidationMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "includeAmmPrice", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "increasePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - }, - { - "internalType": "address", - "name": "_usdg", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isLeverageEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isLiquidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isManager", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isSwapEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastFundingTimes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_feeReceiver", - "type": "address" - } - ], - "name": "liquidatePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "liquidationFeeUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "marginFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxGasPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxGlobalShortSizes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxUsdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "minProfitBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minProfitTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintBurnFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "poolAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "lastIncreasedTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "priceFeed", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "removeRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "reservedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "sellUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setBufferAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_errorCode", - "type": "uint256" - }, - { - "internalType": "string", - "name": "_error", - "type": "string" - } - ], - "name": "setError", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_errorController", - "type": "address" - } - ], - "name": "setErrorController", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableTaxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mintBurnFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_swapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableSwapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_hasDynamicFees", - "type": "bool" - } - ], - "name": "setFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_fundingInterval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "setFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inManagerMode", - "type": "bool" - } - ], - "name": "setInManagerMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateLiquidationMode", - "type": "bool" - } - ], - "name": "setInPrivateLiquidationMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isLeverageEnabled", - "type": "bool" - } - ], - "name": "setIsLeverageEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isSwapEnabled", - "type": "bool" - } - ], - "name": "setIsSwapEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setLiquidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_manager", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isManager", - "type": "bool" - } - ], - "name": "setManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxGasPrice", - "type": "uint256" - } - ], - "name": "setMaxGasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setMaxGlobalShortSize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxLeverage", - "type": "uint256" - } - ], - "name": "setMaxLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - } - ], - "name": "setPriceFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenDecimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isStable", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_isShortable", - "type": "bool" - } - ], - "name": "setTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setUsdgAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVaultUtils", - "name": "_vaultUtils", - "type": "address" - } - ], - "name": "setVaultUtils", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "shortableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableFundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableSwapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableTaxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "taxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenAmount", - "type": "uint256" - } - ], - "name": "tokenToUsdMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - } - ], - "name": "updateCumulativeFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newVault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "upgradeVault", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_price", - "type": "uint256" - } - ], - "name": "usdToToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdg", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "usdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "useSwapPricing", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_raise", - "type": "bool" - } - ], - "name": "validateLiquidation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "vaultUtils", - "outputs": [ - { - "internalType": "contract IVaultUtils", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "whitelistedTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "whitelistedTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawFees", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Vault.ts b/sdk/src/abis/Vault.ts new file mode 100644 index 0000000000..975f548582 --- /dev/null +++ b/sdk/src/abis/Vault.ts @@ -0,0 +1,1306 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "BuyUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + ], + name: "ClosePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectMarginFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectSwapFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "DecreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DirectPoolDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "IncreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + { indexed: false, internalType: "uint256", name: "markPrice", type: "uint256" }, + ], + name: "LiquidatePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "SellUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "tokenIn", type: "address" }, + { indexed: false, internalType: "address", name: "tokenOut", type: "address" }, + { indexed: false, internalType: "uint256", name: "amountIn", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOut", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOutAfterFees", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "Swap", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "fundingRate", type: "uint256" }, + ], + name: "UpdateFundingRate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "bool", name: "hasProfit", type: "bool" }, + { indexed: false, internalType: "uint256", name: "delta", type: "uint256" }, + ], + name: "UpdatePnl", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + { indexed: false, internalType: "uint256", name: "markPrice", type: "uint256" }, + ], + name: "UpdatePosition", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "FUNDING_RATE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FEE_BASIS_POINTS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FUNDING_RATE_FACTOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_LIQUIDATION_FEE_USD", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_FUNDING_RATE_INTERVAL", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_LEVERAGE", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "USDG_DECIMALS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "addRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "address", name: "_tokenDiv", type: "address" }, + { internalType: "address", name: "_tokenMul", type: "address" }, + ], + name: "adjustForDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "allWhitelistedTokens", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "allWhitelistedTokensLength", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "approvedRouters", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "bufferAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "buyUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "clearTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeFundingRates", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_collateralDelta", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "decreasePosition", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "directPoolDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "errorController", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "errors", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "feeReserves", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingInterval", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getEntryFundingRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgDelta", type: "uint256" }, + { internalType: "uint256", name: "_feeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "bool", name: "_increment", type: "bool" }, + ], + name: "getFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_entryFundingRate", type: "uint256" }, + ], + name: "getFundingFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getGlobalShortDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMaxPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMinPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getNextAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getNextFundingRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + ], + name: "getNextGlobalShortAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPosition", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + ], + name: "getPositionFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionKey", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + ], + name: "getRedemptionAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateral", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateralUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getTargetUsdgAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getUtilisation", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortAveragePrices", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortSizes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "guaranteedUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasDynamicFees", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inManagerMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateLiquidationMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "includeAmmPrice", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "increasePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_router", type: "address" }, + { internalType: "address", name: "_usdg", type: "address" }, + { internalType: "address", name: "_priceFeed", type: "address" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isLeverageEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isLiquidator", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isManager", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isSwapEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lastFundingTimes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_feeReceiver", type: "address" }, + ], + name: "liquidatePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "liquidationFeeUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "marginFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxGasPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxGlobalShortSizes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxUsdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "minProfitBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minProfitTime", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "mintBurnFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "poolAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "positions", + outputs: [ + { internalType: "uint256", name: "size", type: "uint256" }, + { internalType: "uint256", name: "collateral", type: "uint256" }, + { internalType: "uint256", name: "averagePrice", type: "uint256" }, + { internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { internalType: "int256", name: "realisedPnl", type: "int256" }, + { internalType: "uint256", name: "lastIncreasedTime", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "priceFeed", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "removeRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "reservedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "sellUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setBufferAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_errorCode", type: "uint256" }, + { internalType: "string", name: "_error", type: "string" }, + ], + name: "setError", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_errorController", type: "address" }], + name: "setErrorController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableTaxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_mintBurnFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_swapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableSwapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_minProfitTime", type: "uint256" }, + { internalType: "bool", name: "_hasDynamicFees", type: "bool" }, + ], + name: "setFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_fundingInterval", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "setFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inManagerMode", type: "bool" }], + name: "setInManagerMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateLiquidationMode", type: "bool" }], + name: "setInPrivateLiquidationMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isLeverageEnabled", type: "bool" }], + name: "setIsLeverageEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isSwapEnabled", type: "bool" }], + name: "setIsSwapEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_liquidator", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setLiquidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_manager", type: "address" }, + { internalType: "bool", name: "_isManager", type: "bool" }, + ], + name: "setManager", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxGasPrice", type: "uint256" }], + name: "setMaxGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setMaxGlobalShortSize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxLeverage", type: "uint256" }], + name: "setMaxLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_priceFeed", type: "address" }], + name: "setPriceFeed", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenDecimals", type: "uint256" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "bool", name: "_isStable", type: "bool" }, + { internalType: "bool", name: "_isShortable", type: "bool" }, + ], + name: "setTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setUsdgAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "contract IVaultUtils", name: "_vaultUtils", type: "address" }], + name: "setVaultUtils", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "shortableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableFundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableSwapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableTaxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "stableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "swap", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "swapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "taxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenBalances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenAmount", type: "uint256" }, + ], + name: "tokenToUsdMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalTokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + ], + name: "updateCumulativeFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_newVault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "upgradeVault", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + { internalType: "uint256", name: "_price", type: "uint256" }, + ], + name: "usdToToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMax", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "usdg", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "usdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "useSwapPricing", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "bool", name: "_raise", type: "bool" }, + ], + name: "validateLiquidation", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "vaultUtils", + outputs: [{ internalType: "contract IVaultUtils", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "whitelistedTokenCount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "whitelistedTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "withdrawFees", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/VaultReader.json b/sdk/src/abis/VaultReader.json deleted file mode 100644 index feafdca1f9..0000000000 --- a/sdk/src/abis/VaultReader.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "VaultReader", - "sourceName": "contracts/peripherals/VaultReader.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_positionManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getVaultTokenInfoV3", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "address", - "name": "_positionManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getVaultTokenInfoV4", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/VaultReader.ts b/sdk/src/abis/VaultReader.ts new file mode 100644 index 0000000000..0436870abc --- /dev/null +++ b/sdk/src/abis/VaultReader.ts @@ -0,0 +1,28 @@ +export default [ + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_positionManager", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getVaultTokenInfoV3", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_vault", type: "address" }, + { internalType: "address", name: "_positionManager", type: "address" }, + { internalType: "address", name: "_weth", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + { internalType: "address[]", name: "_tokens", type: "address[]" }, + ], + name: "getVaultTokenInfoV4", + outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/VaultV2.json b/sdk/src/abis/VaultV2.json deleted file mode 100644 index 35882f8342..0000000000 --- a/sdk/src/abis/VaultV2.json +++ /dev/null @@ -1,3019 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Vault", - "sourceName": "contracts/core/Vault.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "BuyUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - } - ], - "name": "ClosePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectMarginFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectSwapFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "DecreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DirectPoolDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "IncreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "markPrice", - "type": "uint256" - } - ], - "name": "LiquidatePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "SellUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOutAfterFees", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fundingRate", - "type": "uint256" - } - ], - "name": "UpdateFundingRate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "hasProfit", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "delta", - "type": "uint256" - } - ], - "name": "UpdatePnl", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - } - ], - "name": "UpdatePosition", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FUNDING_RATE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE_BASIS_POINTS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FUNDING_RATE_FACTOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_LIQUIDATION_FEE_USD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_FUNDING_RATE_INTERVAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_LEVERAGE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USDG_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "addRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_tokenDiv", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenMul", - "type": "address" - } - ], - "name": "adjustForDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allWhitelistedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "allWhitelistedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "approvedRouters", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bufferAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "buyUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "clearTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeFundingRates", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "decreasePosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "directPoolDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "feeReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_feeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_increment", - "type": "bool" - } - ], - "name": "getFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_entryFundingRate", - "type": "uint256" - } - ], - "name": "getFundingFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getGlobalShortDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMaxPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMinPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getNextAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getNextFundingRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getNextGlobalShortAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getPositionFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionKey", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - } - ], - "name": "getRedemptionAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateralUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getTargetUsdgAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getUtilisation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortAveragePrices", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortSizes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "guaranteedUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasDynamicFees", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inManagerMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateLiquidationMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "includeAmmPrice", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "increasePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - }, - { - "internalType": "address", - "name": "_usdg", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isLeverageEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isLiquidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isManager", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isSwapEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastFundingTimes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_feeReceiver", - "type": "address" - } - ], - "name": "liquidatePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "liquidationFeeUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "marginFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxGasPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxUsdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "minProfitBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minProfitTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintBurnFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "poolAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "lastIncreasedTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "priceFeed", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "removeRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "reservedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "sellUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setBufferAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableTaxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mintBurnFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_swapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableSwapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_hasDynamicFees", - "type": "bool" - } - ], - "name": "setFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_fundingInterval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "setFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inManagerMode", - "type": "bool" - } - ], - "name": "setInManagerMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateLiquidationMode", - "type": "bool" - } - ], - "name": "setInPrivateLiquidationMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isLeverageEnabled", - "type": "bool" - } - ], - "name": "setIsLeverageEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isSwapEnabled", - "type": "bool" - } - ], - "name": "setIsSwapEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setLiquidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_manager", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isManager", - "type": "bool" - } - ], - "name": "setManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxGasPrice", - "type": "uint256" - } - ], - "name": "setMaxGasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxLeverage", - "type": "uint256" - } - ], - "name": "setMaxLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - } - ], - "name": "setPriceFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenDecimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isStable", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_isShortable", - "type": "bool" - } - ], - "name": "setTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setUsdgAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "shortableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableFundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableSwapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableTaxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "taxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenAmount", - "type": "uint256" - } - ], - "name": "tokenToUsdMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "updateCumulativeFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newVault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "upgradeVault", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_price", - "type": "uint256" - } - ], - "name": "usdToToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdg", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "usdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "useSwapPricing", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_raise", - "type": "bool" - } - ], - "name": "validateLiquidation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "whitelistedTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "whitelistedTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawFees", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/VaultV2.ts b/sdk/src/abis/VaultV2.ts new file mode 100644 index 0000000000..0ab0fe3fa1 --- /dev/null +++ b/sdk/src/abis/VaultV2.ts @@ -0,0 +1,1220 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "BuyUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + ], + name: "ClosePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectMarginFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectSwapFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "DecreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DirectPoolDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "IncreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + { indexed: false, internalType: "uint256", name: "markPrice", type: "uint256" }, + ], + name: "LiquidatePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "SellUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "tokenIn", type: "address" }, + { indexed: false, internalType: "address", name: "tokenOut", type: "address" }, + { indexed: false, internalType: "uint256", name: "amountIn", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOut", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOutAfterFees", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "Swap", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "fundingRate", type: "uint256" }, + ], + name: "UpdateFundingRate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "bool", name: "hasProfit", type: "bool" }, + { indexed: false, internalType: "uint256", name: "delta", type: "uint256" }, + ], + name: "UpdatePnl", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + ], + name: "UpdatePosition", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "FUNDING_RATE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FEE_BASIS_POINTS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FUNDING_RATE_FACTOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_LIQUIDATION_FEE_USD", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_FUNDING_RATE_INTERVAL", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_LEVERAGE", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "USDG_DECIMALS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "addRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "address", name: "_tokenDiv", type: "address" }, + { internalType: "address", name: "_tokenMul", type: "address" }, + ], + name: "adjustForDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "allWhitelistedTokens", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "allWhitelistedTokensLength", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "approvedRouters", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "bufferAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "buyUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "clearTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeFundingRates", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_collateralDelta", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "decreasePosition", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "directPoolDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "feeReserves", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingInterval", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgDelta", type: "uint256" }, + { internalType: "uint256", name: "_feeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "bool", name: "_increment", type: "bool" }, + ], + name: "getFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_entryFundingRate", type: "uint256" }, + ], + name: "getFundingFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getGlobalShortDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMaxPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMinPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getNextAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getNextFundingRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + ], + name: "getNextGlobalShortAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPosition", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_sizeDelta", type: "uint256" }], + name: "getPositionFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionKey", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + ], + name: "getRedemptionAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateral", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateralUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getTargetUsdgAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getUtilisation", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortAveragePrices", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortSizes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "guaranteedUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasDynamicFees", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inManagerMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateLiquidationMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "includeAmmPrice", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "increasePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_router", type: "address" }, + { internalType: "address", name: "_usdg", type: "address" }, + { internalType: "address", name: "_priceFeed", type: "address" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isLeverageEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isLiquidator", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isManager", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isSwapEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lastFundingTimes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_feeReceiver", type: "address" }, + ], + name: "liquidatePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "liquidationFeeUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "marginFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxGasPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxUsdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "minProfitBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minProfitTime", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "mintBurnFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "poolAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "positions", + outputs: [ + { internalType: "uint256", name: "size", type: "uint256" }, + { internalType: "uint256", name: "collateral", type: "uint256" }, + { internalType: "uint256", name: "averagePrice", type: "uint256" }, + { internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { internalType: "int256", name: "realisedPnl", type: "int256" }, + { internalType: "uint256", name: "lastIncreasedTime", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "priceFeed", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "removeRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "reservedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "sellUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setBufferAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableTaxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_mintBurnFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_swapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableSwapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_minProfitTime", type: "uint256" }, + { internalType: "bool", name: "_hasDynamicFees", type: "bool" }, + ], + name: "setFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_fundingInterval", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "setFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inManagerMode", type: "bool" }], + name: "setInManagerMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateLiquidationMode", type: "bool" }], + name: "setInPrivateLiquidationMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isLeverageEnabled", type: "bool" }], + name: "setIsLeverageEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isSwapEnabled", type: "bool" }], + name: "setIsSwapEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_liquidator", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setLiquidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_manager", type: "address" }, + { internalType: "bool", name: "_isManager", type: "bool" }, + ], + name: "setManager", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxGasPrice", type: "uint256" }], + name: "setMaxGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxLeverage", type: "uint256" }], + name: "setMaxLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_priceFeed", type: "address" }], + name: "setPriceFeed", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenDecimals", type: "uint256" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "bool", name: "_isStable", type: "bool" }, + { internalType: "bool", name: "_isShortable", type: "bool" }, + ], + name: "setTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setUsdgAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "shortableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableFundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableSwapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableTaxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "stableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "swap", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "swapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "taxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenBalances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenAmount", type: "uint256" }, + ], + name: "tokenToUsdMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalTokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "updateCumulativeFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_newVault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "upgradeVault", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + { internalType: "uint256", name: "_price", type: "uint256" }, + ], + name: "usdToToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMax", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "usdg", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "usdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "useSwapPricing", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "bool", name: "_raise", type: "bool" }, + ], + name: "validateLiquidation", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "whitelistedTokenCount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "whitelistedTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "withdrawFees", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/VaultV2b.json b/sdk/src/abis/VaultV2b.json deleted file mode 100644 index a787d83959..0000000000 --- a/sdk/src/abis/VaultV2b.json +++ /dev/null @@ -1,3220 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Vault", - "sourceName": "contracts/core/Vault.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "BuyUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - } - ], - "name": "ClosePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectMarginFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeUsd", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeTokens", - "type": "uint256" - } - ], - "name": "CollectSwapFees", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "DecreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DecreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DirectPoolDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseGuaranteedUsd", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreasePoolAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sizeDelta", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "IncreasePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseReservedAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "IncreaseUsdgAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "collateralToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "markPrice", - "type": "uint256" - } - ], - "name": "LiquidatePosition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "usdgAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "SellUSDG", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOutAfterFees", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeBasisPoints", - "type": "uint256" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fundingRate", - "type": "uint256" - } - ], - "name": "UpdateFundingRate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "hasProfit", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "delta", - "type": "uint256" - } - ], - "name": "UpdatePnl", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "markPrice", - "type": "uint256" - } - ], - "name": "UpdatePosition", - "type": "event" - }, - { - "inputs": [], - "name": "BASIS_POINTS_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FUNDING_RATE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE_BASIS_POINTS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FUNDING_RATE_FACTOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_LIQUIDATION_FEE_USD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_FUNDING_RATE_INTERVAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_LEVERAGE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRICE_PRECISION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "USDG_DECIMALS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "addRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_tokenDiv", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenMul", - "type": "address" - } - ], - "name": "adjustForDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allWhitelistedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "allWhitelistedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "approvedRouters", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bufferAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "buyUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "clearTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeFundingRates", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "decreasePosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "directPoolDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "errorController", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "errors", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "feeReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getEntryFundingRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_feeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_increment", - "type": "bool" - } - ], - "name": "getFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_entryFundingRate", - "type": "uint256" - } - ], - "name": "getFundingFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getGlobalShortDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMaxPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getMinPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_averagePrice", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lastIncreasedTime", - "type": "uint256" - } - ], - "name": "getNextAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getNextFundingRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_nextPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getNextGlobalShortAveragePrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPosition", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionDelta", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - } - ], - "name": "getPositionFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionKey", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "getPositionLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdgAmount", - "type": "uint256" - } - ], - "name": "getRedemptionAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getRedemptionCollateralUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getTargetUsdgAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getUtilisation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortAveragePrices", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "globalShortSizes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "guaranteedUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasDynamicFees", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inManagerMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inPrivateLiquidationMode", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "includeAmmPrice", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_sizeDelta", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - } - ], - "name": "increasePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - }, - { - "internalType": "address", - "name": "_usdg", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isLeverageEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isLiquidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isManager", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isSwapEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastFundingTimes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "address", - "name": "_feeReceiver", - "type": "address" - } - ], - "name": "liquidatePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "liquidationFeeUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "marginFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxGasPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxGlobalShortSizes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLeverage", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxUsdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "minProfitBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minProfitTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintBurnFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "poolAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint256", - "name": "size", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averagePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "entryFundingRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "realisedPnl", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "lastIncreasedTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "priceFeed", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_router", - "type": "address" - } - ], - "name": "removeRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "reservedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "router", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "sellUSDG", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setBufferAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_errorCode", - "type": "uint256" - }, - { - "internalType": "string", - "name": "_error", - "type": "string" - } - ], - "name": "setError", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_errorController", - "type": "address" - } - ], - "name": "setErrorController", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_taxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableTaxBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mintBurnFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_swapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableSwapFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_marginFeeBasisPoints", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_liquidationFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_hasDynamicFees", - "type": "bool" - } - ], - "name": "setFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_fundingInterval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_fundingRateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_stableFundingRateFactor", - "type": "uint256" - } - ], - "name": "setFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inManagerMode", - "type": "bool" - } - ], - "name": "setInManagerMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_inPrivateLiquidationMode", - "type": "bool" - } - ], - "name": "setInPrivateLiquidationMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isLeverageEnabled", - "type": "bool" - } - ], - "name": "setIsLeverageEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isSwapEnabled", - "type": "bool" - } - ], - "name": "setIsSwapEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setLiquidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_manager", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isManager", - "type": "bool" - } - ], - "name": "setManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxGasPrice", - "type": "uint256" - } - ], - "name": "setMaxGasPrice", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setMaxGlobalShortSize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxLeverage", - "type": "uint256" - } - ], - "name": "setMaxLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_priceFeed", - "type": "address" - } - ], - "name": "setPriceFeed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenDecimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minProfitBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUsdgAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isStable", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_isShortable", - "type": "bool" - } - ], - "name": "setTokenConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setUsdgAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVaultUtils", - "name": "_vaultUtils", - "type": "address" - } - ], - "name": "setVaultUtils", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "shortableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableFundingRateFactor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableSwapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "stableTaxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stableTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenOut", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapFeeBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "taxBasisPoints", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenAmount", - "type": "uint256" - } - ], - "name": "tokenToUsdMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokenWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - } - ], - "name": "updateCumulativeFundingRate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newVault", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "upgradeVault", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_price", - "type": "uint256" - } - ], - "name": "usdToToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdAmount", - "type": "uint256" - } - ], - "name": "usdToTokenMin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdg", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "usdgAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "useSwapPricing", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_indexToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "_raise", - "type": "bool" - } - ], - "name": "validateLiquidation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "vaultUtils", - "outputs": [ - { - "internalType": "contract IVaultUtils", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "whitelistedTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "whitelistedTokens", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawFees", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/VaultV2b.ts b/sdk/src/abis/VaultV2b.ts new file mode 100644 index 0000000000..975f548582 --- /dev/null +++ b/sdk/src/abis/VaultV2b.ts @@ -0,0 +1,1306 @@ +export default [ + { inputs: [], stateMutability: "nonpayable", type: "constructor" }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "BuyUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + ], + name: "ClosePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectMarginFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "feeUsd", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeTokens", type: "uint256" }, + ], + name: "CollectSwapFees", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "DecreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DecreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "DirectPoolDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseGuaranteedUsd", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreasePoolAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "collateralDelta", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "sizeDelta", type: "uint256" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "price", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "fee", type: "uint256" }, + ], + name: "IncreasePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseReservedAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "IncreaseUsdgAmount", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "collateralToken", type: "address" }, + { indexed: false, internalType: "address", name: "indexToken", type: "address" }, + { indexed: false, internalType: "bool", name: "isLong", type: "bool" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + { indexed: false, internalType: "uint256", name: "markPrice", type: "uint256" }, + ], + name: "LiquidatePosition", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "usdgAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "tokenAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "SellUSDG", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "address", name: "tokenIn", type: "address" }, + { indexed: false, internalType: "address", name: "tokenOut", type: "address" }, + { indexed: false, internalType: "uint256", name: "amountIn", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOut", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "amountOutAfterFees", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "feeBasisPoints", type: "uint256" }, + ], + name: "Swap", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "token", type: "address" }, + { indexed: false, internalType: "uint256", name: "fundingRate", type: "uint256" }, + ], + name: "UpdateFundingRate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "bool", name: "hasProfit", type: "bool" }, + { indexed: false, internalType: "uint256", name: "delta", type: "uint256" }, + ], + name: "UpdatePnl", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "key", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "size", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "collateral", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "averagePrice", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { indexed: false, internalType: "int256", name: "realisedPnl", type: "int256" }, + { indexed: false, internalType: "uint256", name: "markPrice", type: "uint256" }, + ], + name: "UpdatePosition", + type: "event", + }, + { + inputs: [], + name: "BASIS_POINTS_DIVISOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "FUNDING_RATE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FEE_BASIS_POINTS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_FUNDING_RATE_FACTOR", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_LIQUIDATION_FEE_USD", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_FUNDING_RATE_INTERVAL", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MIN_LEVERAGE", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "PRICE_PRECISION", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "USDG_DECIMALS", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "addRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "address", name: "_tokenDiv", type: "address" }, + { internalType: "address", name: "_tokenMul", type: "address" }, + ], + name: "adjustForDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "allWhitelistedTokens", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "allWhitelistedTokensLength", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "approvedRouters", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "bufferAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "buyUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "clearTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeFundingRates", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_collateralDelta", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "decreasePosition", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "directPoolDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "errorController", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "errors", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "feeReserves", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingInterval", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getEntryFundingRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgDelta", type: "uint256" }, + { internalType: "uint256", name: "_feeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "bool", name: "_increment", type: "bool" }, + ], + name: "getFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_entryFundingRate", type: "uint256" }, + ], + name: "getFundingFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getGlobalShortDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMaxPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getMinPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_size", type: "uint256" }, + { internalType: "uint256", name: "_averagePrice", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "uint256", name: "_lastIncreasedTime", type: "uint256" }, + ], + name: "getNextAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getNextFundingRate", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_nextPrice", type: "uint256" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + ], + name: "getNextGlobalShortAveragePrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPosition", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionDelta", + outputs: [ + { internalType: "bool", name: "", type: "bool" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + ], + name: "getPositionFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionKey", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "getPositionLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdgAmount", type: "uint256" }, + ], + name: "getRedemptionAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateral", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getRedemptionCollateralUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getTargetUsdgAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getUtilisation", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortAveragePrices", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "globalShortSizes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "guaranteedUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasDynamicFees", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inManagerMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inPrivateLiquidationMode", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "includeAmmPrice", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "uint256", name: "_sizeDelta", type: "uint256" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + ], + name: "increasePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_router", type: "address" }, + { internalType: "address", name: "_usdg", type: "address" }, + { internalType: "address", name: "_priceFeed", type: "address" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "isInitialized", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isLeverageEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isLiquidator", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isManager", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isSwapEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lastFundingTimes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "address", name: "_feeReceiver", type: "address" }, + ], + name: "liquidatePosition", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "liquidationFeeUsd", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "marginFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxGasPrice", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxGlobalShortSizes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxLeverage", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxUsdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "minProfitBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minProfitTime", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "mintBurnFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "poolAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "positions", + outputs: [ + { internalType: "uint256", name: "size", type: "uint256" }, + { internalType: "uint256", name: "collateral", type: "uint256" }, + { internalType: "uint256", name: "averagePrice", type: "uint256" }, + { internalType: "uint256", name: "entryFundingRate", type: "uint256" }, + { internalType: "uint256", name: "reserveAmount", type: "uint256" }, + { internalType: "int256", name: "realisedPnl", type: "int256" }, + { internalType: "uint256", name: "lastIncreasedTime", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "priceFeed", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_router", type: "address" }], + name: "removeRouter", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "reservedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "sellUSDG", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setBufferAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_errorCode", type: "uint256" }, + { internalType: "string", name: "_error", type: "string" }, + ], + name: "setError", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_errorController", type: "address" }], + name: "setErrorController", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_taxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableTaxBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_mintBurnFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_swapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_stableSwapFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_marginFeeBasisPoints", type: "uint256" }, + { internalType: "uint256", name: "_liquidationFeeUsd", type: "uint256" }, + { internalType: "uint256", name: "_minProfitTime", type: "uint256" }, + { internalType: "bool", name: "_hasDynamicFees", type: "bool" }, + ], + name: "setFees", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_fundingInterval", type: "uint256" }, + { internalType: "uint256", name: "_fundingRateFactor", type: "uint256" }, + { internalType: "uint256", name: "_stableFundingRateFactor", type: "uint256" }, + ], + name: "setFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inManagerMode", type: "bool" }], + name: "setInManagerMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_inPrivateLiquidationMode", type: "bool" }], + name: "setInPrivateLiquidationMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isLeverageEnabled", type: "bool" }], + name: "setIsLeverageEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_isSwapEnabled", type: "bool" }], + name: "setIsSwapEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_liquidator", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setLiquidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_manager", type: "address" }, + { internalType: "bool", name: "_isManager", type: "bool" }, + ], + name: "setManager", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxGasPrice", type: "uint256" }], + name: "setMaxGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setMaxGlobalShortSize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_maxLeverage", type: "uint256" }], + name: "setMaxLeverage", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_priceFeed", type: "address" }], + name: "setPriceFeed", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenDecimals", type: "uint256" }, + { internalType: "uint256", name: "_tokenWeight", type: "uint256" }, + { internalType: "uint256", name: "_minProfitBps", type: "uint256" }, + { internalType: "uint256", name: "_maxUsdgAmount", type: "uint256" }, + { internalType: "bool", name: "_isStable", type: "bool" }, + { internalType: "bool", name: "_isShortable", type: "bool" }, + ], + name: "setTokenConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setUsdgAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "contract IVaultUtils", name: "_vaultUtils", type: "address" }], + name: "setVaultUtils", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "shortableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableFundingRateFactor", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableSwapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "stableTaxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "stableTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_tokenIn", type: "address" }, + { internalType: "address", name: "_tokenOut", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "swap", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "swapFeeBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "taxBasisPoints", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenBalances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenDecimals", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_tokenAmount", type: "uint256" }, + ], + name: "tokenToUsdMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "tokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalTokenWeights", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + ], + name: "updateCumulativeFundingRate", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_newVault", type: "address" }, + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "upgradeVault", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + { internalType: "uint256", name: "_price", type: "uint256" }, + ], + name: "usdToToken", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMax", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "uint256", name: "_usdAmount", type: "uint256" }, + ], + name: "usdToTokenMin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "usdg", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "usdgAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "useSwapPricing", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_collateralToken", type: "address" }, + { internalType: "address", name: "_indexToken", type: "address" }, + { internalType: "bool", name: "_isLong", type: "bool" }, + { internalType: "bool", name: "_raise", type: "bool" }, + ], + name: "validateLiquidation", + outputs: [ + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "vaultUtils", + outputs: [{ internalType: "contract IVaultUtils", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "whitelistedTokenCount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "whitelistedTokens", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "withdrawFees", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/VenusVToken.json b/sdk/src/abis/VenusVToken.json deleted file mode 100644 index 1f524d11e8..0000000000 --- a/sdk/src/abis/VenusVToken.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "abi": [ - { - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/sdk/src/abis/VenusVToken.ts b/sdk/src/abis/VenusVToken.ts new file mode 100644 index 0000000000..768430d1a6 --- /dev/null +++ b/sdk/src/abis/VenusVToken.ts @@ -0,0 +1,47 @@ +export default [ + { + inputs: [], + name: "exchangeRateStored", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/Vester.json b/sdk/src/abis/Vester.json deleted file mode 100644 index 6630ef8ac5..0000000000 --- a/sdk/src/abis/Vester.json +++ /dev/null @@ -1,1031 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Vester", - "sourceName": "contracts/staking/Vester.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "internalType": "uint256", - "name": "_vestingDuration", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_esToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_pairToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_claimableToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_rewardTracker", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Claim", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "PairTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "claimedAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bonusRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claim", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "claimForAccount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "claimable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claimableToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "claimedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeClaimAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "cumulativeRewardDeductions", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "depositForAccount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "esToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "getCombinedAverageStakedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "getMaxVestableAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_esAmount", - "type": "uint256" - } - ], - "name": "getPairAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "getTotalVested", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "getVestedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gov", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasMaxVestableAmount", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasPairToken", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "hasRewardTracker", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isHandler", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastVestingTimes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pairAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pairSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pairToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardTracker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setBonusRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setCumulativeRewardDeductions", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_gov", - "type": "address" - } - ], - "name": "setGov", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_handler", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setHandler", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_hasMaxVestableAmount", - "type": "bool" - } - ], - "name": "setHasMaxVestableAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setTransferredAverageStakedAmounts", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "setTransferredCumulativeRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "transferStakeValues", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "transferredAverageStakedAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "transferredCumulativeRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "vestingDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdrawToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/Vester.ts b/sdk/src/abis/Vester.ts new file mode 100644 index 0000000000..ce1f0919dd --- /dev/null +++ b/sdk/src/abis/Vester.ts @@ -0,0 +1,454 @@ +export default [ + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_symbol", type: "string" }, + { internalType: "uint256", name: "_vestingDuration", type: "uint256" }, + { internalType: "address", name: "_esToken", type: "address" }, + { internalType: "address", name: "_pairToken", type: "address" }, + { internalType: "address", name: "_claimableToken", type: "address" }, + { internalType: "address", name: "_rewardTracker", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "Claim", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "Deposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "PairTransfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "account", type: "address" }, + { indexed: false, internalType: "uint256", name: "claimedAmount", type: "uint256" }, + { indexed: false, internalType: "uint256", name: "balance", type: "uint256" }, + ], + name: "Withdraw", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "balances", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "bonusRewards", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "claim", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "claimForAccount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "claimable", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "claimableToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "claimedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeClaimAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "cumulativeRewardDeductions", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], + name: "deposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "depositForAccount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "esToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "getCombinedAverageStakedAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "getMaxVestableAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_esAmount", type: "uint256" }, + ], + name: "getPairAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "getTotalVested", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_account", type: "address" }], + name: "getVestedAmount", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "gov", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasMaxVestableAmount", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasPairToken", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "hasRewardTracker", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isHandler", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "lastVestingTimes", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "pairAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pairSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pairToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "rewardTracker", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setBonusRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setCumulativeRewardDeductions", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_gov", type: "address" }], + name: "setGov", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_handler", type: "address" }, + { internalType: "bool", name: "_isActive", type: "bool" }, + ], + name: "setHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_hasMaxVestableAmount", type: "bool" }], + name: "setHasMaxVestableAmount", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setTransferredAverageStakedAmounts", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "setTransferredCumulativeRewards", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256", name: "", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_sender", type: "address" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "transferStakeValues", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "transferredAverageStakedAmounts", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "transferredCumulativeRewards", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "vestingDuration", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "withdraw", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_account", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/WETH.json b/sdk/src/abis/WETH.json deleted file mode 100644 index 8925271e3a..0000000000 --- a/sdk/src/abis/WETH.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "WETH", - "sourceName": "contracts/tokens/WETH.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/sdk/src/abis/WETH.ts b/sdk/src/abis/WETH.ts new file mode 100644 index 0000000000..99eb96ffcc --- /dev/null +++ b/sdk/src/abis/WETH.ts @@ -0,0 +1,135 @@ +export default [ + { + inputs: [ + { internalType: "string", name: "name", type: "string" }, + { internalType: "string", name: "symbol", type: "string" }, + { internalType: "uint8", name: "decimals", type: "uint8" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "owner", type: "address" }, + { indexed: true, internalType: "address", name: "spender", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "spender", type: "address" }, + ], + name: "allowance", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "approve", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "deposit", outputs: [], stateMutability: "payable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [{ internalType: "string", name: "", type: "string" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/sdk/src/abis/__tests__/abis.spec.ts b/sdk/src/abis/__tests__/abis.spec.ts deleted file mode 100644 index fc73105bfb..0000000000 --- a/sdk/src/abis/__tests__/abis.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -import fs from "fs"; -import path from "path"; -import { describe, expect, it } from "vitest"; - -function isEmptyValue(value: any): boolean { - if ( - !value || - (Array.isArray(value) && value.length === 0) || - (typeof value === "object" && Object.keys(value).length === 0) - ) { - return true; - } - - return false; -} - -describe("ABI files validation", () => { - const abiDir = path.join(__dirname, ".."); - const abiFiles = fs.readdirSync(abiDir).filter((file) => file.endsWith(".json")); - - it.each(abiFiles)("validates %s doesn't contain metadata or bytecode", (fileName) => { - const filePath = path.join(abiDir, fileName); - const fileContent = JSON.parse(fs.readFileSync(filePath, "utf-8")); - - const abiContent = Array.isArray(fileContent) ? fileContent : fileContent.abi; - - expect(abiContent).toBeDefined(); - expect(Array.isArray(abiContent)).toBe(true); - - const unnecessaryFields = [ - "metadata", - "bytecode", - "deployedBytecode", - "sourceMap", - "deployedSourceMap", - "source", - "ast", - "schemaVersion", - "updatedAt", - ]; - - const foundFields = unnecessaryFields.filter((field) => !isEmptyValue(fileContent[field])); - - expect(foundFields).toHaveLength(0); - }); -}); diff --git a/sdk/src/abis/index.ts b/sdk/src/abis/index.ts index 855a009e4d..75c3840394 100644 --- a/sdk/src/abis/index.ts +++ b/sdk/src/abis/index.ts @@ -1,137 +1,59 @@ -import { Abi, erc20Abi } from "viem"; +import { erc20Abi } from "viem"; -import ArbitrumNodeInterface from "./ArbitrumNodeInterface.json"; -import ClaimHandler from "./ClaimHandler.json"; -import CustomErrors from "./CustomErrors.json"; -import DataStore from "./DataStore.json"; -import ERC20PermitInterface from "./ERC20PermitInterface.json"; -import ERC721 from "./ERC721.json"; -import EventEmitter from "./EventEmitter.json"; -import ExchangeRouter from "./ExchangeRouter.json"; -import GelatoRelayRouter from "./GelatoRelayRouter.json"; -import GlpManager from "./GlpManager.json"; -import GlvReader from "./GlvReader.json"; -import GlvRouter from "./GlvRouter.json"; -import GmxMigrator from "./GmxMigrator.json"; -import GovToken from "./GovToken.json"; -import LayerZeroProvider from "./LayerZeroProvider.json"; -import MintableBaseToken from "./MintableBaseToken.json"; -import Multicall from "./Multicall.json"; -import MultichainClaimsRouter from "./MultichainClaimsRouter.json"; -import MultichainGlvRouter from "./MultichainGlvRouter.json"; -import MultichainGmRouter from "./MultichainGmRouter.json"; -import MultichainOrderRouter from "./MultichainOrderRouter.json"; -import MultichainSubaccountRouter from "./MultichainSubaccountRouter.json"; -import MultichainTransferRouter from "./MultichainTransferRouter.json"; -import MultichainVault from "./MultichainVault.json"; -import Reader from "./Reader.json"; -import ReaderV2 from "./ReaderV2.json"; -import ReferralStorage from "./ReferralStorage.json"; -import RelayParams from "./RelayParams.json"; -import RewardReader from "./RewardReader.json"; -import RewardRouter from "./RewardRouter.json"; -import RewardTracker from "./RewardTracker.json"; -import SmartAccount from "./SmartAccount.json"; -import StBTC from "./StBTC.json"; -import SubaccountGelatoRelayRouter from "./SubaccountGelatoRelayRouter.json"; -import SubaccountRouter from "./SubaccountRouter.json"; -import SyntheticsReader from "./SyntheticsReader.json"; -import SyntheticsRouter from "./SyntheticsRouter.json"; -import Timelock from "./Timelock.json"; -import Token from "./Token.json"; -import Treasury from "./Treasury.json"; -import UniPool from "./UniPool.json"; -import UniswapV2 from "./UniswapV2.json"; -import UniswapV3Factory from "./UniswapV3Factory.json"; -import UniswapV3Pool from "./UniswapV3Pool.json"; -import UniswapV3PositionManager from "./UniswapV3PositionManager.json"; -import Vault from "./Vault.json"; -import VaultReader from "./VaultReader.json"; -import VaultV2 from "./VaultV2.json"; -import VaultV2b from "./VaultV2b.json"; -import VenusVToken from "./VenusVToken.json"; -import Vester from "./Vester.json"; -import WETH from "./WETH.json"; - -export type AbiId = - | "AbstractSubaccountApprovalNonceable" - | "ArbitrumNodeInterface" - | "ClaimHandler" - | "CustomErrors" - | "DataStore" - | "ERC20" - | "ERC20PermitInterface" - | "ERC20PermitInterface" - | "ERC721" - | "EventEmitter" - | "ExchangeRouter" - | "GelatoRelayRouter" - | "GelatoRelayRouter" - | "GlpManager" - | "GlvReader" - | "GlvRouter" - | "GmxMigrator" - | "GovToken" - | "LayerZeroProvider" - | "MintableBaseToken" - | "Multicall" - | "MultichainClaimsRouter" - | "MultichainGlvRouter" - | "MultichainGmRouter" - | "MultichainOrderRouter" - | "MultichainSubaccountRouter" - | "MultichainTransferRouter" - | "MultichainVault" - | "ReferralStorage" - | "RelayParams" - | "RewardReader" - | "RewardRouter" - | "RewardTracker" - | "SmartAccount" - | "StBTC" - | "SubaccountGelatoRelayRouter" - | "SubaccountGelatoRelayRouter" - | "SubaccountRouter" - | "SyntheticsReader" - | "SyntheticsRouter" - | "Timelock" - | "Token" - | "Reader" - | "ReaderV2" - | "Treasury" - | "UniPool" - | "UniswapV2" - | "UniswapV3Factory" - | "UniswapV3Pool" - | "UniswapV3PositionManager" - | "VenusVToken" - | "Vault" - | "VaultReader" - | "VaultV2" - | "VaultV2b" - | "Vester" - | "WETH"; - -/** Copied from ethers to enable compatibility with GMX UI */ -interface JsonFragmentType { - readonly name?: string; - readonly indexed?: boolean; - readonly type?: string; - readonly internalType?: string; - readonly components?: ReadonlyArray; -} - -interface JsonFragment { - readonly name?: string; - readonly type?: string; - readonly anonymous?: boolean; - readonly payable?: boolean; - readonly constant?: boolean; - readonly stateMutability?: string; - readonly inputs?: ReadonlyArray; - readonly outputs?: ReadonlyArray; - readonly gas?: string; -} +import ArbitrumNodeInterface from "./ArbitrumNodeInterface"; +import ClaimHandler from "./ClaimHandler"; +import CustomErrors from "./CustomErrors"; +import DataStore from "./DataStore"; +import ERC20PermitInterface from "./ERC20PermitInterface"; +import ERC721 from "./ERC721"; +import EventEmitter from "./EventEmitter"; +import ExchangeRouter from "./ExchangeRouter"; +import GelatoRelayRouter from "./GelatoRelayRouter"; +import GlpManager from "./GlpManager"; +import GlvReader from "./GlvReader"; +import GlvRouter from "./GlvRouter"; +import GmxMigrator from "./GmxMigrator"; +import GovToken from "./GovToken"; +import IStargate from "./IStargate"; +import LayerZeroProvider from "./LayerZeroProvider"; +import MintableBaseToken from "./MintableBaseToken"; +import Multicall from "./Multicall"; +import MultichainClaimsRouter from "./MultichainClaimsRouter"; +import MultichainGlvRouter from "./MultichainGlvRouter"; +import MultichainGmRouter from "./MultichainGmRouter"; +import MultichainOrderRouter from "./MultichainOrderRouter"; +import MultichainSubaccountRouter from "./MultichainSubaccountRouter"; +import MultichainTransferRouter from "./MultichainTransferRouter"; +import MultichainUtils from "./MultichainUtils"; +import MultichainVault from "./MultichainVault"; +import Reader from "./Reader"; +import ReaderV2 from "./ReaderV2"; +import ReferralStorage from "./ReferralStorage"; +import RelayParams from "./RelayParams"; +import RewardReader from "./RewardReader"; +import RewardRouter from "./RewardRouter"; +import RewardTracker from "./RewardTracker"; +import SmartAccount from "./SmartAccount"; +import StBTC from "./StBTC"; +import SubaccountGelatoRelayRouter from "./SubaccountGelatoRelayRouter"; +import SubaccountRouter from "./SubaccountRouter"; +import SyntheticsReader from "./SyntheticsReader"; +import SyntheticsRouter from "./SyntheticsRouter"; +import Timelock from "./Timelock"; +import Token from "./Token"; +import Treasury from "./Treasury"; +import UniPool from "./UniPool"; +import UniswapV2 from "./UniswapV2"; +import UniswapV3Factory from "./UniswapV3Factory"; +import UniswapV3Pool from "./UniswapV3Pool"; +import UniswapV3PositionManager from "./UniswapV3PositionManager"; +import Vault from "./Vault"; +import VaultReader from "./VaultReader"; +import VaultV2 from "./VaultV2"; +import VaultV2b from "./VaultV2b"; +import VenusVToken from "./VenusVToken"; +import Vester from "./Vester"; +import WETH from "./WETH"; const AbstractSubaccountApprovalNonceable = [ { @@ -155,59 +77,63 @@ const AbstractSubaccountApprovalNonceable = [ }, ] as const; -export const abis: Record = { +export const abis = { AbstractSubaccountApprovalNonceable, - ArbitrumNodeInterface: ArbitrumNodeInterface.abi, - ClaimHandler: ClaimHandler.abi, - CustomErrors: CustomErrors.abi, - DataStore: DataStore.abi, + ArbitrumNodeInterface, + ClaimHandler, + CustomErrors, + DataStore, ERC20: erc20Abi, - ERC20PermitInterface: ERC20PermitInterface.abi, - ERC721: ERC721.abi, - EventEmitter: EventEmitter.abi, - ExchangeRouter: ExchangeRouter.abi, - GelatoRelayRouter: GelatoRelayRouter.abi, - GlpManager: GlpManager.abi, - GlvReader: GlvReader.abi, - GlvRouter: GlvRouter.abi, - GmxMigrator: GmxMigrator.abi, - GovToken: GovToken.abi, - LayerZeroProvider: LayerZeroProvider.abi, - MintableBaseToken: MintableBaseToken.abi, - Multicall: Multicall.abi, - MultichainClaimsRouter: MultichainClaimsRouter.abi, - MultichainGlvRouter: MultichainGlvRouter.abi, - MultichainGmRouter: MultichainGmRouter.abi, - MultichainOrderRouter: MultichainOrderRouter.abi, - MultichainSubaccountRouter: MultichainSubaccountRouter.abi, - MultichainTransferRouter: MultichainTransferRouter.abi, - MultichainVault: MultichainVault.abi, - ReferralStorage: ReferralStorage.abi, - RelayParams: RelayParams.abi, - RewardReader: RewardReader.abi, - RewardRouter: RewardRouter.abi, - RewardTracker: RewardTracker.abi, - SmartAccount: SmartAccount.abi, - StBTC: StBTC.abi, - SubaccountGelatoRelayRouter: SubaccountGelatoRelayRouter.abi, - SubaccountRouter: SubaccountRouter.abi, - SyntheticsReader: SyntheticsReader.abi, - SyntheticsRouter: SyntheticsRouter.abi, - Timelock: Timelock.abi, - Token: Token.abi, - Reader: Reader.abi, - ReaderV2: ReaderV2.abi, - Treasury: Treasury.abi, - UniPool: UniPool.abi, - UniswapV2: UniswapV2.abi, - UniswapV3Factory: UniswapV3Factory.abi, - UniswapV3Pool: UniswapV3Pool.abi, - UniswapV3PositionManager: UniswapV3PositionManager.abi, - VenusVToken: VenusVToken.abi, - Vault: Vault.abi, - VaultReader: VaultReader.abi, - VaultV2: VaultV2.abi, - VaultV2b: VaultV2b.abi, - Vester: Vester.abi, - WETH: WETH.abi, -} satisfies Record as any; + ERC20PermitInterface, + ERC721: ERC721, + EventEmitter, + ExchangeRouter, + GelatoRelayRouter, + GlpManager, + GlvReader, + GlvRouter, + GmxMigrator, + GovToken, + LayerZeroProvider, + MintableBaseToken, + Multicall, + MultichainClaimsRouter, + MultichainGlvRouter, + MultichainGmRouter, + MultichainOrderRouter, + MultichainSubaccountRouter, + MultichainTransferRouter, + MultichainUtils, + MultichainVault, + ReferralStorage, + RelayParams, + RewardReader, + RewardRouter, + RewardTracker, + SmartAccount, + StBTC, + SubaccountGelatoRelayRouter, + SubaccountRouter, + SyntheticsReader, + SyntheticsRouter, + Timelock, + Token, + Reader, + ReaderV2, + Treasury, + UniPool, + UniswapV2, + UniswapV3Factory, + UniswapV3Pool, + UniswapV3PositionManager, + Vault, + VaultReader, + VaultV2, + VaultV2b, + VenusVToken, + Vester, + WETH, + IStargate, +} satisfies Record; + +export type AbiId = keyof typeof abis; diff --git a/sdk/src/utils/errors/parseError.ts b/sdk/src/utils/errors/parseError.ts index 15b343e697..84f4a5b28d 100644 --- a/sdk/src/utils/errors/parseError.ts +++ b/sdk/src/utils/errors/parseError.ts @@ -1,5 +1,5 @@ import cryptoJs from "crypto-js"; -import { Abi, Address, decodeErrorResult } from "viem"; +import { Abi, decodeErrorResult } from "viem"; import { abis } from "abis"; @@ -155,7 +155,7 @@ export function parseError(error: ErrorLike | string | undefined, errorDepth = 0 if (errorData) { const parsedError = decodeErrorResult({ abi: abis.CustomErrors as Abi, - data: errorData as Address, + data: errorData, }); if (parsedError) { diff --git a/sdk/src/utils/multicall.ts b/sdk/src/utils/multicall.ts index cbde25caf6..12db66a4d6 100644 --- a/sdk/src/utils/multicall.ts +++ b/sdk/src/utils/multicall.ts @@ -68,8 +68,8 @@ export class Multicall { // Add Errors ABI to each contract ABI to correctly parse errors abis[contractCallConfig.contractAddress] = abis[contractCallConfig.contractAddress] || [ - ...allAbis[contractCallConfig.abiId], - ...allAbis.CustomErrors, + ...(allAbis[contractCallConfig.abiId] as any), + ...(allAbis.CustomErrors as any), ]; const abi = abis[contractCallConfig.contractAddress]; diff --git a/sdk/src/utils/orderTransactions.ts b/sdk/src/utils/orderTransactions.ts index 8c2febd5f3..c875fecc4e 100644 --- a/sdk/src/utils/orderTransactions.ts +++ b/sdk/src/utils/orderTransactions.ts @@ -1,9 +1,9 @@ import uniq from "lodash/uniq"; import { encodeFunctionData, zeroAddress, zeroHash } from "viem"; -import ExchangeRouterAbi from "abis/ExchangeRouter.json"; +import ExchangeRouterAbi from "abis/ExchangeRouter"; import { abis } from "abis/index"; -import ERC20ABI from "abis/Token.json"; +import ERC20ABI from "abis/Token"; import { ContractsChainId, getExcessiveExecutionFee, getHighExecutionFee } from "configs/chains"; import { getContract } from "configs/contracts"; import { convertTokenAddress, getToken, getWrappedToken, NATIVE_TOKEN_ADDRESS } from "configs/tokens"; @@ -759,7 +759,7 @@ export function getExternalCallsPayload({ payload.externalCallTargets.push(inTokenAddress); payload.externalCallDataList.push( encodeFunctionData({ - abi: ERC20ABI.abi, + abi: ERC20ABI, functionName: "approve", args: [quote.txnData.to, MaxUint256], }) @@ -909,13 +909,13 @@ export function encodeExchangeRouterMulticall(multicall: ExchangeRouterCall[]) { const encodedMulticall = multicall.map((call) => encodeFunctionData({ abi: abis.ExchangeRouter, - functionName: call.method, - args: call.params, + functionName: call.method as any, + args: call.params as any, }) ); const callData = encodeFunctionData({ - abi: ExchangeRouterAbi.abi, + abi: ExchangeRouterAbi, functionName: "multicall", args: [encodedMulticall], }); diff --git a/sdk/src/utils/swap/botanixStaking.ts b/sdk/src/utils/swap/botanixStaking.ts index 10cbe477d4..3aa8bc484f 100644 --- a/sdk/src/utils/swap/botanixStaking.ts +++ b/sdk/src/utils/swap/botanixStaking.ts @@ -1,6 +1,6 @@ import { encodeFunctionData } from "viem"; -import StBTCABI from "abis/StBTC.json"; +import StBTCABI from "abis/StBTC"; import { BOTANIX } from "configs/chains"; import { getContract } from "configs/contracts"; import { TokensData } from "types/tokens"; @@ -62,7 +62,7 @@ export const getBotanixStakingExternalSwapQuote = ({ txnData: { to: getContract(BOTANIX, "StBTC"), data: encodeFunctionData({ - abi: StBTCABI.abi, + abi: StBTCABI, functionName: "deposit", args: [amountIn, receiverAddress], }), @@ -97,7 +97,7 @@ export const getBotanixStakingExternalSwapQuote = ({ txnData: { to: getContract(BOTANIX, "StBTC"), data: encodeFunctionData({ - abi: StBTCABI.abi, + abi: StBTCABI, functionName: "withdraw", args: [amountIn, receiverAddress, getContract(BOTANIX, "ExternalHandler")], }), diff --git a/sdk/tsconfig.json b/sdk/tsconfig.json index ed98e673c5..560292a723 100644 --- a/sdk/tsconfig.json +++ b/sdk/tsconfig.json @@ -38,5 +38,5 @@ { "transform": "typescript-transform-paths", "afterDeclarations": true } ] }, - "include": ["./src", "./src/**/*.json", "./scripts"] + "include": ["./src", "./src/**/*.json", "./scripts", "../viem-override.d.ts"] } diff --git a/sdk/yarn.lock b/sdk/yarn.lock index f07a04d125..9c2441efdf 100644 --- a/sdk/yarn.lock +++ b/sdk/yarn.lock @@ -755,7 +755,7 @@ __metadata: typescript: 5.4.2 typescript-transform-paths: 3.5.1 universal-perf-hooks: 1.0.1 - viem: ^2.37.1 + viem: 2.37.1 vitest: 3.0.4 languageName: unknown linkType: soft @@ -5497,7 +5497,7 @@ __metadata: languageName: node linkType: hard -"viem@npm:^2.37.1": +"viem@npm:2.37.1": version: 2.37.1 resolution: "viem@npm:2.37.1" dependencies: @@ -5518,6 +5518,27 @@ __metadata: languageName: node linkType: hard +"viem@patch:viem@npm:2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341::locator=%40gmx-io%2Fsdk%40workspace%3A.": + version: 2.37.1 + resolution: "viem@patch:viem@npm%3A2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=410eea&locator=%40gmx-io%2Fsdk%40workspace%3A." + dependencies: + "@noble/curves": 1.9.1 + "@noble/hashes": 1.8.0 + "@scure/bip32": 1.7.0 + "@scure/bip39": 1.6.0 + abitype: 1.0.8 + isows: 1.0.7 + ox: 0.9.3 + ws: 8.18.3 + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 7f0c63f1f263c9af7bc437aa0a99503985733bb779578462c5c225098637fa0735abab219f9c0b6cbac593c977c4fd1f735f80536ab7d47cec60f6e25c124df4 + languageName: node + linkType: hard + "vite-node@npm:3.0.4": version: 3.0.4 resolution: "vite-node@npm:3.0.4" diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index 62a2420da8..51fcfbaf0e 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -19,6 +19,7 @@ import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors import { useSelector } from "context/SyntheticsStateContext/utils"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { TransferRequests } from "domain/multichain/types"; import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct, createDepositTxn } from "domain/synthetics/markets"; import { createGlvDepositTxn } from "domain/synthetics/markets/createGlvDepositTxn"; import { createMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; @@ -43,7 +44,6 @@ import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress } from "sdk/configs/tokens"; import { nowInSeconds } from "sdk/utils/time"; import { applySlippageToMinOut } from "sdk/utils/trade"; -import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainDepositExpressTxnParams } from "./useMultichainDepositExpressTxnParams"; @@ -100,7 +100,7 @@ export const useDepositTransactions = ({ const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; - const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { + const transferRequests = useMemo((): TransferRequests => { const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); return getTransferRequests([ { diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx index 621911c484..4eb243213c 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx @@ -1,4 +1,5 @@ import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import { TransferRequests } from "domain/multichain/types"; import type { CreateDepositParamsStruct, CreateGlvDepositParamsStruct } from "domain/synthetics/markets"; import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; import { buildAndSignMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; @@ -6,7 +7,6 @@ import { useChainId } from "lib/chains"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { GmPaySource } from "../types"; @@ -16,7 +16,7 @@ export function useMultichainDepositExpressTxnParams({ gmParams, glvParams, }: { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; paySource: GmPaySource; gmParams: CreateDepositParamsStruct | undefined; glvParams: CreateGlvDepositParamsStruct | undefined; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx index ff78b13350..5436b5a9c9 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx @@ -1,4 +1,5 @@ import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; +import { TransferRequests } from "domain/multichain/types"; import type { CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; import { buildAndSignMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; import { buildAndSignMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; @@ -6,7 +7,6 @@ import { useChainId } from "lib/chains"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { GmPaySource } from "../types"; @@ -16,7 +16,7 @@ export function useMultichainWithdrawalExpressTxnParams({ gmParams, glvParams, }: { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; paySource: GmPaySource; gmParams: CreateWithdrawalParamsStruct | undefined; glvParams: CreateGlvWithdrawalParamsStruct | undefined; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index 0ea50fde36..cd8fbb40ac 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -12,6 +12,7 @@ import { selectBlockTimestampData } from "context/SyntheticsStateContext/selecto import { useSelector } from "context/SyntheticsStateContext/utils"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { TransferRequests } from "domain/multichain/types"; import { CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct, @@ -37,7 +38,6 @@ import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress } from "sdk/configs/tokens"; import { nowInSeconds } from "sdk/utils/time"; -import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainWithdrawalExpressTxnParams } from "./useMultichainWithdrawalExpressTxnParams"; @@ -88,7 +88,7 @@ export const useWithdrawalTransactions = ({ // ) // : undefined; - const transferRequests = useMemo((): IRelayUtils.TransferRequestsStruct => { + const transferRequests = useMemo((): TransferRequests => { if (isGlv) { return getTransferRequests([ { diff --git a/src/components/GmxAccountModal/DepositView.tsx b/src/components/GmxAccountModal/DepositView.tsx index 965a0358c1..27dbb42f69 100644 --- a/src/components/GmxAccountModal/DepositView.tsx +++ b/src/components/GmxAccountModal/DepositView.tsx @@ -32,6 +32,7 @@ import { useMultichainApprovalsActiveListener } from "context/SyntheticsEvents/u import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { sendCrossChainDepositTxn } from "domain/multichain/sendCrossChainDepositTxn"; import { sendSameChainDepositTxn } from "domain/multichain/sendSameChainDepositTxn"; +import { SendParam } from "domain/multichain/types"; import { useGmxAccountFundingHistory } from "domain/multichain/useGmxAccountFundingHistory"; import { useMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { useMultichainQuoteFeeUsd } from "domain/multichain/useMultichainQuoteFeeUsd"; @@ -61,7 +62,6 @@ import { convertTokenAddress, getNativeToken, getToken } from "sdk/configs/token import { bigMath } from "sdk/utils/bigmath"; import { convertToTokenAmount, convertToUsd, getMidPrice } from "sdk/utils/tokens"; import { applySlippageToMinOut } from "sdk/utils/trade"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; import { AlertInfoCard } from "components/AlertInfo/AlertInfoCard"; import { Amount } from "components/Amount/Amount"; @@ -290,7 +290,7 @@ export const DepositView = () => { tokenAddress: depositViewTokenAddress, }); - const sendParamsWithoutSlippage: SendParamStruct | undefined = useMemo(() => { + const sendParamsWithoutSlippage: SendParam | undefined = useMemo(() => { if ( !account || inputAmount === undefined || @@ -326,7 +326,7 @@ export const DepositView = () => { decimals: selectedTokenSourceChainTokenId?.decimals, }); - const sendParamsWithSlippage: SendParamStruct | undefined = useMemo(() => { + const sendParamsWithSlippage: SendParam | undefined = useMemo(() => { if (!quoteOft || !sendParamsWithoutSlippage) { return undefined; } @@ -335,7 +335,7 @@ export const DepositView = () => { const minAmountLD = applySlippageToMinOut(MULTICHAIN_FUNDING_SLIPPAGE_BPS, receipt.amountReceivedLD as bigint); - const newSendParams: SendParamStruct = { + const newSendParams: SendParam = { ...sendParamsWithoutSlippage, minAmountLD, }; @@ -394,7 +394,7 @@ export const DepositView = () => { (params: { depositViewChain: SourceChainId; metricId: OrderMetricId; - sendParams: SendParamStruct; + sendParams: SendParam; tokenAddress: string; }): TxnCallback => (txnEvent) => { diff --git a/src/components/GmxAccountModal/WithdrawalView.tsx b/src/components/GmxAccountModal/WithdrawalView.tsx index 125590d01b..8031c6bfca 100644 --- a/src/components/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/GmxAccountModal/WithdrawalView.tsx @@ -44,7 +44,7 @@ import { useSelector } from "context/SyntheticsStateContext/utils"; import { useArbitraryError, useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { fallbackCustomError } from "domain/multichain/fallbackCustomError"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; -import { BridgeOutParams } from "domain/multichain/types"; +import { BridgeOutParams, SendParam } from "domain/multichain/types"; import { useGmxAccountFundingHistory } from "domain/multichain/useGmxAccountFundingHistory"; import { useMultichainQuoteFeeUsd } from "domain/multichain/useMultichainQuoteFeeUsd"; import { useQuoteOft } from "domain/multichain/useQuoteOft"; @@ -79,7 +79,6 @@ import { convertTokenAddress, getToken } from "sdk/configs/tokens"; import { bigMath } from "sdk/utils/bigmath"; import { convertToTokenAmount, getMidPrice } from "sdk/utils/tokens"; import { applySlippageToMinOut } from "sdk/utils/trade"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; import { AlertInfoCard } from "components/AlertInfo/AlertInfoCard"; import { Amount } from "components/Amount/Amount"; @@ -222,7 +221,7 @@ export const WithdrawalView = () => { return { nextGmxAccountBalanceUsd }; }, [selectedToken, inputAmount, inputAmountUsd, gmxAccountUsd]); - const sendParamsWithoutSlippage: SendParamStruct | undefined = useMemo(() => { + const sendParamsWithoutSlippage: SendParam | undefined = useMemo(() => { if (!account || inputAmount === undefined || inputAmount <= 0n || withdrawalViewChain === undefined) { return; } @@ -250,7 +249,7 @@ export const WithdrawalView = () => { decimals: selectedTokenSettlementChainTokenId?.decimals, }); - const sendParamsWithSlippage: SendParamStruct | undefined = useMemo(() => { + const sendParamsWithSlippage: SendParam | undefined = useMemo(() => { if (!quoteOft || !sendParamsWithoutSlippage) { return undefined; } @@ -259,7 +258,7 @@ export const WithdrawalView = () => { const minAmountLD = applySlippageToMinOut(MULTICHAIN_FUNDING_SLIPPAGE_BPS, receipt.amountReceivedLD as bigint); - const newSendParams: SendParamStruct = { + const newSendParams: SendParam = { ...sendParamsWithoutSlippage, minAmountLD, }; diff --git a/src/components/GmxAccountModal/toastCustomOrStargateError.ts b/src/components/GmxAccountModal/toastCustomOrStargateError.ts index 6713a69943..4155953e5d 100644 --- a/src/components/GmxAccountModal/toastCustomOrStargateError.ts +++ b/src/components/GmxAccountModal/toastCustomOrStargateError.ts @@ -1,4 +1,4 @@ -import { decodeErrorResult } from "viem"; +import { Abi, decodeErrorResult } from "viem"; import type { AnyChainId } from "config/chains"; import { StargateErrorsAbi } from "config/multichain"; @@ -15,7 +15,7 @@ export function toastCustomOrStargateError(chainId: AnyChainId, error: Error) { if (data) { try { const parsedError = decodeErrorResult({ - abi: abis.CustomErrors.concat(StargateErrorsAbi), + abi: (abis.CustomErrors as Abi).concat(StargateErrorsAbi), data, }); diff --git a/src/components/Referrals/JoinReferralCode.tsx b/src/components/Referrals/JoinReferralCode.tsx index 81b1f9e84b..a10c0c44f5 100644 --- a/src/components/Referrals/JoinReferralCode.tsx +++ b/src/components/Referrals/JoinReferralCode.tsx @@ -19,6 +19,7 @@ import { SyntheticsStateContextProvider } from "context/SyntheticsStateContext/S import { useSelector } from "context/SyntheticsStateContext/utils"; import { type MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { setTraderReferralCodeByUser, validateReferralCodeExists } from "domain/referrals/hooks"; import { getRawRelayerParams, RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express"; @@ -37,7 +38,6 @@ import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { encodeReferralCode } from "sdk/utils/referrals"; import { nowInSeconds } from "sdk/utils/time"; import type { IStargate } from "typechain-types-stargate"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; import Button from "components/Button/Button"; import { useMultichainTokensRequest } from "components/GmxAccountModal/hooks"; @@ -370,11 +370,11 @@ function ReferralCodeFormMultichain({ let amountBeforeFee = minAmount - negativeFee; amountBeforeFee = (amountBeforeFee * 15n) / 10n; - const sendParamsWithMinimumAmount: SendParamStruct = { + const sendParamsWithMinimumAmount: SendParam = { ...sendParamsWithRoughAmount, amountLD: amountBeforeFee, - minAmountLD: 0, + minAmountLD: 0n, }; const quoteSend = await iStargateInstance.quoteSend(sendParamsWithMinimumAmount, false); @@ -477,7 +477,7 @@ function ReferralCodeFormMultichain({ }, }; - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, diff --git a/src/components/TableMarketFilter/MarketFilterLongShort.tsx b/src/components/TableMarketFilter/MarketFilterLongShort.tsx index 67da0700c3..25e8eb26e2 100644 --- a/src/components/TableMarketFilter/MarketFilterLongShort.tsx +++ b/src/components/TableMarketFilter/MarketFilterLongShort.tsx @@ -166,7 +166,9 @@ export function MarketFilterLongShort({ value, onChange, withPositions, asButton ? getNormalizedTokenSymbol(market.longToken.symbol) + getNormalizedTokenSymbol(market.shortToken.symbol) : market.indexToken.symbol; - const collateralToken = props.item.collateralAddress && getToken(chainId, props.item.collateralAddress); + const collateralToken = props.item.collateralAddress + ? getToken(chainId, props.item.collateralAddress) + : undefined; const collateralSymbol = collateralToken?.symbol; if (props.item.direction === "long" || props.item.direction === "short") { diff --git a/src/components/UserIncentiveDistributionList/utils.tsx b/src/components/UserIncentiveDistributionList/utils.tsx index cf3e90a776..dbdc2b0fe5 100644 --- a/src/components/UserIncentiveDistributionList/utils.tsx +++ b/src/components/UserIncentiveDistributionList/utils.tsx @@ -40,14 +40,16 @@ export async function checkValidity({ const hash = hashMessage(message); const [inMemorySignatureResponse, onchainSignatureResponse] = (await Promise.all([ - publicClient - .readContract({ - address: account, - abi: abis.SmartAccount, - functionName: "isValidSignature", - args: [hash, claimTermsAcceptedSignature], - }) - .catch(() => "0x"), + claimTermsAcceptedSignature + ? publicClient + .readContract({ + address: account, + abi: abis.SmartAccount, + functionName: "isValidSignature", + args: [hash, claimTermsAcceptedSignature], + }) + .catch(() => "0x") + : Promise.resolve("0x"), publicClient .readContract({ address: account, diff --git a/src/config/multichain.ts b/src/config/multichain.ts index 062943de6e..1c504e0c0f 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -11,7 +11,7 @@ import { address as ethPoolOptimismSepolia } from "@stargatefinance/stg-evm-sdk- import { address as usdcSgPoolOptimismSepolia } from "@stargatefinance/stg-evm-sdk-v2/deployments/optsep-testnet/StargatePoolUSDC.json"; import { address as ethPoolSepolia } from "@stargatefinance/stg-evm-sdk-v2/deployments/sepolia-testnet/StargatePoolNative.json"; import { address as usdcSgPoolSepolia } from "@stargatefinance/stg-evm-sdk-v2/deployments/sepolia-testnet/StargatePoolUSDC.json"; -import { Wallet, type JsonFragment } from "ethers"; +import { Wallet } from "ethers"; import invert from "lodash/invert"; import mapValues from "lodash/mapValues"; import uniq from "lodash/uniq"; @@ -371,7 +371,7 @@ export const CHAIN_ID_PREFERRED_DEPOSIT_TOKEN: Record export const MULTICHAIN_FUNDING_SLIPPAGE_BPS = 50; -export const StargateErrorsAbi = _StargateErrorsAbi as readonly (Abi[number] & JsonFragment)[]; +export const StargateErrorsAbi = _StargateErrorsAbi as Abi; export const CHAIN_ID_TO_ENDPOINT_ID: Record = { [ARBITRUM_SEPOLIA]: 40231, diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index a23a479d2a..10ab3485b7 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -1,6 +1,7 @@ import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities"; import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex, zeroAddress } from "viem"; +import { TransferRequests } from "domain/multichain/types"; import type { RelayParamsPayload } from "domain/synthetics/express"; import { CreateDepositParamsStruct, @@ -11,7 +12,6 @@ import { import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; import { hashString } from "sdk/utils/hash"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { BRIDGE_OUT_PARAMS, @@ -48,7 +48,7 @@ type SetTraderReferralCodeAction = { }; type DepositActionData = CommonActionData & { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateDepositParamsStruct; }; @@ -74,7 +74,7 @@ type BridgeOutAction = { }; type GlvDepositActionData = CommonActionData & { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvDepositParamsStruct; }; @@ -84,7 +84,7 @@ type GlvDepositAction = { }; type WithdrawalActionData = CommonActionData & { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateWithdrawalParamsStruct; }; @@ -94,7 +94,7 @@ type WithdrawalAction = { }; type GlvWithdrawalActionData = CommonActionData & { - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvWithdrawalParamsStruct; }; diff --git a/src/domain/multichain/getSendParams.ts b/src/domain/multichain/getSendParams.ts index 0fb1f0bd9a..9853c669c6 100644 --- a/src/domain/multichain/getSendParams.ts +++ b/src/domain/multichain/getSendParams.ts @@ -4,7 +4,7 @@ import { toHex } from "viem"; import type { AnyChainId, ContractsChainId } from "config/chains"; import { getContract } from "config/contracts"; import { getLayerZeroEndpointId, isSettlementChain, isSourceChain } from "config/multichain"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; +import { SendParam } from "domain/multichain/types"; import { CodecUiHelper, MultichainAction } from "./codecs/CodecUiHelper"; import { OftCmd, SEND_MODE_TAXI } from "./codecs/OftCmd"; @@ -30,7 +30,7 @@ export function getMultichainTransferSendParams({ isToGmx: boolean; isManualGas?: boolean; action?: MultichainAction; -}): SendParamStruct { +}): SendParam { const oftCmd: OftCmd = new OftCmd(SEND_MODE_TAXI, []); const dstEid = getLayerZeroEndpointId(dstChainId); @@ -75,7 +75,7 @@ export function getMultichainTransferSendParams({ extraOptions = builder.toHex(); } - const sendParams: SendParamStruct = { + const sendParams: SendParam = { dstEid, to, amountLD: amount, diff --git a/src/domain/multichain/getTransferRequests.tsx b/src/domain/multichain/getTransferRequests.tsx index c8e1a1d805..e612803db7 100644 --- a/src/domain/multichain/getTransferRequests.tsx +++ b/src/domain/multichain/getTransferRequests.tsx @@ -1,4 +1,4 @@ -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; +import type { TransferRequests } from "domain/multichain/types"; export function getTransferRequests( transfers: { @@ -6,8 +6,8 @@ export function getTransferRequests( token: string | undefined; amount: bigint | undefined; }[] -): IRelayUtils.TransferRequestsStruct { - const requests: IRelayUtils.TransferRequestsStruct = { +): TransferRequests { + const requests: TransferRequests = { tokens: [], receivers: [], amounts: [], diff --git a/src/domain/multichain/sendCrossChainDepositTxn.ts b/src/domain/multichain/sendCrossChainDepositTxn.ts index 5d9a6ff31e..2d3ee7ebaa 100644 --- a/src/domain/multichain/sendCrossChainDepositTxn.ts +++ b/src/domain/multichain/sendCrossChainDepositTxn.ts @@ -1,11 +1,12 @@ import { encodeFunctionData, zeroAddress } from "viem"; import type { SourceChainId } from "config/chains"; -import { IStargateAbi } from "config/multichain"; -import type { QuoteSend } from "domain/multichain/types"; +import { SendParam } from "domain/multichain/types"; import { TxnCallback, WalletTxnCtx, sendWalletTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; +import { abis } from "sdk/abis"; + +import type { MessagingFee } from "./types"; export async function sendCrossChainDepositTxn({ chainId, @@ -23,9 +24,9 @@ export async function sendCrossChainDepositTxn({ tokenAddress: string; stargateAddress: string; amount: bigint; - sendParams: SendParamStruct; + sendParams: SendParam; account: string; - quoteSend: QuoteSend; + quoteSend: MessagingFee; callback?: TxnCallback; }) { const isNative = tokenAddress === zeroAddress; @@ -36,7 +37,7 @@ export async function sendCrossChainDepositTxn({ to: stargateAddress, signer: signer, callData: encodeFunctionData({ - abi: IStargateAbi, + abi: abis.IStargate, functionName: "sendToken", args: [sendParams, quoteSend, account], }), diff --git a/src/domain/multichain/types.ts b/src/domain/multichain/types.ts index 06db8ceb1d..41444853d5 100644 --- a/src/domain/multichain/types.ts +++ b/src/domain/multichain/types.ts @@ -1,12 +1,5 @@ import type { SourceChainId } from "config/chains"; import type { Token, TokenPrices } from "domain/tokens"; -import type { IRelayUtils } from "typechain-types/LayerZeroProvider"; -import type { - MessagingFeeStructOutput, - OFTFeeDetailStruct, - OFTLimitStruct, - OFTReceiptStruct, -} from "typechain-types-stargate/IStargate"; export type TokenChainData = Token & { sourceChainId: SourceChainId; @@ -37,16 +30,54 @@ export type MultichainFundingHistoryItem = { isFromWs?: boolean; }; -export type StrippedGeneratedType = Omit; - -export type BridgeOutParams = StrippedGeneratedType; +export type BridgeOutParams = { + token: string; + amount: bigint; + minAmountOut: bigint; + provider: string; + data: string; +}; export type LayerZeroEndpointId = 40161 | 40231 | 40232 | 30184 | 30110 | 30106; +export type OFTLimit = { + minAmountLD: bigint; + maxAmountLD: bigint; +}; + +export type OFTFeeDetail = { + feeAmountLD: bigint; + description: string; +}; + +export type OFTReceipt = { + amountSentLD: bigint; + amountReceivedLD: bigint; +}; + export type QuoteOft = { - limit: OFTLimitStruct; - oftFeeDetails: OFTFeeDetailStruct[]; - receipt: OFTReceiptStruct; + limit: OFTLimit; + oftFeeDetails: OFTFeeDetail[]; + receipt: OFTReceipt; +}; + +export type TransferRequests = { + tokens: string[]; + receivers: string[]; + amounts: bigint[]; }; -export type QuoteSend = StrippedGeneratedType; +export type SendParam = { + dstEid: number; + to: string; + amountLD: bigint; + minAmountLD: bigint; + extraOptions: string; + composeMsg: string; + oftCmd: string; +}; + +export type MessagingFee = { + nativeFee: bigint; + lzTokenFee: bigint; +}; diff --git a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts index c128804ee5..3cc1dfbf33 100644 --- a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts +++ b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts @@ -145,24 +145,22 @@ export async function estimateMultichainDepositNetworkComposeGas({ stateOverride.push(stateOverrideForNative); } - const args = [ - // From - stargatePool, - // Guid - toHex(0, { size: 32 }), - // Message - message, - // Executor - zeroAddress, - // Extra Data - "0x", - ]; - const gas = await settlementChainPublicClient.estimateContractGas({ address, abi: abis.LayerZeroProvider, functionName: "lzCompose", - args, + args: [ + // From + stargatePool, + // Guid + toHex(0, { size: 32 }), + // Message + message, + // Executor + zeroAddress, + // Extra Data + "0x", + ], account: CodecUiHelper.getLzEndpoint(chainId), stateOverride, }); diff --git a/src/domain/multichain/useMultichainQuoteFeeUsd.ts b/src/domain/multichain/useMultichainQuoteFeeUsd.ts index 8faacd5bf9..6f49567c8d 100644 --- a/src/domain/multichain/useMultichainQuoteFeeUsd.ts +++ b/src/domain/multichain/useMultichainQuoteFeeUsd.ts @@ -8,7 +8,7 @@ import { useChainId } from "lib/chains"; import { getToken } from "sdk/configs/tokens"; import { NATIVE_TOKEN_PRICE_MAP } from "./nativeTokenPriceMap"; -import type { QuoteOft, QuoteSend } from "./types"; +import type { QuoteOft, MessagingFee } from "./types"; export function useMultichainQuoteFeeUsd({ quoteSend, @@ -17,7 +17,7 @@ export function useMultichainQuoteFeeUsd({ sourceChainId, targetChainId, }: { - quoteSend: QuoteSend | undefined; + quoteSend: MessagingFee | undefined; quoteOft: QuoteOft | undefined; unwrappedTokenAddress: string | undefined; sourceChainId: AnyChainId | undefined; @@ -79,8 +79,8 @@ export function useMultichainQuoteFeeUsd({ if (quoteOft !== undefined) { protocolFeeAmount = 0n; for (const feeDetail of quoteOft.oftFeeDetails) { - if (feeDetail.feeAmountLD) { - protocolFeeAmount -= feeDetail.feeAmountLD as bigint; + if (feeDetail.feeAmountLD !== 0n) { + protocolFeeAmount -= feeDetail.feeAmountLD; } } protocolFeeUsd = convertToUsd(protocolFeeAmount, sourceChainDepositTokenDecimals, transferTokenPrices?.maxPrice); diff --git a/src/domain/multichain/useQuoteOft.ts b/src/domain/multichain/useQuoteOft.ts index b9eacf711b..090f485ec6 100644 --- a/src/domain/multichain/useQuoteOft.ts +++ b/src/domain/multichain/useQuoteOft.ts @@ -5,14 +5,8 @@ import type { AnyChainId } from "config/chains"; import { IStargateAbi } from "config/multichain"; import { CONFIG_UPDATE_INTERVAL } from "lib/timeConstants"; import { IStargate } from "typechain-types-stargate"; -import type { - OFTFeeDetailStruct, - OFTLimitStruct, - OFTReceiptStruct, - SendParamStruct, -} from "typechain-types-stargate/IStargate"; -import type { QuoteOft } from "./types"; +import type { OFTFeeDetail, OFTLimit, OFTReceipt, QuoteOft, SendParam } from "./types"; export function useQuoteOft({ sendParams, @@ -21,7 +15,7 @@ export function useQuoteOft({ fromChainId, toChainId, }: { - sendParams: SendParamStruct | undefined; + sendParams: SendParam | undefined; fromStargateAddress: string | undefined; fromChainProvider: Provider | undefined; fromChainId: AnyChainId | undefined; @@ -50,7 +44,7 @@ export function useQuoteOft({ ) as unknown as IStargate; // TODO: add timing metrics - const [limit, oftFeeDetails, receipt]: [OFTLimitStruct, OFTFeeDetailStruct[], OFTReceiptStruct] = + const [limit, oftFeeDetails, receipt]: [OFTLimit, OFTFeeDetail[], OFTReceipt] = await iStargateInstance.quoteOFT(sendParams); return { diff --git a/src/domain/multichain/useQuoteOftLimits.ts b/src/domain/multichain/useQuoteOftLimits.ts index 9f4b71143d..6e6a2b03c5 100644 --- a/src/domain/multichain/useQuoteOftLimits.ts +++ b/src/domain/multichain/useQuoteOftLimits.ts @@ -17,9 +17,9 @@ export function useQuoteOftLimits({ const lastMinAmountLD = useRef(undefined); const lastMaxAmountLD = useRef(undefined); - if (quoteOft && quoteOft.limit.maxAmountLD && quoteOft.limit.minAmountLD) { - lastMaxAmountLD.current = quoteOft.limit.maxAmountLD as bigint; - lastMinAmountLD.current = quoteOft.limit.minAmountLD as bigint; + if (quoteOft) { + lastMaxAmountLD.current = quoteOft.limit.maxAmountLD; + lastMinAmountLD.current = quoteOft.limit.minAmountLD; } const isBelowLimit = diff --git a/src/domain/multichain/useQuoteSend.ts b/src/domain/multichain/useQuoteSend.ts index 93e544c1a6..9fb373b79c 100644 --- a/src/domain/multichain/useQuoteSend.ts +++ b/src/domain/multichain/useQuoteSend.ts @@ -3,11 +3,11 @@ import useSWR from "swr"; import type { AnyChainId } from "config/chains"; import { IStargateAbi } from "config/multichain"; +import { SendParam } from "domain/multichain/types"; import { CONFIG_UPDATE_INTERVAL } from "lib/timeConstants"; import type { IStargate } from "typechain-types-stargate"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; -import type { QuoteSend } from "./types"; +import type { MessagingFee } from "./types"; export function useQuoteSend({ sendParams, @@ -17,7 +17,7 @@ export function useQuoteSend({ toChainId, composeGas, }: { - sendParams: SendParamStruct | undefined; + sendParams: SendParam | undefined; fromStargateAddress: string | undefined; fromChainProvider: Provider | undefined; fromChainId: AnyChainId | undefined; @@ -32,7 +32,7 @@ export function useQuoteSend({ fromChainId !== undefined && fromChainId !== toChainId; - const quoteSendQuery = useSWR( + const quoteSendQuery = useSWR( quoteSendCondition ? ["quoteSend", sendParams.dstEid, sendParams.to, sendParams.amountLD, fromStargateAddress, composeGas] : null, diff --git a/src/domain/synthetics/claimHistory/claimPriceImpactRebate.ts b/src/domain/synthetics/claimHistory/claimPriceImpactRebate.ts index 7524f047c1..436b95f273 100644 --- a/src/domain/synthetics/claimHistory/claimPriceImpactRebate.ts +++ b/src/domain/synthetics/claimHistory/claimPriceImpactRebate.ts @@ -99,7 +99,7 @@ export async function buildAndSignClaimPositionPriceImpactFeesTxn({ const claimCollateralCallData = encodeFunctionData({ abi: abis.MultichainClaimsRouter, functionName: "claimCollateral", - args: [{ ...relayParams, signature }, account, srcChainId, markets, tokens, timeKeys, receiver], + args: [{ ...relayParams, signature }, account, BigInt(srcChainId), markets, tokens, timeKeys, receiver], }); return { diff --git a/src/domain/synthetics/claims/createClaimTransaction.ts b/src/domain/synthetics/claims/createClaimTransaction.ts index 547a74e9f9..c1b8d063e6 100644 --- a/src/domain/synthetics/claims/createClaimTransaction.ts +++ b/src/domain/synthetics/claims/createClaimTransaction.ts @@ -3,7 +3,7 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; import { sendWalletTransaction, TxnCallback, WalletTxnCtx } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; -import ClaimHandlerAbi from "sdk/abis/ClaimHandler.json"; +import ClaimHandlerAbi from "sdk/abis/ClaimHandler"; import type { ContractsChainId } from "sdk/configs/chains"; export function getClaimTransactionCallData( @@ -19,7 +19,7 @@ export function getClaimTransactionCallData( })); return encodeFunctionData({ - abi: ClaimHandlerAbi.abi, + abi: ClaimHandlerAbi, functionName: "claimFunds", args: [params, account], }); diff --git a/src/domain/synthetics/express/expressOrderUtils.ts b/src/domain/synthetics/express/expressOrderUtils.ts index a32fa25216..449bc83d56 100644 --- a/src/domain/synthetics/express/expressOrderUtils.ts +++ b/src/domain/synthetics/express/expressOrderUtils.ts @@ -56,8 +56,6 @@ import { } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; import { setUiFeeReceiverIsExpress } from "sdk/utils/twap/uiFeeReceiver"; -import { GelatoRelayRouter, MultichainSubaccountRouter, SubaccountGelatoRelayRouter } from "typechain-types"; -import { MultichainOrderRouter } from "typechain-types/MultichainOrderRouter"; import { approximateL1GasBuffer, estimateBatchGasLimit, estimateRelayerGasLimit, GasLimitsConfig } from "../fees"; import { getNeedTokenApprove } from "../tokens"; @@ -533,7 +531,7 @@ export async function buildAndSignExpressBatchOrderTxn({ relayPayload: { ...(relayParamsPayload as RelayParamsPayload), deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - userNonce: nowInSeconds(), + userNonce: BigInt(nowInSeconds()), } satisfies RelayParamsPayload, subaccountApproval: subaccount?.signedApproval, paramsLists: getBatchParamsLists(batchParams), @@ -586,7 +584,7 @@ export async function buildAndSignExpressBatchOrderTxn({ BigInt(srcChainId), subaccount.signedApproval?.subaccount, params.paramsLists, - ] satisfies Parameters, + ], }); } else { batchCalldata = encodeFunctionData({ @@ -600,7 +598,7 @@ export async function buildAndSignExpressBatchOrderTxn({ params.account, BigInt(srcChainId), params.paramsLists, - ] satisfies Parameters, + ], }); } } else { @@ -617,7 +615,7 @@ export async function buildAndSignExpressBatchOrderTxn({ params.account, subaccount.signedApproval?.subaccount, params.paramsLists, - ] satisfies Parameters, + ], }); } else { batchCalldata = encodeFunctionData({ @@ -630,7 +628,7 @@ export async function buildAndSignExpressBatchOrderTxn({ }, params.account, params.paramsLists, - ] satisfies Parameters, + ], }); } } diff --git a/src/domain/synthetics/express/relayParamsUtils.ts b/src/domain/synthetics/express/relayParamsUtils.ts index 5791ef2b30..cf830a9ada 100644 --- a/src/domain/synthetics/express/relayParamsUtils.ts +++ b/src/domain/synthetics/express/relayParamsUtils.ts @@ -222,7 +222,7 @@ export function getRawRelayerParams({ externalCalls, fee: feeParams, desChainId: BigInt(chainId), - userNonce: nowInSeconds(), + userNonce: BigInt(nowInSeconds()), }; return relayParamsPayload; @@ -230,17 +230,25 @@ export function getRawRelayerParams({ export function hashRelayParams(relayParams: RelayParamsPayload) { const encoded = encodeAbiParameters(abis.RelayParams, [ - [relayParams.oracleParams.tokens, relayParams.oracleParams.providers, relayParams.oracleParams.data], - [ - relayParams.externalCalls.sendTokens, - relayParams.externalCalls.sendAmounts, - relayParams.externalCalls.externalCallTargets, - relayParams.externalCalls.externalCallDataList, - relayParams.externalCalls.refundTokens, - relayParams.externalCalls.refundReceivers, - ], + { + tokens: relayParams.oracleParams.tokens, + providers: relayParams.oracleParams.providers, + data: relayParams.oracleParams.data, + }, + { + sendTokens: relayParams.externalCalls.sendTokens, + sendAmounts: relayParams.externalCalls.sendAmounts, + externalCallTargets: relayParams.externalCalls.externalCallTargets, + externalCallDataList: relayParams.externalCalls.externalCallDataList, + refundTokens: relayParams.externalCalls.refundTokens, + refundReceivers: relayParams.externalCalls.refundReceivers, + }, relayParams.tokenPermits, - [relayParams.fee.feeToken, relayParams.fee.feeAmount, relayParams.fee.feeSwapPath], + { + feeToken: relayParams.fee.feeToken, + feeAmount: relayParams.fee.feeAmount, + feeSwapPath: relayParams.fee.feeSwapPath, + }, relayParams.userNonce, relayParams.deadline, relayParams.desChainId, diff --git a/src/domain/synthetics/express/types.ts b/src/domain/synthetics/express/types.ts index 263fb4a4a7..6c0c809b54 100644 --- a/src/domain/synthetics/express/types.ts +++ b/src/domain/synthetics/express/types.ts @@ -83,7 +83,7 @@ export type RelayParamsPayload = { fee: RelayFeePayload; deadline: bigint; desChainId: bigint; - userNonce: bigint | number; + userNonce: bigint; }; export type RelayParamsPayloadWithSignature = RelayParamsPayload & { diff --git a/src/domain/synthetics/express/useL1ExpressGasReference.ts b/src/domain/synthetics/express/useL1ExpressGasReference.ts index 20fb9bc0f9..1aea5515c7 100644 --- a/src/domain/synthetics/express/useL1ExpressGasReference.ts +++ b/src/domain/synthetics/express/useL1ExpressGasReference.ts @@ -38,8 +38,8 @@ export function useL1ExpressOrderGasReference() { const referenceDecoded = decodeFunctionResult({ abi: abis.ArbitrumNodeInterface, functionName: "gasEstimateL1Component", - data: referenceResult as `0x${string}`, - }) as [bigint]; + data: referenceResult, + }); return { gasLimit: referenceDecoded[0], diff --git a/src/domain/synthetics/markets/claimFundingFeesTxn.ts b/src/domain/synthetics/markets/claimFundingFeesTxn.ts index a16b8777af..0340ce0597 100644 --- a/src/domain/synthetics/markets/claimFundingFeesTxn.ts +++ b/src/domain/synthetics/markets/claimFundingFeesTxn.ts @@ -93,7 +93,7 @@ export async function buildAndSignClaimFundingFeesTxn({ const claimFundingFeesCallData = encodeFunctionData({ abi: abis.MultichainClaimsRouter, functionName: "claimFundingFees", - args: [{ ...relayParams, signature }, account, srcChainId, markets, tokens, receiver], + args: [{ ...relayParams, signature }, account, BigInt(srcChainId), markets, tokens, receiver], }); return { diff --git a/src/domain/synthetics/markets/createBridgeInTxn.ts b/src/domain/synthetics/markets/createBridgeInTxn.ts index 0173121637..a52b16fda8 100644 --- a/src/domain/synthetics/markets/createBridgeInTxn.ts +++ b/src/domain/synthetics/markets/createBridgeInTxn.ts @@ -6,13 +6,13 @@ import { encodeFunctionData, Hex, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { GlobalExpressParams } from "domain/synthetics/express"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import { IStargate, IStargate__factory } from "typechain-types-stargate"; -import { SendParamStruct } from "typechain-types-stargate/IStargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -40,7 +40,7 @@ export async function createBridgeInTxn({ settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, }); - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index a5a6585495..8353870412 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -1,6 +1,7 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import { AsyncResult } from "lib/useThrottledAsync"; import type { WalletSigner } from "lib/wallets"; @@ -8,7 +9,6 @@ import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; import { CreateDepositParamsStruct } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; @@ -21,7 +21,7 @@ type TxnParams = { relayParams: RelayParamsPayload; emptySignature?: boolean; account: string; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateDepositParamsStruct; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; @@ -63,10 +63,10 @@ export async function buildAndSignMultichainDepositTxn({ signature, }, account, - srcChainId ?? chainId, + BigInt(srcChainId ?? chainId), transferRequests, params, - ] satisfies Parameters, + ], }); return { @@ -88,7 +88,7 @@ export function createMultichainDepositTxn({ chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; // TODO MLTCH: make it just ExpressTxnParams asyncExpressTxnResult: AsyncResult; params: CreateDepositParamsStruct; diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts index 4b4c4f22e3..9388e91aec 100644 --- a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -1,14 +1,13 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { MultichainGlvRouter } from "typechain-types/MultichainGlvRouter"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { CreateGlvDepositParamsStruct } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; @@ -21,7 +20,7 @@ export type CreateMultichainGlvDepositParams = { relayParams: RelayParamsPayload; emptySignature?: boolean; account: string; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvDepositParamsStruct; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; @@ -63,10 +62,10 @@ export async function buildAndSignMultichainGlvDepositTxn({ signature, }, account, - srcChainId ?? chainId, + BigInt(srcChainId ?? chainId), transferRequests, params, - ] satisfies Parameters, + ], }); return { @@ -88,7 +87,7 @@ export function createMultichainGlvDepositTxn({ chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; params: CreateGlvDepositParamsStruct; // TODO MLTCH: support pending txns diff --git a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts index 2f238f7844..357e3ef065 100644 --- a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts @@ -1,14 +1,13 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { MultichainGlvRouter } from "typechain-types/MultichainGlvRouter"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateGlvWithdrawal } from "./signCreateGlvWithdrawal"; @@ -21,7 +20,7 @@ type TxnParams = { relayParams: RelayParamsPayload; emptySignature?: boolean; account: string; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvWithdrawalParamsStruct; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; @@ -63,10 +62,10 @@ export async function buildAndSignMultichainGlvWithdrawalTxn({ signature, }, account, - srcChainId ?? chainId, + BigInt(srcChainId ?? chainId), transferRequests, params, - ] satisfies Parameters, + ], }); return { @@ -88,7 +87,7 @@ export async function createMultichainGlvWithdrawalTxn({ chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; params: CreateGlvWithdrawalParamsStruct; // TODO MLTCH: support pending txns diff --git a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts index 47f5ab6373..df222bb9a8 100644 --- a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts @@ -1,13 +1,13 @@ import { encodeFunctionData } from "viem"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; import { abis } from "sdk/abis"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { IRelayUtils, MultichainGmRouter } from "typechain-types/MultichainGmRouter"; import { CreateWithdrawalParamsStruct } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; @@ -20,7 +20,7 @@ type TxnParams = { relayParams: RelayParamsPayload; emptySignature?: boolean; account: string; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateWithdrawalParamsStruct; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; @@ -62,10 +62,10 @@ export async function buildAndSignMultichainWithdrawalTxn({ signature, }, account, - srcChainId ?? chainId, + BigInt(srcChainId ?? chainId), transferRequests, params, - ] satisfies Parameters, + ], }); return { @@ -87,7 +87,7 @@ export async function createMultichainWithdrawalTxn({ chainId: ContractsChainId; srcChainId: SourceChainId | undefined; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; params: CreateWithdrawalParamsStruct; // TODO MLTCH: support pending txns diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index 8cd3fcd189..bddcd253f7 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -7,6 +7,7 @@ import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam, TransferRequests } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateDepositParamsStruct } from "domain/synthetics/markets"; @@ -16,9 +17,7 @@ import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; -import { IRelayUtils } from "typechain-types/MultichainGmRouter"; import { IStargate } from "typechain-types-stargate"; -import { SendParamStruct } from "typechain-types-stargate/IStargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -40,7 +39,7 @@ export async function createSourceChainDepositTxn({ globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateDepositParamsStruct; account: string; tokenAddress: string; @@ -97,7 +96,7 @@ export async function createSourceChainDepositTxn({ settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, }); - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts index 9ba8c3d87a..ad2c5726f0 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -7,6 +7,7 @@ import type { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam, TransferRequests } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { getRawRelayerParams, @@ -21,9 +22,7 @@ import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { IStargate } from "typechain-types-stargate"; -import type { SendParamStruct } from "typechain-types-stargate/IStargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -46,7 +45,7 @@ export async function createSourceChainGlvDepositTxn({ globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvDepositParamsStruct; account: string; tokenAddress: string; @@ -96,7 +95,7 @@ export async function createSourceChainGlvDepositTxn({ settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, }); - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts index 5e3ddb6b53..0d778a9a23 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -1,25 +1,23 @@ import { t } from "@lingui/macro"; import { getPublicClient } from "@wagmi/core"; -import { Contract } from "ethers"; -import { encodeFunctionData, Hex, zeroAddress } from "viem"; +import { encodeFunctionData, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; -import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam, TransferRequests } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateGlvWithdrawalParamsStruct } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { getTokenBySymbol } from "sdk/configs/tokens"; import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; -import { IRelayUtils } from "typechain-types/MultichainGlvRouter"; -import { IStargate, IStargate__factory } from "typechain-types-stargate"; -import { SendParamStruct } from "typechain-types-stargate/IStargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -39,7 +37,7 @@ export async function createSourceChainGlvWithdrawalTxn({ globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvWithdrawalParamsStruct; tokenAmount: bigint; // additionalFee: bigint; @@ -100,7 +98,7 @@ export async function createSourceChainGlvWithdrawalTxn({ // TODO MLTCH withdrawal also includes a withdrawal compose gas - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, @@ -117,9 +115,14 @@ export async function createSourceChainGlvWithdrawalTxn({ throw new Error("Token ID not found"); } - const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + const publicClient = getPublicClient(getRainbowKitConfig(), { chainId })!; - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + const quoteSend = await publicClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }); const value = quoteSend.nativeFee + (glvTokenAddress === zeroAddress ? tokenAmount : 0n); @@ -129,9 +132,9 @@ export async function createSourceChainGlvWithdrawalTxn({ to: sourceChainTokenId.stargate, signer, callData: encodeFunctionData({ - abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + abi: abis.IStargate, functionName: "send", - args: [sendParams as any, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], }), value, msg: t`Sent withdrawal transaction`, diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts index 66ab78a8d6..fc8ea11136 100644 --- a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -1,25 +1,23 @@ import { t } from "@lingui/macro"; import { getPublicClient } from "@wagmi/core"; -import { Contract } from "ethers"; -import { encodeFunctionData, Hex, zeroAddress } from "viem"; +import { encodeFunctionData, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; -import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam, TransferRequests } from "domain/multichain/types"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { getTokenBySymbol } from "sdk/configs/tokens"; import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { nowInSeconds } from "sdk/utils/time"; -import { IRelayUtils } from "typechain-types/MultichainGmRouter"; -import { IStargate, IStargate__factory } from "typechain-types-stargate"; -import { SendParamStruct } from "typechain-types-stargate/IStargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -41,7 +39,7 @@ export async function createSourceChainWithdrawalTxn({ globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateWithdrawalParamsStruct; // account: string; // tokenAddress: string; @@ -112,7 +110,7 @@ export async function createSourceChainWithdrawalTxn({ // TODO MLTCH withdrawal also includes a withdrawal compose gas - const sendParams: SendParamStruct = getMultichainTransferSendParams({ + const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, account, srcChainId, @@ -129,9 +127,14 @@ export async function createSourceChainWithdrawalTxn({ throw new Error("Token ID not found"); } - const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; + const publicClient = getPublicClient(getRainbowKitConfig(), { chainId })!; - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); + const quoteSend = await publicClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }); const value = quoteSend.nativeFee + (marketTokenAddress === zeroAddress ? tokenAmount : 0n); @@ -141,9 +144,9 @@ export async function createSourceChainWithdrawalTxn({ to: sourceChainTokenId.stargate, signer, callData: encodeFunctionData({ - abi: IStargateAbi as unknown as typeof IStargate__factory.abi, + abi: abis.IStargate, functionName: "send", - args: [sendParams as any, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account as Hex], + args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], }), value, msg: t`Sent withdrawal transaction`, diff --git a/src/domain/synthetics/markets/signCreateDeposit.ts b/src/domain/synthetics/markets/signCreateDeposit.ts index ef666c5fbe..c2493ab4e1 100644 --- a/src/domain/synthetics/markets/signCreateDeposit.ts +++ b/src/domain/synthetics/markets/signCreateDeposit.ts @@ -2,9 +2,9 @@ import type { Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { CreateDepositParamsStruct } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; @@ -20,7 +20,7 @@ export async function signCreateDeposit({ }: { signer: WalletSigner | Wallet; relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateDepositParamsStruct; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; diff --git a/src/domain/synthetics/markets/signCreateGlvDeposit.ts b/src/domain/synthetics/markets/signCreateGlvDeposit.ts index 8dfefa1e09..d1378a26c1 100644 --- a/src/domain/synthetics/markets/signCreateGlvDeposit.ts +++ b/src/domain/synthetics/markets/signCreateGlvDeposit.ts @@ -1,8 +1,8 @@ import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { CreateGlvDepositParamsStruct } from "."; import { getGelatoRelayRouterDomain, hashRelayParams, RelayParamsPayload } from "../express"; @@ -19,7 +19,7 @@ export function signCreateGlvDeposit({ srcChainId: SourceChainId | undefined; signer: WalletSigner; relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateGlvDepositParamsStruct; }) { const types = { diff --git a/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts index e4e74433a3..b27b3dbf56 100644 --- a/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts +++ b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts @@ -2,9 +2,9 @@ import type { Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { CreateWithdrawalParamsStruct } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; @@ -20,7 +20,7 @@ export async function signCreateGlvWithdrawal({ }: { signer: WalletSigner | Wallet; relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateWithdrawalParamsStruct; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; diff --git a/src/domain/synthetics/markets/signCreateWithdrawal.ts b/src/domain/synthetics/markets/signCreateWithdrawal.ts index 4cbe96cb8e..8f04cc82e6 100644 --- a/src/domain/synthetics/markets/signCreateWithdrawal.ts +++ b/src/domain/synthetics/markets/signCreateWithdrawal.ts @@ -2,9 +2,9 @@ import type { AbstractSigner, Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; +import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { IRelayUtils } from "typechain-types/MultichainGmRouter"; import type { CreateWithdrawalParamsStruct } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; @@ -20,7 +20,7 @@ export async function signCreateWithdrawal({ }: { signer: AbstractSigner | WalletSigner | Wallet; relayParams: RelayParamsPayload; - transferRequests: IRelayUtils.TransferRequestsStruct; + transferRequests: TransferRequests; params: CreateWithdrawalParamsStruct; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; diff --git a/src/domain/synthetics/orders/createStakeOrUnStakeTxn.tsx b/src/domain/synthetics/orders/createStakeOrUnStakeTxn.tsx index ca34c70d48..7ba2a4d2c4 100644 --- a/src/domain/synthetics/orders/createStakeOrUnStakeTxn.tsx +++ b/src/domain/synthetics/orders/createStakeOrUnStakeTxn.tsx @@ -7,8 +7,8 @@ import { getContract } from "config/contracts"; import { helperToast } from "lib/helperToast"; import { sleep } from "lib/sleep"; import { sendWalletTransaction, TxnEventName } from "lib/transactions"; -import StBTCABI from "sdk/abis/StBTC.json"; -import ERC20ABI from "sdk/abis/Token.json"; +import StBTCABI from "sdk/abis/StBTC"; +import ERC20ABI from "sdk/abis/Token"; import { encodeExchangeRouterMulticall, ExchangeRouterCall, ExternalCallsPayload } from "sdk/utils/orderTransactions"; import { StakeNotification } from "components/StatusNotification/StakeNotification"; @@ -57,12 +57,12 @@ export async function createStakeOrUnstakeTxn(chainId: number, signer: Signer, p externalCalls.externalCallTargets.push(getContract(chainId, "PBTC"), getContract(chainId, "StBTC")); externalCalls.externalCallDataList.push( encodeFunctionData({ - abi: ERC20ABI.abi, + abi: ERC20ABI, functionName: "approve", args: [getContract(chainId, "StBTC"), p.amount], }), encodeFunctionData({ - abi: StBTCABI.abi, + abi: StBTCABI, functionName: "deposit", args: [p.amount, address], }) @@ -73,7 +73,7 @@ export async function createStakeOrUnstakeTxn(chainId: number, signer: Signer, p throw new Error("Unwrapping not implemented"); } - const stBTC = new ethers.Contract(getContract(chainId, "StBTC"), StBTCABI.abi, signer); + const stBTC = new ethers.Contract(getContract(chainId, "StBTC"), StBTCABI, signer); const tx = await stBTC.withdraw(p.amount, address, address); await signer.provider?.waitForTransaction(tx.hash, 0); diff --git a/src/domain/synthetics/subaccount/removeSubaccount.ts b/src/domain/synthetics/subaccount/removeSubaccount.ts index 23a4a348b5..af988abf5c 100644 --- a/src/domain/synthetics/subaccount/removeSubaccount.ts +++ b/src/domain/synthetics/subaccount/removeSubaccount.ts @@ -12,11 +12,10 @@ import { ExpressTxnData, sendExpressTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; import { abis } from "sdk/abis"; -import SubaccountRouter from "sdk/abis/SubaccountRouter.json"; +import SubaccountRouterAbi from "sdk/abis/SubaccountRouter"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { MultichainSubaccountRouter, SubaccountGelatoRelayRouter } from "typechain-types"; import { ExpressTransactionBuilder, @@ -34,7 +33,7 @@ export async function removeSubaccountWalletTxn( signer: Signer, subaccountAddress: string ): Promise { - const subaccountRouter = new ethers.Contract(getContract(chainId, "SubaccountRouter"), SubaccountRouter.abi, signer); + const subaccountRouter = new ethers.Contract(getContract(chainId, "SubaccountRouter"), SubaccountRouterAbi, signer); return callContract(chainId, subaccountRouter, "removeSubaccount", [subaccountAddress], { value: 0n, @@ -84,20 +83,20 @@ export async function buildAndSignRemoveSubaccountTxn({ }); } - const removeSubaccountCallData = encodeFunctionData({ - abi: isMultichain ? abis.MultichainSubaccountRouter : abis.SubaccountGelatoRelayRouter, - functionName: "removeSubaccount", - args: isMultichain - ? ([ - { ...relayParamsPayload, signature }, - signer.address, - srcChainId ?? chainId, - subaccount.address, - ] satisfies Parameters) - : ([{ ...relayParamsPayload, signature }, signer.address, subaccount.address] satisfies Parameters< - SubaccountGelatoRelayRouter["removeSubaccount"] - >), - }); + let removeSubaccountCallData: string; + if (isMultichain) { + removeSubaccountCallData = encodeFunctionData({ + abi: abis.MultichainSubaccountRouter, + functionName: "removeSubaccount", + args: [{ ...relayParamsPayload, signature }, signer.address, BigInt(srcChainId ?? chainId), subaccount.address], + }); + } else { + removeSubaccountCallData = encodeFunctionData({ + abi: abis.SubaccountGelatoRelayRouter, + functionName: "removeSubaccount", + args: [{ ...relayParamsPayload, signature }, signer.address, subaccount.address], + }); + } return { callData: removeSubaccountCallData, diff --git a/src/domain/synthetics/subaccount/types.ts b/src/domain/synthetics/subaccount/types.ts index c9355e4ce0..1dc1dd37af 100644 --- a/src/domain/synthetics/subaccount/types.ts +++ b/src/domain/synthetics/subaccount/types.ts @@ -26,7 +26,7 @@ export type SubaccountApproval = { expiresAt: bigint; maxAllowedCount: bigint; actionType: string; - desChainId: ContractsChainId; + desChainId: bigint; deadline: bigint; integrationId: string; }; diff --git a/src/domain/synthetics/subaccount/utils.ts b/src/domain/synthetics/subaccount/utils.ts index 833bfd0581..10f09c2876 100644 --- a/src/domain/synthetics/subaccount/utils.ts +++ b/src/domain/synthetics/subaccount/utils.ts @@ -301,7 +301,7 @@ export function getEmptySubaccountApproval( actionType: SUBACCOUNT_ORDER_ACTION, nonce: 0n, deadline: maxUint256, - desChainId: chainId, + desChainId: BigInt(chainId), signature: ZERO_DATA, signedAt: 0, integrationId: zeroHash, @@ -499,7 +499,7 @@ export async function createAndSignSubaccountApproval( shouldAdd: params.shouldAdd, expiresAt: params.expiresAt, maxAllowedCount: params.maxAllowedCount, - desChainId: chainId, + desChainId: BigInt(chainId), actionType: SUBACCOUNT_ORDER_ACTION, nonce, integrationId: zeroHash, diff --git a/src/domain/tokens/approveTokens.tsx b/src/domain/tokens/approveTokens.tsx index b212b4873f..6d218ec2bd 100644 --- a/src/domain/tokens/approveTokens.tsx +++ b/src/domain/tokens/approveTokens.tsx @@ -7,7 +7,7 @@ import { AddTokenPermitFn } from "context/TokenPermitsContext/TokenPermitsContex import { INVALID_PERMIT_SIGNATURE_ERROR } from "lib/errors/customErrors"; import { helperToast } from "lib/helperToast"; import { metrics } from "lib/metrics"; -import Token from "sdk/abis/Token.json"; +import TokenAbi from "sdk/abis/Token"; import { getNativeToken, getToken } from "sdk/configs/tokens"; import { InfoTokens, TokenInfo } from "sdk/types/tokens"; @@ -112,7 +112,7 @@ export async function approveTokens({ }); } - const contract = new ethers.Contract(tokenAddress, Token.abi, signer); + const contract = new ethers.Contract(tokenAddress, TokenAbi, signer); const nativeToken = getNativeToken(chainId); const networkName = getChainName(chainId); return await contract diff --git a/src/domain/tokens/permitUtils.ts b/src/domain/tokens/permitUtils.ts index b25c291207..fcc222327d 100644 --- a/src/domain/tokens/permitUtils.ts +++ b/src/domain/tokens/permitUtils.ts @@ -1,12 +1,18 @@ import { ethers } from "ethers"; -import { decodeFunctionResult, encodeFunctionData, recoverTypedDataAddress } from "viem"; +import { + Abi, + decodeFunctionResult, + encodeFunctionData, + EncodeFunctionDataParameters, + recoverTypedDataAddress, +} from "viem"; import { parseError } from "lib/errors"; import { defined } from "lib/guards"; import { WalletSigner } from "lib/wallets"; import { signTypedData, splitSignature } from "lib/wallets/signing"; import { abis } from "sdk/abis"; -import ERC20PermitInterfaceAbi from "sdk/abis/ERC20PermitInterface.json"; +import ERC20PermitInterfaceAbi from "sdk/abis/ERC20PermitInterface"; import type { ContractsChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_PERMIT_DEADLINE_DURATION } from "sdk/configs/express"; @@ -87,26 +93,33 @@ export async function getTokenPermitParams( }> { const token = getToken(chainId, tokenAddress); - const calls = [ + const calls: { + contractAddress: string; + abi: Abi; + functionName: string; + args: any[]; + }[] = [ { contractAddress: tokenAddress, abi: abis.ERC20PermitInterface, functionName: "name", args: [], - }, + } satisfies EncodeFunctionDataParameters & { contractAddress: string }, { contractAddress: tokenAddress, abi: abis.ERC20PermitInterface, functionName: "nonces", args: [owner], - }, + } satisfies EncodeFunctionDataParameters & { contractAddress: string }, !token.contractVersion - ? { + ? ({ contractAddress: tokenAddress, abi: abis.ERC20PermitInterface, functionName: "version", args: [], - } + } satisfies EncodeFunctionDataParameters & { + contractAddress: string; + }) : undefined, ].filter(defined); @@ -133,21 +146,21 @@ export async function getTokenPermitParams( }) as [bigint, string[]]; const name = decodeFunctionResult({ - abi: ERC20PermitInterfaceAbi.abi, + abi: ERC20PermitInterfaceAbi, functionName: "name", data: decodedMulticallResults[0] as `0x${string}`, }) as string; const nonce = decodeFunctionResult({ - abi: ERC20PermitInterfaceAbi.abi, + abi: ERC20PermitInterfaceAbi, functionName: "nonces", - data: decodedMulticallResults[1] as `0x${string}`, + data: decodedMulticallResults[1], }) as bigint; const version = token.contractVersion ?? (decodeFunctionResult({ - abi: ERC20PermitInterfaceAbi.abi, + abi: ERC20PermitInterfaceAbi, functionName: "version", data: decodedMulticallResults[2] as `0x${string}`, }) as string); diff --git a/src/lib/multicall/Multicall.ts b/src/lib/multicall/Multicall.ts index f724139241..34b1bfbd34 100644 --- a/src/lib/multicall/Multicall.ts +++ b/src/lib/multicall/Multicall.ts @@ -121,7 +121,10 @@ export class Multicall { // Add Errors ABI to each contract ABI to correctly parse errors if (!abiWithErrorsMap[contractCallConfig.abiId]) { - abiWithErrorsMap[contractCallConfig.abiId] = [...allAbis[contractCallConfig.abiId], ...allAbis.CustomErrors]; + abiWithErrorsMap[contractCallConfig.abiId] = [ + ...(allAbis[contractCallConfig.abiId] as any), + ...(allAbis.CustomErrors as any), + ]; } const abi = abiWithErrorsMap[contractCallConfig.abiId]; diff --git a/src/lib/wallets/useAccountType.ts b/src/lib/wallets/useAccountType.ts index 8028b59bf7..15556d6667 100644 --- a/src/lib/wallets/useAccountType.ts +++ b/src/lib/wallets/useAccountType.ts @@ -26,7 +26,7 @@ const KNOWN_SAFE_SINGLETONS = new Set( ); async function isSafeAccount( - address: `0x${string}`, + address: string, client: PublicClient, safeSingletonAddresses: Set ): Promise { @@ -46,7 +46,7 @@ async function isSafeAccount( } async function getAccountType( - address: `0x${string}`, + address: string, client: PublicClient, safeSingletonAddresses: Set ): Promise { diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index 845bd1d694..cf2e21fa38 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -2342,10 +2342,6 @@ msgstr "Trigger" msgid "Unstake failed." msgstr "Unstaking fehlgeschlagen." -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "Order storniert" @@ -4232,7 +4228,7 @@ msgstr "Verringern" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "Auftrag kann nicht ausgeführt werden, da er die Hebelwirkung der Position unter 1 reduzieren würde<<<<<<< HEAD" +msgstr "Auftrag kann nicht ausgeführt werden, da er die Hebelwirkung der Position unter 1 reduzieren würde" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "Einstellungen aktualisieren fehlgeschlagen" msgid "Tweet" msgstr "Tweeten" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 06bfa519c0..9635b95a70 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -2342,10 +2342,6 @@ msgstr "Trigger" msgid "Unstake failed." msgstr "Unstake failed." -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "Debug Express Signature Error" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "Order cancelled" @@ -7014,10 +7010,6 @@ msgstr "Failed to update settings" msgid "Tweet" msgstr "Tweet" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "Funding claimed." diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index 7f4514f51d..f84eacf677 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -2342,10 +2342,6 @@ msgstr "Activador" msgid "Unstake failed." msgstr "Destakeo fallido." -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "Orden cancelada" @@ -4232,7 +4228,7 @@ msgstr "Reducir" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "La orden no se puede ejecutar pues reduciría el apalancamiento de la posición por debajo de 1<<<<<<< HEAD" +msgstr "La orden no se puede ejecutar pues reduciría el apalancamiento de la posición por debajo de 1" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "Falló la actualización de ajustes" msgid "Tweet" msgstr "Tweet" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index b2274a46a4..60690f31da 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -2342,10 +2342,6 @@ msgstr "Déclencheur" msgid "Unstake failed." msgstr "Échec du unstaking." -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "Ordre annulé" @@ -4232,7 +4228,7 @@ msgstr "Diminuer" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "L'ordre ne peut être exécuté car il réduirait l'effet de levier de la position en dessous de 1<<<<<<< HEAD" +msgstr "L'ordre ne peut être exécuté car il réduirait l'effet de levier de la position en dessous de 1" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "Échec de la mise à jour des paramètres" msgid "Tweet" msgstr "Tweet" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 247458c761..c6beb4d8b3 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -2342,10 +2342,6 @@ msgstr "トリガー" msgid "Unstake failed." msgstr "アンステークに失敗しました。" -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "注文はキャンセルされました" @@ -4232,7 +4228,7 @@ msgstr "減少" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "レバレッジ倍率が1倍以下になるため注文を執行できません<<<<<<< HEAD" +msgstr "レバレッジ倍率が1倍以下になるため注文を執行できません" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "設定更新に失敗" msgid "Tweet" msgstr "ツイート" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index ef3ce11975..4c1e68cb4d 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -2342,10 +2342,6 @@ msgstr "트리거" msgid "Unstake failed." msgstr "언스테이킹 실패" -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "주문 최소됨" @@ -4232,7 +4228,7 @@ msgstr "감소" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "포지션의 레버리지가 1 미만으로 감소되므로 주문을 실행할 수 없습니다<<<<<<< HEAD" +msgstr "포지션의 레버리지가 1 미만으로 감소되므로 주문을 실행할 수 없습니다" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "설정 업데이트 실패" msgid "Tweet" msgstr "트윗" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index a9ba6cb1ea..5cb867b660 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -2342,10 +2342,6 @@ msgstr "" msgid "Unstake failed." msgstr "" -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "" @@ -7014,10 +7010,6 @@ msgstr "" msgid "Tweet" msgstr "" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index e2f87501cb..56b199d29e 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -2342,10 +2342,6 @@ msgstr "Триггер" msgid "Unstake failed." msgstr "Снятие стейкинга не удалось." -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "Ордер отменён" @@ -4232,7 +4228,7 @@ msgstr "Уменьшить" #: src/lib/legacy.ts msgid "Order cannot be executed as it would reduce the position's leverage below 1" -msgstr "Ордер не может быть выполнен, так как это уменьшит кредитное плечо позиции ниже 1<<<<<<< HEAD" +msgstr "Ордер не может быть выполнен, так как это уменьшит кредитное плечо позиции ниже 1" #: src/components/PositionShare/PositionShare.tsx msgid "Link copied to clipboard." @@ -7014,10 +7010,6 @@ msgstr "Не удалось обновить настройки" msgid "Tweet" msgstr "Твитнуть" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index b1cca8d956..5288e51f36 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -2342,10 +2342,6 @@ msgstr "触发" msgid "Unstake failed." msgstr "解除质押失败。" -#: src/components/SettingsModal/DebugSettings.tsx -#~ msgid "Debug Express Signature Error" -#~ msgstr "" - #: src/components/StatusNotification/OrderStatusNotification.tsx msgid "Order cancelled" msgstr "订单已取消" @@ -7014,10 +7010,6 @@ msgstr "更新设置失败" msgid "Tweet" msgstr "推文" -#: src/components/Errors/errorToasts.tsx -#~ msgid "Transaction failed due to invalid signature.<0/><1/>Please try a different wallet app or switch to 1CT or Classic mode." -#~ msgstr "" - #: src/domain/synthetics/markets/claimFundingFeesTxn.ts msgid "Funding claimed." msgstr "" diff --git a/tsconfig.json b/tsconfig.json index 363c3fb8bf..a0d81ea635 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,5 +27,5 @@ } }, "references": [{ "path": "./sdk" }], - "include": ["src", "scripts"] + "include": ["src", "scripts", "viem-override.d.ts"] } diff --git a/viem-override.d.ts b/viem-override.d.ts new file mode 100644 index 0000000000..8c2482caf4 --- /dev/null +++ b/viem-override.d.ts @@ -0,0 +1,12 @@ +import "abitype"; + +declare module "abitype" { + export interface Register { + addressType: string; + bytesType: { + inputs: string; + outputs: `0x${string}`; + }; + bigIntType: bigint; + } +} diff --git a/yarn.lock b/yarn.lock index 5b606cc048..6de3b69f14 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16378,6 +16378,27 @@ __metadata: languageName: node linkType: hard +"viem@patch:viem@npm:2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341::locator=gmx-interface%40workspace%3A.": + version: 2.37.1 + resolution: "viem@patch:viem@npm%3A2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=410eea&locator=gmx-interface%40workspace%3A." + dependencies: + "@noble/curves": 1.9.1 + "@noble/hashes": 1.8.0 + "@scure/bip32": 1.7.0 + "@scure/bip39": 1.6.0 + abitype: 1.0.8 + isows: 1.0.7 + ox: 0.9.3 + ws: 8.18.3 + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 7f0c63f1f263c9af7bc437aa0a99503985733bb779578462c5c225098637fa0735abab219f9c0b6cbac593c977c4fd1f735f80536ab7d47cec60f6e25c124df4 + languageName: node + linkType: hard + "vite-bundle-analyzer@npm:0.20.1": version: 0.20.1 resolution: "vite-bundle-analyzer@npm:0.20.1" From 6f09be753d5c4463ff095869868f6849337d3402 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 20 Oct 2025 19:26:41 +0200 Subject: [PATCH 24/38] Multichain LP enhancement --- .yarn/patches/viem-npm-2.37.1-7013552341 | 6 +- sdk/src/configs/dataStore.ts | 6 + sdk/src/configs/markets.ts | 4 +- sdk/src/types/subsquid.ts | 15707 ++++++++-------- sdk/src/types/tokens.ts | 3 + sdk/src/types/trade.ts | 1 + .../utils/fees/estimateOraclePriceCount.ts | 2 +- sdk/src/utils/fees/executionFee.ts | 16 +- sdk/src/utils/markets.ts | 7 + sdk/src/utils/swap/buildSwapStrategy.ts | 8 +- sdk/yarn.lock | 4 +- src/App/MainRoutes.tsx | 7 +- src/components/GmSwap/GmFees/GmFees.tsx | 10 +- .../GmDepositWithdrawalBox.tsx | 353 +- .../GmDepositWithdrawalBox/InfoRows.tsx | 25 +- .../lpTxn/useDepositTransactions.tsx | 244 +- .../lpTxn/useLpTransactions.tsx | 23 +- .../useMultichainDepositExpressTxnParams.tsx | 8 +- ...seMultichainWithdrawalExpressTxnParams.tsx | 18 +- .../lpTxn/useParams.tsx | 424 + .../lpTxn/useWithdrawalTransactions.tsx | 139 +- .../selectDepositWithdrawalAmounts.ts | 148 + .../GmSwapBox/GmDepositWithdrawalBox/types.ts | 5 + .../useDepositWithdrawalAmounts.tsx | 174 - .../useDepositWithdrawalFees.tsx | 141 +- .../useGmDepositWithdrawalBoxState.tsx | 114 - .../useGmSwapSubmitState.tsx | 213 +- .../useTokensToApprove.tsx | 279 +- .../useUpdateInputAmounts.tsx | 8 +- .../useUpdateTokens.tsx | 12 +- .../GmSwapBox/GmShiftBox/GmShiftBox.tsx | 6 +- ...eDepositWithdrawalSetFirstTokenAddress.tsx | 13 - .../GmSwap/GmSwapBox/useGmWarningState.ts | 12 +- .../GmxAccountModal/DepositView.tsx | 4 +- .../SelectAssetToDepositView.tsx | 4 +- src/components/GmxAccountModal/hooks.ts | 90 +- .../MarketStats/hooks/useBestGmPoolForGlv.ts | 2 +- src/components/Referrals/JoinReferralCode.tsx | 8 +- src/config/multichain.ts | 165 +- .../PoolsDetailsContext.tsx | 703 +- .../SyntheticsStateContextProvider.tsx | 13 + .../selectors/tradeSelectors.ts | 4 +- src/domain/multichain/arbitraryRelayParams.ts | 3 - src/domain/multichain/codecs/CodecUiHelper.ts | 16 +- ...MultichainDepositNetworkComposeGas.spec.ts | 271 + ...imateMultichainDepositNetworkComposeGas.ts | 142 + .../fetchMultichainTokenBalances.ts | 6 + .../useMultichainDepositNetworkComposeGas.ts | 112 +- .../multichain/useMultichainQuoteFeeUsd.ts | 131 +- .../synthetics/express/expressOrderUtils.ts | 3 - .../synthetics/express/oracleParamsUtils.ts | 37 +- .../synthetics/express/relayParamsUtils.ts | 16 +- .../synthetics/markets/createBridgeInTxn.ts | 7 +- .../synthetics/markets/createDepositTxn.ts | 34 +- .../synthetics/markets/createGlvDepositTxn.ts | 40 +- .../markets/createGlvWithdrawalTxn.ts | 90 +- .../markets/createMultichainDepositTxn.ts | 6 +- .../markets/createMultichainGlvDepositTxn.ts | 6 +- .../createMultichainGlvWithdrawalTxn.ts | 6 +- .../markets/createMultichainWithdrawalTxn.ts | 6 +- .../markets/createSourceChainDepositTxn.ts | 108 +- .../markets/createSourceChainGlvDepositTxn.ts | 108 +- .../createSourceChainGlvWithdrawalTxn.ts | 117 +- .../markets/createSourceChainWithdrawalTxn.ts | 120 +- .../synthetics/markets/createWithdrawalTxn.ts | 96 +- ...mateDepositPlatformTokenTransferOutFees.ts | 82 + ...lvWithdrawalPlatformTokenTransferInFees.ts | 180 + .../estimatePureDepositGasLimit.ts | 41 + .../estimatePureGlvDepositGasLimit.ts | 45 + .../estimatePureGlvWithdrawalGasLimit.ts | 44 + .../estimatePureLpActionExecutionFee.ts | 75 + .../estimatePureWithdrawalGasLimit.ts | 41 + .../estimateSourceChainDepositFees.ts | 337 + .../estimateSourceChainGlvDepositFees.ts | 293 + .../estimateSourceChainGlvWithdrawalFees.ts | 122 + .../estimateSourceChainWithdrawalFees.ts | 275 + ...teWithdrawalPlatformTokenTransferInFees.ts | 181 + .../synthetics/markets/signCreateDeposit.ts | 12 +- .../markets/signCreateGlvDeposit.ts | 13 +- .../markets/signCreateGlvWithdrawal.ts | 7 +- .../markets/signCreateWithdrawal.ts | 8 +- src/domain/synthetics/markets/types.ts | 32 +- .../synthetics/markets/useMarketTokensData.ts | 61 +- .../tokens/useOnchainTokenConfigs.ts | 5 +- .../tokens/useTokenRecentPricesData.ts | 66 +- .../synthetics/tokens/useTokensDataRequest.ts | 30 +- .../synthetics/trade/utils/validation.ts | 42 +- src/lib/errors/additionalValidation.ts | 9 +- src/lib/gas/estimateGasLimit.ts | 3 +- src/lib/metrics/utils.ts | 20 +- src/lib/tenderly.tsx | 51 +- src/lib/transactions/iSigner.ts | 307 + src/lib/transactions/sendWalletTransaction.ts | 13 +- src/lib/wallets/rainbowKitConfig.ts | 28 +- src/lib/wallets/signing.ts | 5 +- src/pages/PoolsDetails/PoolsDetails.tsx | 16 +- vitest.global-setup.js | 4 +- yarn.lock | 4 +- 98 files changed, 13610 insertions(+), 9456 deletions(-) create mode 100644 src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx create mode 100644 src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts delete mode 100644 src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx delete mode 100644 src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx delete mode 100644 src/components/GmSwap/GmSwapBox/useDepositWithdrawalSetFirstTokenAddress.tsx create mode 100644 src/domain/multichain/estimateMultichainDepositNetworkComposeGas.spec.ts create mode 100644 src/domain/multichain/estimateMultichainDepositNetworkComposeGas.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimatePureDepositGasLimit.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimatePureGlvWithdrawalGasLimit.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimatePureWithdrawalGasLimit.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts create mode 100644 src/lib/transactions/iSigner.ts diff --git a/.yarn/patches/viem-npm-2.37.1-7013552341 b/.yarn/patches/viem-npm-2.37.1-7013552341 index 6bef3d9ef7..d20e153bc3 100644 --- a/.yarn/patches/viem-npm-2.37.1-7013552341 +++ b/.yarn/patches/viem-npm-2.37.1-7013552341 @@ -7,7 +7,8 @@ index 2fa2d166d6e708ad2adea724a2e20f40b0b9ac88..032498f54ab08dfba43dd125637f0c70 export type ByteArray = Uint8Array; -export type Hex = `0x${string}`; +export type Hex = string - export type Hash = `0x${string}`; +-export type Hash = `0x${string}`; ++export type Hash = string; export type LogTopic = Hex | Hex[] | null; export type SignableMessage = string | { diff --git a/types/misc.ts b/types/misc.ts @@ -20,6 +21,7 @@ index 625ba085cc64d197faff2f981ff06e706c2898a0..59e49bec00ac4a7a2f351c1406a35676 export type ByteArray = Uint8Array -export type Hex = `0x${string}` +export type Hex = string - export type Hash = `0x${string}` +-export type Hash = `0x${string}` ++export type Hash = string export type LogTopic = Hex | Hex[] | null export type SignableMessage = diff --git a/sdk/src/configs/dataStore.ts b/sdk/src/configs/dataStore.ts index 12ce25cddb..00c3d11a9f 100644 --- a/sdk/src/configs/dataStore.ts +++ b/sdk/src/configs/dataStore.ts @@ -1,4 +1,5 @@ import { hashData, hashString, keccakString } from "utils/hash"; +import { applyFactor, expandDecimals } from "utils/numbers"; export const POSITION_IMPACT_FACTOR_KEY = hashString("POSITION_IMPACT_FACTOR"); export const MAX_POSITION_IMPACT_FACTOR_KEY = hashString("MAX_POSITION_IMPACT_FACTOR"); @@ -173,6 +174,11 @@ export function atomicSwapFeeFactorKey(market: string) { return hashData(["bytes32", "address"], [ATOMIC_SWAP_FEE_FACTOR_KEY, market]); } +// 0xc46dff7dcd179b6c69db86df5ffc8eaf8ae18c2a8aa86f51a930178d6a1f63b9 +// 22500000000000000000000000000 +console.log("ATOMIC_SWAP_FEE_FACTOR_KEY", atomicSwapFeeFactorKey("0xb6fc4c9eb02c35a134044526c62bb15014ac0bcc")); +console.log(applyFactor(expandDecimals(1, 30), 22500000000000000000000000000n)); + export function openInterestKey(market: string, collateralToken: string, isLong: boolean) { return hashData(["bytes32", "address", "address", "bool"], [OPEN_INTEREST_KEY, market, collateralToken, isLong]); } diff --git a/sdk/src/configs/markets.ts b/sdk/src/configs/markets.ts index f0dfdbcf8b..589981f682 100644 --- a/sdk/src/configs/markets.ts +++ b/sdk/src/configs/markets.ts @@ -13,11 +13,13 @@ export type MarketConfig = { shortTokenAddress: string; }; +export type MarketsConfigMap = Record; + /* ATTENTION When adding new markets, please add them also to the end of the list in ./src/configs/static/sortedMarkets.ts */ -export const MARKETS: Record> = { +export const MARKETS: Record = { [ARBITRUM]: { // BTC/USD [WBTC.e-USDC] "0x47c031236e19d024b42f8AE6780E44A573170703": { diff --git a/sdk/src/types/subsquid.ts b/sdk/src/types/subsquid.ts index 56eb87be82..61d0c96cab 100644 --- a/sdk/src/types/subsquid.ts +++ b/sdk/src/types/subsquid.ts @@ -4,943 +4,939 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export interface Scalars { - ID: { input: string; output: string }; - String: { input: string; output: string }; - Boolean: { input: boolean; output: boolean }; - Int: { input: number; output: number }; - Float: { input: number; output: number }; - BigInt: { input: number; output: string }; + ID: { input: string; output: string; } + String: { input: string; output: string; } + Boolean: { input: boolean; output: boolean; } + Int: { input: number; output: number; } + Float: { input: number; output: number; } + BigInt: { input: number; output: string; } } export interface AccountPnlHistoryPointObject { - __typename?: "AccountPnlHistoryPointObject"; - account: Scalars["String"]["output"]; - cumulativePnl: Scalars["BigInt"]["output"]; + __typename?: 'AccountPnlHistoryPointObject'; + account: Scalars['String']['output']; + cumulativePnl: Scalars['BigInt']['output']; /** Field for debug */ - cumulativeRealizedFees: Scalars["BigInt"]["output"]; + cumulativeRealizedFees: Scalars['BigInt']['output']; /** Field for debug */ - cumulativeRealizedPnl: Scalars["BigInt"]["output"]; + cumulativeRealizedPnl: Scalars['BigInt']['output']; /** Field for debug */ - cumulativeRealizedPriceImpact: Scalars["BigInt"]["output"]; - pnl: Scalars["BigInt"]["output"]; + cumulativeRealizedPriceImpact: Scalars['BigInt']['output']; + pnl: Scalars['BigInt']['output']; /** Field for debug */ - realizedFees: Scalars["BigInt"]["output"]; + realizedFees: Scalars['BigInt']['output']; /** Field for debug */ - realizedPnl: Scalars["BigInt"]["output"]; + realizedPnl: Scalars['BigInt']['output']; /** Field for debug */ - realizedPriceImpact: Scalars["BigInt"]["output"]; + realizedPriceImpact: Scalars['BigInt']['output']; /** Field for debug */ - startUnrealizedFees: Scalars["BigInt"]["output"]; + startUnrealizedFees: Scalars['BigInt']['output']; /** Field for debug */ - startUnrealizedPnl: Scalars["BigInt"]["output"]; - timestamp: Scalars["Int"]["output"]; + startUnrealizedPnl: Scalars['BigInt']['output']; + timestamp: Scalars['Int']['output']; /** Field for debug */ - unrealizedFees: Scalars["BigInt"]["output"]; + unrealizedFees: Scalars['BigInt']['output']; /** Field for debug */ - unrealizedPnl: Scalars["BigInt"]["output"]; + unrealizedPnl: Scalars['BigInt']['output']; } export interface AccountPnlSummaryBucketObject { - __typename?: "AccountPnlSummaryBucketObject"; - bucketLabel: Scalars["String"]["output"]; - losses: Scalars["Int"]["output"]; - pnlBps: Scalars["BigInt"]["output"]; - pnlUsd: Scalars["BigInt"]["output"]; + __typename?: 'AccountPnlSummaryBucketObject'; + bucketLabel: Scalars['String']['output']; + losses: Scalars['Int']['output']; + pnlBps: Scalars['BigInt']['output']; + pnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - realizedBasePnlUsd: Scalars["BigInt"]["output"]; + realizedBasePnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - realizedFeesUsd: Scalars["BigInt"]["output"]; - realizedPnlUsd: Scalars["BigInt"]["output"]; + realizedFeesUsd: Scalars['BigInt']['output']; + realizedPnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - realizedPriceImpactUsd: Scalars["BigInt"]["output"]; + realizedPriceImpactUsd: Scalars['BigInt']['output']; /** Field for debug */ - startUnrealizedBasePnlUsd: Scalars["BigInt"]["output"]; + startUnrealizedBasePnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - startUnrealizedFeesUsd: Scalars["BigInt"]["output"]; - startUnrealizedPnlUsd: Scalars["BigInt"]["output"]; + startUnrealizedFeesUsd: Scalars['BigInt']['output']; + startUnrealizedPnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - unrealizedBasePnlUsd: Scalars["BigInt"]["output"]; + unrealizedBasePnlUsd: Scalars['BigInt']['output']; /** Field for debug */ - unrealizedFeesUsd: Scalars["BigInt"]["output"]; - unrealizedPnlUsd: Scalars["BigInt"]["output"]; - usedCapitalUsd: Scalars["BigInt"]["output"]; - volume: Scalars["BigInt"]["output"]; - wins: Scalars["Int"]["output"]; + unrealizedFeesUsd: Scalars['BigInt']['output']; + unrealizedPnlUsd: Scalars['BigInt']['output']; + usedCapitalUsd: Scalars['BigInt']['output']; + volume: Scalars['BigInt']['output']; + wins: Scalars['Int']['output']; /** Null when no losses and no wins */ - winsLossesRatioBps?: Maybe; + winsLossesRatioBps?: Maybe; } export interface AccountStat { - __typename?: "AccountStat"; - closedCount: Scalars["Int"]["output"]; - cumsumCollateral: Scalars["BigInt"]["output"]; - cumsumSize: Scalars["BigInt"]["output"]; - deposits: Scalars["Int"]["output"]; - id: Scalars["String"]["output"]; - losses: Scalars["Int"]["output"]; - maxCapital: Scalars["BigInt"]["output"]; - netCapital: Scalars["BigInt"]["output"]; + __typename?: 'AccountStat'; + closedCount: Scalars['Int']['output']; + cumsumCollateral: Scalars['BigInt']['output']; + cumsumSize: Scalars['BigInt']['output']; + deposits: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + losses: Scalars['Int']['output']; + maxCapital: Scalars['BigInt']['output']; + netCapital: Scalars['BigInt']['output']; positions: Array; - realizedFees: Scalars["BigInt"]["output"]; - realizedPnl: Scalars["BigInt"]["output"]; - realizedPriceImpact: Scalars["BigInt"]["output"]; - sumMaxSize: Scalars["BigInt"]["output"]; - volume: Scalars["BigInt"]["output"]; - wins: Scalars["Int"]["output"]; + realizedFees: Scalars['BigInt']['output']; + realizedPnl: Scalars['BigInt']['output']; + realizedPriceImpact: Scalars['BigInt']['output']; + sumMaxSize: Scalars['BigInt']['output']; + volume: Scalars['BigInt']['output']; + wins: Scalars['Int']['output']; } + export interface AccountStatpositionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } export interface AccountStatEdge { - __typename?: "AccountStatEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'AccountStatEdge'; + cursor: Scalars['String']['output']; node: AccountStat; } export enum AccountStatOrderByInput { - closedCount_ASC = "closedCount_ASC", - closedCount_ASC_NULLS_FIRST = "closedCount_ASC_NULLS_FIRST", - closedCount_ASC_NULLS_LAST = "closedCount_ASC_NULLS_LAST", - closedCount_DESC = "closedCount_DESC", - closedCount_DESC_NULLS_FIRST = "closedCount_DESC_NULLS_FIRST", - closedCount_DESC_NULLS_LAST = "closedCount_DESC_NULLS_LAST", - cumsumCollateral_ASC = "cumsumCollateral_ASC", - cumsumCollateral_ASC_NULLS_FIRST = "cumsumCollateral_ASC_NULLS_FIRST", - cumsumCollateral_ASC_NULLS_LAST = "cumsumCollateral_ASC_NULLS_LAST", - cumsumCollateral_DESC = "cumsumCollateral_DESC", - cumsumCollateral_DESC_NULLS_FIRST = "cumsumCollateral_DESC_NULLS_FIRST", - cumsumCollateral_DESC_NULLS_LAST = "cumsumCollateral_DESC_NULLS_LAST", - cumsumSize_ASC = "cumsumSize_ASC", - cumsumSize_ASC_NULLS_FIRST = "cumsumSize_ASC_NULLS_FIRST", - cumsumSize_ASC_NULLS_LAST = "cumsumSize_ASC_NULLS_LAST", - cumsumSize_DESC = "cumsumSize_DESC", - cumsumSize_DESC_NULLS_FIRST = "cumsumSize_DESC_NULLS_FIRST", - cumsumSize_DESC_NULLS_LAST = "cumsumSize_DESC_NULLS_LAST", - deposits_ASC = "deposits_ASC", - deposits_ASC_NULLS_FIRST = "deposits_ASC_NULLS_FIRST", - deposits_ASC_NULLS_LAST = "deposits_ASC_NULLS_LAST", - deposits_DESC = "deposits_DESC", - deposits_DESC_NULLS_FIRST = "deposits_DESC_NULLS_FIRST", - deposits_DESC_NULLS_LAST = "deposits_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - losses_ASC = "losses_ASC", - losses_ASC_NULLS_FIRST = "losses_ASC_NULLS_FIRST", - losses_ASC_NULLS_LAST = "losses_ASC_NULLS_LAST", - losses_DESC = "losses_DESC", - losses_DESC_NULLS_FIRST = "losses_DESC_NULLS_FIRST", - losses_DESC_NULLS_LAST = "losses_DESC_NULLS_LAST", - maxCapital_ASC = "maxCapital_ASC", - maxCapital_ASC_NULLS_FIRST = "maxCapital_ASC_NULLS_FIRST", - maxCapital_ASC_NULLS_LAST = "maxCapital_ASC_NULLS_LAST", - maxCapital_DESC = "maxCapital_DESC", - maxCapital_DESC_NULLS_FIRST = "maxCapital_DESC_NULLS_FIRST", - maxCapital_DESC_NULLS_LAST = "maxCapital_DESC_NULLS_LAST", - netCapital_ASC = "netCapital_ASC", - netCapital_ASC_NULLS_FIRST = "netCapital_ASC_NULLS_FIRST", - netCapital_ASC_NULLS_LAST = "netCapital_ASC_NULLS_LAST", - netCapital_DESC = "netCapital_DESC", - netCapital_DESC_NULLS_FIRST = "netCapital_DESC_NULLS_FIRST", - netCapital_DESC_NULLS_LAST = "netCapital_DESC_NULLS_LAST", - realizedFees_ASC = "realizedFees_ASC", - realizedFees_ASC_NULLS_FIRST = "realizedFees_ASC_NULLS_FIRST", - realizedFees_ASC_NULLS_LAST = "realizedFees_ASC_NULLS_LAST", - realizedFees_DESC = "realizedFees_DESC", - realizedFees_DESC_NULLS_FIRST = "realizedFees_DESC_NULLS_FIRST", - realizedFees_DESC_NULLS_LAST = "realizedFees_DESC_NULLS_LAST", - realizedPnl_ASC = "realizedPnl_ASC", - realizedPnl_ASC_NULLS_FIRST = "realizedPnl_ASC_NULLS_FIRST", - realizedPnl_ASC_NULLS_LAST = "realizedPnl_ASC_NULLS_LAST", - realizedPnl_DESC = "realizedPnl_DESC", - realizedPnl_DESC_NULLS_FIRST = "realizedPnl_DESC_NULLS_FIRST", - realizedPnl_DESC_NULLS_LAST = "realizedPnl_DESC_NULLS_LAST", - realizedPriceImpact_ASC = "realizedPriceImpact_ASC", - realizedPriceImpact_ASC_NULLS_FIRST = "realizedPriceImpact_ASC_NULLS_FIRST", - realizedPriceImpact_ASC_NULLS_LAST = "realizedPriceImpact_ASC_NULLS_LAST", - realizedPriceImpact_DESC = "realizedPriceImpact_DESC", - realizedPriceImpact_DESC_NULLS_FIRST = "realizedPriceImpact_DESC_NULLS_FIRST", - realizedPriceImpact_DESC_NULLS_LAST = "realizedPriceImpact_DESC_NULLS_LAST", - sumMaxSize_ASC = "sumMaxSize_ASC", - sumMaxSize_ASC_NULLS_FIRST = "sumMaxSize_ASC_NULLS_FIRST", - sumMaxSize_ASC_NULLS_LAST = "sumMaxSize_ASC_NULLS_LAST", - sumMaxSize_DESC = "sumMaxSize_DESC", - sumMaxSize_DESC_NULLS_FIRST = "sumMaxSize_DESC_NULLS_FIRST", - sumMaxSize_DESC_NULLS_LAST = "sumMaxSize_DESC_NULLS_LAST", - volume_ASC = "volume_ASC", - volume_ASC_NULLS_FIRST = "volume_ASC_NULLS_FIRST", - volume_ASC_NULLS_LAST = "volume_ASC_NULLS_LAST", - volume_DESC = "volume_DESC", - volume_DESC_NULLS_FIRST = "volume_DESC_NULLS_FIRST", - volume_DESC_NULLS_LAST = "volume_DESC_NULLS_LAST", - wins_ASC = "wins_ASC", - wins_ASC_NULLS_FIRST = "wins_ASC_NULLS_FIRST", - wins_ASC_NULLS_LAST = "wins_ASC_NULLS_LAST", - wins_DESC = "wins_DESC", - wins_DESC_NULLS_FIRST = "wins_DESC_NULLS_FIRST", - wins_DESC_NULLS_LAST = "wins_DESC_NULLS_LAST", + closedCount_ASC = 'closedCount_ASC', + closedCount_ASC_NULLS_FIRST = 'closedCount_ASC_NULLS_FIRST', + closedCount_ASC_NULLS_LAST = 'closedCount_ASC_NULLS_LAST', + closedCount_DESC = 'closedCount_DESC', + closedCount_DESC_NULLS_FIRST = 'closedCount_DESC_NULLS_FIRST', + closedCount_DESC_NULLS_LAST = 'closedCount_DESC_NULLS_LAST', + cumsumCollateral_ASC = 'cumsumCollateral_ASC', + cumsumCollateral_ASC_NULLS_FIRST = 'cumsumCollateral_ASC_NULLS_FIRST', + cumsumCollateral_ASC_NULLS_LAST = 'cumsumCollateral_ASC_NULLS_LAST', + cumsumCollateral_DESC = 'cumsumCollateral_DESC', + cumsumCollateral_DESC_NULLS_FIRST = 'cumsumCollateral_DESC_NULLS_FIRST', + cumsumCollateral_DESC_NULLS_LAST = 'cumsumCollateral_DESC_NULLS_LAST', + cumsumSize_ASC = 'cumsumSize_ASC', + cumsumSize_ASC_NULLS_FIRST = 'cumsumSize_ASC_NULLS_FIRST', + cumsumSize_ASC_NULLS_LAST = 'cumsumSize_ASC_NULLS_LAST', + cumsumSize_DESC = 'cumsumSize_DESC', + cumsumSize_DESC_NULLS_FIRST = 'cumsumSize_DESC_NULLS_FIRST', + cumsumSize_DESC_NULLS_LAST = 'cumsumSize_DESC_NULLS_LAST', + deposits_ASC = 'deposits_ASC', + deposits_ASC_NULLS_FIRST = 'deposits_ASC_NULLS_FIRST', + deposits_ASC_NULLS_LAST = 'deposits_ASC_NULLS_LAST', + deposits_DESC = 'deposits_DESC', + deposits_DESC_NULLS_FIRST = 'deposits_DESC_NULLS_FIRST', + deposits_DESC_NULLS_LAST = 'deposits_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + losses_ASC = 'losses_ASC', + losses_ASC_NULLS_FIRST = 'losses_ASC_NULLS_FIRST', + losses_ASC_NULLS_LAST = 'losses_ASC_NULLS_LAST', + losses_DESC = 'losses_DESC', + losses_DESC_NULLS_FIRST = 'losses_DESC_NULLS_FIRST', + losses_DESC_NULLS_LAST = 'losses_DESC_NULLS_LAST', + maxCapital_ASC = 'maxCapital_ASC', + maxCapital_ASC_NULLS_FIRST = 'maxCapital_ASC_NULLS_FIRST', + maxCapital_ASC_NULLS_LAST = 'maxCapital_ASC_NULLS_LAST', + maxCapital_DESC = 'maxCapital_DESC', + maxCapital_DESC_NULLS_FIRST = 'maxCapital_DESC_NULLS_FIRST', + maxCapital_DESC_NULLS_LAST = 'maxCapital_DESC_NULLS_LAST', + netCapital_ASC = 'netCapital_ASC', + netCapital_ASC_NULLS_FIRST = 'netCapital_ASC_NULLS_FIRST', + netCapital_ASC_NULLS_LAST = 'netCapital_ASC_NULLS_LAST', + netCapital_DESC = 'netCapital_DESC', + netCapital_DESC_NULLS_FIRST = 'netCapital_DESC_NULLS_FIRST', + netCapital_DESC_NULLS_LAST = 'netCapital_DESC_NULLS_LAST', + realizedFees_ASC = 'realizedFees_ASC', + realizedFees_ASC_NULLS_FIRST = 'realizedFees_ASC_NULLS_FIRST', + realizedFees_ASC_NULLS_LAST = 'realizedFees_ASC_NULLS_LAST', + realizedFees_DESC = 'realizedFees_DESC', + realizedFees_DESC_NULLS_FIRST = 'realizedFees_DESC_NULLS_FIRST', + realizedFees_DESC_NULLS_LAST = 'realizedFees_DESC_NULLS_LAST', + realizedPnl_ASC = 'realizedPnl_ASC', + realizedPnl_ASC_NULLS_FIRST = 'realizedPnl_ASC_NULLS_FIRST', + realizedPnl_ASC_NULLS_LAST = 'realizedPnl_ASC_NULLS_LAST', + realizedPnl_DESC = 'realizedPnl_DESC', + realizedPnl_DESC_NULLS_FIRST = 'realizedPnl_DESC_NULLS_FIRST', + realizedPnl_DESC_NULLS_LAST = 'realizedPnl_DESC_NULLS_LAST', + realizedPriceImpact_ASC = 'realizedPriceImpact_ASC', + realizedPriceImpact_ASC_NULLS_FIRST = 'realizedPriceImpact_ASC_NULLS_FIRST', + realizedPriceImpact_ASC_NULLS_LAST = 'realizedPriceImpact_ASC_NULLS_LAST', + realizedPriceImpact_DESC = 'realizedPriceImpact_DESC', + realizedPriceImpact_DESC_NULLS_FIRST = 'realizedPriceImpact_DESC_NULLS_FIRST', + realizedPriceImpact_DESC_NULLS_LAST = 'realizedPriceImpact_DESC_NULLS_LAST', + sumMaxSize_ASC = 'sumMaxSize_ASC', + sumMaxSize_ASC_NULLS_FIRST = 'sumMaxSize_ASC_NULLS_FIRST', + sumMaxSize_ASC_NULLS_LAST = 'sumMaxSize_ASC_NULLS_LAST', + sumMaxSize_DESC = 'sumMaxSize_DESC', + sumMaxSize_DESC_NULLS_FIRST = 'sumMaxSize_DESC_NULLS_FIRST', + sumMaxSize_DESC_NULLS_LAST = 'sumMaxSize_DESC_NULLS_LAST', + volume_ASC = 'volume_ASC', + volume_ASC_NULLS_FIRST = 'volume_ASC_NULLS_FIRST', + volume_ASC_NULLS_LAST = 'volume_ASC_NULLS_LAST', + volume_DESC = 'volume_DESC', + volume_DESC_NULLS_FIRST = 'volume_DESC_NULLS_FIRST', + volume_DESC_NULLS_LAST = 'volume_DESC_NULLS_LAST', + wins_ASC = 'wins_ASC', + wins_ASC_NULLS_FIRST = 'wins_ASC_NULLS_FIRST', + wins_ASC_NULLS_LAST = 'wins_ASC_NULLS_LAST', + wins_DESC = 'wins_DESC', + wins_DESC_NULLS_FIRST = 'wins_DESC_NULLS_FIRST', + wins_DESC_NULLS_LAST = 'wins_DESC_NULLS_LAST' } export interface AccountStatWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - closedCount_eq?: InputMaybe; - closedCount_gt?: InputMaybe; - closedCount_gte?: InputMaybe; - closedCount_in?: InputMaybe>; - closedCount_isNull?: InputMaybe; - closedCount_lt?: InputMaybe; - closedCount_lte?: InputMaybe; - closedCount_not_eq?: InputMaybe; - closedCount_not_in?: InputMaybe>; - cumsumCollateral_eq?: InputMaybe; - cumsumCollateral_gt?: InputMaybe; - cumsumCollateral_gte?: InputMaybe; - cumsumCollateral_in?: InputMaybe>; - cumsumCollateral_isNull?: InputMaybe; - cumsumCollateral_lt?: InputMaybe; - cumsumCollateral_lte?: InputMaybe; - cumsumCollateral_not_eq?: InputMaybe; - cumsumCollateral_not_in?: InputMaybe>; - cumsumSize_eq?: InputMaybe; - cumsumSize_gt?: InputMaybe; - cumsumSize_gte?: InputMaybe; - cumsumSize_in?: InputMaybe>; - cumsumSize_isNull?: InputMaybe; - cumsumSize_lt?: InputMaybe; - cumsumSize_lte?: InputMaybe; - cumsumSize_not_eq?: InputMaybe; - cumsumSize_not_in?: InputMaybe>; - deposits_eq?: InputMaybe; - deposits_gt?: InputMaybe; - deposits_gte?: InputMaybe; - deposits_in?: InputMaybe>; - deposits_isNull?: InputMaybe; - deposits_lt?: InputMaybe; - deposits_lte?: InputMaybe; - deposits_not_eq?: InputMaybe; - deposits_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - losses_eq?: InputMaybe; - losses_gt?: InputMaybe; - losses_gte?: InputMaybe; - losses_in?: InputMaybe>; - losses_isNull?: InputMaybe; - losses_lt?: InputMaybe; - losses_lte?: InputMaybe; - losses_not_eq?: InputMaybe; - losses_not_in?: InputMaybe>; - maxCapital_eq?: InputMaybe; - maxCapital_gt?: InputMaybe; - maxCapital_gte?: InputMaybe; - maxCapital_in?: InputMaybe>; - maxCapital_isNull?: InputMaybe; - maxCapital_lt?: InputMaybe; - maxCapital_lte?: InputMaybe; - maxCapital_not_eq?: InputMaybe; - maxCapital_not_in?: InputMaybe>; - netCapital_eq?: InputMaybe; - netCapital_gt?: InputMaybe; - netCapital_gte?: InputMaybe; - netCapital_in?: InputMaybe>; - netCapital_isNull?: InputMaybe; - netCapital_lt?: InputMaybe; - netCapital_lte?: InputMaybe; - netCapital_not_eq?: InputMaybe; - netCapital_not_in?: InputMaybe>; + closedCount_eq?: InputMaybe; + closedCount_gt?: InputMaybe; + closedCount_gte?: InputMaybe; + closedCount_in?: InputMaybe>; + closedCount_isNull?: InputMaybe; + closedCount_lt?: InputMaybe; + closedCount_lte?: InputMaybe; + closedCount_not_eq?: InputMaybe; + closedCount_not_in?: InputMaybe>; + cumsumCollateral_eq?: InputMaybe; + cumsumCollateral_gt?: InputMaybe; + cumsumCollateral_gte?: InputMaybe; + cumsumCollateral_in?: InputMaybe>; + cumsumCollateral_isNull?: InputMaybe; + cumsumCollateral_lt?: InputMaybe; + cumsumCollateral_lte?: InputMaybe; + cumsumCollateral_not_eq?: InputMaybe; + cumsumCollateral_not_in?: InputMaybe>; + cumsumSize_eq?: InputMaybe; + cumsumSize_gt?: InputMaybe; + cumsumSize_gte?: InputMaybe; + cumsumSize_in?: InputMaybe>; + cumsumSize_isNull?: InputMaybe; + cumsumSize_lt?: InputMaybe; + cumsumSize_lte?: InputMaybe; + cumsumSize_not_eq?: InputMaybe; + cumsumSize_not_in?: InputMaybe>; + deposits_eq?: InputMaybe; + deposits_gt?: InputMaybe; + deposits_gte?: InputMaybe; + deposits_in?: InputMaybe>; + deposits_isNull?: InputMaybe; + deposits_lt?: InputMaybe; + deposits_lte?: InputMaybe; + deposits_not_eq?: InputMaybe; + deposits_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + losses_eq?: InputMaybe; + losses_gt?: InputMaybe; + losses_gte?: InputMaybe; + losses_in?: InputMaybe>; + losses_isNull?: InputMaybe; + losses_lt?: InputMaybe; + losses_lte?: InputMaybe; + losses_not_eq?: InputMaybe; + losses_not_in?: InputMaybe>; + maxCapital_eq?: InputMaybe; + maxCapital_gt?: InputMaybe; + maxCapital_gte?: InputMaybe; + maxCapital_in?: InputMaybe>; + maxCapital_isNull?: InputMaybe; + maxCapital_lt?: InputMaybe; + maxCapital_lte?: InputMaybe; + maxCapital_not_eq?: InputMaybe; + maxCapital_not_in?: InputMaybe>; + netCapital_eq?: InputMaybe; + netCapital_gt?: InputMaybe; + netCapital_gte?: InputMaybe; + netCapital_in?: InputMaybe>; + netCapital_isNull?: InputMaybe; + netCapital_lt?: InputMaybe; + netCapital_lte?: InputMaybe; + netCapital_not_eq?: InputMaybe; + netCapital_not_in?: InputMaybe>; positions_every?: InputMaybe; positions_none?: InputMaybe; positions_some?: InputMaybe; - realizedFees_eq?: InputMaybe; - realizedFees_gt?: InputMaybe; - realizedFees_gte?: InputMaybe; - realizedFees_in?: InputMaybe>; - realizedFees_isNull?: InputMaybe; - realizedFees_lt?: InputMaybe; - realizedFees_lte?: InputMaybe; - realizedFees_not_eq?: InputMaybe; - realizedFees_not_in?: InputMaybe>; - realizedPnl_eq?: InputMaybe; - realizedPnl_gt?: InputMaybe; - realizedPnl_gte?: InputMaybe; - realizedPnl_in?: InputMaybe>; - realizedPnl_isNull?: InputMaybe; - realizedPnl_lt?: InputMaybe; - realizedPnl_lte?: InputMaybe; - realizedPnl_not_eq?: InputMaybe; - realizedPnl_not_in?: InputMaybe>; - realizedPriceImpact_eq?: InputMaybe; - realizedPriceImpact_gt?: InputMaybe; - realizedPriceImpact_gte?: InputMaybe; - realizedPriceImpact_in?: InputMaybe>; - realizedPriceImpact_isNull?: InputMaybe; - realizedPriceImpact_lt?: InputMaybe; - realizedPriceImpact_lte?: InputMaybe; - realizedPriceImpact_not_eq?: InputMaybe; - realizedPriceImpact_not_in?: InputMaybe>; - sumMaxSize_eq?: InputMaybe; - sumMaxSize_gt?: InputMaybe; - sumMaxSize_gte?: InputMaybe; - sumMaxSize_in?: InputMaybe>; - sumMaxSize_isNull?: InputMaybe; - sumMaxSize_lt?: InputMaybe; - sumMaxSize_lte?: InputMaybe; - sumMaxSize_not_eq?: InputMaybe; - sumMaxSize_not_in?: InputMaybe>; - volume_eq?: InputMaybe; - volume_gt?: InputMaybe; - volume_gte?: InputMaybe; - volume_in?: InputMaybe>; - volume_isNull?: InputMaybe; - volume_lt?: InputMaybe; - volume_lte?: InputMaybe; - volume_not_eq?: InputMaybe; - volume_not_in?: InputMaybe>; - wins_eq?: InputMaybe; - wins_gt?: InputMaybe; - wins_gte?: InputMaybe; - wins_in?: InputMaybe>; - wins_isNull?: InputMaybe; - wins_lt?: InputMaybe; - wins_lte?: InputMaybe; - wins_not_eq?: InputMaybe; - wins_not_in?: InputMaybe>; + realizedFees_eq?: InputMaybe; + realizedFees_gt?: InputMaybe; + realizedFees_gte?: InputMaybe; + realizedFees_in?: InputMaybe>; + realizedFees_isNull?: InputMaybe; + realizedFees_lt?: InputMaybe; + realizedFees_lte?: InputMaybe; + realizedFees_not_eq?: InputMaybe; + realizedFees_not_in?: InputMaybe>; + realizedPnl_eq?: InputMaybe; + realizedPnl_gt?: InputMaybe; + realizedPnl_gte?: InputMaybe; + realizedPnl_in?: InputMaybe>; + realizedPnl_isNull?: InputMaybe; + realizedPnl_lt?: InputMaybe; + realizedPnl_lte?: InputMaybe; + realizedPnl_not_eq?: InputMaybe; + realizedPnl_not_in?: InputMaybe>; + realizedPriceImpact_eq?: InputMaybe; + realizedPriceImpact_gt?: InputMaybe; + realizedPriceImpact_gte?: InputMaybe; + realizedPriceImpact_in?: InputMaybe>; + realizedPriceImpact_isNull?: InputMaybe; + realizedPriceImpact_lt?: InputMaybe; + realizedPriceImpact_lte?: InputMaybe; + realizedPriceImpact_not_eq?: InputMaybe; + realizedPriceImpact_not_in?: InputMaybe>; + sumMaxSize_eq?: InputMaybe; + sumMaxSize_gt?: InputMaybe; + sumMaxSize_gte?: InputMaybe; + sumMaxSize_in?: InputMaybe>; + sumMaxSize_isNull?: InputMaybe; + sumMaxSize_lt?: InputMaybe; + sumMaxSize_lte?: InputMaybe; + sumMaxSize_not_eq?: InputMaybe; + sumMaxSize_not_in?: InputMaybe>; + volume_eq?: InputMaybe; + volume_gt?: InputMaybe; + volume_gte?: InputMaybe; + volume_in?: InputMaybe>; + volume_isNull?: InputMaybe; + volume_lt?: InputMaybe; + volume_lte?: InputMaybe; + volume_not_eq?: InputMaybe; + volume_not_in?: InputMaybe>; + wins_eq?: InputMaybe; + wins_gt?: InputMaybe; + wins_gte?: InputMaybe; + wins_in?: InputMaybe>; + wins_isNull?: InputMaybe; + wins_lt?: InputMaybe; + wins_lte?: InputMaybe; + wins_not_eq?: InputMaybe; + wins_not_in?: InputMaybe>; } export interface AccountStatsConnection { - __typename?: "AccountStatsConnection"; + __typename?: 'AccountStatsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface AnnualizedPerformanceObject { - __typename?: "AnnualizedPerformanceObject"; - address: Scalars["String"]["output"]; - entity: Scalars["String"]["output"]; - longTokenPerformance: Scalars["BigInt"]["output"]; - shortTokenPerformance: Scalars["BigInt"]["output"]; - uniswapV2Performance: Scalars["BigInt"]["output"]; + __typename?: 'AnnualizedPerformanceObject'; + address: Scalars['String']['output']; + entity: Scalars['String']['output']; + longTokenPerformance: Scalars['BigInt']['output']; + shortTokenPerformance: Scalars['BigInt']['output']; + uniswapV2Performance: Scalars['BigInt']['output']; } export interface AprSnapshot { - __typename?: "AprSnapshot"; - address: Scalars["String"]["output"]; - aprByBorrowingFee: Scalars["BigInt"]["output"]; - aprByFee: Scalars["BigInt"]["output"]; + __typename?: 'AprSnapshot'; + address: Scalars['String']['output']; + aprByBorrowingFee: Scalars['BigInt']['output']; + aprByFee: Scalars['BigInt']['output']; entityType: EntityType; - id: Scalars["String"]["output"]; - snapshotTimestamp: Scalars["Int"]["output"]; + id: Scalars['String']['output']; + snapshotTimestamp: Scalars['Int']['output']; } export interface AprSnapshotEdge { - __typename?: "AprSnapshotEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'AprSnapshotEdge'; + cursor: Scalars['String']['output']; node: AprSnapshot; } export enum AprSnapshotOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - aprByBorrowingFee_ASC = "aprByBorrowingFee_ASC", - aprByBorrowingFee_ASC_NULLS_FIRST = "aprByBorrowingFee_ASC_NULLS_FIRST", - aprByBorrowingFee_ASC_NULLS_LAST = "aprByBorrowingFee_ASC_NULLS_LAST", - aprByBorrowingFee_DESC = "aprByBorrowingFee_DESC", - aprByBorrowingFee_DESC_NULLS_FIRST = "aprByBorrowingFee_DESC_NULLS_FIRST", - aprByBorrowingFee_DESC_NULLS_LAST = "aprByBorrowingFee_DESC_NULLS_LAST", - aprByFee_ASC = "aprByFee_ASC", - aprByFee_ASC_NULLS_FIRST = "aprByFee_ASC_NULLS_FIRST", - aprByFee_ASC_NULLS_LAST = "aprByFee_ASC_NULLS_LAST", - aprByFee_DESC = "aprByFee_DESC", - aprByFee_DESC_NULLS_FIRST = "aprByFee_DESC_NULLS_FIRST", - aprByFee_DESC_NULLS_LAST = "aprByFee_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + aprByBorrowingFee_ASC = 'aprByBorrowingFee_ASC', + aprByBorrowingFee_ASC_NULLS_FIRST = 'aprByBorrowingFee_ASC_NULLS_FIRST', + aprByBorrowingFee_ASC_NULLS_LAST = 'aprByBorrowingFee_ASC_NULLS_LAST', + aprByBorrowingFee_DESC = 'aprByBorrowingFee_DESC', + aprByBorrowingFee_DESC_NULLS_FIRST = 'aprByBorrowingFee_DESC_NULLS_FIRST', + aprByBorrowingFee_DESC_NULLS_LAST = 'aprByBorrowingFee_DESC_NULLS_LAST', + aprByFee_ASC = 'aprByFee_ASC', + aprByFee_ASC_NULLS_FIRST = 'aprByFee_ASC_NULLS_FIRST', + aprByFee_ASC_NULLS_LAST = 'aprByFee_ASC_NULLS_LAST', + aprByFee_DESC = 'aprByFee_DESC', + aprByFee_DESC_NULLS_FIRST = 'aprByFee_DESC_NULLS_FIRST', + aprByFee_DESC_NULLS_LAST = 'aprByFee_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST' } export interface AprSnapshotWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - aprByBorrowingFee_eq?: InputMaybe; - aprByBorrowingFee_gt?: InputMaybe; - aprByBorrowingFee_gte?: InputMaybe; - aprByBorrowingFee_in?: InputMaybe>; - aprByBorrowingFee_isNull?: InputMaybe; - aprByBorrowingFee_lt?: InputMaybe; - aprByBorrowingFee_lte?: InputMaybe; - aprByBorrowingFee_not_eq?: InputMaybe; - aprByBorrowingFee_not_in?: InputMaybe>; - aprByFee_eq?: InputMaybe; - aprByFee_gt?: InputMaybe; - aprByFee_gte?: InputMaybe; - aprByFee_in?: InputMaybe>; - aprByFee_isNull?: InputMaybe; - aprByFee_lt?: InputMaybe; - aprByFee_lte?: InputMaybe; - aprByFee_not_eq?: InputMaybe; - aprByFee_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + aprByBorrowingFee_eq?: InputMaybe; + aprByBorrowingFee_gt?: InputMaybe; + aprByBorrowingFee_gte?: InputMaybe; + aprByBorrowingFee_in?: InputMaybe>; + aprByBorrowingFee_isNull?: InputMaybe; + aprByBorrowingFee_lt?: InputMaybe; + aprByBorrowingFee_lte?: InputMaybe; + aprByBorrowingFee_not_eq?: InputMaybe; + aprByBorrowingFee_not_in?: InputMaybe>; + aprByFee_eq?: InputMaybe; + aprByFee_gt?: InputMaybe; + aprByFee_gte?: InputMaybe; + aprByFee_in?: InputMaybe>; + aprByFee_isNull?: InputMaybe; + aprByFee_lt?: InputMaybe; + aprByFee_lte?: InputMaybe; + aprByFee_not_eq?: InputMaybe; + aprByFee_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; } export interface AprSnapshotsConnection { - __typename?: "AprSnapshotsConnection"; + __typename?: 'AprSnapshotsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface BorrowingRateSnapshot { - __typename?: "BorrowingRateSnapshot"; - address: Scalars["String"]["output"]; - borrowingFactorPerSecondLong: Scalars["BigInt"]["output"]; - borrowingFactorPerSecondShort: Scalars["BigInt"]["output"]; - borrowingRateForPool: Scalars["BigInt"]["output"]; + __typename?: 'BorrowingRateSnapshot'; + address: Scalars['String']['output']; + borrowingFactorPerSecondLong: Scalars['BigInt']['output']; + borrowingFactorPerSecondShort: Scalars['BigInt']['output']; + borrowingRateForPool: Scalars['BigInt']['output']; entityType: EntityType; - id: Scalars["String"]["output"]; - snapshotTimestamp: Scalars["Int"]["output"]; + id: Scalars['String']['output']; + snapshotTimestamp: Scalars['Int']['output']; } export interface BorrowingRateSnapshotEdge { - __typename?: "BorrowingRateSnapshotEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'BorrowingRateSnapshotEdge'; + cursor: Scalars['String']['output']; node: BorrowingRateSnapshot; } export enum BorrowingRateSnapshotOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - borrowingFactorPerSecondLong_ASC = "borrowingFactorPerSecondLong_ASC", - borrowingFactorPerSecondLong_ASC_NULLS_FIRST = "borrowingFactorPerSecondLong_ASC_NULLS_FIRST", - borrowingFactorPerSecondLong_ASC_NULLS_LAST = "borrowingFactorPerSecondLong_ASC_NULLS_LAST", - borrowingFactorPerSecondLong_DESC = "borrowingFactorPerSecondLong_DESC", - borrowingFactorPerSecondLong_DESC_NULLS_FIRST = "borrowingFactorPerSecondLong_DESC_NULLS_FIRST", - borrowingFactorPerSecondLong_DESC_NULLS_LAST = "borrowingFactorPerSecondLong_DESC_NULLS_LAST", - borrowingFactorPerSecondShort_ASC = "borrowingFactorPerSecondShort_ASC", - borrowingFactorPerSecondShort_ASC_NULLS_FIRST = "borrowingFactorPerSecondShort_ASC_NULLS_FIRST", - borrowingFactorPerSecondShort_ASC_NULLS_LAST = "borrowingFactorPerSecondShort_ASC_NULLS_LAST", - borrowingFactorPerSecondShort_DESC = "borrowingFactorPerSecondShort_DESC", - borrowingFactorPerSecondShort_DESC_NULLS_FIRST = "borrowingFactorPerSecondShort_DESC_NULLS_FIRST", - borrowingFactorPerSecondShort_DESC_NULLS_LAST = "borrowingFactorPerSecondShort_DESC_NULLS_LAST", - borrowingRateForPool_ASC = "borrowingRateForPool_ASC", - borrowingRateForPool_ASC_NULLS_FIRST = "borrowingRateForPool_ASC_NULLS_FIRST", - borrowingRateForPool_ASC_NULLS_LAST = "borrowingRateForPool_ASC_NULLS_LAST", - borrowingRateForPool_DESC = "borrowingRateForPool_DESC", - borrowingRateForPool_DESC_NULLS_FIRST = "borrowingRateForPool_DESC_NULLS_FIRST", - borrowingRateForPool_DESC_NULLS_LAST = "borrowingRateForPool_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + borrowingFactorPerSecondLong_ASC = 'borrowingFactorPerSecondLong_ASC', + borrowingFactorPerSecondLong_ASC_NULLS_FIRST = 'borrowingFactorPerSecondLong_ASC_NULLS_FIRST', + borrowingFactorPerSecondLong_ASC_NULLS_LAST = 'borrowingFactorPerSecondLong_ASC_NULLS_LAST', + borrowingFactorPerSecondLong_DESC = 'borrowingFactorPerSecondLong_DESC', + borrowingFactorPerSecondLong_DESC_NULLS_FIRST = 'borrowingFactorPerSecondLong_DESC_NULLS_FIRST', + borrowingFactorPerSecondLong_DESC_NULLS_LAST = 'borrowingFactorPerSecondLong_DESC_NULLS_LAST', + borrowingFactorPerSecondShort_ASC = 'borrowingFactorPerSecondShort_ASC', + borrowingFactorPerSecondShort_ASC_NULLS_FIRST = 'borrowingFactorPerSecondShort_ASC_NULLS_FIRST', + borrowingFactorPerSecondShort_ASC_NULLS_LAST = 'borrowingFactorPerSecondShort_ASC_NULLS_LAST', + borrowingFactorPerSecondShort_DESC = 'borrowingFactorPerSecondShort_DESC', + borrowingFactorPerSecondShort_DESC_NULLS_FIRST = 'borrowingFactorPerSecondShort_DESC_NULLS_FIRST', + borrowingFactorPerSecondShort_DESC_NULLS_LAST = 'borrowingFactorPerSecondShort_DESC_NULLS_LAST', + borrowingRateForPool_ASC = 'borrowingRateForPool_ASC', + borrowingRateForPool_ASC_NULLS_FIRST = 'borrowingRateForPool_ASC_NULLS_FIRST', + borrowingRateForPool_ASC_NULLS_LAST = 'borrowingRateForPool_ASC_NULLS_LAST', + borrowingRateForPool_DESC = 'borrowingRateForPool_DESC', + borrowingRateForPool_DESC_NULLS_FIRST = 'borrowingRateForPool_DESC_NULLS_FIRST', + borrowingRateForPool_DESC_NULLS_LAST = 'borrowingRateForPool_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST' } export interface BorrowingRateSnapshotWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - borrowingFactorPerSecondLong_eq?: InputMaybe; - borrowingFactorPerSecondLong_gt?: InputMaybe; - borrowingFactorPerSecondLong_gte?: InputMaybe; - borrowingFactorPerSecondLong_in?: InputMaybe>; - borrowingFactorPerSecondLong_isNull?: InputMaybe; - borrowingFactorPerSecondLong_lt?: InputMaybe; - borrowingFactorPerSecondLong_lte?: InputMaybe; - borrowingFactorPerSecondLong_not_eq?: InputMaybe; - borrowingFactorPerSecondLong_not_in?: InputMaybe>; - borrowingFactorPerSecondShort_eq?: InputMaybe; - borrowingFactorPerSecondShort_gt?: InputMaybe; - borrowingFactorPerSecondShort_gte?: InputMaybe; - borrowingFactorPerSecondShort_in?: InputMaybe>; - borrowingFactorPerSecondShort_isNull?: InputMaybe; - borrowingFactorPerSecondShort_lt?: InputMaybe; - borrowingFactorPerSecondShort_lte?: InputMaybe; - borrowingFactorPerSecondShort_not_eq?: InputMaybe; - borrowingFactorPerSecondShort_not_in?: InputMaybe>; - borrowingRateForPool_eq?: InputMaybe; - borrowingRateForPool_gt?: InputMaybe; - borrowingRateForPool_gte?: InputMaybe; - borrowingRateForPool_in?: InputMaybe>; - borrowingRateForPool_isNull?: InputMaybe; - borrowingRateForPool_lt?: InputMaybe; - borrowingRateForPool_lte?: InputMaybe; - borrowingRateForPool_not_eq?: InputMaybe; - borrowingRateForPool_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + borrowingFactorPerSecondLong_eq?: InputMaybe; + borrowingFactorPerSecondLong_gt?: InputMaybe; + borrowingFactorPerSecondLong_gte?: InputMaybe; + borrowingFactorPerSecondLong_in?: InputMaybe>; + borrowingFactorPerSecondLong_isNull?: InputMaybe; + borrowingFactorPerSecondLong_lt?: InputMaybe; + borrowingFactorPerSecondLong_lte?: InputMaybe; + borrowingFactorPerSecondLong_not_eq?: InputMaybe; + borrowingFactorPerSecondLong_not_in?: InputMaybe>; + borrowingFactorPerSecondShort_eq?: InputMaybe; + borrowingFactorPerSecondShort_gt?: InputMaybe; + borrowingFactorPerSecondShort_gte?: InputMaybe; + borrowingFactorPerSecondShort_in?: InputMaybe>; + borrowingFactorPerSecondShort_isNull?: InputMaybe; + borrowingFactorPerSecondShort_lt?: InputMaybe; + borrowingFactorPerSecondShort_lte?: InputMaybe; + borrowingFactorPerSecondShort_not_eq?: InputMaybe; + borrowingFactorPerSecondShort_not_in?: InputMaybe>; + borrowingRateForPool_eq?: InputMaybe; + borrowingRateForPool_gt?: InputMaybe; + borrowingRateForPool_gte?: InputMaybe; + borrowingRateForPool_in?: InputMaybe>; + borrowingRateForPool_isNull?: InputMaybe; + borrowingRateForPool_lt?: InputMaybe; + borrowingRateForPool_lte?: InputMaybe; + borrowingRateForPool_not_eq?: InputMaybe; + borrowingRateForPool_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; } export interface BorrowingRateSnapshotsConnection { - __typename?: "BorrowingRateSnapshotsConnection"; + __typename?: 'BorrowingRateSnapshotsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface ClaimAction { - __typename?: "ClaimAction"; - account: Scalars["String"]["output"]; - amounts: Array; + __typename?: 'ClaimAction'; + account: Scalars['String']['output']; + amounts: Array; eventName: ClaimActionType; - id: Scalars["String"]["output"]; - isLongOrders: Array; - marketAddresses: Array; - timestamp: Scalars["Int"]["output"]; - tokenAddresses: Array; - tokenPrices: Array; + id: Scalars['String']['output']; + isLongOrders: Array; + marketAddresses: Array; + timestamp: Scalars['Int']['output']; + tokenAddresses: Array; + tokenPrices: Array; transaction: Transaction; } export interface ClaimActionEdge { - __typename?: "ClaimActionEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ClaimActionEdge'; + cursor: Scalars['String']['output']; node: ClaimAction; } export enum ClaimActionOrderByInput { - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - eventName_ASC = "eventName_ASC", - eventName_ASC_NULLS_FIRST = "eventName_ASC_NULLS_FIRST", - eventName_ASC_NULLS_LAST = "eventName_ASC_NULLS_LAST", - eventName_DESC = "eventName_DESC", - eventName_DESC_NULLS_FIRST = "eventName_DESC_NULLS_FIRST", - eventName_DESC_NULLS_LAST = "eventName_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - timestamp_ASC = "timestamp_ASC", - timestamp_ASC_NULLS_FIRST = "timestamp_ASC_NULLS_FIRST", - timestamp_ASC_NULLS_LAST = "timestamp_ASC_NULLS_LAST", - timestamp_DESC = "timestamp_DESC", - timestamp_DESC_NULLS_FIRST = "timestamp_DESC_NULLS_FIRST", - timestamp_DESC_NULLS_LAST = "timestamp_DESC_NULLS_LAST", - transaction_blockNumber_ASC = "transaction_blockNumber_ASC", - transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", - transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", - transaction_blockNumber_DESC = "transaction_blockNumber_DESC", - transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", - transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", - transaction_chainId_ASC = "transaction_chainId_ASC", - transaction_chainId_ASC_NULLS_FIRST = "transaction_chainId_ASC_NULLS_FIRST", - transaction_chainId_ASC_NULLS_LAST = "transaction_chainId_ASC_NULLS_LAST", - transaction_chainId_DESC = "transaction_chainId_DESC", - transaction_chainId_DESC_NULLS_FIRST = "transaction_chainId_DESC_NULLS_FIRST", - transaction_chainId_DESC_NULLS_LAST = "transaction_chainId_DESC_NULLS_LAST", - transaction_from_ASC = "transaction_from_ASC", - transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", - transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", - transaction_from_DESC = "transaction_from_DESC", - transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", - transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", - transaction_hash_ASC = "transaction_hash_ASC", - transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", - transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", - transaction_hash_DESC = "transaction_hash_DESC", - transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", - transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", - transaction_id_ASC = "transaction_id_ASC", - transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", - transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", - transaction_id_DESC = "transaction_id_DESC", - transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", - transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", - transaction_timestamp_ASC = "transaction_timestamp_ASC", - transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", - transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", - transaction_timestamp_DESC = "transaction_timestamp_DESC", - transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", - transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", - transaction_to_ASC = "transaction_to_ASC", - transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", - transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", - transaction_to_DESC = "transaction_to_DESC", - transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", - transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", - transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", - transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", - transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", - transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", - transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", - transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + eventName_ASC = 'eventName_ASC', + eventName_ASC_NULLS_FIRST = 'eventName_ASC_NULLS_FIRST', + eventName_ASC_NULLS_LAST = 'eventName_ASC_NULLS_LAST', + eventName_DESC = 'eventName_DESC', + eventName_DESC_NULLS_FIRST = 'eventName_DESC_NULLS_FIRST', + eventName_DESC_NULLS_LAST = 'eventName_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + transaction_blockNumber_ASC = 'transaction_blockNumber_ASC', + transaction_blockNumber_ASC_NULLS_FIRST = 'transaction_blockNumber_ASC_NULLS_FIRST', + transaction_blockNumber_ASC_NULLS_LAST = 'transaction_blockNumber_ASC_NULLS_LAST', + transaction_blockNumber_DESC = 'transaction_blockNumber_DESC', + transaction_blockNumber_DESC_NULLS_FIRST = 'transaction_blockNumber_DESC_NULLS_FIRST', + transaction_blockNumber_DESC_NULLS_LAST = 'transaction_blockNumber_DESC_NULLS_LAST', + transaction_from_ASC = 'transaction_from_ASC', + transaction_from_ASC_NULLS_FIRST = 'transaction_from_ASC_NULLS_FIRST', + transaction_from_ASC_NULLS_LAST = 'transaction_from_ASC_NULLS_LAST', + transaction_from_DESC = 'transaction_from_DESC', + transaction_from_DESC_NULLS_FIRST = 'transaction_from_DESC_NULLS_FIRST', + transaction_from_DESC_NULLS_LAST = 'transaction_from_DESC_NULLS_LAST', + transaction_hash_ASC = 'transaction_hash_ASC', + transaction_hash_ASC_NULLS_FIRST = 'transaction_hash_ASC_NULLS_FIRST', + transaction_hash_ASC_NULLS_LAST = 'transaction_hash_ASC_NULLS_LAST', + transaction_hash_DESC = 'transaction_hash_DESC', + transaction_hash_DESC_NULLS_FIRST = 'transaction_hash_DESC_NULLS_FIRST', + transaction_hash_DESC_NULLS_LAST = 'transaction_hash_DESC_NULLS_LAST', + transaction_id_ASC = 'transaction_id_ASC', + transaction_id_ASC_NULLS_FIRST = 'transaction_id_ASC_NULLS_FIRST', + transaction_id_ASC_NULLS_LAST = 'transaction_id_ASC_NULLS_LAST', + transaction_id_DESC = 'transaction_id_DESC', + transaction_id_DESC_NULLS_FIRST = 'transaction_id_DESC_NULLS_FIRST', + transaction_id_DESC_NULLS_LAST = 'transaction_id_DESC_NULLS_LAST', + transaction_timestamp_ASC = 'transaction_timestamp_ASC', + transaction_timestamp_ASC_NULLS_FIRST = 'transaction_timestamp_ASC_NULLS_FIRST', + transaction_timestamp_ASC_NULLS_LAST = 'transaction_timestamp_ASC_NULLS_LAST', + transaction_timestamp_DESC = 'transaction_timestamp_DESC', + transaction_timestamp_DESC_NULLS_FIRST = 'transaction_timestamp_DESC_NULLS_FIRST', + transaction_timestamp_DESC_NULLS_LAST = 'transaction_timestamp_DESC_NULLS_LAST', + transaction_to_ASC = 'transaction_to_ASC', + transaction_to_ASC_NULLS_FIRST = 'transaction_to_ASC_NULLS_FIRST', + transaction_to_ASC_NULLS_LAST = 'transaction_to_ASC_NULLS_LAST', + transaction_to_DESC = 'transaction_to_DESC', + transaction_to_DESC_NULLS_FIRST = 'transaction_to_DESC_NULLS_FIRST', + transaction_to_DESC_NULLS_LAST = 'transaction_to_DESC_NULLS_LAST', + transaction_transactionIndex_ASC = 'transaction_transactionIndex_ASC', + transaction_transactionIndex_ASC_NULLS_FIRST = 'transaction_transactionIndex_ASC_NULLS_FIRST', + transaction_transactionIndex_ASC_NULLS_LAST = 'transaction_transactionIndex_ASC_NULLS_LAST', + transaction_transactionIndex_DESC = 'transaction_transactionIndex_DESC', + transaction_transactionIndex_DESC_NULLS_FIRST = 'transaction_transactionIndex_DESC_NULLS_FIRST', + transaction_transactionIndex_DESC_NULLS_LAST = 'transaction_transactionIndex_DESC_NULLS_LAST' } export enum ClaimActionType { - ClaimFunding = "ClaimFunding", - ClaimPriceImpact = "ClaimPriceImpact", - SettleFundingFeeCancelled = "SettleFundingFeeCancelled", - SettleFundingFeeCreated = "SettleFundingFeeCreated", - SettleFundingFeeExecuted = "SettleFundingFeeExecuted", + ClaimFunding = 'ClaimFunding', + ClaimPriceImpact = 'ClaimPriceImpact', + SettleFundingFeeCancelled = 'SettleFundingFeeCancelled', + SettleFundingFeeCreated = 'SettleFundingFeeCreated', + SettleFundingFeeExecuted = 'SettleFundingFeeExecuted' } export interface ClaimActionWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - amounts_containsAll?: InputMaybe>; - amounts_containsAny?: InputMaybe>; - amounts_containsNone?: InputMaybe>; - amounts_isNull?: InputMaybe; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + amounts_containsAll?: InputMaybe>; + amounts_containsAny?: InputMaybe>; + amounts_containsNone?: InputMaybe>; + amounts_isNull?: InputMaybe; eventName_eq?: InputMaybe; eventName_in?: InputMaybe>; - eventName_isNull?: InputMaybe; + eventName_isNull?: InputMaybe; eventName_not_eq?: InputMaybe; eventName_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isLongOrders_containsAll?: InputMaybe>; - isLongOrders_containsAny?: InputMaybe>; - isLongOrders_containsNone?: InputMaybe>; - isLongOrders_isNull?: InputMaybe; - marketAddresses_containsAll?: InputMaybe>; - marketAddresses_containsAny?: InputMaybe>; - marketAddresses_containsNone?: InputMaybe>; - marketAddresses_isNull?: InputMaybe; - timestamp_eq?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_isNull?: InputMaybe; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not_eq?: InputMaybe; - timestamp_not_in?: InputMaybe>; - tokenAddresses_containsAll?: InputMaybe>; - tokenAddresses_containsAny?: InputMaybe>; - tokenAddresses_containsNone?: InputMaybe>; - tokenAddresses_isNull?: InputMaybe; - tokenPrices_containsAll?: InputMaybe>; - tokenPrices_containsAny?: InputMaybe>; - tokenPrices_containsNone?: InputMaybe>; - tokenPrices_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isLongOrders_containsAll?: InputMaybe>; + isLongOrders_containsAny?: InputMaybe>; + isLongOrders_containsNone?: InputMaybe>; + isLongOrders_isNull?: InputMaybe; + marketAddresses_containsAll?: InputMaybe>; + marketAddresses_containsAny?: InputMaybe>; + marketAddresses_containsNone?: InputMaybe>; + marketAddresses_isNull?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + tokenAddresses_containsAll?: InputMaybe>; + tokenAddresses_containsAny?: InputMaybe>; + tokenAddresses_containsNone?: InputMaybe>; + tokenAddresses_isNull?: InputMaybe; + tokenPrices_containsAll?: InputMaybe>; + tokenPrices_containsAny?: InputMaybe>; + tokenPrices_containsNone?: InputMaybe>; + tokenPrices_isNull?: InputMaybe; transaction?: InputMaybe; - transaction_isNull?: InputMaybe; + transaction_isNull?: InputMaybe; } export interface ClaimActionsConnection { - __typename?: "ClaimActionsConnection"; + __typename?: 'ClaimActionsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface ClaimRef { - __typename?: "ClaimRef"; - id: Scalars["String"]["output"]; + __typename?: 'ClaimRef'; + id: Scalars['String']['output']; } export interface ClaimRefEdge { - __typename?: "ClaimRefEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ClaimRefEdge'; + cursor: Scalars['String']['output']; node: ClaimRef; } export enum ClaimRefOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST' } export interface ClaimRefWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; } export interface ClaimRefsConnection { - __typename?: "ClaimRefsConnection"; + __typename?: 'ClaimRefsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface ClaimableCollateral { - __typename?: "ClaimableCollateral"; - account: Scalars["String"]["output"]; - claimed: Scalars["Boolean"]["output"]; - factor: Scalars["BigInt"]["output"]; - factorByTime: Scalars["BigInt"]["output"]; + __typename?: 'ClaimableCollateral'; + account: Scalars['String']['output']; + claimed: Scalars['Boolean']['output']; + factor: Scalars['BigInt']['output']; + factorByTime: Scalars['BigInt']['output']; group: ClaimableCollateralGroup; - id: Scalars["String"]["output"]; - marketAddress: Scalars["String"]["output"]; - reductionFactor: Scalars["BigInt"]["output"]; - timeKey: Scalars["String"]["output"]; - tokenAddress: Scalars["String"]["output"]; - value: Scalars["BigInt"]["output"]; + id: Scalars['String']['output']; + marketAddress: Scalars['String']['output']; + reductionFactor: Scalars['BigInt']['output']; + timeKey: Scalars['String']['output']; + tokenAddress: Scalars['String']['output']; + value: Scalars['BigInt']['output']; } export interface ClaimableCollateralEdge { - __typename?: "ClaimableCollateralEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ClaimableCollateralEdge'; + cursor: Scalars['String']['output']; node: ClaimableCollateral; } export interface ClaimableCollateralGroup { - __typename?: "ClaimableCollateralGroup"; + __typename?: 'ClaimableCollateralGroup'; claimables: Array; - factor: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - marketAddress: Scalars["String"]["output"]; - timeKey: Scalars["String"]["output"]; - tokenAddress: Scalars["String"]["output"]; + factor: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + marketAddress: Scalars['String']['output']; + timeKey: Scalars['String']['output']; + tokenAddress: Scalars['String']['output']; } + export interface ClaimableCollateralGroupclaimablesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } export interface ClaimableCollateralGroupEdge { - __typename?: "ClaimableCollateralGroupEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ClaimableCollateralGroupEdge'; + cursor: Scalars['String']['output']; node: ClaimableCollateralGroup; } export enum ClaimableCollateralGroupOrderByInput { - factor_ASC = "factor_ASC", - factor_ASC_NULLS_FIRST = "factor_ASC_NULLS_FIRST", - factor_ASC_NULLS_LAST = "factor_ASC_NULLS_LAST", - factor_DESC = "factor_DESC", - factor_DESC_NULLS_FIRST = "factor_DESC_NULLS_FIRST", - factor_DESC_NULLS_LAST = "factor_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - timeKey_ASC = "timeKey_ASC", - timeKey_ASC_NULLS_FIRST = "timeKey_ASC_NULLS_FIRST", - timeKey_ASC_NULLS_LAST = "timeKey_ASC_NULLS_LAST", - timeKey_DESC = "timeKey_DESC", - timeKey_DESC_NULLS_FIRST = "timeKey_DESC_NULLS_FIRST", - timeKey_DESC_NULLS_LAST = "timeKey_DESC_NULLS_LAST", - tokenAddress_ASC = "tokenAddress_ASC", - tokenAddress_ASC_NULLS_FIRST = "tokenAddress_ASC_NULLS_FIRST", - tokenAddress_ASC_NULLS_LAST = "tokenAddress_ASC_NULLS_LAST", - tokenAddress_DESC = "tokenAddress_DESC", - tokenAddress_DESC_NULLS_FIRST = "tokenAddress_DESC_NULLS_FIRST", - tokenAddress_DESC_NULLS_LAST = "tokenAddress_DESC_NULLS_LAST", + factor_ASC = 'factor_ASC', + factor_ASC_NULLS_FIRST = 'factor_ASC_NULLS_FIRST', + factor_ASC_NULLS_LAST = 'factor_ASC_NULLS_LAST', + factor_DESC = 'factor_DESC', + factor_DESC_NULLS_FIRST = 'factor_DESC_NULLS_FIRST', + factor_DESC_NULLS_LAST = 'factor_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + timeKey_ASC = 'timeKey_ASC', + timeKey_ASC_NULLS_FIRST = 'timeKey_ASC_NULLS_FIRST', + timeKey_ASC_NULLS_LAST = 'timeKey_ASC_NULLS_LAST', + timeKey_DESC = 'timeKey_DESC', + timeKey_DESC_NULLS_FIRST = 'timeKey_DESC_NULLS_FIRST', + timeKey_DESC_NULLS_LAST = 'timeKey_DESC_NULLS_LAST', + tokenAddress_ASC = 'tokenAddress_ASC', + tokenAddress_ASC_NULLS_FIRST = 'tokenAddress_ASC_NULLS_FIRST', + tokenAddress_ASC_NULLS_LAST = 'tokenAddress_ASC_NULLS_LAST', + tokenAddress_DESC = 'tokenAddress_DESC', + tokenAddress_DESC_NULLS_FIRST = 'tokenAddress_DESC_NULLS_FIRST', + tokenAddress_DESC_NULLS_LAST = 'tokenAddress_DESC_NULLS_LAST' } export interface ClaimableCollateralGroupWhereInput { @@ -949,6313 +945,6219 @@ export interface ClaimableCollateralGroupWhereInput { claimables_every?: InputMaybe; claimables_none?: InputMaybe; claimables_some?: InputMaybe; - factor_eq?: InputMaybe; - factor_gt?: InputMaybe; - factor_gte?: InputMaybe; - factor_in?: InputMaybe>; - factor_isNull?: InputMaybe; - factor_lt?: InputMaybe; - factor_lte?: InputMaybe; - factor_not_eq?: InputMaybe; - factor_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - timeKey_contains?: InputMaybe; - timeKey_containsInsensitive?: InputMaybe; - timeKey_endsWith?: InputMaybe; - timeKey_eq?: InputMaybe; - timeKey_gt?: InputMaybe; - timeKey_gte?: InputMaybe; - timeKey_in?: InputMaybe>; - timeKey_isNull?: InputMaybe; - timeKey_lt?: InputMaybe; - timeKey_lte?: InputMaybe; - timeKey_not_contains?: InputMaybe; - timeKey_not_containsInsensitive?: InputMaybe; - timeKey_not_endsWith?: InputMaybe; - timeKey_not_eq?: InputMaybe; - timeKey_not_in?: InputMaybe>; - timeKey_not_startsWith?: InputMaybe; - timeKey_startsWith?: InputMaybe; - tokenAddress_contains?: InputMaybe; - tokenAddress_containsInsensitive?: InputMaybe; - tokenAddress_endsWith?: InputMaybe; - tokenAddress_eq?: InputMaybe; - tokenAddress_gt?: InputMaybe; - tokenAddress_gte?: InputMaybe; - tokenAddress_in?: InputMaybe>; - tokenAddress_isNull?: InputMaybe; - tokenAddress_lt?: InputMaybe; - tokenAddress_lte?: InputMaybe; - tokenAddress_not_contains?: InputMaybe; - tokenAddress_not_containsInsensitive?: InputMaybe; - tokenAddress_not_endsWith?: InputMaybe; - tokenAddress_not_eq?: InputMaybe; - tokenAddress_not_in?: InputMaybe>; - tokenAddress_not_startsWith?: InputMaybe; - tokenAddress_startsWith?: InputMaybe; + factor_eq?: InputMaybe; + factor_gt?: InputMaybe; + factor_gte?: InputMaybe; + factor_in?: InputMaybe>; + factor_isNull?: InputMaybe; + factor_lt?: InputMaybe; + factor_lte?: InputMaybe; + factor_not_eq?: InputMaybe; + factor_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + timeKey_contains?: InputMaybe; + timeKey_containsInsensitive?: InputMaybe; + timeKey_endsWith?: InputMaybe; + timeKey_eq?: InputMaybe; + timeKey_gt?: InputMaybe; + timeKey_gte?: InputMaybe; + timeKey_in?: InputMaybe>; + timeKey_isNull?: InputMaybe; + timeKey_lt?: InputMaybe; + timeKey_lte?: InputMaybe; + timeKey_not_contains?: InputMaybe; + timeKey_not_containsInsensitive?: InputMaybe; + timeKey_not_endsWith?: InputMaybe; + timeKey_not_eq?: InputMaybe; + timeKey_not_in?: InputMaybe>; + timeKey_not_startsWith?: InputMaybe; + timeKey_startsWith?: InputMaybe; + tokenAddress_contains?: InputMaybe; + tokenAddress_containsInsensitive?: InputMaybe; + tokenAddress_endsWith?: InputMaybe; + tokenAddress_eq?: InputMaybe; + tokenAddress_gt?: InputMaybe; + tokenAddress_gte?: InputMaybe; + tokenAddress_in?: InputMaybe>; + tokenAddress_isNull?: InputMaybe; + tokenAddress_lt?: InputMaybe; + tokenAddress_lte?: InputMaybe; + tokenAddress_not_contains?: InputMaybe; + tokenAddress_not_containsInsensitive?: InputMaybe; + tokenAddress_not_endsWith?: InputMaybe; + tokenAddress_not_eq?: InputMaybe; + tokenAddress_not_in?: InputMaybe>; + tokenAddress_not_startsWith?: InputMaybe; + tokenAddress_startsWith?: InputMaybe; } export interface ClaimableCollateralGroupsConnection { - __typename?: "ClaimableCollateralGroupsConnection"; + __typename?: 'ClaimableCollateralGroupsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export enum ClaimableCollateralOrderByInput { - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - claimed_ASC = "claimed_ASC", - claimed_ASC_NULLS_FIRST = "claimed_ASC_NULLS_FIRST", - claimed_ASC_NULLS_LAST = "claimed_ASC_NULLS_LAST", - claimed_DESC = "claimed_DESC", - claimed_DESC_NULLS_FIRST = "claimed_DESC_NULLS_FIRST", - claimed_DESC_NULLS_LAST = "claimed_DESC_NULLS_LAST", - factorByTime_ASC = "factorByTime_ASC", - factorByTime_ASC_NULLS_FIRST = "factorByTime_ASC_NULLS_FIRST", - factorByTime_ASC_NULLS_LAST = "factorByTime_ASC_NULLS_LAST", - factorByTime_DESC = "factorByTime_DESC", - factorByTime_DESC_NULLS_FIRST = "factorByTime_DESC_NULLS_FIRST", - factorByTime_DESC_NULLS_LAST = "factorByTime_DESC_NULLS_LAST", - factor_ASC = "factor_ASC", - factor_ASC_NULLS_FIRST = "factor_ASC_NULLS_FIRST", - factor_ASC_NULLS_LAST = "factor_ASC_NULLS_LAST", - factor_DESC = "factor_DESC", - factor_DESC_NULLS_FIRST = "factor_DESC_NULLS_FIRST", - factor_DESC_NULLS_LAST = "factor_DESC_NULLS_LAST", - group_factor_ASC = "group_factor_ASC", - group_factor_ASC_NULLS_FIRST = "group_factor_ASC_NULLS_FIRST", - group_factor_ASC_NULLS_LAST = "group_factor_ASC_NULLS_LAST", - group_factor_DESC = "group_factor_DESC", - group_factor_DESC_NULLS_FIRST = "group_factor_DESC_NULLS_FIRST", - group_factor_DESC_NULLS_LAST = "group_factor_DESC_NULLS_LAST", - group_id_ASC = "group_id_ASC", - group_id_ASC_NULLS_FIRST = "group_id_ASC_NULLS_FIRST", - group_id_ASC_NULLS_LAST = "group_id_ASC_NULLS_LAST", - group_id_DESC = "group_id_DESC", - group_id_DESC_NULLS_FIRST = "group_id_DESC_NULLS_FIRST", - group_id_DESC_NULLS_LAST = "group_id_DESC_NULLS_LAST", - group_marketAddress_ASC = "group_marketAddress_ASC", - group_marketAddress_ASC_NULLS_FIRST = "group_marketAddress_ASC_NULLS_FIRST", - group_marketAddress_ASC_NULLS_LAST = "group_marketAddress_ASC_NULLS_LAST", - group_marketAddress_DESC = "group_marketAddress_DESC", - group_marketAddress_DESC_NULLS_FIRST = "group_marketAddress_DESC_NULLS_FIRST", - group_marketAddress_DESC_NULLS_LAST = "group_marketAddress_DESC_NULLS_LAST", - group_timeKey_ASC = "group_timeKey_ASC", - group_timeKey_ASC_NULLS_FIRST = "group_timeKey_ASC_NULLS_FIRST", - group_timeKey_ASC_NULLS_LAST = "group_timeKey_ASC_NULLS_LAST", - group_timeKey_DESC = "group_timeKey_DESC", - group_timeKey_DESC_NULLS_FIRST = "group_timeKey_DESC_NULLS_FIRST", - group_timeKey_DESC_NULLS_LAST = "group_timeKey_DESC_NULLS_LAST", - group_tokenAddress_ASC = "group_tokenAddress_ASC", - group_tokenAddress_ASC_NULLS_FIRST = "group_tokenAddress_ASC_NULLS_FIRST", - group_tokenAddress_ASC_NULLS_LAST = "group_tokenAddress_ASC_NULLS_LAST", - group_tokenAddress_DESC = "group_tokenAddress_DESC", - group_tokenAddress_DESC_NULLS_FIRST = "group_tokenAddress_DESC_NULLS_FIRST", - group_tokenAddress_DESC_NULLS_LAST = "group_tokenAddress_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - reductionFactor_ASC = "reductionFactor_ASC", - reductionFactor_ASC_NULLS_FIRST = "reductionFactor_ASC_NULLS_FIRST", - reductionFactor_ASC_NULLS_LAST = "reductionFactor_ASC_NULLS_LAST", - reductionFactor_DESC = "reductionFactor_DESC", - reductionFactor_DESC_NULLS_FIRST = "reductionFactor_DESC_NULLS_FIRST", - reductionFactor_DESC_NULLS_LAST = "reductionFactor_DESC_NULLS_LAST", - timeKey_ASC = "timeKey_ASC", - timeKey_ASC_NULLS_FIRST = "timeKey_ASC_NULLS_FIRST", - timeKey_ASC_NULLS_LAST = "timeKey_ASC_NULLS_LAST", - timeKey_DESC = "timeKey_DESC", - timeKey_DESC_NULLS_FIRST = "timeKey_DESC_NULLS_FIRST", - timeKey_DESC_NULLS_LAST = "timeKey_DESC_NULLS_LAST", - tokenAddress_ASC = "tokenAddress_ASC", - tokenAddress_ASC_NULLS_FIRST = "tokenAddress_ASC_NULLS_FIRST", - tokenAddress_ASC_NULLS_LAST = "tokenAddress_ASC_NULLS_LAST", - tokenAddress_DESC = "tokenAddress_DESC", - tokenAddress_DESC_NULLS_FIRST = "tokenAddress_DESC_NULLS_FIRST", - tokenAddress_DESC_NULLS_LAST = "tokenAddress_DESC_NULLS_LAST", - value_ASC = "value_ASC", - value_ASC_NULLS_FIRST = "value_ASC_NULLS_FIRST", - value_ASC_NULLS_LAST = "value_ASC_NULLS_LAST", - value_DESC = "value_DESC", - value_DESC_NULLS_FIRST = "value_DESC_NULLS_FIRST", - value_DESC_NULLS_LAST = "value_DESC_NULLS_LAST", + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + claimed_ASC = 'claimed_ASC', + claimed_ASC_NULLS_FIRST = 'claimed_ASC_NULLS_FIRST', + claimed_ASC_NULLS_LAST = 'claimed_ASC_NULLS_LAST', + claimed_DESC = 'claimed_DESC', + claimed_DESC_NULLS_FIRST = 'claimed_DESC_NULLS_FIRST', + claimed_DESC_NULLS_LAST = 'claimed_DESC_NULLS_LAST', + factorByTime_ASC = 'factorByTime_ASC', + factorByTime_ASC_NULLS_FIRST = 'factorByTime_ASC_NULLS_FIRST', + factorByTime_ASC_NULLS_LAST = 'factorByTime_ASC_NULLS_LAST', + factorByTime_DESC = 'factorByTime_DESC', + factorByTime_DESC_NULLS_FIRST = 'factorByTime_DESC_NULLS_FIRST', + factorByTime_DESC_NULLS_LAST = 'factorByTime_DESC_NULLS_LAST', + factor_ASC = 'factor_ASC', + factor_ASC_NULLS_FIRST = 'factor_ASC_NULLS_FIRST', + factor_ASC_NULLS_LAST = 'factor_ASC_NULLS_LAST', + factor_DESC = 'factor_DESC', + factor_DESC_NULLS_FIRST = 'factor_DESC_NULLS_FIRST', + factor_DESC_NULLS_LAST = 'factor_DESC_NULLS_LAST', + group_factor_ASC = 'group_factor_ASC', + group_factor_ASC_NULLS_FIRST = 'group_factor_ASC_NULLS_FIRST', + group_factor_ASC_NULLS_LAST = 'group_factor_ASC_NULLS_LAST', + group_factor_DESC = 'group_factor_DESC', + group_factor_DESC_NULLS_FIRST = 'group_factor_DESC_NULLS_FIRST', + group_factor_DESC_NULLS_LAST = 'group_factor_DESC_NULLS_LAST', + group_id_ASC = 'group_id_ASC', + group_id_ASC_NULLS_FIRST = 'group_id_ASC_NULLS_FIRST', + group_id_ASC_NULLS_LAST = 'group_id_ASC_NULLS_LAST', + group_id_DESC = 'group_id_DESC', + group_id_DESC_NULLS_FIRST = 'group_id_DESC_NULLS_FIRST', + group_id_DESC_NULLS_LAST = 'group_id_DESC_NULLS_LAST', + group_marketAddress_ASC = 'group_marketAddress_ASC', + group_marketAddress_ASC_NULLS_FIRST = 'group_marketAddress_ASC_NULLS_FIRST', + group_marketAddress_ASC_NULLS_LAST = 'group_marketAddress_ASC_NULLS_LAST', + group_marketAddress_DESC = 'group_marketAddress_DESC', + group_marketAddress_DESC_NULLS_FIRST = 'group_marketAddress_DESC_NULLS_FIRST', + group_marketAddress_DESC_NULLS_LAST = 'group_marketAddress_DESC_NULLS_LAST', + group_timeKey_ASC = 'group_timeKey_ASC', + group_timeKey_ASC_NULLS_FIRST = 'group_timeKey_ASC_NULLS_FIRST', + group_timeKey_ASC_NULLS_LAST = 'group_timeKey_ASC_NULLS_LAST', + group_timeKey_DESC = 'group_timeKey_DESC', + group_timeKey_DESC_NULLS_FIRST = 'group_timeKey_DESC_NULLS_FIRST', + group_timeKey_DESC_NULLS_LAST = 'group_timeKey_DESC_NULLS_LAST', + group_tokenAddress_ASC = 'group_tokenAddress_ASC', + group_tokenAddress_ASC_NULLS_FIRST = 'group_tokenAddress_ASC_NULLS_FIRST', + group_tokenAddress_ASC_NULLS_LAST = 'group_tokenAddress_ASC_NULLS_LAST', + group_tokenAddress_DESC = 'group_tokenAddress_DESC', + group_tokenAddress_DESC_NULLS_FIRST = 'group_tokenAddress_DESC_NULLS_FIRST', + group_tokenAddress_DESC_NULLS_LAST = 'group_tokenAddress_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + reductionFactor_ASC = 'reductionFactor_ASC', + reductionFactor_ASC_NULLS_FIRST = 'reductionFactor_ASC_NULLS_FIRST', + reductionFactor_ASC_NULLS_LAST = 'reductionFactor_ASC_NULLS_LAST', + reductionFactor_DESC = 'reductionFactor_DESC', + reductionFactor_DESC_NULLS_FIRST = 'reductionFactor_DESC_NULLS_FIRST', + reductionFactor_DESC_NULLS_LAST = 'reductionFactor_DESC_NULLS_LAST', + timeKey_ASC = 'timeKey_ASC', + timeKey_ASC_NULLS_FIRST = 'timeKey_ASC_NULLS_FIRST', + timeKey_ASC_NULLS_LAST = 'timeKey_ASC_NULLS_LAST', + timeKey_DESC = 'timeKey_DESC', + timeKey_DESC_NULLS_FIRST = 'timeKey_DESC_NULLS_FIRST', + timeKey_DESC_NULLS_LAST = 'timeKey_DESC_NULLS_LAST', + tokenAddress_ASC = 'tokenAddress_ASC', + tokenAddress_ASC_NULLS_FIRST = 'tokenAddress_ASC_NULLS_FIRST', + tokenAddress_ASC_NULLS_LAST = 'tokenAddress_ASC_NULLS_LAST', + tokenAddress_DESC = 'tokenAddress_DESC', + tokenAddress_DESC_NULLS_FIRST = 'tokenAddress_DESC_NULLS_FIRST', + tokenAddress_DESC_NULLS_LAST = 'tokenAddress_DESC_NULLS_LAST', + value_ASC = 'value_ASC', + value_ASC_NULLS_FIRST = 'value_ASC_NULLS_FIRST', + value_ASC_NULLS_LAST = 'value_ASC_NULLS_LAST', + value_DESC = 'value_DESC', + value_DESC_NULLS_FIRST = 'value_DESC_NULLS_FIRST', + value_DESC_NULLS_LAST = 'value_DESC_NULLS_LAST' } export interface ClaimableCollateralWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - claimed_eq?: InputMaybe; - claimed_isNull?: InputMaybe; - claimed_not_eq?: InputMaybe; - factorByTime_eq?: InputMaybe; - factorByTime_gt?: InputMaybe; - factorByTime_gte?: InputMaybe; - factorByTime_in?: InputMaybe>; - factorByTime_isNull?: InputMaybe; - factorByTime_lt?: InputMaybe; - factorByTime_lte?: InputMaybe; - factorByTime_not_eq?: InputMaybe; - factorByTime_not_in?: InputMaybe>; - factor_eq?: InputMaybe; - factor_gt?: InputMaybe; - factor_gte?: InputMaybe; - factor_in?: InputMaybe>; - factor_isNull?: InputMaybe; - factor_lt?: InputMaybe; - factor_lte?: InputMaybe; - factor_not_eq?: InputMaybe; - factor_not_in?: InputMaybe>; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + claimed_eq?: InputMaybe; + claimed_isNull?: InputMaybe; + claimed_not_eq?: InputMaybe; + factorByTime_eq?: InputMaybe; + factorByTime_gt?: InputMaybe; + factorByTime_gte?: InputMaybe; + factorByTime_in?: InputMaybe>; + factorByTime_isNull?: InputMaybe; + factorByTime_lt?: InputMaybe; + factorByTime_lte?: InputMaybe; + factorByTime_not_eq?: InputMaybe; + factorByTime_not_in?: InputMaybe>; + factor_eq?: InputMaybe; + factor_gt?: InputMaybe; + factor_gte?: InputMaybe; + factor_in?: InputMaybe>; + factor_isNull?: InputMaybe; + factor_lt?: InputMaybe; + factor_lte?: InputMaybe; + factor_not_eq?: InputMaybe; + factor_not_in?: InputMaybe>; group?: InputMaybe; - group_isNull?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - reductionFactor_eq?: InputMaybe; - reductionFactor_gt?: InputMaybe; - reductionFactor_gte?: InputMaybe; - reductionFactor_in?: InputMaybe>; - reductionFactor_isNull?: InputMaybe; - reductionFactor_lt?: InputMaybe; - reductionFactor_lte?: InputMaybe; - reductionFactor_not_eq?: InputMaybe; - reductionFactor_not_in?: InputMaybe>; - timeKey_contains?: InputMaybe; - timeKey_containsInsensitive?: InputMaybe; - timeKey_endsWith?: InputMaybe; - timeKey_eq?: InputMaybe; - timeKey_gt?: InputMaybe; - timeKey_gte?: InputMaybe; - timeKey_in?: InputMaybe>; - timeKey_isNull?: InputMaybe; - timeKey_lt?: InputMaybe; - timeKey_lte?: InputMaybe; - timeKey_not_contains?: InputMaybe; - timeKey_not_containsInsensitive?: InputMaybe; - timeKey_not_endsWith?: InputMaybe; - timeKey_not_eq?: InputMaybe; - timeKey_not_in?: InputMaybe>; - timeKey_not_startsWith?: InputMaybe; - timeKey_startsWith?: InputMaybe; - tokenAddress_contains?: InputMaybe; - tokenAddress_containsInsensitive?: InputMaybe; - tokenAddress_endsWith?: InputMaybe; - tokenAddress_eq?: InputMaybe; - tokenAddress_gt?: InputMaybe; - tokenAddress_gte?: InputMaybe; - tokenAddress_in?: InputMaybe>; - tokenAddress_isNull?: InputMaybe; - tokenAddress_lt?: InputMaybe; - tokenAddress_lte?: InputMaybe; - tokenAddress_not_contains?: InputMaybe; - tokenAddress_not_containsInsensitive?: InputMaybe; - tokenAddress_not_endsWith?: InputMaybe; - tokenAddress_not_eq?: InputMaybe; - tokenAddress_not_in?: InputMaybe>; - tokenAddress_not_startsWith?: InputMaybe; - tokenAddress_startsWith?: InputMaybe; - value_eq?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_isNull?: InputMaybe; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not_eq?: InputMaybe; - value_not_in?: InputMaybe>; + group_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + reductionFactor_eq?: InputMaybe; + reductionFactor_gt?: InputMaybe; + reductionFactor_gte?: InputMaybe; + reductionFactor_in?: InputMaybe>; + reductionFactor_isNull?: InputMaybe; + reductionFactor_lt?: InputMaybe; + reductionFactor_lte?: InputMaybe; + reductionFactor_not_eq?: InputMaybe; + reductionFactor_not_in?: InputMaybe>; + timeKey_contains?: InputMaybe; + timeKey_containsInsensitive?: InputMaybe; + timeKey_endsWith?: InputMaybe; + timeKey_eq?: InputMaybe; + timeKey_gt?: InputMaybe; + timeKey_gte?: InputMaybe; + timeKey_in?: InputMaybe>; + timeKey_isNull?: InputMaybe; + timeKey_lt?: InputMaybe; + timeKey_lte?: InputMaybe; + timeKey_not_contains?: InputMaybe; + timeKey_not_containsInsensitive?: InputMaybe; + timeKey_not_endsWith?: InputMaybe; + timeKey_not_eq?: InputMaybe; + timeKey_not_in?: InputMaybe>; + timeKey_not_startsWith?: InputMaybe; + timeKey_startsWith?: InputMaybe; + tokenAddress_contains?: InputMaybe; + tokenAddress_containsInsensitive?: InputMaybe; + tokenAddress_endsWith?: InputMaybe; + tokenAddress_eq?: InputMaybe; + tokenAddress_gt?: InputMaybe; + tokenAddress_gte?: InputMaybe; + tokenAddress_in?: InputMaybe>; + tokenAddress_isNull?: InputMaybe; + tokenAddress_lt?: InputMaybe; + tokenAddress_lte?: InputMaybe; + tokenAddress_not_contains?: InputMaybe; + tokenAddress_not_containsInsensitive?: InputMaybe; + tokenAddress_not_endsWith?: InputMaybe; + tokenAddress_not_eq?: InputMaybe; + tokenAddress_not_in?: InputMaybe>; + tokenAddress_not_startsWith?: InputMaybe; + tokenAddress_startsWith?: InputMaybe; + value_eq?: InputMaybe; + value_gt?: InputMaybe; + value_gte?: InputMaybe; + value_in?: InputMaybe>; + value_isNull?: InputMaybe; + value_lt?: InputMaybe; + value_lte?: InputMaybe; + value_not_eq?: InputMaybe; + value_not_in?: InputMaybe>; } export interface ClaimableCollateralsConnection { - __typename?: "ClaimableCollateralsConnection"; + __typename?: 'ClaimableCollateralsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface ClaimableFundingFeeInfo { - __typename?: "ClaimableFundingFeeInfo"; - amounts: Array; - id: Scalars["String"]["output"]; - marketAddresses: Array; - tokenAddresses: Array; + __typename?: 'ClaimableFundingFeeInfo'; + amounts: Array; + id: Scalars['String']['output']; + marketAddresses: Array; + tokenAddresses: Array; } export interface ClaimableFundingFeeInfoEdge { - __typename?: "ClaimableFundingFeeInfoEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ClaimableFundingFeeInfoEdge'; + cursor: Scalars['String']['output']; node: ClaimableFundingFeeInfo; } export enum ClaimableFundingFeeInfoOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST' } export interface ClaimableFundingFeeInfoWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - amounts_containsAll?: InputMaybe>; - amounts_containsAny?: InputMaybe>; - amounts_containsNone?: InputMaybe>; - amounts_isNull?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - marketAddresses_containsAll?: InputMaybe>; - marketAddresses_containsAny?: InputMaybe>; - marketAddresses_containsNone?: InputMaybe>; - marketAddresses_isNull?: InputMaybe; - tokenAddresses_containsAll?: InputMaybe>; - tokenAddresses_containsAny?: InputMaybe>; - tokenAddresses_containsNone?: InputMaybe>; - tokenAddresses_isNull?: InputMaybe; + amounts_containsAll?: InputMaybe>; + amounts_containsAny?: InputMaybe>; + amounts_containsNone?: InputMaybe>; + amounts_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + marketAddresses_containsAll?: InputMaybe>; + marketAddresses_containsAny?: InputMaybe>; + marketAddresses_containsNone?: InputMaybe>; + marketAddresses_isNull?: InputMaybe; + tokenAddresses_containsAll?: InputMaybe>; + tokenAddresses_containsAny?: InputMaybe>; + tokenAddresses_containsNone?: InputMaybe>; + tokenAddresses_isNull?: InputMaybe; } export interface ClaimableFundingFeeInfosConnection { - __typename?: "ClaimableFundingFeeInfosConnection"; + __typename?: 'ClaimableFundingFeeInfosConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface CollectedFeesInfo { - __typename?: "CollectedFeesInfo"; - address: Scalars["String"]["output"]; - borrowingFeeUsdForPool: Scalars["BigInt"]["output"]; - borrowingFeeUsdPerPoolValue: Scalars["BigInt"]["output"]; - cumulativeBorrowingFeeUsdForPool: Scalars["BigInt"]["output"]; - cumulativeBorrowingFeeUsdPerPoolValue: Scalars["BigInt"]["output"]; - cumulativeFeeUsdForPool: Scalars["BigInt"]["output"]; - cumulativeFeeUsdPerPoolValue: Scalars["BigInt"]["output"]; + __typename?: 'CollectedFeesInfo'; + address: Scalars['String']['output']; + borrowingFeeUsdForPool: Scalars['BigInt']['output']; + borrowingFeeUsdPerPoolValue: Scalars['BigInt']['output']; + cumulativeBorrowingFeeUsdForPool: Scalars['BigInt']['output']; + cumulativeBorrowingFeeUsdPerPoolValue: Scalars['BigInt']['output']; + cumulativeFeeUsdForPool: Scalars['BigInt']['output']; + cumulativeFeeUsdPerPoolValue: Scalars['BigInt']['output']; entityType: EntityType; - feeUsdForPool: Scalars["BigInt"]["output"]; - feeUsdPerPoolValue: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - period: Scalars["String"]["output"]; - timestampGroup: Scalars["Int"]["output"]; + feeUsdForPool: Scalars['BigInt']['output']; + feeUsdPerPoolValue: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + period: Scalars['String']['output']; + timestampGroup: Scalars['Int']['output']; } export interface CollectedFeesInfoEdge { - __typename?: "CollectedFeesInfoEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'CollectedFeesInfoEdge'; + cursor: Scalars['String']['output']; node: CollectedFeesInfo; } export enum CollectedFeesInfoOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - borrowingFeeUsdForPool_ASC = "borrowingFeeUsdForPool_ASC", - borrowingFeeUsdForPool_ASC_NULLS_FIRST = "borrowingFeeUsdForPool_ASC_NULLS_FIRST", - borrowingFeeUsdForPool_ASC_NULLS_LAST = "borrowingFeeUsdForPool_ASC_NULLS_LAST", - borrowingFeeUsdForPool_DESC = "borrowingFeeUsdForPool_DESC", - borrowingFeeUsdForPool_DESC_NULLS_FIRST = "borrowingFeeUsdForPool_DESC_NULLS_FIRST", - borrowingFeeUsdForPool_DESC_NULLS_LAST = "borrowingFeeUsdForPool_DESC_NULLS_LAST", - borrowingFeeUsdPerPoolValue_ASC = "borrowingFeeUsdPerPoolValue_ASC", - borrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST = "borrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST", - borrowingFeeUsdPerPoolValue_ASC_NULLS_LAST = "borrowingFeeUsdPerPoolValue_ASC_NULLS_LAST", - borrowingFeeUsdPerPoolValue_DESC = "borrowingFeeUsdPerPoolValue_DESC", - borrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST = "borrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST", - borrowingFeeUsdPerPoolValue_DESC_NULLS_LAST = "borrowingFeeUsdPerPoolValue_DESC_NULLS_LAST", - cumulativeBorrowingFeeUsdForPool_ASC = "cumulativeBorrowingFeeUsdForPool_ASC", - cumulativeBorrowingFeeUsdForPool_ASC_NULLS_FIRST = "cumulativeBorrowingFeeUsdForPool_ASC_NULLS_FIRST", - cumulativeBorrowingFeeUsdForPool_ASC_NULLS_LAST = "cumulativeBorrowingFeeUsdForPool_ASC_NULLS_LAST", - cumulativeBorrowingFeeUsdForPool_DESC = "cumulativeBorrowingFeeUsdForPool_DESC", - cumulativeBorrowingFeeUsdForPool_DESC_NULLS_FIRST = "cumulativeBorrowingFeeUsdForPool_DESC_NULLS_FIRST", - cumulativeBorrowingFeeUsdForPool_DESC_NULLS_LAST = "cumulativeBorrowingFeeUsdForPool_DESC_NULLS_LAST", - cumulativeBorrowingFeeUsdPerPoolValue_ASC = "cumulativeBorrowingFeeUsdPerPoolValue_ASC", - cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST = "cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST", - cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_LAST = "cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_LAST", - cumulativeBorrowingFeeUsdPerPoolValue_DESC = "cumulativeBorrowingFeeUsdPerPoolValue_DESC", - cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST = "cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST", - cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_LAST = "cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_LAST", - cumulativeFeeUsdForPool_ASC = "cumulativeFeeUsdForPool_ASC", - cumulativeFeeUsdForPool_ASC_NULLS_FIRST = "cumulativeFeeUsdForPool_ASC_NULLS_FIRST", - cumulativeFeeUsdForPool_ASC_NULLS_LAST = "cumulativeFeeUsdForPool_ASC_NULLS_LAST", - cumulativeFeeUsdForPool_DESC = "cumulativeFeeUsdForPool_DESC", - cumulativeFeeUsdForPool_DESC_NULLS_FIRST = "cumulativeFeeUsdForPool_DESC_NULLS_FIRST", - cumulativeFeeUsdForPool_DESC_NULLS_LAST = "cumulativeFeeUsdForPool_DESC_NULLS_LAST", - cumulativeFeeUsdPerPoolValue_ASC = "cumulativeFeeUsdPerPoolValue_ASC", - cumulativeFeeUsdPerPoolValue_ASC_NULLS_FIRST = "cumulativeFeeUsdPerPoolValue_ASC_NULLS_FIRST", - cumulativeFeeUsdPerPoolValue_ASC_NULLS_LAST = "cumulativeFeeUsdPerPoolValue_ASC_NULLS_LAST", - cumulativeFeeUsdPerPoolValue_DESC = "cumulativeFeeUsdPerPoolValue_DESC", - cumulativeFeeUsdPerPoolValue_DESC_NULLS_FIRST = "cumulativeFeeUsdPerPoolValue_DESC_NULLS_FIRST", - cumulativeFeeUsdPerPoolValue_DESC_NULLS_LAST = "cumulativeFeeUsdPerPoolValue_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - feeUsdForPool_ASC = "feeUsdForPool_ASC", - feeUsdForPool_ASC_NULLS_FIRST = "feeUsdForPool_ASC_NULLS_FIRST", - feeUsdForPool_ASC_NULLS_LAST = "feeUsdForPool_ASC_NULLS_LAST", - feeUsdForPool_DESC = "feeUsdForPool_DESC", - feeUsdForPool_DESC_NULLS_FIRST = "feeUsdForPool_DESC_NULLS_FIRST", - feeUsdForPool_DESC_NULLS_LAST = "feeUsdForPool_DESC_NULLS_LAST", - feeUsdPerPoolValue_ASC = "feeUsdPerPoolValue_ASC", - feeUsdPerPoolValue_ASC_NULLS_FIRST = "feeUsdPerPoolValue_ASC_NULLS_FIRST", - feeUsdPerPoolValue_ASC_NULLS_LAST = "feeUsdPerPoolValue_ASC_NULLS_LAST", - feeUsdPerPoolValue_DESC = "feeUsdPerPoolValue_DESC", - feeUsdPerPoolValue_DESC_NULLS_FIRST = "feeUsdPerPoolValue_DESC_NULLS_FIRST", - feeUsdPerPoolValue_DESC_NULLS_LAST = "feeUsdPerPoolValue_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - period_ASC = "period_ASC", - period_ASC_NULLS_FIRST = "period_ASC_NULLS_FIRST", - period_ASC_NULLS_LAST = "period_ASC_NULLS_LAST", - period_DESC = "period_DESC", - period_DESC_NULLS_FIRST = "period_DESC_NULLS_FIRST", - period_DESC_NULLS_LAST = "period_DESC_NULLS_LAST", - timestampGroup_ASC = "timestampGroup_ASC", - timestampGroup_ASC_NULLS_FIRST = "timestampGroup_ASC_NULLS_FIRST", - timestampGroup_ASC_NULLS_LAST = "timestampGroup_ASC_NULLS_LAST", - timestampGroup_DESC = "timestampGroup_DESC", - timestampGroup_DESC_NULLS_FIRST = "timestampGroup_DESC_NULLS_FIRST", - timestampGroup_DESC_NULLS_LAST = "timestampGroup_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + borrowingFeeUsdForPool_ASC = 'borrowingFeeUsdForPool_ASC', + borrowingFeeUsdForPool_ASC_NULLS_FIRST = 'borrowingFeeUsdForPool_ASC_NULLS_FIRST', + borrowingFeeUsdForPool_ASC_NULLS_LAST = 'borrowingFeeUsdForPool_ASC_NULLS_LAST', + borrowingFeeUsdForPool_DESC = 'borrowingFeeUsdForPool_DESC', + borrowingFeeUsdForPool_DESC_NULLS_FIRST = 'borrowingFeeUsdForPool_DESC_NULLS_FIRST', + borrowingFeeUsdForPool_DESC_NULLS_LAST = 'borrowingFeeUsdForPool_DESC_NULLS_LAST', + borrowingFeeUsdPerPoolValue_ASC = 'borrowingFeeUsdPerPoolValue_ASC', + borrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST = 'borrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST', + borrowingFeeUsdPerPoolValue_ASC_NULLS_LAST = 'borrowingFeeUsdPerPoolValue_ASC_NULLS_LAST', + borrowingFeeUsdPerPoolValue_DESC = 'borrowingFeeUsdPerPoolValue_DESC', + borrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST = 'borrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST', + borrowingFeeUsdPerPoolValue_DESC_NULLS_LAST = 'borrowingFeeUsdPerPoolValue_DESC_NULLS_LAST', + cumulativeBorrowingFeeUsdForPool_ASC = 'cumulativeBorrowingFeeUsdForPool_ASC', + cumulativeBorrowingFeeUsdForPool_ASC_NULLS_FIRST = 'cumulativeBorrowingFeeUsdForPool_ASC_NULLS_FIRST', + cumulativeBorrowingFeeUsdForPool_ASC_NULLS_LAST = 'cumulativeBorrowingFeeUsdForPool_ASC_NULLS_LAST', + cumulativeBorrowingFeeUsdForPool_DESC = 'cumulativeBorrowingFeeUsdForPool_DESC', + cumulativeBorrowingFeeUsdForPool_DESC_NULLS_FIRST = 'cumulativeBorrowingFeeUsdForPool_DESC_NULLS_FIRST', + cumulativeBorrowingFeeUsdForPool_DESC_NULLS_LAST = 'cumulativeBorrowingFeeUsdForPool_DESC_NULLS_LAST', + cumulativeBorrowingFeeUsdPerPoolValue_ASC = 'cumulativeBorrowingFeeUsdPerPoolValue_ASC', + cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST = 'cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_FIRST', + cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_LAST = 'cumulativeBorrowingFeeUsdPerPoolValue_ASC_NULLS_LAST', + cumulativeBorrowingFeeUsdPerPoolValue_DESC = 'cumulativeBorrowingFeeUsdPerPoolValue_DESC', + cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST = 'cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_FIRST', + cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_LAST = 'cumulativeBorrowingFeeUsdPerPoolValue_DESC_NULLS_LAST', + cumulativeFeeUsdForPool_ASC = 'cumulativeFeeUsdForPool_ASC', + cumulativeFeeUsdForPool_ASC_NULLS_FIRST = 'cumulativeFeeUsdForPool_ASC_NULLS_FIRST', + cumulativeFeeUsdForPool_ASC_NULLS_LAST = 'cumulativeFeeUsdForPool_ASC_NULLS_LAST', + cumulativeFeeUsdForPool_DESC = 'cumulativeFeeUsdForPool_DESC', + cumulativeFeeUsdForPool_DESC_NULLS_FIRST = 'cumulativeFeeUsdForPool_DESC_NULLS_FIRST', + cumulativeFeeUsdForPool_DESC_NULLS_LAST = 'cumulativeFeeUsdForPool_DESC_NULLS_LAST', + cumulativeFeeUsdPerPoolValue_ASC = 'cumulativeFeeUsdPerPoolValue_ASC', + cumulativeFeeUsdPerPoolValue_ASC_NULLS_FIRST = 'cumulativeFeeUsdPerPoolValue_ASC_NULLS_FIRST', + cumulativeFeeUsdPerPoolValue_ASC_NULLS_LAST = 'cumulativeFeeUsdPerPoolValue_ASC_NULLS_LAST', + cumulativeFeeUsdPerPoolValue_DESC = 'cumulativeFeeUsdPerPoolValue_DESC', + cumulativeFeeUsdPerPoolValue_DESC_NULLS_FIRST = 'cumulativeFeeUsdPerPoolValue_DESC_NULLS_FIRST', + cumulativeFeeUsdPerPoolValue_DESC_NULLS_LAST = 'cumulativeFeeUsdPerPoolValue_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + feeUsdForPool_ASC = 'feeUsdForPool_ASC', + feeUsdForPool_ASC_NULLS_FIRST = 'feeUsdForPool_ASC_NULLS_FIRST', + feeUsdForPool_ASC_NULLS_LAST = 'feeUsdForPool_ASC_NULLS_LAST', + feeUsdForPool_DESC = 'feeUsdForPool_DESC', + feeUsdForPool_DESC_NULLS_FIRST = 'feeUsdForPool_DESC_NULLS_FIRST', + feeUsdForPool_DESC_NULLS_LAST = 'feeUsdForPool_DESC_NULLS_LAST', + feeUsdPerPoolValue_ASC = 'feeUsdPerPoolValue_ASC', + feeUsdPerPoolValue_ASC_NULLS_FIRST = 'feeUsdPerPoolValue_ASC_NULLS_FIRST', + feeUsdPerPoolValue_ASC_NULLS_LAST = 'feeUsdPerPoolValue_ASC_NULLS_LAST', + feeUsdPerPoolValue_DESC = 'feeUsdPerPoolValue_DESC', + feeUsdPerPoolValue_DESC_NULLS_FIRST = 'feeUsdPerPoolValue_DESC_NULLS_FIRST', + feeUsdPerPoolValue_DESC_NULLS_LAST = 'feeUsdPerPoolValue_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + period_ASC = 'period_ASC', + period_ASC_NULLS_FIRST = 'period_ASC_NULLS_FIRST', + period_ASC_NULLS_LAST = 'period_ASC_NULLS_LAST', + period_DESC = 'period_DESC', + period_DESC_NULLS_FIRST = 'period_DESC_NULLS_FIRST', + period_DESC_NULLS_LAST = 'period_DESC_NULLS_LAST', + timestampGroup_ASC = 'timestampGroup_ASC', + timestampGroup_ASC_NULLS_FIRST = 'timestampGroup_ASC_NULLS_FIRST', + timestampGroup_ASC_NULLS_LAST = 'timestampGroup_ASC_NULLS_LAST', + timestampGroup_DESC = 'timestampGroup_DESC', + timestampGroup_DESC_NULLS_FIRST = 'timestampGroup_DESC_NULLS_FIRST', + timestampGroup_DESC_NULLS_LAST = 'timestampGroup_DESC_NULLS_LAST' } export interface CollectedFeesInfoWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - borrowingFeeUsdForPool_eq?: InputMaybe; - borrowingFeeUsdForPool_gt?: InputMaybe; - borrowingFeeUsdForPool_gte?: InputMaybe; - borrowingFeeUsdForPool_in?: InputMaybe>; - borrowingFeeUsdForPool_isNull?: InputMaybe; - borrowingFeeUsdForPool_lt?: InputMaybe; - borrowingFeeUsdForPool_lte?: InputMaybe; - borrowingFeeUsdForPool_not_eq?: InputMaybe; - borrowingFeeUsdForPool_not_in?: InputMaybe>; - borrowingFeeUsdPerPoolValue_eq?: InputMaybe; - borrowingFeeUsdPerPoolValue_gt?: InputMaybe; - borrowingFeeUsdPerPoolValue_gte?: InputMaybe; - borrowingFeeUsdPerPoolValue_in?: InputMaybe>; - borrowingFeeUsdPerPoolValue_isNull?: InputMaybe; - borrowingFeeUsdPerPoolValue_lt?: InputMaybe; - borrowingFeeUsdPerPoolValue_lte?: InputMaybe; - borrowingFeeUsdPerPoolValue_not_eq?: InputMaybe; - borrowingFeeUsdPerPoolValue_not_in?: InputMaybe>; - cumulativeBorrowingFeeUsdForPool_eq?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_gt?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_gte?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_in?: InputMaybe>; - cumulativeBorrowingFeeUsdForPool_isNull?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_lt?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_lte?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_not_eq?: InputMaybe; - cumulativeBorrowingFeeUsdForPool_not_in?: InputMaybe>; - cumulativeBorrowingFeeUsdPerPoolValue_eq?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_gt?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_gte?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_in?: InputMaybe>; - cumulativeBorrowingFeeUsdPerPoolValue_isNull?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_lt?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_lte?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_not_eq?: InputMaybe; - cumulativeBorrowingFeeUsdPerPoolValue_not_in?: InputMaybe>; - cumulativeFeeUsdForPool_eq?: InputMaybe; - cumulativeFeeUsdForPool_gt?: InputMaybe; - cumulativeFeeUsdForPool_gte?: InputMaybe; - cumulativeFeeUsdForPool_in?: InputMaybe>; - cumulativeFeeUsdForPool_isNull?: InputMaybe; - cumulativeFeeUsdForPool_lt?: InputMaybe; - cumulativeFeeUsdForPool_lte?: InputMaybe; - cumulativeFeeUsdForPool_not_eq?: InputMaybe; - cumulativeFeeUsdForPool_not_in?: InputMaybe>; - cumulativeFeeUsdPerPoolValue_eq?: InputMaybe; - cumulativeFeeUsdPerPoolValue_gt?: InputMaybe; - cumulativeFeeUsdPerPoolValue_gte?: InputMaybe; - cumulativeFeeUsdPerPoolValue_in?: InputMaybe>; - cumulativeFeeUsdPerPoolValue_isNull?: InputMaybe; - cumulativeFeeUsdPerPoolValue_lt?: InputMaybe; - cumulativeFeeUsdPerPoolValue_lte?: InputMaybe; - cumulativeFeeUsdPerPoolValue_not_eq?: InputMaybe; - cumulativeFeeUsdPerPoolValue_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + borrowingFeeUsdForPool_eq?: InputMaybe; + borrowingFeeUsdForPool_gt?: InputMaybe; + borrowingFeeUsdForPool_gte?: InputMaybe; + borrowingFeeUsdForPool_in?: InputMaybe>; + borrowingFeeUsdForPool_isNull?: InputMaybe; + borrowingFeeUsdForPool_lt?: InputMaybe; + borrowingFeeUsdForPool_lte?: InputMaybe; + borrowingFeeUsdForPool_not_eq?: InputMaybe; + borrowingFeeUsdForPool_not_in?: InputMaybe>; + borrowingFeeUsdPerPoolValue_eq?: InputMaybe; + borrowingFeeUsdPerPoolValue_gt?: InputMaybe; + borrowingFeeUsdPerPoolValue_gte?: InputMaybe; + borrowingFeeUsdPerPoolValue_in?: InputMaybe>; + borrowingFeeUsdPerPoolValue_isNull?: InputMaybe; + borrowingFeeUsdPerPoolValue_lt?: InputMaybe; + borrowingFeeUsdPerPoolValue_lte?: InputMaybe; + borrowingFeeUsdPerPoolValue_not_eq?: InputMaybe; + borrowingFeeUsdPerPoolValue_not_in?: InputMaybe>; + cumulativeBorrowingFeeUsdForPool_eq?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_gt?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_gte?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_in?: InputMaybe>; + cumulativeBorrowingFeeUsdForPool_isNull?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_lt?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_lte?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_not_eq?: InputMaybe; + cumulativeBorrowingFeeUsdForPool_not_in?: InputMaybe>; + cumulativeBorrowingFeeUsdPerPoolValue_eq?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_gt?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_gte?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_in?: InputMaybe>; + cumulativeBorrowingFeeUsdPerPoolValue_isNull?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_lt?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_lte?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_not_eq?: InputMaybe; + cumulativeBorrowingFeeUsdPerPoolValue_not_in?: InputMaybe>; + cumulativeFeeUsdForPool_eq?: InputMaybe; + cumulativeFeeUsdForPool_gt?: InputMaybe; + cumulativeFeeUsdForPool_gte?: InputMaybe; + cumulativeFeeUsdForPool_in?: InputMaybe>; + cumulativeFeeUsdForPool_isNull?: InputMaybe; + cumulativeFeeUsdForPool_lt?: InputMaybe; + cumulativeFeeUsdForPool_lte?: InputMaybe; + cumulativeFeeUsdForPool_not_eq?: InputMaybe; + cumulativeFeeUsdForPool_not_in?: InputMaybe>; + cumulativeFeeUsdPerPoolValue_eq?: InputMaybe; + cumulativeFeeUsdPerPoolValue_gt?: InputMaybe; + cumulativeFeeUsdPerPoolValue_gte?: InputMaybe; + cumulativeFeeUsdPerPoolValue_in?: InputMaybe>; + cumulativeFeeUsdPerPoolValue_isNull?: InputMaybe; + cumulativeFeeUsdPerPoolValue_lt?: InputMaybe; + cumulativeFeeUsdPerPoolValue_lte?: InputMaybe; + cumulativeFeeUsdPerPoolValue_not_eq?: InputMaybe; + cumulativeFeeUsdPerPoolValue_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - feeUsdForPool_eq?: InputMaybe; - feeUsdForPool_gt?: InputMaybe; - feeUsdForPool_gte?: InputMaybe; - feeUsdForPool_in?: InputMaybe>; - feeUsdForPool_isNull?: InputMaybe; - feeUsdForPool_lt?: InputMaybe; - feeUsdForPool_lte?: InputMaybe; - feeUsdForPool_not_eq?: InputMaybe; - feeUsdForPool_not_in?: InputMaybe>; - feeUsdPerPoolValue_eq?: InputMaybe; - feeUsdPerPoolValue_gt?: InputMaybe; - feeUsdPerPoolValue_gte?: InputMaybe; - feeUsdPerPoolValue_in?: InputMaybe>; - feeUsdPerPoolValue_isNull?: InputMaybe; - feeUsdPerPoolValue_lt?: InputMaybe; - feeUsdPerPoolValue_lte?: InputMaybe; - feeUsdPerPoolValue_not_eq?: InputMaybe; - feeUsdPerPoolValue_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - period_contains?: InputMaybe; - period_containsInsensitive?: InputMaybe; - period_endsWith?: InputMaybe; - period_eq?: InputMaybe; - period_gt?: InputMaybe; - period_gte?: InputMaybe; - period_in?: InputMaybe>; - period_isNull?: InputMaybe; - period_lt?: InputMaybe; - period_lte?: InputMaybe; - period_not_contains?: InputMaybe; - period_not_containsInsensitive?: InputMaybe; - period_not_endsWith?: InputMaybe; - period_not_eq?: InputMaybe; - period_not_in?: InputMaybe>; - period_not_startsWith?: InputMaybe; - period_startsWith?: InputMaybe; - timestampGroup_eq?: InputMaybe; - timestampGroup_gt?: InputMaybe; - timestampGroup_gte?: InputMaybe; - timestampGroup_in?: InputMaybe>; - timestampGroup_isNull?: InputMaybe; - timestampGroup_lt?: InputMaybe; - timestampGroup_lte?: InputMaybe; - timestampGroup_not_eq?: InputMaybe; - timestampGroup_not_in?: InputMaybe>; + feeUsdForPool_eq?: InputMaybe; + feeUsdForPool_gt?: InputMaybe; + feeUsdForPool_gte?: InputMaybe; + feeUsdForPool_in?: InputMaybe>; + feeUsdForPool_isNull?: InputMaybe; + feeUsdForPool_lt?: InputMaybe; + feeUsdForPool_lte?: InputMaybe; + feeUsdForPool_not_eq?: InputMaybe; + feeUsdForPool_not_in?: InputMaybe>; + feeUsdPerPoolValue_eq?: InputMaybe; + feeUsdPerPoolValue_gt?: InputMaybe; + feeUsdPerPoolValue_gte?: InputMaybe; + feeUsdPerPoolValue_in?: InputMaybe>; + feeUsdPerPoolValue_isNull?: InputMaybe; + feeUsdPerPoolValue_lt?: InputMaybe; + feeUsdPerPoolValue_lte?: InputMaybe; + feeUsdPerPoolValue_not_eq?: InputMaybe; + feeUsdPerPoolValue_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + period_contains?: InputMaybe; + period_containsInsensitive?: InputMaybe; + period_endsWith?: InputMaybe; + period_eq?: InputMaybe; + period_gt?: InputMaybe; + period_gte?: InputMaybe; + period_in?: InputMaybe>; + period_isNull?: InputMaybe; + period_lt?: InputMaybe; + period_lte?: InputMaybe; + period_not_contains?: InputMaybe; + period_not_containsInsensitive?: InputMaybe; + period_not_endsWith?: InputMaybe; + period_not_eq?: InputMaybe; + period_not_in?: InputMaybe>; + period_not_startsWith?: InputMaybe; + period_startsWith?: InputMaybe; + timestampGroup_eq?: InputMaybe; + timestampGroup_gt?: InputMaybe; + timestampGroup_gte?: InputMaybe; + timestampGroup_in?: InputMaybe>; + timestampGroup_isNull?: InputMaybe; + timestampGroup_lt?: InputMaybe; + timestampGroup_lte?: InputMaybe; + timestampGroup_not_eq?: InputMaybe; + timestampGroup_not_in?: InputMaybe>; } export interface CollectedFeesInfosConnection { - __typename?: "CollectedFeesInfosConnection"; + __typename?: 'CollectedFeesInfosConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface CumulativePnl { - __typename?: "CumulativePnl"; - address: Scalars["String"]["output"]; - cumulativeRealizedPnlLong: Scalars["BigInt"]["output"]; - cumulativeRealizedPnlShort: Scalars["BigInt"]["output"]; - cumulativeUnrealizedPnlLong: Scalars["BigInt"]["output"]; - cumulativeUnrealizedPnlShort: Scalars["BigInt"]["output"]; + __typename?: 'CumulativePnl'; + address: Scalars['String']['output']; + cumulativeRealizedPnlLong: Scalars['BigInt']['output']; + cumulativeRealizedPnlShort: Scalars['BigInt']['output']; + cumulativeUnrealizedPnlLong: Scalars['BigInt']['output']; + cumulativeUnrealizedPnlShort: Scalars['BigInt']['output']; entityType: EntityType; - id: Scalars["String"]["output"]; - isSnapshot: Scalars["Boolean"]["output"]; - lastUnrealizedPnlLong?: Maybe; - lastUnrealizedPnlShort?: Maybe; - snapshotTimestamp?: Maybe; + id: Scalars['String']['output']; + isSnapshot: Scalars['Boolean']['output']; + lastUnrealizedPnlLong?: Maybe; + lastUnrealizedPnlShort?: Maybe; + snapshotTimestamp?: Maybe; } export interface CumulativePnlEdge { - __typename?: "CumulativePnlEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'CumulativePnlEdge'; + cursor: Scalars['String']['output']; node: CumulativePnl; } export enum CumulativePnlOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - cumulativeRealizedPnlLong_ASC = "cumulativeRealizedPnlLong_ASC", - cumulativeRealizedPnlLong_ASC_NULLS_FIRST = "cumulativeRealizedPnlLong_ASC_NULLS_FIRST", - cumulativeRealizedPnlLong_ASC_NULLS_LAST = "cumulativeRealizedPnlLong_ASC_NULLS_LAST", - cumulativeRealizedPnlLong_DESC = "cumulativeRealizedPnlLong_DESC", - cumulativeRealizedPnlLong_DESC_NULLS_FIRST = "cumulativeRealizedPnlLong_DESC_NULLS_FIRST", - cumulativeRealizedPnlLong_DESC_NULLS_LAST = "cumulativeRealizedPnlLong_DESC_NULLS_LAST", - cumulativeRealizedPnlShort_ASC = "cumulativeRealizedPnlShort_ASC", - cumulativeRealizedPnlShort_ASC_NULLS_FIRST = "cumulativeRealizedPnlShort_ASC_NULLS_FIRST", - cumulativeRealizedPnlShort_ASC_NULLS_LAST = "cumulativeRealizedPnlShort_ASC_NULLS_LAST", - cumulativeRealizedPnlShort_DESC = "cumulativeRealizedPnlShort_DESC", - cumulativeRealizedPnlShort_DESC_NULLS_FIRST = "cumulativeRealizedPnlShort_DESC_NULLS_FIRST", - cumulativeRealizedPnlShort_DESC_NULLS_LAST = "cumulativeRealizedPnlShort_DESC_NULLS_LAST", - cumulativeUnrealizedPnlLong_ASC = "cumulativeUnrealizedPnlLong_ASC", - cumulativeUnrealizedPnlLong_ASC_NULLS_FIRST = "cumulativeUnrealizedPnlLong_ASC_NULLS_FIRST", - cumulativeUnrealizedPnlLong_ASC_NULLS_LAST = "cumulativeUnrealizedPnlLong_ASC_NULLS_LAST", - cumulativeUnrealizedPnlLong_DESC = "cumulativeUnrealizedPnlLong_DESC", - cumulativeUnrealizedPnlLong_DESC_NULLS_FIRST = "cumulativeUnrealizedPnlLong_DESC_NULLS_FIRST", - cumulativeUnrealizedPnlLong_DESC_NULLS_LAST = "cumulativeUnrealizedPnlLong_DESC_NULLS_LAST", - cumulativeUnrealizedPnlShort_ASC = "cumulativeUnrealizedPnlShort_ASC", - cumulativeUnrealizedPnlShort_ASC_NULLS_FIRST = "cumulativeUnrealizedPnlShort_ASC_NULLS_FIRST", - cumulativeUnrealizedPnlShort_ASC_NULLS_LAST = "cumulativeUnrealizedPnlShort_ASC_NULLS_LAST", - cumulativeUnrealizedPnlShort_DESC = "cumulativeUnrealizedPnlShort_DESC", - cumulativeUnrealizedPnlShort_DESC_NULLS_FIRST = "cumulativeUnrealizedPnlShort_DESC_NULLS_FIRST", - cumulativeUnrealizedPnlShort_DESC_NULLS_LAST = "cumulativeUnrealizedPnlShort_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isSnapshot_ASC = "isSnapshot_ASC", - isSnapshot_ASC_NULLS_FIRST = "isSnapshot_ASC_NULLS_FIRST", - isSnapshot_ASC_NULLS_LAST = "isSnapshot_ASC_NULLS_LAST", - isSnapshot_DESC = "isSnapshot_DESC", - isSnapshot_DESC_NULLS_FIRST = "isSnapshot_DESC_NULLS_FIRST", - isSnapshot_DESC_NULLS_LAST = "isSnapshot_DESC_NULLS_LAST", - lastUnrealizedPnlLong_ASC = "lastUnrealizedPnlLong_ASC", - lastUnrealizedPnlLong_ASC_NULLS_FIRST = "lastUnrealizedPnlLong_ASC_NULLS_FIRST", - lastUnrealizedPnlLong_ASC_NULLS_LAST = "lastUnrealizedPnlLong_ASC_NULLS_LAST", - lastUnrealizedPnlLong_DESC = "lastUnrealizedPnlLong_DESC", - lastUnrealizedPnlLong_DESC_NULLS_FIRST = "lastUnrealizedPnlLong_DESC_NULLS_FIRST", - lastUnrealizedPnlLong_DESC_NULLS_LAST = "lastUnrealizedPnlLong_DESC_NULLS_LAST", - lastUnrealizedPnlShort_ASC = "lastUnrealizedPnlShort_ASC", - lastUnrealizedPnlShort_ASC_NULLS_FIRST = "lastUnrealizedPnlShort_ASC_NULLS_FIRST", - lastUnrealizedPnlShort_ASC_NULLS_LAST = "lastUnrealizedPnlShort_ASC_NULLS_LAST", - lastUnrealizedPnlShort_DESC = "lastUnrealizedPnlShort_DESC", - lastUnrealizedPnlShort_DESC_NULLS_FIRST = "lastUnrealizedPnlShort_DESC_NULLS_FIRST", - lastUnrealizedPnlShort_DESC_NULLS_LAST = "lastUnrealizedPnlShort_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + cumulativeRealizedPnlLong_ASC = 'cumulativeRealizedPnlLong_ASC', + cumulativeRealizedPnlLong_ASC_NULLS_FIRST = 'cumulativeRealizedPnlLong_ASC_NULLS_FIRST', + cumulativeRealizedPnlLong_ASC_NULLS_LAST = 'cumulativeRealizedPnlLong_ASC_NULLS_LAST', + cumulativeRealizedPnlLong_DESC = 'cumulativeRealizedPnlLong_DESC', + cumulativeRealizedPnlLong_DESC_NULLS_FIRST = 'cumulativeRealizedPnlLong_DESC_NULLS_FIRST', + cumulativeRealizedPnlLong_DESC_NULLS_LAST = 'cumulativeRealizedPnlLong_DESC_NULLS_LAST', + cumulativeRealizedPnlShort_ASC = 'cumulativeRealizedPnlShort_ASC', + cumulativeRealizedPnlShort_ASC_NULLS_FIRST = 'cumulativeRealizedPnlShort_ASC_NULLS_FIRST', + cumulativeRealizedPnlShort_ASC_NULLS_LAST = 'cumulativeRealizedPnlShort_ASC_NULLS_LAST', + cumulativeRealizedPnlShort_DESC = 'cumulativeRealizedPnlShort_DESC', + cumulativeRealizedPnlShort_DESC_NULLS_FIRST = 'cumulativeRealizedPnlShort_DESC_NULLS_FIRST', + cumulativeRealizedPnlShort_DESC_NULLS_LAST = 'cumulativeRealizedPnlShort_DESC_NULLS_LAST', + cumulativeUnrealizedPnlLong_ASC = 'cumulativeUnrealizedPnlLong_ASC', + cumulativeUnrealizedPnlLong_ASC_NULLS_FIRST = 'cumulativeUnrealizedPnlLong_ASC_NULLS_FIRST', + cumulativeUnrealizedPnlLong_ASC_NULLS_LAST = 'cumulativeUnrealizedPnlLong_ASC_NULLS_LAST', + cumulativeUnrealizedPnlLong_DESC = 'cumulativeUnrealizedPnlLong_DESC', + cumulativeUnrealizedPnlLong_DESC_NULLS_FIRST = 'cumulativeUnrealizedPnlLong_DESC_NULLS_FIRST', + cumulativeUnrealizedPnlLong_DESC_NULLS_LAST = 'cumulativeUnrealizedPnlLong_DESC_NULLS_LAST', + cumulativeUnrealizedPnlShort_ASC = 'cumulativeUnrealizedPnlShort_ASC', + cumulativeUnrealizedPnlShort_ASC_NULLS_FIRST = 'cumulativeUnrealizedPnlShort_ASC_NULLS_FIRST', + cumulativeUnrealizedPnlShort_ASC_NULLS_LAST = 'cumulativeUnrealizedPnlShort_ASC_NULLS_LAST', + cumulativeUnrealizedPnlShort_DESC = 'cumulativeUnrealizedPnlShort_DESC', + cumulativeUnrealizedPnlShort_DESC_NULLS_FIRST = 'cumulativeUnrealizedPnlShort_DESC_NULLS_FIRST', + cumulativeUnrealizedPnlShort_DESC_NULLS_LAST = 'cumulativeUnrealizedPnlShort_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isSnapshot_ASC = 'isSnapshot_ASC', + isSnapshot_ASC_NULLS_FIRST = 'isSnapshot_ASC_NULLS_FIRST', + isSnapshot_ASC_NULLS_LAST = 'isSnapshot_ASC_NULLS_LAST', + isSnapshot_DESC = 'isSnapshot_DESC', + isSnapshot_DESC_NULLS_FIRST = 'isSnapshot_DESC_NULLS_FIRST', + isSnapshot_DESC_NULLS_LAST = 'isSnapshot_DESC_NULLS_LAST', + lastUnrealizedPnlLong_ASC = 'lastUnrealizedPnlLong_ASC', + lastUnrealizedPnlLong_ASC_NULLS_FIRST = 'lastUnrealizedPnlLong_ASC_NULLS_FIRST', + lastUnrealizedPnlLong_ASC_NULLS_LAST = 'lastUnrealizedPnlLong_ASC_NULLS_LAST', + lastUnrealizedPnlLong_DESC = 'lastUnrealizedPnlLong_DESC', + lastUnrealizedPnlLong_DESC_NULLS_FIRST = 'lastUnrealizedPnlLong_DESC_NULLS_FIRST', + lastUnrealizedPnlLong_DESC_NULLS_LAST = 'lastUnrealizedPnlLong_DESC_NULLS_LAST', + lastUnrealizedPnlShort_ASC = 'lastUnrealizedPnlShort_ASC', + lastUnrealizedPnlShort_ASC_NULLS_FIRST = 'lastUnrealizedPnlShort_ASC_NULLS_FIRST', + lastUnrealizedPnlShort_ASC_NULLS_LAST = 'lastUnrealizedPnlShort_ASC_NULLS_LAST', + lastUnrealizedPnlShort_DESC = 'lastUnrealizedPnlShort_DESC', + lastUnrealizedPnlShort_DESC_NULLS_FIRST = 'lastUnrealizedPnlShort_DESC_NULLS_FIRST', + lastUnrealizedPnlShort_DESC_NULLS_LAST = 'lastUnrealizedPnlShort_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST' } export interface CumulativePnlWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - cumulativeRealizedPnlLong_eq?: InputMaybe; - cumulativeRealizedPnlLong_gt?: InputMaybe; - cumulativeRealizedPnlLong_gte?: InputMaybe; - cumulativeRealizedPnlLong_in?: InputMaybe>; - cumulativeRealizedPnlLong_isNull?: InputMaybe; - cumulativeRealizedPnlLong_lt?: InputMaybe; - cumulativeRealizedPnlLong_lte?: InputMaybe; - cumulativeRealizedPnlLong_not_eq?: InputMaybe; - cumulativeRealizedPnlLong_not_in?: InputMaybe>; - cumulativeRealizedPnlShort_eq?: InputMaybe; - cumulativeRealizedPnlShort_gt?: InputMaybe; - cumulativeRealizedPnlShort_gte?: InputMaybe; - cumulativeRealizedPnlShort_in?: InputMaybe>; - cumulativeRealizedPnlShort_isNull?: InputMaybe; - cumulativeRealizedPnlShort_lt?: InputMaybe; - cumulativeRealizedPnlShort_lte?: InputMaybe; - cumulativeRealizedPnlShort_not_eq?: InputMaybe; - cumulativeRealizedPnlShort_not_in?: InputMaybe>; - cumulativeUnrealizedPnlLong_eq?: InputMaybe; - cumulativeUnrealizedPnlLong_gt?: InputMaybe; - cumulativeUnrealizedPnlLong_gte?: InputMaybe; - cumulativeUnrealizedPnlLong_in?: InputMaybe>; - cumulativeUnrealizedPnlLong_isNull?: InputMaybe; - cumulativeUnrealizedPnlLong_lt?: InputMaybe; - cumulativeUnrealizedPnlLong_lte?: InputMaybe; - cumulativeUnrealizedPnlLong_not_eq?: InputMaybe; - cumulativeUnrealizedPnlLong_not_in?: InputMaybe>; - cumulativeUnrealizedPnlShort_eq?: InputMaybe; - cumulativeUnrealizedPnlShort_gt?: InputMaybe; - cumulativeUnrealizedPnlShort_gte?: InputMaybe; - cumulativeUnrealizedPnlShort_in?: InputMaybe>; - cumulativeUnrealizedPnlShort_isNull?: InputMaybe; - cumulativeUnrealizedPnlShort_lt?: InputMaybe; - cumulativeUnrealizedPnlShort_lte?: InputMaybe; - cumulativeUnrealizedPnlShort_not_eq?: InputMaybe; - cumulativeUnrealizedPnlShort_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + cumulativeRealizedPnlLong_eq?: InputMaybe; + cumulativeRealizedPnlLong_gt?: InputMaybe; + cumulativeRealizedPnlLong_gte?: InputMaybe; + cumulativeRealizedPnlLong_in?: InputMaybe>; + cumulativeRealizedPnlLong_isNull?: InputMaybe; + cumulativeRealizedPnlLong_lt?: InputMaybe; + cumulativeRealizedPnlLong_lte?: InputMaybe; + cumulativeRealizedPnlLong_not_eq?: InputMaybe; + cumulativeRealizedPnlLong_not_in?: InputMaybe>; + cumulativeRealizedPnlShort_eq?: InputMaybe; + cumulativeRealizedPnlShort_gt?: InputMaybe; + cumulativeRealizedPnlShort_gte?: InputMaybe; + cumulativeRealizedPnlShort_in?: InputMaybe>; + cumulativeRealizedPnlShort_isNull?: InputMaybe; + cumulativeRealizedPnlShort_lt?: InputMaybe; + cumulativeRealizedPnlShort_lte?: InputMaybe; + cumulativeRealizedPnlShort_not_eq?: InputMaybe; + cumulativeRealizedPnlShort_not_in?: InputMaybe>; + cumulativeUnrealizedPnlLong_eq?: InputMaybe; + cumulativeUnrealizedPnlLong_gt?: InputMaybe; + cumulativeUnrealizedPnlLong_gte?: InputMaybe; + cumulativeUnrealizedPnlLong_in?: InputMaybe>; + cumulativeUnrealizedPnlLong_isNull?: InputMaybe; + cumulativeUnrealizedPnlLong_lt?: InputMaybe; + cumulativeUnrealizedPnlLong_lte?: InputMaybe; + cumulativeUnrealizedPnlLong_not_eq?: InputMaybe; + cumulativeUnrealizedPnlLong_not_in?: InputMaybe>; + cumulativeUnrealizedPnlShort_eq?: InputMaybe; + cumulativeUnrealizedPnlShort_gt?: InputMaybe; + cumulativeUnrealizedPnlShort_gte?: InputMaybe; + cumulativeUnrealizedPnlShort_in?: InputMaybe>; + cumulativeUnrealizedPnlShort_isNull?: InputMaybe; + cumulativeUnrealizedPnlShort_lt?: InputMaybe; + cumulativeUnrealizedPnlShort_lte?: InputMaybe; + cumulativeUnrealizedPnlShort_not_eq?: InputMaybe; + cumulativeUnrealizedPnlShort_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isSnapshot_eq?: InputMaybe; - isSnapshot_isNull?: InputMaybe; - isSnapshot_not_eq?: InputMaybe; - lastUnrealizedPnlLong_eq?: InputMaybe; - lastUnrealizedPnlLong_gt?: InputMaybe; - lastUnrealizedPnlLong_gte?: InputMaybe; - lastUnrealizedPnlLong_in?: InputMaybe>; - lastUnrealizedPnlLong_isNull?: InputMaybe; - lastUnrealizedPnlLong_lt?: InputMaybe; - lastUnrealizedPnlLong_lte?: InputMaybe; - lastUnrealizedPnlLong_not_eq?: InputMaybe; - lastUnrealizedPnlLong_not_in?: InputMaybe>; - lastUnrealizedPnlShort_eq?: InputMaybe; - lastUnrealizedPnlShort_gt?: InputMaybe; - lastUnrealizedPnlShort_gte?: InputMaybe; - lastUnrealizedPnlShort_in?: InputMaybe>; - lastUnrealizedPnlShort_isNull?: InputMaybe; - lastUnrealizedPnlShort_lt?: InputMaybe; - lastUnrealizedPnlShort_lte?: InputMaybe; - lastUnrealizedPnlShort_not_eq?: InputMaybe; - lastUnrealizedPnlShort_not_in?: InputMaybe>; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isSnapshot_eq?: InputMaybe; + isSnapshot_isNull?: InputMaybe; + isSnapshot_not_eq?: InputMaybe; + lastUnrealizedPnlLong_eq?: InputMaybe; + lastUnrealizedPnlLong_gt?: InputMaybe; + lastUnrealizedPnlLong_gte?: InputMaybe; + lastUnrealizedPnlLong_in?: InputMaybe>; + lastUnrealizedPnlLong_isNull?: InputMaybe; + lastUnrealizedPnlLong_lt?: InputMaybe; + lastUnrealizedPnlLong_lte?: InputMaybe; + lastUnrealizedPnlLong_not_eq?: InputMaybe; + lastUnrealizedPnlLong_not_in?: InputMaybe>; + lastUnrealizedPnlShort_eq?: InputMaybe; + lastUnrealizedPnlShort_gt?: InputMaybe; + lastUnrealizedPnlShort_gte?: InputMaybe; + lastUnrealizedPnlShort_in?: InputMaybe>; + lastUnrealizedPnlShort_isNull?: InputMaybe; + lastUnrealizedPnlShort_lt?: InputMaybe; + lastUnrealizedPnlShort_lte?: InputMaybe; + lastUnrealizedPnlShort_not_eq?: InputMaybe; + lastUnrealizedPnlShort_not_in?: InputMaybe>; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; } export interface CumulativePnlsConnection { - __typename?: "CumulativePnlsConnection"; + __typename?: 'CumulativePnlsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface CumulativePoolValue { - __typename?: "CumulativePoolValue"; - address: Scalars["String"]["output"]; - cumulativePoolValueByTime: Scalars["BigInt"]["output"]; - cumulativeTime: Scalars["BigInt"]["output"]; + __typename?: 'CumulativePoolValue'; + address: Scalars['String']['output']; + cumulativePoolValueByTime: Scalars['BigInt']['output']; + cumulativeTime: Scalars['BigInt']['output']; entityType: EntityType; - id: Scalars["String"]["output"]; - isSnapshot: Scalars["Boolean"]["output"]; - lastPoolValue: Scalars["BigInt"]["output"]; - lastUpdateTimestamp: Scalars["Int"]["output"]; - snapshotTimestamp?: Maybe; + id: Scalars['String']['output']; + isSnapshot: Scalars['Boolean']['output']; + lastPoolValue: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['Int']['output']; + snapshotTimestamp?: Maybe; } export interface CumulativePoolValueEdge { - __typename?: "CumulativePoolValueEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'CumulativePoolValueEdge'; + cursor: Scalars['String']['output']; node: CumulativePoolValue; } export enum CumulativePoolValueOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - cumulativePoolValueByTime_ASC = "cumulativePoolValueByTime_ASC", - cumulativePoolValueByTime_ASC_NULLS_FIRST = "cumulativePoolValueByTime_ASC_NULLS_FIRST", - cumulativePoolValueByTime_ASC_NULLS_LAST = "cumulativePoolValueByTime_ASC_NULLS_LAST", - cumulativePoolValueByTime_DESC = "cumulativePoolValueByTime_DESC", - cumulativePoolValueByTime_DESC_NULLS_FIRST = "cumulativePoolValueByTime_DESC_NULLS_FIRST", - cumulativePoolValueByTime_DESC_NULLS_LAST = "cumulativePoolValueByTime_DESC_NULLS_LAST", - cumulativeTime_ASC = "cumulativeTime_ASC", - cumulativeTime_ASC_NULLS_FIRST = "cumulativeTime_ASC_NULLS_FIRST", - cumulativeTime_ASC_NULLS_LAST = "cumulativeTime_ASC_NULLS_LAST", - cumulativeTime_DESC = "cumulativeTime_DESC", - cumulativeTime_DESC_NULLS_FIRST = "cumulativeTime_DESC_NULLS_FIRST", - cumulativeTime_DESC_NULLS_LAST = "cumulativeTime_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isSnapshot_ASC = "isSnapshot_ASC", - isSnapshot_ASC_NULLS_FIRST = "isSnapshot_ASC_NULLS_FIRST", - isSnapshot_ASC_NULLS_LAST = "isSnapshot_ASC_NULLS_LAST", - isSnapshot_DESC = "isSnapshot_DESC", - isSnapshot_DESC_NULLS_FIRST = "isSnapshot_DESC_NULLS_FIRST", - isSnapshot_DESC_NULLS_LAST = "isSnapshot_DESC_NULLS_LAST", - lastPoolValue_ASC = "lastPoolValue_ASC", - lastPoolValue_ASC_NULLS_FIRST = "lastPoolValue_ASC_NULLS_FIRST", - lastPoolValue_ASC_NULLS_LAST = "lastPoolValue_ASC_NULLS_LAST", - lastPoolValue_DESC = "lastPoolValue_DESC", - lastPoolValue_DESC_NULLS_FIRST = "lastPoolValue_DESC_NULLS_FIRST", - lastPoolValue_DESC_NULLS_LAST = "lastPoolValue_DESC_NULLS_LAST", - lastUpdateTimestamp_ASC = "lastUpdateTimestamp_ASC", - lastUpdateTimestamp_ASC_NULLS_FIRST = "lastUpdateTimestamp_ASC_NULLS_FIRST", - lastUpdateTimestamp_ASC_NULLS_LAST = "lastUpdateTimestamp_ASC_NULLS_LAST", - lastUpdateTimestamp_DESC = "lastUpdateTimestamp_DESC", - lastUpdateTimestamp_DESC_NULLS_FIRST = "lastUpdateTimestamp_DESC_NULLS_FIRST", - lastUpdateTimestamp_DESC_NULLS_LAST = "lastUpdateTimestamp_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + cumulativePoolValueByTime_ASC = 'cumulativePoolValueByTime_ASC', + cumulativePoolValueByTime_ASC_NULLS_FIRST = 'cumulativePoolValueByTime_ASC_NULLS_FIRST', + cumulativePoolValueByTime_ASC_NULLS_LAST = 'cumulativePoolValueByTime_ASC_NULLS_LAST', + cumulativePoolValueByTime_DESC = 'cumulativePoolValueByTime_DESC', + cumulativePoolValueByTime_DESC_NULLS_FIRST = 'cumulativePoolValueByTime_DESC_NULLS_FIRST', + cumulativePoolValueByTime_DESC_NULLS_LAST = 'cumulativePoolValueByTime_DESC_NULLS_LAST', + cumulativeTime_ASC = 'cumulativeTime_ASC', + cumulativeTime_ASC_NULLS_FIRST = 'cumulativeTime_ASC_NULLS_FIRST', + cumulativeTime_ASC_NULLS_LAST = 'cumulativeTime_ASC_NULLS_LAST', + cumulativeTime_DESC = 'cumulativeTime_DESC', + cumulativeTime_DESC_NULLS_FIRST = 'cumulativeTime_DESC_NULLS_FIRST', + cumulativeTime_DESC_NULLS_LAST = 'cumulativeTime_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isSnapshot_ASC = 'isSnapshot_ASC', + isSnapshot_ASC_NULLS_FIRST = 'isSnapshot_ASC_NULLS_FIRST', + isSnapshot_ASC_NULLS_LAST = 'isSnapshot_ASC_NULLS_LAST', + isSnapshot_DESC = 'isSnapshot_DESC', + isSnapshot_DESC_NULLS_FIRST = 'isSnapshot_DESC_NULLS_FIRST', + isSnapshot_DESC_NULLS_LAST = 'isSnapshot_DESC_NULLS_LAST', + lastPoolValue_ASC = 'lastPoolValue_ASC', + lastPoolValue_ASC_NULLS_FIRST = 'lastPoolValue_ASC_NULLS_FIRST', + lastPoolValue_ASC_NULLS_LAST = 'lastPoolValue_ASC_NULLS_LAST', + lastPoolValue_DESC = 'lastPoolValue_DESC', + lastPoolValue_DESC_NULLS_FIRST = 'lastPoolValue_DESC_NULLS_FIRST', + lastPoolValue_DESC_NULLS_LAST = 'lastPoolValue_DESC_NULLS_LAST', + lastUpdateTimestamp_ASC = 'lastUpdateTimestamp_ASC', + lastUpdateTimestamp_ASC_NULLS_FIRST = 'lastUpdateTimestamp_ASC_NULLS_FIRST', + lastUpdateTimestamp_ASC_NULLS_LAST = 'lastUpdateTimestamp_ASC_NULLS_LAST', + lastUpdateTimestamp_DESC = 'lastUpdateTimestamp_DESC', + lastUpdateTimestamp_DESC_NULLS_FIRST = 'lastUpdateTimestamp_DESC_NULLS_FIRST', + lastUpdateTimestamp_DESC_NULLS_LAST = 'lastUpdateTimestamp_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST' } export interface CumulativePoolValueWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - cumulativePoolValueByTime_eq?: InputMaybe; - cumulativePoolValueByTime_gt?: InputMaybe; - cumulativePoolValueByTime_gte?: InputMaybe; - cumulativePoolValueByTime_in?: InputMaybe>; - cumulativePoolValueByTime_isNull?: InputMaybe; - cumulativePoolValueByTime_lt?: InputMaybe; - cumulativePoolValueByTime_lte?: InputMaybe; - cumulativePoolValueByTime_not_eq?: InputMaybe; - cumulativePoolValueByTime_not_in?: InputMaybe>; - cumulativeTime_eq?: InputMaybe; - cumulativeTime_gt?: InputMaybe; - cumulativeTime_gte?: InputMaybe; - cumulativeTime_in?: InputMaybe>; - cumulativeTime_isNull?: InputMaybe; - cumulativeTime_lt?: InputMaybe; - cumulativeTime_lte?: InputMaybe; - cumulativeTime_not_eq?: InputMaybe; - cumulativeTime_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + cumulativePoolValueByTime_eq?: InputMaybe; + cumulativePoolValueByTime_gt?: InputMaybe; + cumulativePoolValueByTime_gte?: InputMaybe; + cumulativePoolValueByTime_in?: InputMaybe>; + cumulativePoolValueByTime_isNull?: InputMaybe; + cumulativePoolValueByTime_lt?: InputMaybe; + cumulativePoolValueByTime_lte?: InputMaybe; + cumulativePoolValueByTime_not_eq?: InputMaybe; + cumulativePoolValueByTime_not_in?: InputMaybe>; + cumulativeTime_eq?: InputMaybe; + cumulativeTime_gt?: InputMaybe; + cumulativeTime_gte?: InputMaybe; + cumulativeTime_in?: InputMaybe>; + cumulativeTime_isNull?: InputMaybe; + cumulativeTime_lt?: InputMaybe; + cumulativeTime_lte?: InputMaybe; + cumulativeTime_not_eq?: InputMaybe; + cumulativeTime_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isSnapshot_eq?: InputMaybe; - isSnapshot_isNull?: InputMaybe; - isSnapshot_not_eq?: InputMaybe; - lastPoolValue_eq?: InputMaybe; - lastPoolValue_gt?: InputMaybe; - lastPoolValue_gte?: InputMaybe; - lastPoolValue_in?: InputMaybe>; - lastPoolValue_isNull?: InputMaybe; - lastPoolValue_lt?: InputMaybe; - lastPoolValue_lte?: InputMaybe; - lastPoolValue_not_eq?: InputMaybe; - lastPoolValue_not_in?: InputMaybe>; - lastUpdateTimestamp_eq?: InputMaybe; - lastUpdateTimestamp_gt?: InputMaybe; - lastUpdateTimestamp_gte?: InputMaybe; - lastUpdateTimestamp_in?: InputMaybe>; - lastUpdateTimestamp_isNull?: InputMaybe; - lastUpdateTimestamp_lt?: InputMaybe; - lastUpdateTimestamp_lte?: InputMaybe; - lastUpdateTimestamp_not_eq?: InputMaybe; - lastUpdateTimestamp_not_in?: InputMaybe>; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isSnapshot_eq?: InputMaybe; + isSnapshot_isNull?: InputMaybe; + isSnapshot_not_eq?: InputMaybe; + lastPoolValue_eq?: InputMaybe; + lastPoolValue_gt?: InputMaybe; + lastPoolValue_gte?: InputMaybe; + lastPoolValue_in?: InputMaybe>; + lastPoolValue_isNull?: InputMaybe; + lastPoolValue_lt?: InputMaybe; + lastPoolValue_lte?: InputMaybe; + lastPoolValue_not_eq?: InputMaybe; + lastPoolValue_not_in?: InputMaybe>; + lastUpdateTimestamp_eq?: InputMaybe; + lastUpdateTimestamp_gt?: InputMaybe; + lastUpdateTimestamp_gte?: InputMaybe; + lastUpdateTimestamp_in?: InputMaybe>; + lastUpdateTimestamp_isNull?: InputMaybe; + lastUpdateTimestamp_lt?: InputMaybe; + lastUpdateTimestamp_lte?: InputMaybe; + lastUpdateTimestamp_not_eq?: InputMaybe; + lastUpdateTimestamp_not_in?: InputMaybe>; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; } export interface CumulativePoolValuesConnection { - __typename?: "CumulativePoolValuesConnection"; + __typename?: 'CumulativePoolValuesConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Distribution { - __typename?: "Distribution"; - amounts: Array; - amountsInUsd: Array; - id: Scalars["String"]["output"]; - receiver: Scalars["String"]["output"]; - tokens: Array; + __typename?: 'Distribution'; + amounts: Array; + amountsInUsd: Array; + id: Scalars['String']['output']; + receiver: Scalars['String']['output']; + tokens: Array; transaction: Transaction; - typeId: Scalars["BigInt"]["output"]; + typeId: Scalars['BigInt']['output']; } export interface DistributionEdge { - __typename?: "DistributionEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'DistributionEdge'; + cursor: Scalars['String']['output']; node: Distribution; } export enum DistributionOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - receiver_ASC = "receiver_ASC", - receiver_ASC_NULLS_FIRST = "receiver_ASC_NULLS_FIRST", - receiver_ASC_NULLS_LAST = "receiver_ASC_NULLS_LAST", - receiver_DESC = "receiver_DESC", - receiver_DESC_NULLS_FIRST = "receiver_DESC_NULLS_FIRST", - receiver_DESC_NULLS_LAST = "receiver_DESC_NULLS_LAST", - transaction_blockNumber_ASC = "transaction_blockNumber_ASC", - transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", - transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", - transaction_blockNumber_DESC = "transaction_blockNumber_DESC", - transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", - transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", - transaction_chainId_ASC = "transaction_chainId_ASC", - transaction_chainId_ASC_NULLS_FIRST = "transaction_chainId_ASC_NULLS_FIRST", - transaction_chainId_ASC_NULLS_LAST = "transaction_chainId_ASC_NULLS_LAST", - transaction_chainId_DESC = "transaction_chainId_DESC", - transaction_chainId_DESC_NULLS_FIRST = "transaction_chainId_DESC_NULLS_FIRST", - transaction_chainId_DESC_NULLS_LAST = "transaction_chainId_DESC_NULLS_LAST", - transaction_from_ASC = "transaction_from_ASC", - transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", - transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", - transaction_from_DESC = "transaction_from_DESC", - transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", - transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", - transaction_hash_ASC = "transaction_hash_ASC", - transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", - transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", - transaction_hash_DESC = "transaction_hash_DESC", - transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", - transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", - transaction_id_ASC = "transaction_id_ASC", - transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", - transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", - transaction_id_DESC = "transaction_id_DESC", - transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", - transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", - transaction_timestamp_ASC = "transaction_timestamp_ASC", - transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", - transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", - transaction_timestamp_DESC = "transaction_timestamp_DESC", - transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", - transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", - transaction_to_ASC = "transaction_to_ASC", - transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", - transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", - transaction_to_DESC = "transaction_to_DESC", - transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", - transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", - transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", - transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", - transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", - transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", - transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", - transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", - typeId_ASC = "typeId_ASC", - typeId_ASC_NULLS_FIRST = "typeId_ASC_NULLS_FIRST", - typeId_ASC_NULLS_LAST = "typeId_ASC_NULLS_LAST", - typeId_DESC = "typeId_DESC", - typeId_DESC_NULLS_FIRST = "typeId_DESC_NULLS_FIRST", - typeId_DESC_NULLS_LAST = "typeId_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + receiver_ASC = 'receiver_ASC', + receiver_ASC_NULLS_FIRST = 'receiver_ASC_NULLS_FIRST', + receiver_ASC_NULLS_LAST = 'receiver_ASC_NULLS_LAST', + receiver_DESC = 'receiver_DESC', + receiver_DESC_NULLS_FIRST = 'receiver_DESC_NULLS_FIRST', + receiver_DESC_NULLS_LAST = 'receiver_DESC_NULLS_LAST', + transaction_blockNumber_ASC = 'transaction_blockNumber_ASC', + transaction_blockNumber_ASC_NULLS_FIRST = 'transaction_blockNumber_ASC_NULLS_FIRST', + transaction_blockNumber_ASC_NULLS_LAST = 'transaction_blockNumber_ASC_NULLS_LAST', + transaction_blockNumber_DESC = 'transaction_blockNumber_DESC', + transaction_blockNumber_DESC_NULLS_FIRST = 'transaction_blockNumber_DESC_NULLS_FIRST', + transaction_blockNumber_DESC_NULLS_LAST = 'transaction_blockNumber_DESC_NULLS_LAST', + transaction_from_ASC = 'transaction_from_ASC', + transaction_from_ASC_NULLS_FIRST = 'transaction_from_ASC_NULLS_FIRST', + transaction_from_ASC_NULLS_LAST = 'transaction_from_ASC_NULLS_LAST', + transaction_from_DESC = 'transaction_from_DESC', + transaction_from_DESC_NULLS_FIRST = 'transaction_from_DESC_NULLS_FIRST', + transaction_from_DESC_NULLS_LAST = 'transaction_from_DESC_NULLS_LAST', + transaction_hash_ASC = 'transaction_hash_ASC', + transaction_hash_ASC_NULLS_FIRST = 'transaction_hash_ASC_NULLS_FIRST', + transaction_hash_ASC_NULLS_LAST = 'transaction_hash_ASC_NULLS_LAST', + transaction_hash_DESC = 'transaction_hash_DESC', + transaction_hash_DESC_NULLS_FIRST = 'transaction_hash_DESC_NULLS_FIRST', + transaction_hash_DESC_NULLS_LAST = 'transaction_hash_DESC_NULLS_LAST', + transaction_id_ASC = 'transaction_id_ASC', + transaction_id_ASC_NULLS_FIRST = 'transaction_id_ASC_NULLS_FIRST', + transaction_id_ASC_NULLS_LAST = 'transaction_id_ASC_NULLS_LAST', + transaction_id_DESC = 'transaction_id_DESC', + transaction_id_DESC_NULLS_FIRST = 'transaction_id_DESC_NULLS_FIRST', + transaction_id_DESC_NULLS_LAST = 'transaction_id_DESC_NULLS_LAST', + transaction_timestamp_ASC = 'transaction_timestamp_ASC', + transaction_timestamp_ASC_NULLS_FIRST = 'transaction_timestamp_ASC_NULLS_FIRST', + transaction_timestamp_ASC_NULLS_LAST = 'transaction_timestamp_ASC_NULLS_LAST', + transaction_timestamp_DESC = 'transaction_timestamp_DESC', + transaction_timestamp_DESC_NULLS_FIRST = 'transaction_timestamp_DESC_NULLS_FIRST', + transaction_timestamp_DESC_NULLS_LAST = 'transaction_timestamp_DESC_NULLS_LAST', + transaction_to_ASC = 'transaction_to_ASC', + transaction_to_ASC_NULLS_FIRST = 'transaction_to_ASC_NULLS_FIRST', + transaction_to_ASC_NULLS_LAST = 'transaction_to_ASC_NULLS_LAST', + transaction_to_DESC = 'transaction_to_DESC', + transaction_to_DESC_NULLS_FIRST = 'transaction_to_DESC_NULLS_FIRST', + transaction_to_DESC_NULLS_LAST = 'transaction_to_DESC_NULLS_LAST', + transaction_transactionIndex_ASC = 'transaction_transactionIndex_ASC', + transaction_transactionIndex_ASC_NULLS_FIRST = 'transaction_transactionIndex_ASC_NULLS_FIRST', + transaction_transactionIndex_ASC_NULLS_LAST = 'transaction_transactionIndex_ASC_NULLS_LAST', + transaction_transactionIndex_DESC = 'transaction_transactionIndex_DESC', + transaction_transactionIndex_DESC_NULLS_FIRST = 'transaction_transactionIndex_DESC_NULLS_FIRST', + transaction_transactionIndex_DESC_NULLS_LAST = 'transaction_transactionIndex_DESC_NULLS_LAST', + typeId_ASC = 'typeId_ASC', + typeId_ASC_NULLS_FIRST = 'typeId_ASC_NULLS_FIRST', + typeId_ASC_NULLS_LAST = 'typeId_ASC_NULLS_LAST', + typeId_DESC = 'typeId_DESC', + typeId_DESC_NULLS_FIRST = 'typeId_DESC_NULLS_FIRST', + typeId_DESC_NULLS_LAST = 'typeId_DESC_NULLS_LAST' } export interface DistributionWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - amountsInUsd_containsAll?: InputMaybe>; - amountsInUsd_containsAny?: InputMaybe>; - amountsInUsd_containsNone?: InputMaybe>; - amountsInUsd_isNull?: InputMaybe; - amounts_containsAll?: InputMaybe>; - amounts_containsAny?: InputMaybe>; - amounts_containsNone?: InputMaybe>; - amounts_isNull?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - receiver_contains?: InputMaybe; - receiver_containsInsensitive?: InputMaybe; - receiver_endsWith?: InputMaybe; - receiver_eq?: InputMaybe; - receiver_gt?: InputMaybe; - receiver_gte?: InputMaybe; - receiver_in?: InputMaybe>; - receiver_isNull?: InputMaybe; - receiver_lt?: InputMaybe; - receiver_lte?: InputMaybe; - receiver_not_contains?: InputMaybe; - receiver_not_containsInsensitive?: InputMaybe; - receiver_not_endsWith?: InputMaybe; - receiver_not_eq?: InputMaybe; - receiver_not_in?: InputMaybe>; - receiver_not_startsWith?: InputMaybe; - receiver_startsWith?: InputMaybe; - tokens_containsAll?: InputMaybe>; - tokens_containsAny?: InputMaybe>; - tokens_containsNone?: InputMaybe>; - tokens_isNull?: InputMaybe; + amountsInUsd_containsAll?: InputMaybe>; + amountsInUsd_containsAny?: InputMaybe>; + amountsInUsd_containsNone?: InputMaybe>; + amountsInUsd_isNull?: InputMaybe; + amounts_containsAll?: InputMaybe>; + amounts_containsAny?: InputMaybe>; + amounts_containsNone?: InputMaybe>; + amounts_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + receiver_contains?: InputMaybe; + receiver_containsInsensitive?: InputMaybe; + receiver_endsWith?: InputMaybe; + receiver_eq?: InputMaybe; + receiver_gt?: InputMaybe; + receiver_gte?: InputMaybe; + receiver_in?: InputMaybe>; + receiver_isNull?: InputMaybe; + receiver_lt?: InputMaybe; + receiver_lte?: InputMaybe; + receiver_not_contains?: InputMaybe; + receiver_not_containsInsensitive?: InputMaybe; + receiver_not_endsWith?: InputMaybe; + receiver_not_eq?: InputMaybe; + receiver_not_in?: InputMaybe>; + receiver_not_startsWith?: InputMaybe; + receiver_startsWith?: InputMaybe; + tokens_containsAll?: InputMaybe>; + tokens_containsAny?: InputMaybe>; + tokens_containsNone?: InputMaybe>; + tokens_isNull?: InputMaybe; transaction?: InputMaybe; - transaction_isNull?: InputMaybe; - typeId_eq?: InputMaybe; - typeId_gt?: InputMaybe; - typeId_gte?: InputMaybe; - typeId_in?: InputMaybe>; - typeId_isNull?: InputMaybe; - typeId_lt?: InputMaybe; - typeId_lte?: InputMaybe; - typeId_not_eq?: InputMaybe; - typeId_not_in?: InputMaybe>; + transaction_isNull?: InputMaybe; + typeId_eq?: InputMaybe; + typeId_gt?: InputMaybe; + typeId_gte?: InputMaybe; + typeId_in?: InputMaybe>; + typeId_isNull?: InputMaybe; + typeId_lt?: InputMaybe; + typeId_lte?: InputMaybe; + typeId_not_eq?: InputMaybe; + typeId_not_in?: InputMaybe>; } export interface DistributionsConnection { - __typename?: "DistributionsConnection"; + __typename?: 'DistributionsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export enum EntityType { - Glv = "Glv", - Market = "Market", + Glv = 'Glv', + Market = 'Market' } export interface Glv { - __typename?: "Glv"; - glvTokenAddress: Scalars["String"]["output"]; - gmComposition: Array; - id: Scalars["String"]["output"]; - longTokenAddress: Scalars["String"]["output"]; - markets: Array; - poolValue: Scalars["BigInt"]["output"]; - shortTokenAddress: Scalars["String"]["output"]; + __typename?: 'Glv'; + glvTokenAddress: Scalars['String']['output']; + gmComposition: Array; + id: Scalars['String']['output']; + longTokenAddress: Scalars['String']['output']; + markets: Array; + poolValue: Scalars['BigInt']['output']; + shortTokenAddress: Scalars['String']['output']; } export interface GlvApr { - __typename?: "GlvApr"; - aprByBorrowingFee: Scalars["BigInt"]["output"]; - aprByFee: Scalars["BigInt"]["output"]; - glvAddress: Scalars["String"]["output"]; + __typename?: 'GlvApr'; + aprByBorrowingFee: Scalars['BigInt']['output']; + aprByFee: Scalars['BigInt']['output']; + glvAddress: Scalars['String']['output']; } export interface GlvAprsWhereInputWhereInput { - glvAddresses?: InputMaybe>; - periodEnd: Scalars["Float"]["input"]; - periodStart: Scalars["Float"]["input"]; + glvAddresses?: InputMaybe>; + periodEnd: Scalars['Float']['input']; + periodStart: Scalars['Float']['input']; } export interface GlvEdge { - __typename?: "GlvEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'GlvEdge'; + cursor: Scalars['String']['output']; node: Glv; } export enum GlvOrderByInput { - glvTokenAddress_ASC = "glvTokenAddress_ASC", - glvTokenAddress_ASC_NULLS_FIRST = "glvTokenAddress_ASC_NULLS_FIRST", - glvTokenAddress_ASC_NULLS_LAST = "glvTokenAddress_ASC_NULLS_LAST", - glvTokenAddress_DESC = "glvTokenAddress_DESC", - glvTokenAddress_DESC_NULLS_FIRST = "glvTokenAddress_DESC_NULLS_FIRST", - glvTokenAddress_DESC_NULLS_LAST = "glvTokenAddress_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - longTokenAddress_ASC = "longTokenAddress_ASC", - longTokenAddress_ASC_NULLS_FIRST = "longTokenAddress_ASC_NULLS_FIRST", - longTokenAddress_ASC_NULLS_LAST = "longTokenAddress_ASC_NULLS_LAST", - longTokenAddress_DESC = "longTokenAddress_DESC", - longTokenAddress_DESC_NULLS_FIRST = "longTokenAddress_DESC_NULLS_FIRST", - longTokenAddress_DESC_NULLS_LAST = "longTokenAddress_DESC_NULLS_LAST", - poolValue_ASC = "poolValue_ASC", - poolValue_ASC_NULLS_FIRST = "poolValue_ASC_NULLS_FIRST", - poolValue_ASC_NULLS_LAST = "poolValue_ASC_NULLS_LAST", - poolValue_DESC = "poolValue_DESC", - poolValue_DESC_NULLS_FIRST = "poolValue_DESC_NULLS_FIRST", - poolValue_DESC_NULLS_LAST = "poolValue_DESC_NULLS_LAST", - shortTokenAddress_ASC = "shortTokenAddress_ASC", - shortTokenAddress_ASC_NULLS_FIRST = "shortTokenAddress_ASC_NULLS_FIRST", - shortTokenAddress_ASC_NULLS_LAST = "shortTokenAddress_ASC_NULLS_LAST", - shortTokenAddress_DESC = "shortTokenAddress_DESC", - shortTokenAddress_DESC_NULLS_FIRST = "shortTokenAddress_DESC_NULLS_FIRST", - shortTokenAddress_DESC_NULLS_LAST = "shortTokenAddress_DESC_NULLS_LAST", + glvTokenAddress_ASC = 'glvTokenAddress_ASC', + glvTokenAddress_ASC_NULLS_FIRST = 'glvTokenAddress_ASC_NULLS_FIRST', + glvTokenAddress_ASC_NULLS_LAST = 'glvTokenAddress_ASC_NULLS_LAST', + glvTokenAddress_DESC = 'glvTokenAddress_DESC', + glvTokenAddress_DESC_NULLS_FIRST = 'glvTokenAddress_DESC_NULLS_FIRST', + glvTokenAddress_DESC_NULLS_LAST = 'glvTokenAddress_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + longTokenAddress_ASC = 'longTokenAddress_ASC', + longTokenAddress_ASC_NULLS_FIRST = 'longTokenAddress_ASC_NULLS_FIRST', + longTokenAddress_ASC_NULLS_LAST = 'longTokenAddress_ASC_NULLS_LAST', + longTokenAddress_DESC = 'longTokenAddress_DESC', + longTokenAddress_DESC_NULLS_FIRST = 'longTokenAddress_DESC_NULLS_FIRST', + longTokenAddress_DESC_NULLS_LAST = 'longTokenAddress_DESC_NULLS_LAST', + poolValue_ASC = 'poolValue_ASC', + poolValue_ASC_NULLS_FIRST = 'poolValue_ASC_NULLS_FIRST', + poolValue_ASC_NULLS_LAST = 'poolValue_ASC_NULLS_LAST', + poolValue_DESC = 'poolValue_DESC', + poolValue_DESC_NULLS_FIRST = 'poolValue_DESC_NULLS_FIRST', + poolValue_DESC_NULLS_LAST = 'poolValue_DESC_NULLS_LAST', + shortTokenAddress_ASC = 'shortTokenAddress_ASC', + shortTokenAddress_ASC_NULLS_FIRST = 'shortTokenAddress_ASC_NULLS_FIRST', + shortTokenAddress_ASC_NULLS_LAST = 'shortTokenAddress_ASC_NULLS_LAST', + shortTokenAddress_DESC = 'shortTokenAddress_DESC', + shortTokenAddress_DESC_NULLS_FIRST = 'shortTokenAddress_DESC_NULLS_FIRST', + shortTokenAddress_DESC_NULLS_LAST = 'shortTokenAddress_DESC_NULLS_LAST' } export interface GlvPnlApr { - __typename?: "GlvPnlApr"; - apr: Scalars["BigInt"]["output"]; - glvAddress: Scalars["String"]["output"]; - periodRealizedPnlLong: Scalars["BigInt"]["output"]; - periodRealizedPnlShort: Scalars["BigInt"]["output"]; - periodUnrealizedPnlLong: Scalars["BigInt"]["output"]; - periodUnrealizedPnlShort: Scalars["BigInt"]["output"]; - timeWeightedPoolValue: Scalars["BigInt"]["output"]; + __typename?: 'GlvPnlApr'; + apr: Scalars['BigInt']['output']; + glvAddress: Scalars['String']['output']; + periodRealizedPnlLong: Scalars['BigInt']['output']; + periodRealizedPnlShort: Scalars['BigInt']['output']; + periodUnrealizedPnlLong: Scalars['BigInt']['output']; + periodUnrealizedPnlShort: Scalars['BigInt']['output']; + timeWeightedPoolValue: Scalars['BigInt']['output']; } export interface GlvPnlAprsWhereInputWhereInput { - glvAddresses?: InputMaybe>; - periodEnd: Scalars["Float"]["input"]; - periodStart: Scalars["Float"]["input"]; + glvAddresses?: InputMaybe>; + periodEnd: Scalars['Float']['input']; + periodStart: Scalars['Float']['input']; } export interface GlvWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - glvTokenAddress_contains?: InputMaybe; - glvTokenAddress_containsInsensitive?: InputMaybe; - glvTokenAddress_endsWith?: InputMaybe; - glvTokenAddress_eq?: InputMaybe; - glvTokenAddress_gt?: InputMaybe; - glvTokenAddress_gte?: InputMaybe; - glvTokenAddress_in?: InputMaybe>; - glvTokenAddress_isNull?: InputMaybe; - glvTokenAddress_lt?: InputMaybe; - glvTokenAddress_lte?: InputMaybe; - glvTokenAddress_not_contains?: InputMaybe; - glvTokenAddress_not_containsInsensitive?: InputMaybe; - glvTokenAddress_not_endsWith?: InputMaybe; - glvTokenAddress_not_eq?: InputMaybe; - glvTokenAddress_not_in?: InputMaybe>; - glvTokenAddress_not_startsWith?: InputMaybe; - glvTokenAddress_startsWith?: InputMaybe; - gmComposition_containsAll?: InputMaybe>; - gmComposition_containsAny?: InputMaybe>; - gmComposition_containsNone?: InputMaybe>; - gmComposition_isNull?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - longTokenAddress_contains?: InputMaybe; - longTokenAddress_containsInsensitive?: InputMaybe; - longTokenAddress_endsWith?: InputMaybe; - longTokenAddress_eq?: InputMaybe; - longTokenAddress_gt?: InputMaybe; - longTokenAddress_gte?: InputMaybe; - longTokenAddress_in?: InputMaybe>; - longTokenAddress_isNull?: InputMaybe; - longTokenAddress_lt?: InputMaybe; - longTokenAddress_lte?: InputMaybe; - longTokenAddress_not_contains?: InputMaybe; - longTokenAddress_not_containsInsensitive?: InputMaybe; - longTokenAddress_not_endsWith?: InputMaybe; - longTokenAddress_not_eq?: InputMaybe; - longTokenAddress_not_in?: InputMaybe>; - longTokenAddress_not_startsWith?: InputMaybe; - longTokenAddress_startsWith?: InputMaybe; - markets_containsAll?: InputMaybe>; - markets_containsAny?: InputMaybe>; - markets_containsNone?: InputMaybe>; - markets_isNull?: InputMaybe; - poolValue_eq?: InputMaybe; - poolValue_gt?: InputMaybe; - poolValue_gte?: InputMaybe; - poolValue_in?: InputMaybe>; - poolValue_isNull?: InputMaybe; - poolValue_lt?: InputMaybe; - poolValue_lte?: InputMaybe; - poolValue_not_eq?: InputMaybe; - poolValue_not_in?: InputMaybe>; - shortTokenAddress_contains?: InputMaybe; - shortTokenAddress_containsInsensitive?: InputMaybe; - shortTokenAddress_endsWith?: InputMaybe; - shortTokenAddress_eq?: InputMaybe; - shortTokenAddress_gt?: InputMaybe; - shortTokenAddress_gte?: InputMaybe; - shortTokenAddress_in?: InputMaybe>; - shortTokenAddress_isNull?: InputMaybe; - shortTokenAddress_lt?: InputMaybe; - shortTokenAddress_lte?: InputMaybe; - shortTokenAddress_not_contains?: InputMaybe; - shortTokenAddress_not_containsInsensitive?: InputMaybe; - shortTokenAddress_not_endsWith?: InputMaybe; - shortTokenAddress_not_eq?: InputMaybe; - shortTokenAddress_not_in?: InputMaybe>; - shortTokenAddress_not_startsWith?: InputMaybe; - shortTokenAddress_startsWith?: InputMaybe; + glvTokenAddress_contains?: InputMaybe; + glvTokenAddress_containsInsensitive?: InputMaybe; + glvTokenAddress_endsWith?: InputMaybe; + glvTokenAddress_eq?: InputMaybe; + glvTokenAddress_gt?: InputMaybe; + glvTokenAddress_gte?: InputMaybe; + glvTokenAddress_in?: InputMaybe>; + glvTokenAddress_isNull?: InputMaybe; + glvTokenAddress_lt?: InputMaybe; + glvTokenAddress_lte?: InputMaybe; + glvTokenAddress_not_contains?: InputMaybe; + glvTokenAddress_not_containsInsensitive?: InputMaybe; + glvTokenAddress_not_endsWith?: InputMaybe; + glvTokenAddress_not_eq?: InputMaybe; + glvTokenAddress_not_in?: InputMaybe>; + glvTokenAddress_not_startsWith?: InputMaybe; + glvTokenAddress_startsWith?: InputMaybe; + gmComposition_containsAll?: InputMaybe>; + gmComposition_containsAny?: InputMaybe>; + gmComposition_containsNone?: InputMaybe>; + gmComposition_isNull?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + longTokenAddress_contains?: InputMaybe; + longTokenAddress_containsInsensitive?: InputMaybe; + longTokenAddress_endsWith?: InputMaybe; + longTokenAddress_eq?: InputMaybe; + longTokenAddress_gt?: InputMaybe; + longTokenAddress_gte?: InputMaybe; + longTokenAddress_in?: InputMaybe>; + longTokenAddress_isNull?: InputMaybe; + longTokenAddress_lt?: InputMaybe; + longTokenAddress_lte?: InputMaybe; + longTokenAddress_not_contains?: InputMaybe; + longTokenAddress_not_containsInsensitive?: InputMaybe; + longTokenAddress_not_endsWith?: InputMaybe; + longTokenAddress_not_eq?: InputMaybe; + longTokenAddress_not_in?: InputMaybe>; + longTokenAddress_not_startsWith?: InputMaybe; + longTokenAddress_startsWith?: InputMaybe; + markets_containsAll?: InputMaybe>; + markets_containsAny?: InputMaybe>; + markets_containsNone?: InputMaybe>; + markets_isNull?: InputMaybe; + poolValue_eq?: InputMaybe; + poolValue_gt?: InputMaybe; + poolValue_gte?: InputMaybe; + poolValue_in?: InputMaybe>; + poolValue_isNull?: InputMaybe; + poolValue_lt?: InputMaybe; + poolValue_lte?: InputMaybe; + poolValue_not_eq?: InputMaybe; + poolValue_not_in?: InputMaybe>; + shortTokenAddress_contains?: InputMaybe; + shortTokenAddress_containsInsensitive?: InputMaybe; + shortTokenAddress_endsWith?: InputMaybe; + shortTokenAddress_eq?: InputMaybe; + shortTokenAddress_gt?: InputMaybe; + shortTokenAddress_gte?: InputMaybe; + shortTokenAddress_in?: InputMaybe>; + shortTokenAddress_isNull?: InputMaybe; + shortTokenAddress_lt?: InputMaybe; + shortTokenAddress_lte?: InputMaybe; + shortTokenAddress_not_contains?: InputMaybe; + shortTokenAddress_not_containsInsensitive?: InputMaybe; + shortTokenAddress_not_endsWith?: InputMaybe; + shortTokenAddress_not_eq?: InputMaybe; + shortTokenAddress_not_in?: InputMaybe>; + shortTokenAddress_not_startsWith?: InputMaybe; + shortTokenAddress_startsWith?: InputMaybe; } export interface GlvsConnection { - __typename?: "GlvsConnection"; + __typename?: 'GlvsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Market { - __typename?: "Market"; - id: Scalars["String"]["output"]; - indexToken: Scalars["String"]["output"]; - longToken: Scalars["String"]["output"]; - shortToken: Scalars["String"]["output"]; + __typename?: 'Market'; + id: Scalars['String']['output']; + indexToken: Scalars['String']['output']; + longToken: Scalars['String']['output']; + shortToken: Scalars['String']['output']; } export interface MarketApr { - __typename?: "MarketApr"; - aprByBorrowingFee: Scalars["BigInt"]["output"]; - aprByFee: Scalars["BigInt"]["output"]; - marketAddress: Scalars["String"]["output"]; + __typename?: 'MarketApr'; + aprByBorrowingFee: Scalars['BigInt']['output']; + aprByFee: Scalars['BigInt']['output']; + marketAddress: Scalars['String']['output']; } export interface MarketAprsWhereInput { - marketAddresses?: InputMaybe>; - periodEnd: Scalars["Float"]["input"]; - periodStart: Scalars["Float"]["input"]; + marketAddresses?: InputMaybe>; + periodEnd: Scalars['Float']['input']; + periodStart: Scalars['Float']['input']; } export interface MarketEdge { - __typename?: "MarketEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'MarketEdge'; + cursor: Scalars['String']['output']; node: Market; } export interface MarketInfo { - __typename?: "MarketInfo"; - aboveOptimalUsageBorrowingFactorLong: Scalars["BigInt"]["output"]; - aboveOptimalUsageBorrowingFactorShort: Scalars["BigInt"]["output"]; - atomicSwapFeeFactor: Scalars["BigInt"]["output"]; - baseBorrowingFactorLong: Scalars["BigInt"]["output"]; - baseBorrowingFactorShort: Scalars["BigInt"]["output"]; - borrowingExponentFactorLong: Scalars["BigInt"]["output"]; - borrowingExponentFactorShort: Scalars["BigInt"]["output"]; - borrowingFactorLong: Scalars["BigInt"]["output"]; - borrowingFactorPerSecondForLongs: Scalars["BigInt"]["output"]; - borrowingFactorPerSecondForShorts: Scalars["BigInt"]["output"]; - borrowingFactorShort: Scalars["BigInt"]["output"]; - fundingDecreaseFactorPerSecond: Scalars["BigInt"]["output"]; - fundingExponentFactor: Scalars["BigInt"]["output"]; - fundingFactor: Scalars["BigInt"]["output"]; - fundingFactorPerSecond: Scalars["BigInt"]["output"]; - fundingIncreaseFactorPerSecond: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - indexTokenAddress: Scalars["String"]["output"]; - isDisabled: Scalars["Boolean"]["output"]; - lentPositionImpactPoolAmount: Scalars["BigInt"]["output"]; - longOpenInterestInTokens: Scalars["BigInt"]["output"]; - longOpenInterestInTokensUsingLongToken: Scalars["BigInt"]["output"]; - longOpenInterestInTokensUsingShortToken: Scalars["BigInt"]["output"]; - longOpenInterestUsd: Scalars["BigInt"]["output"]; - longOpenInterestUsingLongToken: Scalars["BigInt"]["output"]; - longOpenInterestUsingShortToken: Scalars["BigInt"]["output"]; - longPoolAmount: Scalars["BigInt"]["output"]; - longPoolAmountAdjustment: Scalars["BigInt"]["output"]; - longTokenAddress: Scalars["String"]["output"]; - longsPayShorts: Scalars["Boolean"]["output"]; - marketTokenAddress: Scalars["String"]["output"]; - marketTokenSupply: Scalars["BigInt"]["output"]; - maxFundingFactorPerSecond: Scalars["BigInt"]["output"]; - maxLendableImpactFactor: Scalars["BigInt"]["output"]; - maxLendableImpactFactorForWithdrawals: Scalars["BigInt"]["output"]; - maxLendableImpactUsd: Scalars["BigInt"]["output"]; - maxLongPoolAmount: Scalars["BigInt"]["output"]; - maxLongPoolUsdForDeposit: Scalars["BigInt"]["output"]; - maxOpenInterestLong: Scalars["BigInt"]["output"]; - maxOpenInterestShort: Scalars["BigInt"]["output"]; - maxPnlFactorForTradersLong: Scalars["BigInt"]["output"]; - maxPnlFactorForTradersShort: Scalars["BigInt"]["output"]; - maxPositionImpactFactorForLiquidations: Scalars["BigInt"]["output"]; - maxPositionImpactFactorNegative: Scalars["BigInt"]["output"]; - maxPositionImpactFactorPositive: Scalars["BigInt"]["output"]; - maxShortPoolAmount: Scalars["BigInt"]["output"]; - maxShortPoolUsdForDeposit: Scalars["BigInt"]["output"]; - minCollateralFactor: Scalars["BigInt"]["output"]; - minCollateralFactorForOpenInterestLong: Scalars["BigInt"]["output"]; - minCollateralFactorForOpenInterestShort: Scalars["BigInt"]["output"]; - minFundingFactorPerSecond: Scalars["BigInt"]["output"]; - minPositionImpactPoolAmount: Scalars["BigInt"]["output"]; - openInterestReserveFactorLong: Scalars["BigInt"]["output"]; - openInterestReserveFactorShort: Scalars["BigInt"]["output"]; - optimalUsageFactorLong: Scalars["BigInt"]["output"]; - optimalUsageFactorShort: Scalars["BigInt"]["output"]; - poolValue: Scalars["BigInt"]["output"]; - poolValueMax: Scalars["BigInt"]["output"]; - poolValueMin: Scalars["BigInt"]["output"]; - positionFeeFactorForNegativeImpact: Scalars["BigInt"]["output"]; - positionFeeFactorForPositiveImpact: Scalars["BigInt"]["output"]; - positionImpactExponentFactor: Scalars["BigInt"]["output"]; - positionImpactFactorNegative: Scalars["BigInt"]["output"]; - positionImpactFactorPositive: Scalars["BigInt"]["output"]; - positionImpactPoolAmount: Scalars["BigInt"]["output"]; - positionImpactPoolDistributionRate: Scalars["BigInt"]["output"]; - reserveFactorLong: Scalars["BigInt"]["output"]; - reserveFactorShort: Scalars["BigInt"]["output"]; - shortOpenInterestInTokens: Scalars["BigInt"]["output"]; - shortOpenInterestInTokensUsingLongToken: Scalars["BigInt"]["output"]; - shortOpenInterestInTokensUsingShortToken: Scalars["BigInt"]["output"]; - shortOpenInterestUsd: Scalars["BigInt"]["output"]; - shortOpenInterestUsingLongToken: Scalars["BigInt"]["output"]; - shortOpenInterestUsingShortToken: Scalars["BigInt"]["output"]; - shortPoolAmount: Scalars["BigInt"]["output"]; - shortPoolAmountAdjustment: Scalars["BigInt"]["output"]; - shortTokenAddress: Scalars["String"]["output"]; - swapFeeFactorForNegativeImpact: Scalars["BigInt"]["output"]; - swapFeeFactorForPositiveImpact: Scalars["BigInt"]["output"]; - swapImpactExponentFactor: Scalars["BigInt"]["output"]; - swapImpactFactorNegative: Scalars["BigInt"]["output"]; - swapImpactFactorPositive: Scalars["BigInt"]["output"]; - swapImpactPoolAmountLong: Scalars["BigInt"]["output"]; - swapImpactPoolAmountShort: Scalars["BigInt"]["output"]; - thresholdForDecreaseFunding: Scalars["BigInt"]["output"]; - thresholdForStableFunding: Scalars["BigInt"]["output"]; - totalBorrowingFees: Scalars["BigInt"]["output"]; - virtualIndexTokenId: Scalars["String"]["output"]; - virtualInventoryForPositions: Scalars["BigInt"]["output"]; - virtualLongTokenId: Scalars["String"]["output"]; - virtualMarketId: Scalars["String"]["output"]; - virtualPoolAmountForLongToken: Scalars["BigInt"]["output"]; - virtualPoolAmountForShortToken: Scalars["BigInt"]["output"]; - virtualShortTokenId: Scalars["String"]["output"]; + __typename?: 'MarketInfo'; + aboveOptimalUsageBorrowingFactorLong: Scalars['BigInt']['output']; + aboveOptimalUsageBorrowingFactorShort: Scalars['BigInt']['output']; + atomicSwapFeeFactor: Scalars['BigInt']['output']; + baseBorrowingFactorLong: Scalars['BigInt']['output']; + baseBorrowingFactorShort: Scalars['BigInt']['output']; + borrowingExponentFactorLong: Scalars['BigInt']['output']; + borrowingExponentFactorShort: Scalars['BigInt']['output']; + borrowingFactorLong: Scalars['BigInt']['output']; + borrowingFactorPerSecondForLongs: Scalars['BigInt']['output']; + borrowingFactorPerSecondForShorts: Scalars['BigInt']['output']; + borrowingFactorShort: Scalars['BigInt']['output']; + fundingDecreaseFactorPerSecond: Scalars['BigInt']['output']; + fundingExponentFactor: Scalars['BigInt']['output']; + fundingFactor: Scalars['BigInt']['output']; + fundingFactorPerSecond: Scalars['BigInt']['output']; + fundingIncreaseFactorPerSecond: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + indexTokenAddress: Scalars['String']['output']; + isDisabled: Scalars['Boolean']['output']; + lentPositionImpactPoolAmount: Scalars['BigInt']['output']; + longOpenInterestInTokens: Scalars['BigInt']['output']; + longOpenInterestInTokensUsingLongToken: Scalars['BigInt']['output']; + longOpenInterestInTokensUsingShortToken: Scalars['BigInt']['output']; + longOpenInterestUsd: Scalars['BigInt']['output']; + longOpenInterestUsingLongToken: Scalars['BigInt']['output']; + longOpenInterestUsingShortToken: Scalars['BigInt']['output']; + longPoolAmount: Scalars['BigInt']['output']; + longTokenAddress: Scalars['String']['output']; + longsPayShorts: Scalars['Boolean']['output']; + marketTokenAddress: Scalars['String']['output']; + marketTokenSupply: Scalars['BigInt']['output']; + maxFundingFactorPerSecond: Scalars['BigInt']['output']; + maxLendableImpactFactor: Scalars['BigInt']['output']; + maxLendableImpactFactorForWithdrawals: Scalars['BigInt']['output']; + maxLendableImpactUsd: Scalars['BigInt']['output']; + maxLongPoolAmount: Scalars['BigInt']['output']; + maxLongPoolUsdForDeposit: Scalars['BigInt']['output']; + maxOpenInterestLong: Scalars['BigInt']['output']; + maxOpenInterestShort: Scalars['BigInt']['output']; + maxPnlFactorForTradersLong: Scalars['BigInt']['output']; + maxPnlFactorForTradersShort: Scalars['BigInt']['output']; + maxPositionImpactFactorForLiquidations: Scalars['BigInt']['output']; + maxPositionImpactFactorNegative: Scalars['BigInt']['output']; + maxPositionImpactFactorPositive: Scalars['BigInt']['output']; + maxShortPoolAmount: Scalars['BigInt']['output']; + maxShortPoolUsdForDeposit: Scalars['BigInt']['output']; + minCollateralFactor: Scalars['BigInt']['output']; + minCollateralFactorForOpenInterestLong: Scalars['BigInt']['output']; + minCollateralFactorForOpenInterestShort: Scalars['BigInt']['output']; + minFundingFactorPerSecond: Scalars['BigInt']['output']; + minPositionImpactPoolAmount: Scalars['BigInt']['output']; + openInterestReserveFactorLong: Scalars['BigInt']['output']; + openInterestReserveFactorShort: Scalars['BigInt']['output']; + optimalUsageFactorLong: Scalars['BigInt']['output']; + optimalUsageFactorShort: Scalars['BigInt']['output']; + poolValue: Scalars['BigInt']['output']; + poolValueMax: Scalars['BigInt']['output']; + poolValueMin: Scalars['BigInt']['output']; + positionFeeFactorForNegativeImpact: Scalars['BigInt']['output']; + positionFeeFactorForPositiveImpact: Scalars['BigInt']['output']; + positionImpactExponentFactor: Scalars['BigInt']['output']; + positionImpactFactorNegative: Scalars['BigInt']['output']; + positionImpactFactorPositive: Scalars['BigInt']['output']; + positionImpactPoolAmount: Scalars['BigInt']['output']; + positionImpactPoolDistributionRate: Scalars['BigInt']['output']; + reserveFactorLong: Scalars['BigInt']['output']; + reserveFactorShort: Scalars['BigInt']['output']; + shortOpenInterestInTokens: Scalars['BigInt']['output']; + shortOpenInterestInTokensUsingLongToken: Scalars['BigInt']['output']; + shortOpenInterestInTokensUsingShortToken: Scalars['BigInt']['output']; + shortOpenInterestUsd: Scalars['BigInt']['output']; + shortOpenInterestUsingLongToken: Scalars['BigInt']['output']; + shortOpenInterestUsingShortToken: Scalars['BigInt']['output']; + shortPoolAmount: Scalars['BigInt']['output']; + shortTokenAddress: Scalars['String']['output']; + swapFeeFactorForNegativeImpact: Scalars['BigInt']['output']; + swapFeeFactorForPositiveImpact: Scalars['BigInt']['output']; + swapImpactExponentFactor: Scalars['BigInt']['output']; + swapImpactFactorNegative: Scalars['BigInt']['output']; + swapImpactFactorPositive: Scalars['BigInt']['output']; + swapImpactPoolAmountLong: Scalars['BigInt']['output']; + swapImpactPoolAmountShort: Scalars['BigInt']['output']; + thresholdForDecreaseFunding: Scalars['BigInt']['output']; + thresholdForStableFunding: Scalars['BigInt']['output']; + totalBorrowingFees: Scalars['BigInt']['output']; + virtualIndexTokenId: Scalars['String']['output']; + virtualInventoryForPositions: Scalars['BigInt']['output']; + virtualLongTokenId: Scalars['String']['output']; + virtualMarketId: Scalars['String']['output']; + virtualPoolAmountForLongToken: Scalars['BigInt']['output']; + virtualPoolAmountForShortToken: Scalars['BigInt']['output']; + virtualShortTokenId: Scalars['String']['output']; } export interface MarketInfoEdge { - __typename?: "MarketInfoEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'MarketInfoEdge'; + cursor: Scalars['String']['output']; node: MarketInfo; } export enum MarketInfoOrderByInput { - aboveOptimalUsageBorrowingFactorLong_ASC = "aboveOptimalUsageBorrowingFactorLong_ASC", - aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_FIRST = "aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_FIRST", - aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_LAST = "aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_LAST", - aboveOptimalUsageBorrowingFactorLong_DESC = "aboveOptimalUsageBorrowingFactorLong_DESC", - aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_FIRST = "aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_FIRST", - aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_LAST = "aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_LAST", - aboveOptimalUsageBorrowingFactorShort_ASC = "aboveOptimalUsageBorrowingFactorShort_ASC", - aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_FIRST = "aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_FIRST", - aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_LAST = "aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_LAST", - aboveOptimalUsageBorrowingFactorShort_DESC = "aboveOptimalUsageBorrowingFactorShort_DESC", - aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_FIRST = "aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_FIRST", - aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_LAST = "aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_LAST", - atomicSwapFeeFactor_ASC = "atomicSwapFeeFactor_ASC", - atomicSwapFeeFactor_ASC_NULLS_FIRST = "atomicSwapFeeFactor_ASC_NULLS_FIRST", - atomicSwapFeeFactor_ASC_NULLS_LAST = "atomicSwapFeeFactor_ASC_NULLS_LAST", - atomicSwapFeeFactor_DESC = "atomicSwapFeeFactor_DESC", - atomicSwapFeeFactor_DESC_NULLS_FIRST = "atomicSwapFeeFactor_DESC_NULLS_FIRST", - atomicSwapFeeFactor_DESC_NULLS_LAST = "atomicSwapFeeFactor_DESC_NULLS_LAST", - baseBorrowingFactorLong_ASC = "baseBorrowingFactorLong_ASC", - baseBorrowingFactorLong_ASC_NULLS_FIRST = "baseBorrowingFactorLong_ASC_NULLS_FIRST", - baseBorrowingFactorLong_ASC_NULLS_LAST = "baseBorrowingFactorLong_ASC_NULLS_LAST", - baseBorrowingFactorLong_DESC = "baseBorrowingFactorLong_DESC", - baseBorrowingFactorLong_DESC_NULLS_FIRST = "baseBorrowingFactorLong_DESC_NULLS_FIRST", - baseBorrowingFactorLong_DESC_NULLS_LAST = "baseBorrowingFactorLong_DESC_NULLS_LAST", - baseBorrowingFactorShort_ASC = "baseBorrowingFactorShort_ASC", - baseBorrowingFactorShort_ASC_NULLS_FIRST = "baseBorrowingFactorShort_ASC_NULLS_FIRST", - baseBorrowingFactorShort_ASC_NULLS_LAST = "baseBorrowingFactorShort_ASC_NULLS_LAST", - baseBorrowingFactorShort_DESC = "baseBorrowingFactorShort_DESC", - baseBorrowingFactorShort_DESC_NULLS_FIRST = "baseBorrowingFactorShort_DESC_NULLS_FIRST", - baseBorrowingFactorShort_DESC_NULLS_LAST = "baseBorrowingFactorShort_DESC_NULLS_LAST", - borrowingExponentFactorLong_ASC = "borrowingExponentFactorLong_ASC", - borrowingExponentFactorLong_ASC_NULLS_FIRST = "borrowingExponentFactorLong_ASC_NULLS_FIRST", - borrowingExponentFactorLong_ASC_NULLS_LAST = "borrowingExponentFactorLong_ASC_NULLS_LAST", - borrowingExponentFactorLong_DESC = "borrowingExponentFactorLong_DESC", - borrowingExponentFactorLong_DESC_NULLS_FIRST = "borrowingExponentFactorLong_DESC_NULLS_FIRST", - borrowingExponentFactorLong_DESC_NULLS_LAST = "borrowingExponentFactorLong_DESC_NULLS_LAST", - borrowingExponentFactorShort_ASC = "borrowingExponentFactorShort_ASC", - borrowingExponentFactorShort_ASC_NULLS_FIRST = "borrowingExponentFactorShort_ASC_NULLS_FIRST", - borrowingExponentFactorShort_ASC_NULLS_LAST = "borrowingExponentFactorShort_ASC_NULLS_LAST", - borrowingExponentFactorShort_DESC = "borrowingExponentFactorShort_DESC", - borrowingExponentFactorShort_DESC_NULLS_FIRST = "borrowingExponentFactorShort_DESC_NULLS_FIRST", - borrowingExponentFactorShort_DESC_NULLS_LAST = "borrowingExponentFactorShort_DESC_NULLS_LAST", - borrowingFactorLong_ASC = "borrowingFactorLong_ASC", - borrowingFactorLong_ASC_NULLS_FIRST = "borrowingFactorLong_ASC_NULLS_FIRST", - borrowingFactorLong_ASC_NULLS_LAST = "borrowingFactorLong_ASC_NULLS_LAST", - borrowingFactorLong_DESC = "borrowingFactorLong_DESC", - borrowingFactorLong_DESC_NULLS_FIRST = "borrowingFactorLong_DESC_NULLS_FIRST", - borrowingFactorLong_DESC_NULLS_LAST = "borrowingFactorLong_DESC_NULLS_LAST", - borrowingFactorPerSecondForLongs_ASC = "borrowingFactorPerSecondForLongs_ASC", - borrowingFactorPerSecondForLongs_ASC_NULLS_FIRST = "borrowingFactorPerSecondForLongs_ASC_NULLS_FIRST", - borrowingFactorPerSecondForLongs_ASC_NULLS_LAST = "borrowingFactorPerSecondForLongs_ASC_NULLS_LAST", - borrowingFactorPerSecondForLongs_DESC = "borrowingFactorPerSecondForLongs_DESC", - borrowingFactorPerSecondForLongs_DESC_NULLS_FIRST = "borrowingFactorPerSecondForLongs_DESC_NULLS_FIRST", - borrowingFactorPerSecondForLongs_DESC_NULLS_LAST = "borrowingFactorPerSecondForLongs_DESC_NULLS_LAST", - borrowingFactorPerSecondForShorts_ASC = "borrowingFactorPerSecondForShorts_ASC", - borrowingFactorPerSecondForShorts_ASC_NULLS_FIRST = "borrowingFactorPerSecondForShorts_ASC_NULLS_FIRST", - borrowingFactorPerSecondForShorts_ASC_NULLS_LAST = "borrowingFactorPerSecondForShorts_ASC_NULLS_LAST", - borrowingFactorPerSecondForShorts_DESC = "borrowingFactorPerSecondForShorts_DESC", - borrowingFactorPerSecondForShorts_DESC_NULLS_FIRST = "borrowingFactorPerSecondForShorts_DESC_NULLS_FIRST", - borrowingFactorPerSecondForShorts_DESC_NULLS_LAST = "borrowingFactorPerSecondForShorts_DESC_NULLS_LAST", - borrowingFactorShort_ASC = "borrowingFactorShort_ASC", - borrowingFactorShort_ASC_NULLS_FIRST = "borrowingFactorShort_ASC_NULLS_FIRST", - borrowingFactorShort_ASC_NULLS_LAST = "borrowingFactorShort_ASC_NULLS_LAST", - borrowingFactorShort_DESC = "borrowingFactorShort_DESC", - borrowingFactorShort_DESC_NULLS_FIRST = "borrowingFactorShort_DESC_NULLS_FIRST", - borrowingFactorShort_DESC_NULLS_LAST = "borrowingFactorShort_DESC_NULLS_LAST", - fundingDecreaseFactorPerSecond_ASC = "fundingDecreaseFactorPerSecond_ASC", - fundingDecreaseFactorPerSecond_ASC_NULLS_FIRST = "fundingDecreaseFactorPerSecond_ASC_NULLS_FIRST", - fundingDecreaseFactorPerSecond_ASC_NULLS_LAST = "fundingDecreaseFactorPerSecond_ASC_NULLS_LAST", - fundingDecreaseFactorPerSecond_DESC = "fundingDecreaseFactorPerSecond_DESC", - fundingDecreaseFactorPerSecond_DESC_NULLS_FIRST = "fundingDecreaseFactorPerSecond_DESC_NULLS_FIRST", - fundingDecreaseFactorPerSecond_DESC_NULLS_LAST = "fundingDecreaseFactorPerSecond_DESC_NULLS_LAST", - fundingExponentFactor_ASC = "fundingExponentFactor_ASC", - fundingExponentFactor_ASC_NULLS_FIRST = "fundingExponentFactor_ASC_NULLS_FIRST", - fundingExponentFactor_ASC_NULLS_LAST = "fundingExponentFactor_ASC_NULLS_LAST", - fundingExponentFactor_DESC = "fundingExponentFactor_DESC", - fundingExponentFactor_DESC_NULLS_FIRST = "fundingExponentFactor_DESC_NULLS_FIRST", - fundingExponentFactor_DESC_NULLS_LAST = "fundingExponentFactor_DESC_NULLS_LAST", - fundingFactorPerSecond_ASC = "fundingFactorPerSecond_ASC", - fundingFactorPerSecond_ASC_NULLS_FIRST = "fundingFactorPerSecond_ASC_NULLS_FIRST", - fundingFactorPerSecond_ASC_NULLS_LAST = "fundingFactorPerSecond_ASC_NULLS_LAST", - fundingFactorPerSecond_DESC = "fundingFactorPerSecond_DESC", - fundingFactorPerSecond_DESC_NULLS_FIRST = "fundingFactorPerSecond_DESC_NULLS_FIRST", - fundingFactorPerSecond_DESC_NULLS_LAST = "fundingFactorPerSecond_DESC_NULLS_LAST", - fundingFactor_ASC = "fundingFactor_ASC", - fundingFactor_ASC_NULLS_FIRST = "fundingFactor_ASC_NULLS_FIRST", - fundingFactor_ASC_NULLS_LAST = "fundingFactor_ASC_NULLS_LAST", - fundingFactor_DESC = "fundingFactor_DESC", - fundingFactor_DESC_NULLS_FIRST = "fundingFactor_DESC_NULLS_FIRST", - fundingFactor_DESC_NULLS_LAST = "fundingFactor_DESC_NULLS_LAST", - fundingIncreaseFactorPerSecond_ASC = "fundingIncreaseFactorPerSecond_ASC", - fundingIncreaseFactorPerSecond_ASC_NULLS_FIRST = "fundingIncreaseFactorPerSecond_ASC_NULLS_FIRST", - fundingIncreaseFactorPerSecond_ASC_NULLS_LAST = "fundingIncreaseFactorPerSecond_ASC_NULLS_LAST", - fundingIncreaseFactorPerSecond_DESC = "fundingIncreaseFactorPerSecond_DESC", - fundingIncreaseFactorPerSecond_DESC_NULLS_FIRST = "fundingIncreaseFactorPerSecond_DESC_NULLS_FIRST", - fundingIncreaseFactorPerSecond_DESC_NULLS_LAST = "fundingIncreaseFactorPerSecond_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - indexTokenAddress_ASC = "indexTokenAddress_ASC", - indexTokenAddress_ASC_NULLS_FIRST = "indexTokenAddress_ASC_NULLS_FIRST", - indexTokenAddress_ASC_NULLS_LAST = "indexTokenAddress_ASC_NULLS_LAST", - indexTokenAddress_DESC = "indexTokenAddress_DESC", - indexTokenAddress_DESC_NULLS_FIRST = "indexTokenAddress_DESC_NULLS_FIRST", - indexTokenAddress_DESC_NULLS_LAST = "indexTokenAddress_DESC_NULLS_LAST", - isDisabled_ASC = "isDisabled_ASC", - isDisabled_ASC_NULLS_FIRST = "isDisabled_ASC_NULLS_FIRST", - isDisabled_ASC_NULLS_LAST = "isDisabled_ASC_NULLS_LAST", - isDisabled_DESC = "isDisabled_DESC", - isDisabled_DESC_NULLS_FIRST = "isDisabled_DESC_NULLS_FIRST", - isDisabled_DESC_NULLS_LAST = "isDisabled_DESC_NULLS_LAST", - lentPositionImpactPoolAmount_ASC = "lentPositionImpactPoolAmount_ASC", - lentPositionImpactPoolAmount_ASC_NULLS_FIRST = "lentPositionImpactPoolAmount_ASC_NULLS_FIRST", - lentPositionImpactPoolAmount_ASC_NULLS_LAST = "lentPositionImpactPoolAmount_ASC_NULLS_LAST", - lentPositionImpactPoolAmount_DESC = "lentPositionImpactPoolAmount_DESC", - lentPositionImpactPoolAmount_DESC_NULLS_FIRST = "lentPositionImpactPoolAmount_DESC_NULLS_FIRST", - lentPositionImpactPoolAmount_DESC_NULLS_LAST = "lentPositionImpactPoolAmount_DESC_NULLS_LAST", - longOpenInterestInTokensUsingLongToken_ASC = "longOpenInterestInTokensUsingLongToken_ASC", - longOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST = "longOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST", - longOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST = "longOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST", - longOpenInterestInTokensUsingLongToken_DESC = "longOpenInterestInTokensUsingLongToken_DESC", - longOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST = "longOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST", - longOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST = "longOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST", - longOpenInterestInTokensUsingShortToken_ASC = "longOpenInterestInTokensUsingShortToken_ASC", - longOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST = "longOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST", - longOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST = "longOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST", - longOpenInterestInTokensUsingShortToken_DESC = "longOpenInterestInTokensUsingShortToken_DESC", - longOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST = "longOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST", - longOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST = "longOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST", - longOpenInterestInTokens_ASC = "longOpenInterestInTokens_ASC", - longOpenInterestInTokens_ASC_NULLS_FIRST = "longOpenInterestInTokens_ASC_NULLS_FIRST", - longOpenInterestInTokens_ASC_NULLS_LAST = "longOpenInterestInTokens_ASC_NULLS_LAST", - longOpenInterestInTokens_DESC = "longOpenInterestInTokens_DESC", - longOpenInterestInTokens_DESC_NULLS_FIRST = "longOpenInterestInTokens_DESC_NULLS_FIRST", - longOpenInterestInTokens_DESC_NULLS_LAST = "longOpenInterestInTokens_DESC_NULLS_LAST", - longOpenInterestUsd_ASC = "longOpenInterestUsd_ASC", - longOpenInterestUsd_ASC_NULLS_FIRST = "longOpenInterestUsd_ASC_NULLS_FIRST", - longOpenInterestUsd_ASC_NULLS_LAST = "longOpenInterestUsd_ASC_NULLS_LAST", - longOpenInterestUsd_DESC = "longOpenInterestUsd_DESC", - longOpenInterestUsd_DESC_NULLS_FIRST = "longOpenInterestUsd_DESC_NULLS_FIRST", - longOpenInterestUsd_DESC_NULLS_LAST = "longOpenInterestUsd_DESC_NULLS_LAST", - longOpenInterestUsingLongToken_ASC = "longOpenInterestUsingLongToken_ASC", - longOpenInterestUsingLongToken_ASC_NULLS_FIRST = "longOpenInterestUsingLongToken_ASC_NULLS_FIRST", - longOpenInterestUsingLongToken_ASC_NULLS_LAST = "longOpenInterestUsingLongToken_ASC_NULLS_LAST", - longOpenInterestUsingLongToken_DESC = "longOpenInterestUsingLongToken_DESC", - longOpenInterestUsingLongToken_DESC_NULLS_FIRST = "longOpenInterestUsingLongToken_DESC_NULLS_FIRST", - longOpenInterestUsingLongToken_DESC_NULLS_LAST = "longOpenInterestUsingLongToken_DESC_NULLS_LAST", - longOpenInterestUsingShortToken_ASC = "longOpenInterestUsingShortToken_ASC", - longOpenInterestUsingShortToken_ASC_NULLS_FIRST = "longOpenInterestUsingShortToken_ASC_NULLS_FIRST", - longOpenInterestUsingShortToken_ASC_NULLS_LAST = "longOpenInterestUsingShortToken_ASC_NULLS_LAST", - longOpenInterestUsingShortToken_DESC = "longOpenInterestUsingShortToken_DESC", - longOpenInterestUsingShortToken_DESC_NULLS_FIRST = "longOpenInterestUsingShortToken_DESC_NULLS_FIRST", - longOpenInterestUsingShortToken_DESC_NULLS_LAST = "longOpenInterestUsingShortToken_DESC_NULLS_LAST", - longPoolAmountAdjustment_ASC = "longPoolAmountAdjustment_ASC", - longPoolAmountAdjustment_ASC_NULLS_FIRST = "longPoolAmountAdjustment_ASC_NULLS_FIRST", - longPoolAmountAdjustment_ASC_NULLS_LAST = "longPoolAmountAdjustment_ASC_NULLS_LAST", - longPoolAmountAdjustment_DESC = "longPoolAmountAdjustment_DESC", - longPoolAmountAdjustment_DESC_NULLS_FIRST = "longPoolAmountAdjustment_DESC_NULLS_FIRST", - longPoolAmountAdjustment_DESC_NULLS_LAST = "longPoolAmountAdjustment_DESC_NULLS_LAST", - longPoolAmount_ASC = "longPoolAmount_ASC", - longPoolAmount_ASC_NULLS_FIRST = "longPoolAmount_ASC_NULLS_FIRST", - longPoolAmount_ASC_NULLS_LAST = "longPoolAmount_ASC_NULLS_LAST", - longPoolAmount_DESC = "longPoolAmount_DESC", - longPoolAmount_DESC_NULLS_FIRST = "longPoolAmount_DESC_NULLS_FIRST", - longPoolAmount_DESC_NULLS_LAST = "longPoolAmount_DESC_NULLS_LAST", - longTokenAddress_ASC = "longTokenAddress_ASC", - longTokenAddress_ASC_NULLS_FIRST = "longTokenAddress_ASC_NULLS_FIRST", - longTokenAddress_ASC_NULLS_LAST = "longTokenAddress_ASC_NULLS_LAST", - longTokenAddress_DESC = "longTokenAddress_DESC", - longTokenAddress_DESC_NULLS_FIRST = "longTokenAddress_DESC_NULLS_FIRST", - longTokenAddress_DESC_NULLS_LAST = "longTokenAddress_DESC_NULLS_LAST", - longsPayShorts_ASC = "longsPayShorts_ASC", - longsPayShorts_ASC_NULLS_FIRST = "longsPayShorts_ASC_NULLS_FIRST", - longsPayShorts_ASC_NULLS_LAST = "longsPayShorts_ASC_NULLS_LAST", - longsPayShorts_DESC = "longsPayShorts_DESC", - longsPayShorts_DESC_NULLS_FIRST = "longsPayShorts_DESC_NULLS_FIRST", - longsPayShorts_DESC_NULLS_LAST = "longsPayShorts_DESC_NULLS_LAST", - marketTokenAddress_ASC = "marketTokenAddress_ASC", - marketTokenAddress_ASC_NULLS_FIRST = "marketTokenAddress_ASC_NULLS_FIRST", - marketTokenAddress_ASC_NULLS_LAST = "marketTokenAddress_ASC_NULLS_LAST", - marketTokenAddress_DESC = "marketTokenAddress_DESC", - marketTokenAddress_DESC_NULLS_FIRST = "marketTokenAddress_DESC_NULLS_FIRST", - marketTokenAddress_DESC_NULLS_LAST = "marketTokenAddress_DESC_NULLS_LAST", - marketTokenSupply_ASC = "marketTokenSupply_ASC", - marketTokenSupply_ASC_NULLS_FIRST = "marketTokenSupply_ASC_NULLS_FIRST", - marketTokenSupply_ASC_NULLS_LAST = "marketTokenSupply_ASC_NULLS_LAST", - marketTokenSupply_DESC = "marketTokenSupply_DESC", - marketTokenSupply_DESC_NULLS_FIRST = "marketTokenSupply_DESC_NULLS_FIRST", - marketTokenSupply_DESC_NULLS_LAST = "marketTokenSupply_DESC_NULLS_LAST", - maxFundingFactorPerSecond_ASC = "maxFundingFactorPerSecond_ASC", - maxFundingFactorPerSecond_ASC_NULLS_FIRST = "maxFundingFactorPerSecond_ASC_NULLS_FIRST", - maxFundingFactorPerSecond_ASC_NULLS_LAST = "maxFundingFactorPerSecond_ASC_NULLS_LAST", - maxFundingFactorPerSecond_DESC = "maxFundingFactorPerSecond_DESC", - maxFundingFactorPerSecond_DESC_NULLS_FIRST = "maxFundingFactorPerSecond_DESC_NULLS_FIRST", - maxFundingFactorPerSecond_DESC_NULLS_LAST = "maxFundingFactorPerSecond_DESC_NULLS_LAST", - maxLendableImpactFactorForWithdrawals_ASC = "maxLendableImpactFactorForWithdrawals_ASC", - maxLendableImpactFactorForWithdrawals_ASC_NULLS_FIRST = "maxLendableImpactFactorForWithdrawals_ASC_NULLS_FIRST", - maxLendableImpactFactorForWithdrawals_ASC_NULLS_LAST = "maxLendableImpactFactorForWithdrawals_ASC_NULLS_LAST", - maxLendableImpactFactorForWithdrawals_DESC = "maxLendableImpactFactorForWithdrawals_DESC", - maxLendableImpactFactorForWithdrawals_DESC_NULLS_FIRST = "maxLendableImpactFactorForWithdrawals_DESC_NULLS_FIRST", - maxLendableImpactFactorForWithdrawals_DESC_NULLS_LAST = "maxLendableImpactFactorForWithdrawals_DESC_NULLS_LAST", - maxLendableImpactFactor_ASC = "maxLendableImpactFactor_ASC", - maxLendableImpactFactor_ASC_NULLS_FIRST = "maxLendableImpactFactor_ASC_NULLS_FIRST", - maxLendableImpactFactor_ASC_NULLS_LAST = "maxLendableImpactFactor_ASC_NULLS_LAST", - maxLendableImpactFactor_DESC = "maxLendableImpactFactor_DESC", - maxLendableImpactFactor_DESC_NULLS_FIRST = "maxLendableImpactFactor_DESC_NULLS_FIRST", - maxLendableImpactFactor_DESC_NULLS_LAST = "maxLendableImpactFactor_DESC_NULLS_LAST", - maxLendableImpactUsd_ASC = "maxLendableImpactUsd_ASC", - maxLendableImpactUsd_ASC_NULLS_FIRST = "maxLendableImpactUsd_ASC_NULLS_FIRST", - maxLendableImpactUsd_ASC_NULLS_LAST = "maxLendableImpactUsd_ASC_NULLS_LAST", - maxLendableImpactUsd_DESC = "maxLendableImpactUsd_DESC", - maxLendableImpactUsd_DESC_NULLS_FIRST = "maxLendableImpactUsd_DESC_NULLS_FIRST", - maxLendableImpactUsd_DESC_NULLS_LAST = "maxLendableImpactUsd_DESC_NULLS_LAST", - maxLongPoolAmount_ASC = "maxLongPoolAmount_ASC", - maxLongPoolAmount_ASC_NULLS_FIRST = "maxLongPoolAmount_ASC_NULLS_FIRST", - maxLongPoolAmount_ASC_NULLS_LAST = "maxLongPoolAmount_ASC_NULLS_LAST", - maxLongPoolAmount_DESC = "maxLongPoolAmount_DESC", - maxLongPoolAmount_DESC_NULLS_FIRST = "maxLongPoolAmount_DESC_NULLS_FIRST", - maxLongPoolAmount_DESC_NULLS_LAST = "maxLongPoolAmount_DESC_NULLS_LAST", - maxLongPoolUsdForDeposit_ASC = "maxLongPoolUsdForDeposit_ASC", - maxLongPoolUsdForDeposit_ASC_NULLS_FIRST = "maxLongPoolUsdForDeposit_ASC_NULLS_FIRST", - maxLongPoolUsdForDeposit_ASC_NULLS_LAST = "maxLongPoolUsdForDeposit_ASC_NULLS_LAST", - maxLongPoolUsdForDeposit_DESC = "maxLongPoolUsdForDeposit_DESC", - maxLongPoolUsdForDeposit_DESC_NULLS_FIRST = "maxLongPoolUsdForDeposit_DESC_NULLS_FIRST", - maxLongPoolUsdForDeposit_DESC_NULLS_LAST = "maxLongPoolUsdForDeposit_DESC_NULLS_LAST", - maxOpenInterestLong_ASC = "maxOpenInterestLong_ASC", - maxOpenInterestLong_ASC_NULLS_FIRST = "maxOpenInterestLong_ASC_NULLS_FIRST", - maxOpenInterestLong_ASC_NULLS_LAST = "maxOpenInterestLong_ASC_NULLS_LAST", - maxOpenInterestLong_DESC = "maxOpenInterestLong_DESC", - maxOpenInterestLong_DESC_NULLS_FIRST = "maxOpenInterestLong_DESC_NULLS_FIRST", - maxOpenInterestLong_DESC_NULLS_LAST = "maxOpenInterestLong_DESC_NULLS_LAST", - maxOpenInterestShort_ASC = "maxOpenInterestShort_ASC", - maxOpenInterestShort_ASC_NULLS_FIRST = "maxOpenInterestShort_ASC_NULLS_FIRST", - maxOpenInterestShort_ASC_NULLS_LAST = "maxOpenInterestShort_ASC_NULLS_LAST", - maxOpenInterestShort_DESC = "maxOpenInterestShort_DESC", - maxOpenInterestShort_DESC_NULLS_FIRST = "maxOpenInterestShort_DESC_NULLS_FIRST", - maxOpenInterestShort_DESC_NULLS_LAST = "maxOpenInterestShort_DESC_NULLS_LAST", - maxPnlFactorForTradersLong_ASC = "maxPnlFactorForTradersLong_ASC", - maxPnlFactorForTradersLong_ASC_NULLS_FIRST = "maxPnlFactorForTradersLong_ASC_NULLS_FIRST", - maxPnlFactorForTradersLong_ASC_NULLS_LAST = "maxPnlFactorForTradersLong_ASC_NULLS_LAST", - maxPnlFactorForTradersLong_DESC = "maxPnlFactorForTradersLong_DESC", - maxPnlFactorForTradersLong_DESC_NULLS_FIRST = "maxPnlFactorForTradersLong_DESC_NULLS_FIRST", - maxPnlFactorForTradersLong_DESC_NULLS_LAST = "maxPnlFactorForTradersLong_DESC_NULLS_LAST", - maxPnlFactorForTradersShort_ASC = "maxPnlFactorForTradersShort_ASC", - maxPnlFactorForTradersShort_ASC_NULLS_FIRST = "maxPnlFactorForTradersShort_ASC_NULLS_FIRST", - maxPnlFactorForTradersShort_ASC_NULLS_LAST = "maxPnlFactorForTradersShort_ASC_NULLS_LAST", - maxPnlFactorForTradersShort_DESC = "maxPnlFactorForTradersShort_DESC", - maxPnlFactorForTradersShort_DESC_NULLS_FIRST = "maxPnlFactorForTradersShort_DESC_NULLS_FIRST", - maxPnlFactorForTradersShort_DESC_NULLS_LAST = "maxPnlFactorForTradersShort_DESC_NULLS_LAST", - maxPositionImpactFactorForLiquidations_ASC = "maxPositionImpactFactorForLiquidations_ASC", - maxPositionImpactFactorForLiquidations_ASC_NULLS_FIRST = "maxPositionImpactFactorForLiquidations_ASC_NULLS_FIRST", - maxPositionImpactFactorForLiquidations_ASC_NULLS_LAST = "maxPositionImpactFactorForLiquidations_ASC_NULLS_LAST", - maxPositionImpactFactorForLiquidations_DESC = "maxPositionImpactFactorForLiquidations_DESC", - maxPositionImpactFactorForLiquidations_DESC_NULLS_FIRST = "maxPositionImpactFactorForLiquidations_DESC_NULLS_FIRST", - maxPositionImpactFactorForLiquidations_DESC_NULLS_LAST = "maxPositionImpactFactorForLiquidations_DESC_NULLS_LAST", - maxPositionImpactFactorNegative_ASC = "maxPositionImpactFactorNegative_ASC", - maxPositionImpactFactorNegative_ASC_NULLS_FIRST = "maxPositionImpactFactorNegative_ASC_NULLS_FIRST", - maxPositionImpactFactorNegative_ASC_NULLS_LAST = "maxPositionImpactFactorNegative_ASC_NULLS_LAST", - maxPositionImpactFactorNegative_DESC = "maxPositionImpactFactorNegative_DESC", - maxPositionImpactFactorNegative_DESC_NULLS_FIRST = "maxPositionImpactFactorNegative_DESC_NULLS_FIRST", - maxPositionImpactFactorNegative_DESC_NULLS_LAST = "maxPositionImpactFactorNegative_DESC_NULLS_LAST", - maxPositionImpactFactorPositive_ASC = "maxPositionImpactFactorPositive_ASC", - maxPositionImpactFactorPositive_ASC_NULLS_FIRST = "maxPositionImpactFactorPositive_ASC_NULLS_FIRST", - maxPositionImpactFactorPositive_ASC_NULLS_LAST = "maxPositionImpactFactorPositive_ASC_NULLS_LAST", - maxPositionImpactFactorPositive_DESC = "maxPositionImpactFactorPositive_DESC", - maxPositionImpactFactorPositive_DESC_NULLS_FIRST = "maxPositionImpactFactorPositive_DESC_NULLS_FIRST", - maxPositionImpactFactorPositive_DESC_NULLS_LAST = "maxPositionImpactFactorPositive_DESC_NULLS_LAST", - maxShortPoolAmount_ASC = "maxShortPoolAmount_ASC", - maxShortPoolAmount_ASC_NULLS_FIRST = "maxShortPoolAmount_ASC_NULLS_FIRST", - maxShortPoolAmount_ASC_NULLS_LAST = "maxShortPoolAmount_ASC_NULLS_LAST", - maxShortPoolAmount_DESC = "maxShortPoolAmount_DESC", - maxShortPoolAmount_DESC_NULLS_FIRST = "maxShortPoolAmount_DESC_NULLS_FIRST", - maxShortPoolAmount_DESC_NULLS_LAST = "maxShortPoolAmount_DESC_NULLS_LAST", - maxShortPoolUsdForDeposit_ASC = "maxShortPoolUsdForDeposit_ASC", - maxShortPoolUsdForDeposit_ASC_NULLS_FIRST = "maxShortPoolUsdForDeposit_ASC_NULLS_FIRST", - maxShortPoolUsdForDeposit_ASC_NULLS_LAST = "maxShortPoolUsdForDeposit_ASC_NULLS_LAST", - maxShortPoolUsdForDeposit_DESC = "maxShortPoolUsdForDeposit_DESC", - maxShortPoolUsdForDeposit_DESC_NULLS_FIRST = "maxShortPoolUsdForDeposit_DESC_NULLS_FIRST", - maxShortPoolUsdForDeposit_DESC_NULLS_LAST = "maxShortPoolUsdForDeposit_DESC_NULLS_LAST", - minCollateralFactorForOpenInterestLong_ASC = "minCollateralFactorForOpenInterestLong_ASC", - minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST = "minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST", - minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST = "minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST", - minCollateralFactorForOpenInterestLong_DESC = "minCollateralFactorForOpenInterestLong_DESC", - minCollateralFactorForOpenInterestLong_DESC_NULLS_FIRST = "minCollateralFactorForOpenInterestLong_DESC_NULLS_FIRST", - minCollateralFactorForOpenInterestLong_DESC_NULLS_LAST = "minCollateralFactorForOpenInterestLong_DESC_NULLS_LAST", - minCollateralFactorForOpenInterestShort_ASC = "minCollateralFactorForOpenInterestShort_ASC", - minCollateralFactorForOpenInterestShort_ASC_NULLS_FIRST = "minCollateralFactorForOpenInterestShort_ASC_NULLS_FIRST", - minCollateralFactorForOpenInterestShort_ASC_NULLS_LAST = "minCollateralFactorForOpenInterestShort_ASC_NULLS_LAST", - minCollateralFactorForOpenInterestShort_DESC = "minCollateralFactorForOpenInterestShort_DESC", - minCollateralFactorForOpenInterestShort_DESC_NULLS_FIRST = "minCollateralFactorForOpenInterestShort_DESC_NULLS_FIRST", - minCollateralFactorForOpenInterestShort_DESC_NULLS_LAST = "minCollateralFactorForOpenInterestShort_DESC_NULLS_LAST", - minCollateralFactor_ASC = "minCollateralFactor_ASC", - minCollateralFactor_ASC_NULLS_FIRST = "minCollateralFactor_ASC_NULLS_FIRST", - minCollateralFactor_ASC_NULLS_LAST = "minCollateralFactor_ASC_NULLS_LAST", - minCollateralFactor_DESC = "minCollateralFactor_DESC", - minCollateralFactor_DESC_NULLS_FIRST = "minCollateralFactor_DESC_NULLS_FIRST", - minCollateralFactor_DESC_NULLS_LAST = "minCollateralFactor_DESC_NULLS_LAST", - minFundingFactorPerSecond_ASC = "minFundingFactorPerSecond_ASC", - minFundingFactorPerSecond_ASC_NULLS_FIRST = "minFundingFactorPerSecond_ASC_NULLS_FIRST", - minFundingFactorPerSecond_ASC_NULLS_LAST = "minFundingFactorPerSecond_ASC_NULLS_LAST", - minFundingFactorPerSecond_DESC = "minFundingFactorPerSecond_DESC", - minFundingFactorPerSecond_DESC_NULLS_FIRST = "minFundingFactorPerSecond_DESC_NULLS_FIRST", - minFundingFactorPerSecond_DESC_NULLS_LAST = "minFundingFactorPerSecond_DESC_NULLS_LAST", - minPositionImpactPoolAmount_ASC = "minPositionImpactPoolAmount_ASC", - minPositionImpactPoolAmount_ASC_NULLS_FIRST = "minPositionImpactPoolAmount_ASC_NULLS_FIRST", - minPositionImpactPoolAmount_ASC_NULLS_LAST = "minPositionImpactPoolAmount_ASC_NULLS_LAST", - minPositionImpactPoolAmount_DESC = "minPositionImpactPoolAmount_DESC", - minPositionImpactPoolAmount_DESC_NULLS_FIRST = "minPositionImpactPoolAmount_DESC_NULLS_FIRST", - minPositionImpactPoolAmount_DESC_NULLS_LAST = "minPositionImpactPoolAmount_DESC_NULLS_LAST", - openInterestReserveFactorLong_ASC = "openInterestReserveFactorLong_ASC", - openInterestReserveFactorLong_ASC_NULLS_FIRST = "openInterestReserveFactorLong_ASC_NULLS_FIRST", - openInterestReserveFactorLong_ASC_NULLS_LAST = "openInterestReserveFactorLong_ASC_NULLS_LAST", - openInterestReserveFactorLong_DESC = "openInterestReserveFactorLong_DESC", - openInterestReserveFactorLong_DESC_NULLS_FIRST = "openInterestReserveFactorLong_DESC_NULLS_FIRST", - openInterestReserveFactorLong_DESC_NULLS_LAST = "openInterestReserveFactorLong_DESC_NULLS_LAST", - openInterestReserveFactorShort_ASC = "openInterestReserveFactorShort_ASC", - openInterestReserveFactorShort_ASC_NULLS_FIRST = "openInterestReserveFactorShort_ASC_NULLS_FIRST", - openInterestReserveFactorShort_ASC_NULLS_LAST = "openInterestReserveFactorShort_ASC_NULLS_LAST", - openInterestReserveFactorShort_DESC = "openInterestReserveFactorShort_DESC", - openInterestReserveFactorShort_DESC_NULLS_FIRST = "openInterestReserveFactorShort_DESC_NULLS_FIRST", - openInterestReserveFactorShort_DESC_NULLS_LAST = "openInterestReserveFactorShort_DESC_NULLS_LAST", - optimalUsageFactorLong_ASC = "optimalUsageFactorLong_ASC", - optimalUsageFactorLong_ASC_NULLS_FIRST = "optimalUsageFactorLong_ASC_NULLS_FIRST", - optimalUsageFactorLong_ASC_NULLS_LAST = "optimalUsageFactorLong_ASC_NULLS_LAST", - optimalUsageFactorLong_DESC = "optimalUsageFactorLong_DESC", - optimalUsageFactorLong_DESC_NULLS_FIRST = "optimalUsageFactorLong_DESC_NULLS_FIRST", - optimalUsageFactorLong_DESC_NULLS_LAST = "optimalUsageFactorLong_DESC_NULLS_LAST", - optimalUsageFactorShort_ASC = "optimalUsageFactorShort_ASC", - optimalUsageFactorShort_ASC_NULLS_FIRST = "optimalUsageFactorShort_ASC_NULLS_FIRST", - optimalUsageFactorShort_ASC_NULLS_LAST = "optimalUsageFactorShort_ASC_NULLS_LAST", - optimalUsageFactorShort_DESC = "optimalUsageFactorShort_DESC", - optimalUsageFactorShort_DESC_NULLS_FIRST = "optimalUsageFactorShort_DESC_NULLS_FIRST", - optimalUsageFactorShort_DESC_NULLS_LAST = "optimalUsageFactorShort_DESC_NULLS_LAST", - poolValueMax_ASC = "poolValueMax_ASC", - poolValueMax_ASC_NULLS_FIRST = "poolValueMax_ASC_NULLS_FIRST", - poolValueMax_ASC_NULLS_LAST = "poolValueMax_ASC_NULLS_LAST", - poolValueMax_DESC = "poolValueMax_DESC", - poolValueMax_DESC_NULLS_FIRST = "poolValueMax_DESC_NULLS_FIRST", - poolValueMax_DESC_NULLS_LAST = "poolValueMax_DESC_NULLS_LAST", - poolValueMin_ASC = "poolValueMin_ASC", - poolValueMin_ASC_NULLS_FIRST = "poolValueMin_ASC_NULLS_FIRST", - poolValueMin_ASC_NULLS_LAST = "poolValueMin_ASC_NULLS_LAST", - poolValueMin_DESC = "poolValueMin_DESC", - poolValueMin_DESC_NULLS_FIRST = "poolValueMin_DESC_NULLS_FIRST", - poolValueMin_DESC_NULLS_LAST = "poolValueMin_DESC_NULLS_LAST", - poolValue_ASC = "poolValue_ASC", - poolValue_ASC_NULLS_FIRST = "poolValue_ASC_NULLS_FIRST", - poolValue_ASC_NULLS_LAST = "poolValue_ASC_NULLS_LAST", - poolValue_DESC = "poolValue_DESC", - poolValue_DESC_NULLS_FIRST = "poolValue_DESC_NULLS_FIRST", - poolValue_DESC_NULLS_LAST = "poolValue_DESC_NULLS_LAST", - positionFeeFactorForNegativeImpact_ASC = "positionFeeFactorForNegativeImpact_ASC", - positionFeeFactorForNegativeImpact_ASC_NULLS_FIRST = "positionFeeFactorForNegativeImpact_ASC_NULLS_FIRST", - positionFeeFactorForNegativeImpact_ASC_NULLS_LAST = "positionFeeFactorForNegativeImpact_ASC_NULLS_LAST", - positionFeeFactorForNegativeImpact_DESC = "positionFeeFactorForNegativeImpact_DESC", - positionFeeFactorForNegativeImpact_DESC_NULLS_FIRST = "positionFeeFactorForNegativeImpact_DESC_NULLS_FIRST", - positionFeeFactorForNegativeImpact_DESC_NULLS_LAST = "positionFeeFactorForNegativeImpact_DESC_NULLS_LAST", - positionFeeFactorForPositiveImpact_ASC = "positionFeeFactorForPositiveImpact_ASC", - positionFeeFactorForPositiveImpact_ASC_NULLS_FIRST = "positionFeeFactorForPositiveImpact_ASC_NULLS_FIRST", - positionFeeFactorForPositiveImpact_ASC_NULLS_LAST = "positionFeeFactorForPositiveImpact_ASC_NULLS_LAST", - positionFeeFactorForPositiveImpact_DESC = "positionFeeFactorForPositiveImpact_DESC", - positionFeeFactorForPositiveImpact_DESC_NULLS_FIRST = "positionFeeFactorForPositiveImpact_DESC_NULLS_FIRST", - positionFeeFactorForPositiveImpact_DESC_NULLS_LAST = "positionFeeFactorForPositiveImpact_DESC_NULLS_LAST", - positionImpactExponentFactor_ASC = "positionImpactExponentFactor_ASC", - positionImpactExponentFactor_ASC_NULLS_FIRST = "positionImpactExponentFactor_ASC_NULLS_FIRST", - positionImpactExponentFactor_ASC_NULLS_LAST = "positionImpactExponentFactor_ASC_NULLS_LAST", - positionImpactExponentFactor_DESC = "positionImpactExponentFactor_DESC", - positionImpactExponentFactor_DESC_NULLS_FIRST = "positionImpactExponentFactor_DESC_NULLS_FIRST", - positionImpactExponentFactor_DESC_NULLS_LAST = "positionImpactExponentFactor_DESC_NULLS_LAST", - positionImpactFactorNegative_ASC = "positionImpactFactorNegative_ASC", - positionImpactFactorNegative_ASC_NULLS_FIRST = "positionImpactFactorNegative_ASC_NULLS_FIRST", - positionImpactFactorNegative_ASC_NULLS_LAST = "positionImpactFactorNegative_ASC_NULLS_LAST", - positionImpactFactorNegative_DESC = "positionImpactFactorNegative_DESC", - positionImpactFactorNegative_DESC_NULLS_FIRST = "positionImpactFactorNegative_DESC_NULLS_FIRST", - positionImpactFactorNegative_DESC_NULLS_LAST = "positionImpactFactorNegative_DESC_NULLS_LAST", - positionImpactFactorPositive_ASC = "positionImpactFactorPositive_ASC", - positionImpactFactorPositive_ASC_NULLS_FIRST = "positionImpactFactorPositive_ASC_NULLS_FIRST", - positionImpactFactorPositive_ASC_NULLS_LAST = "positionImpactFactorPositive_ASC_NULLS_LAST", - positionImpactFactorPositive_DESC = "positionImpactFactorPositive_DESC", - positionImpactFactorPositive_DESC_NULLS_FIRST = "positionImpactFactorPositive_DESC_NULLS_FIRST", - positionImpactFactorPositive_DESC_NULLS_LAST = "positionImpactFactorPositive_DESC_NULLS_LAST", - positionImpactPoolAmount_ASC = "positionImpactPoolAmount_ASC", - positionImpactPoolAmount_ASC_NULLS_FIRST = "positionImpactPoolAmount_ASC_NULLS_FIRST", - positionImpactPoolAmount_ASC_NULLS_LAST = "positionImpactPoolAmount_ASC_NULLS_LAST", - positionImpactPoolAmount_DESC = "positionImpactPoolAmount_DESC", - positionImpactPoolAmount_DESC_NULLS_FIRST = "positionImpactPoolAmount_DESC_NULLS_FIRST", - positionImpactPoolAmount_DESC_NULLS_LAST = "positionImpactPoolAmount_DESC_NULLS_LAST", - positionImpactPoolDistributionRate_ASC = "positionImpactPoolDistributionRate_ASC", - positionImpactPoolDistributionRate_ASC_NULLS_FIRST = "positionImpactPoolDistributionRate_ASC_NULLS_FIRST", - positionImpactPoolDistributionRate_ASC_NULLS_LAST = "positionImpactPoolDistributionRate_ASC_NULLS_LAST", - positionImpactPoolDistributionRate_DESC = "positionImpactPoolDistributionRate_DESC", - positionImpactPoolDistributionRate_DESC_NULLS_FIRST = "positionImpactPoolDistributionRate_DESC_NULLS_FIRST", - positionImpactPoolDistributionRate_DESC_NULLS_LAST = "positionImpactPoolDistributionRate_DESC_NULLS_LAST", - reserveFactorLong_ASC = "reserveFactorLong_ASC", - reserveFactorLong_ASC_NULLS_FIRST = "reserveFactorLong_ASC_NULLS_FIRST", - reserveFactorLong_ASC_NULLS_LAST = "reserveFactorLong_ASC_NULLS_LAST", - reserveFactorLong_DESC = "reserveFactorLong_DESC", - reserveFactorLong_DESC_NULLS_FIRST = "reserveFactorLong_DESC_NULLS_FIRST", - reserveFactorLong_DESC_NULLS_LAST = "reserveFactorLong_DESC_NULLS_LAST", - reserveFactorShort_ASC = "reserveFactorShort_ASC", - reserveFactorShort_ASC_NULLS_FIRST = "reserveFactorShort_ASC_NULLS_FIRST", - reserveFactorShort_ASC_NULLS_LAST = "reserveFactorShort_ASC_NULLS_LAST", - reserveFactorShort_DESC = "reserveFactorShort_DESC", - reserveFactorShort_DESC_NULLS_FIRST = "reserveFactorShort_DESC_NULLS_FIRST", - reserveFactorShort_DESC_NULLS_LAST = "reserveFactorShort_DESC_NULLS_LAST", - shortOpenInterestInTokensUsingLongToken_ASC = "shortOpenInterestInTokensUsingLongToken_ASC", - shortOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST = "shortOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST", - shortOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST = "shortOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST", - shortOpenInterestInTokensUsingLongToken_DESC = "shortOpenInterestInTokensUsingLongToken_DESC", - shortOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST = "shortOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST", - shortOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST = "shortOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST", - shortOpenInterestInTokensUsingShortToken_ASC = "shortOpenInterestInTokensUsingShortToken_ASC", - shortOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST = "shortOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST", - shortOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST = "shortOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST", - shortOpenInterestInTokensUsingShortToken_DESC = "shortOpenInterestInTokensUsingShortToken_DESC", - shortOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST = "shortOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST", - shortOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST = "shortOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST", - shortOpenInterestInTokens_ASC = "shortOpenInterestInTokens_ASC", - shortOpenInterestInTokens_ASC_NULLS_FIRST = "shortOpenInterestInTokens_ASC_NULLS_FIRST", - shortOpenInterestInTokens_ASC_NULLS_LAST = "shortOpenInterestInTokens_ASC_NULLS_LAST", - shortOpenInterestInTokens_DESC = "shortOpenInterestInTokens_DESC", - shortOpenInterestInTokens_DESC_NULLS_FIRST = "shortOpenInterestInTokens_DESC_NULLS_FIRST", - shortOpenInterestInTokens_DESC_NULLS_LAST = "shortOpenInterestInTokens_DESC_NULLS_LAST", - shortOpenInterestUsd_ASC = "shortOpenInterestUsd_ASC", - shortOpenInterestUsd_ASC_NULLS_FIRST = "shortOpenInterestUsd_ASC_NULLS_FIRST", - shortOpenInterestUsd_ASC_NULLS_LAST = "shortOpenInterestUsd_ASC_NULLS_LAST", - shortOpenInterestUsd_DESC = "shortOpenInterestUsd_DESC", - shortOpenInterestUsd_DESC_NULLS_FIRST = "shortOpenInterestUsd_DESC_NULLS_FIRST", - shortOpenInterestUsd_DESC_NULLS_LAST = "shortOpenInterestUsd_DESC_NULLS_LAST", - shortOpenInterestUsingLongToken_ASC = "shortOpenInterestUsingLongToken_ASC", - shortOpenInterestUsingLongToken_ASC_NULLS_FIRST = "shortOpenInterestUsingLongToken_ASC_NULLS_FIRST", - shortOpenInterestUsingLongToken_ASC_NULLS_LAST = "shortOpenInterestUsingLongToken_ASC_NULLS_LAST", - shortOpenInterestUsingLongToken_DESC = "shortOpenInterestUsingLongToken_DESC", - shortOpenInterestUsingLongToken_DESC_NULLS_FIRST = "shortOpenInterestUsingLongToken_DESC_NULLS_FIRST", - shortOpenInterestUsingLongToken_DESC_NULLS_LAST = "shortOpenInterestUsingLongToken_DESC_NULLS_LAST", - shortOpenInterestUsingShortToken_ASC = "shortOpenInterestUsingShortToken_ASC", - shortOpenInterestUsingShortToken_ASC_NULLS_FIRST = "shortOpenInterestUsingShortToken_ASC_NULLS_FIRST", - shortOpenInterestUsingShortToken_ASC_NULLS_LAST = "shortOpenInterestUsingShortToken_ASC_NULLS_LAST", - shortOpenInterestUsingShortToken_DESC = "shortOpenInterestUsingShortToken_DESC", - shortOpenInterestUsingShortToken_DESC_NULLS_FIRST = "shortOpenInterestUsingShortToken_DESC_NULLS_FIRST", - shortOpenInterestUsingShortToken_DESC_NULLS_LAST = "shortOpenInterestUsingShortToken_DESC_NULLS_LAST", - shortPoolAmountAdjustment_ASC = "shortPoolAmountAdjustment_ASC", - shortPoolAmountAdjustment_ASC_NULLS_FIRST = "shortPoolAmountAdjustment_ASC_NULLS_FIRST", - shortPoolAmountAdjustment_ASC_NULLS_LAST = "shortPoolAmountAdjustment_ASC_NULLS_LAST", - shortPoolAmountAdjustment_DESC = "shortPoolAmountAdjustment_DESC", - shortPoolAmountAdjustment_DESC_NULLS_FIRST = "shortPoolAmountAdjustment_DESC_NULLS_FIRST", - shortPoolAmountAdjustment_DESC_NULLS_LAST = "shortPoolAmountAdjustment_DESC_NULLS_LAST", - shortPoolAmount_ASC = "shortPoolAmount_ASC", - shortPoolAmount_ASC_NULLS_FIRST = "shortPoolAmount_ASC_NULLS_FIRST", - shortPoolAmount_ASC_NULLS_LAST = "shortPoolAmount_ASC_NULLS_LAST", - shortPoolAmount_DESC = "shortPoolAmount_DESC", - shortPoolAmount_DESC_NULLS_FIRST = "shortPoolAmount_DESC_NULLS_FIRST", - shortPoolAmount_DESC_NULLS_LAST = "shortPoolAmount_DESC_NULLS_LAST", - shortTokenAddress_ASC = "shortTokenAddress_ASC", - shortTokenAddress_ASC_NULLS_FIRST = "shortTokenAddress_ASC_NULLS_FIRST", - shortTokenAddress_ASC_NULLS_LAST = "shortTokenAddress_ASC_NULLS_LAST", - shortTokenAddress_DESC = "shortTokenAddress_DESC", - shortTokenAddress_DESC_NULLS_FIRST = "shortTokenAddress_DESC_NULLS_FIRST", - shortTokenAddress_DESC_NULLS_LAST = "shortTokenAddress_DESC_NULLS_LAST", - swapFeeFactorForNegativeImpact_ASC = "swapFeeFactorForNegativeImpact_ASC", - swapFeeFactorForNegativeImpact_ASC_NULLS_FIRST = "swapFeeFactorForNegativeImpact_ASC_NULLS_FIRST", - swapFeeFactorForNegativeImpact_ASC_NULLS_LAST = "swapFeeFactorForNegativeImpact_ASC_NULLS_LAST", - swapFeeFactorForNegativeImpact_DESC = "swapFeeFactorForNegativeImpact_DESC", - swapFeeFactorForNegativeImpact_DESC_NULLS_FIRST = "swapFeeFactorForNegativeImpact_DESC_NULLS_FIRST", - swapFeeFactorForNegativeImpact_DESC_NULLS_LAST = "swapFeeFactorForNegativeImpact_DESC_NULLS_LAST", - swapFeeFactorForPositiveImpact_ASC = "swapFeeFactorForPositiveImpact_ASC", - swapFeeFactorForPositiveImpact_ASC_NULLS_FIRST = "swapFeeFactorForPositiveImpact_ASC_NULLS_FIRST", - swapFeeFactorForPositiveImpact_ASC_NULLS_LAST = "swapFeeFactorForPositiveImpact_ASC_NULLS_LAST", - swapFeeFactorForPositiveImpact_DESC = "swapFeeFactorForPositiveImpact_DESC", - swapFeeFactorForPositiveImpact_DESC_NULLS_FIRST = "swapFeeFactorForPositiveImpact_DESC_NULLS_FIRST", - swapFeeFactorForPositiveImpact_DESC_NULLS_LAST = "swapFeeFactorForPositiveImpact_DESC_NULLS_LAST", - swapImpactExponentFactor_ASC = "swapImpactExponentFactor_ASC", - swapImpactExponentFactor_ASC_NULLS_FIRST = "swapImpactExponentFactor_ASC_NULLS_FIRST", - swapImpactExponentFactor_ASC_NULLS_LAST = "swapImpactExponentFactor_ASC_NULLS_LAST", - swapImpactExponentFactor_DESC = "swapImpactExponentFactor_DESC", - swapImpactExponentFactor_DESC_NULLS_FIRST = "swapImpactExponentFactor_DESC_NULLS_FIRST", - swapImpactExponentFactor_DESC_NULLS_LAST = "swapImpactExponentFactor_DESC_NULLS_LAST", - swapImpactFactorNegative_ASC = "swapImpactFactorNegative_ASC", - swapImpactFactorNegative_ASC_NULLS_FIRST = "swapImpactFactorNegative_ASC_NULLS_FIRST", - swapImpactFactorNegative_ASC_NULLS_LAST = "swapImpactFactorNegative_ASC_NULLS_LAST", - swapImpactFactorNegative_DESC = "swapImpactFactorNegative_DESC", - swapImpactFactorNegative_DESC_NULLS_FIRST = "swapImpactFactorNegative_DESC_NULLS_FIRST", - swapImpactFactorNegative_DESC_NULLS_LAST = "swapImpactFactorNegative_DESC_NULLS_LAST", - swapImpactFactorPositive_ASC = "swapImpactFactorPositive_ASC", - swapImpactFactorPositive_ASC_NULLS_FIRST = "swapImpactFactorPositive_ASC_NULLS_FIRST", - swapImpactFactorPositive_ASC_NULLS_LAST = "swapImpactFactorPositive_ASC_NULLS_LAST", - swapImpactFactorPositive_DESC = "swapImpactFactorPositive_DESC", - swapImpactFactorPositive_DESC_NULLS_FIRST = "swapImpactFactorPositive_DESC_NULLS_FIRST", - swapImpactFactorPositive_DESC_NULLS_LAST = "swapImpactFactorPositive_DESC_NULLS_LAST", - swapImpactPoolAmountLong_ASC = "swapImpactPoolAmountLong_ASC", - swapImpactPoolAmountLong_ASC_NULLS_FIRST = "swapImpactPoolAmountLong_ASC_NULLS_FIRST", - swapImpactPoolAmountLong_ASC_NULLS_LAST = "swapImpactPoolAmountLong_ASC_NULLS_LAST", - swapImpactPoolAmountLong_DESC = "swapImpactPoolAmountLong_DESC", - swapImpactPoolAmountLong_DESC_NULLS_FIRST = "swapImpactPoolAmountLong_DESC_NULLS_FIRST", - swapImpactPoolAmountLong_DESC_NULLS_LAST = "swapImpactPoolAmountLong_DESC_NULLS_LAST", - swapImpactPoolAmountShort_ASC = "swapImpactPoolAmountShort_ASC", - swapImpactPoolAmountShort_ASC_NULLS_FIRST = "swapImpactPoolAmountShort_ASC_NULLS_FIRST", - swapImpactPoolAmountShort_ASC_NULLS_LAST = "swapImpactPoolAmountShort_ASC_NULLS_LAST", - swapImpactPoolAmountShort_DESC = "swapImpactPoolAmountShort_DESC", - swapImpactPoolAmountShort_DESC_NULLS_FIRST = "swapImpactPoolAmountShort_DESC_NULLS_FIRST", - swapImpactPoolAmountShort_DESC_NULLS_LAST = "swapImpactPoolAmountShort_DESC_NULLS_LAST", - thresholdForDecreaseFunding_ASC = "thresholdForDecreaseFunding_ASC", - thresholdForDecreaseFunding_ASC_NULLS_FIRST = "thresholdForDecreaseFunding_ASC_NULLS_FIRST", - thresholdForDecreaseFunding_ASC_NULLS_LAST = "thresholdForDecreaseFunding_ASC_NULLS_LAST", - thresholdForDecreaseFunding_DESC = "thresholdForDecreaseFunding_DESC", - thresholdForDecreaseFunding_DESC_NULLS_FIRST = "thresholdForDecreaseFunding_DESC_NULLS_FIRST", - thresholdForDecreaseFunding_DESC_NULLS_LAST = "thresholdForDecreaseFunding_DESC_NULLS_LAST", - thresholdForStableFunding_ASC = "thresholdForStableFunding_ASC", - thresholdForStableFunding_ASC_NULLS_FIRST = "thresholdForStableFunding_ASC_NULLS_FIRST", - thresholdForStableFunding_ASC_NULLS_LAST = "thresholdForStableFunding_ASC_NULLS_LAST", - thresholdForStableFunding_DESC = "thresholdForStableFunding_DESC", - thresholdForStableFunding_DESC_NULLS_FIRST = "thresholdForStableFunding_DESC_NULLS_FIRST", - thresholdForStableFunding_DESC_NULLS_LAST = "thresholdForStableFunding_DESC_NULLS_LAST", - totalBorrowingFees_ASC = "totalBorrowingFees_ASC", - totalBorrowingFees_ASC_NULLS_FIRST = "totalBorrowingFees_ASC_NULLS_FIRST", - totalBorrowingFees_ASC_NULLS_LAST = "totalBorrowingFees_ASC_NULLS_LAST", - totalBorrowingFees_DESC = "totalBorrowingFees_DESC", - totalBorrowingFees_DESC_NULLS_FIRST = "totalBorrowingFees_DESC_NULLS_FIRST", - totalBorrowingFees_DESC_NULLS_LAST = "totalBorrowingFees_DESC_NULLS_LAST", - virtualIndexTokenId_ASC = "virtualIndexTokenId_ASC", - virtualIndexTokenId_ASC_NULLS_FIRST = "virtualIndexTokenId_ASC_NULLS_FIRST", - virtualIndexTokenId_ASC_NULLS_LAST = "virtualIndexTokenId_ASC_NULLS_LAST", - virtualIndexTokenId_DESC = "virtualIndexTokenId_DESC", - virtualIndexTokenId_DESC_NULLS_FIRST = "virtualIndexTokenId_DESC_NULLS_FIRST", - virtualIndexTokenId_DESC_NULLS_LAST = "virtualIndexTokenId_DESC_NULLS_LAST", - virtualInventoryForPositions_ASC = "virtualInventoryForPositions_ASC", - virtualInventoryForPositions_ASC_NULLS_FIRST = "virtualInventoryForPositions_ASC_NULLS_FIRST", - virtualInventoryForPositions_ASC_NULLS_LAST = "virtualInventoryForPositions_ASC_NULLS_LAST", - virtualInventoryForPositions_DESC = "virtualInventoryForPositions_DESC", - virtualInventoryForPositions_DESC_NULLS_FIRST = "virtualInventoryForPositions_DESC_NULLS_FIRST", - virtualInventoryForPositions_DESC_NULLS_LAST = "virtualInventoryForPositions_DESC_NULLS_LAST", - virtualLongTokenId_ASC = "virtualLongTokenId_ASC", - virtualLongTokenId_ASC_NULLS_FIRST = "virtualLongTokenId_ASC_NULLS_FIRST", - virtualLongTokenId_ASC_NULLS_LAST = "virtualLongTokenId_ASC_NULLS_LAST", - virtualLongTokenId_DESC = "virtualLongTokenId_DESC", - virtualLongTokenId_DESC_NULLS_FIRST = "virtualLongTokenId_DESC_NULLS_FIRST", - virtualLongTokenId_DESC_NULLS_LAST = "virtualLongTokenId_DESC_NULLS_LAST", - virtualMarketId_ASC = "virtualMarketId_ASC", - virtualMarketId_ASC_NULLS_FIRST = "virtualMarketId_ASC_NULLS_FIRST", - virtualMarketId_ASC_NULLS_LAST = "virtualMarketId_ASC_NULLS_LAST", - virtualMarketId_DESC = "virtualMarketId_DESC", - virtualMarketId_DESC_NULLS_FIRST = "virtualMarketId_DESC_NULLS_FIRST", - virtualMarketId_DESC_NULLS_LAST = "virtualMarketId_DESC_NULLS_LAST", - virtualPoolAmountForLongToken_ASC = "virtualPoolAmountForLongToken_ASC", - virtualPoolAmountForLongToken_ASC_NULLS_FIRST = "virtualPoolAmountForLongToken_ASC_NULLS_FIRST", - virtualPoolAmountForLongToken_ASC_NULLS_LAST = "virtualPoolAmountForLongToken_ASC_NULLS_LAST", - virtualPoolAmountForLongToken_DESC = "virtualPoolAmountForLongToken_DESC", - virtualPoolAmountForLongToken_DESC_NULLS_FIRST = "virtualPoolAmountForLongToken_DESC_NULLS_FIRST", - virtualPoolAmountForLongToken_DESC_NULLS_LAST = "virtualPoolAmountForLongToken_DESC_NULLS_LAST", - virtualPoolAmountForShortToken_ASC = "virtualPoolAmountForShortToken_ASC", - virtualPoolAmountForShortToken_ASC_NULLS_FIRST = "virtualPoolAmountForShortToken_ASC_NULLS_FIRST", - virtualPoolAmountForShortToken_ASC_NULLS_LAST = "virtualPoolAmountForShortToken_ASC_NULLS_LAST", - virtualPoolAmountForShortToken_DESC = "virtualPoolAmountForShortToken_DESC", - virtualPoolAmountForShortToken_DESC_NULLS_FIRST = "virtualPoolAmountForShortToken_DESC_NULLS_FIRST", - virtualPoolAmountForShortToken_DESC_NULLS_LAST = "virtualPoolAmountForShortToken_DESC_NULLS_LAST", - virtualShortTokenId_ASC = "virtualShortTokenId_ASC", - virtualShortTokenId_ASC_NULLS_FIRST = "virtualShortTokenId_ASC_NULLS_FIRST", - virtualShortTokenId_ASC_NULLS_LAST = "virtualShortTokenId_ASC_NULLS_LAST", - virtualShortTokenId_DESC = "virtualShortTokenId_DESC", - virtualShortTokenId_DESC_NULLS_FIRST = "virtualShortTokenId_DESC_NULLS_FIRST", - virtualShortTokenId_DESC_NULLS_LAST = "virtualShortTokenId_DESC_NULLS_LAST", + aboveOptimalUsageBorrowingFactorLong_ASC = 'aboveOptimalUsageBorrowingFactorLong_ASC', + aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_FIRST = 'aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_FIRST', + aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_LAST = 'aboveOptimalUsageBorrowingFactorLong_ASC_NULLS_LAST', + aboveOptimalUsageBorrowingFactorLong_DESC = 'aboveOptimalUsageBorrowingFactorLong_DESC', + aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_FIRST = 'aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_FIRST', + aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_LAST = 'aboveOptimalUsageBorrowingFactorLong_DESC_NULLS_LAST', + aboveOptimalUsageBorrowingFactorShort_ASC = 'aboveOptimalUsageBorrowingFactorShort_ASC', + aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_FIRST = 'aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_FIRST', + aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_LAST = 'aboveOptimalUsageBorrowingFactorShort_ASC_NULLS_LAST', + aboveOptimalUsageBorrowingFactorShort_DESC = 'aboveOptimalUsageBorrowingFactorShort_DESC', + aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_FIRST = 'aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_FIRST', + aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_LAST = 'aboveOptimalUsageBorrowingFactorShort_DESC_NULLS_LAST', + atomicSwapFeeFactor_ASC = 'atomicSwapFeeFactor_ASC', + atomicSwapFeeFactor_ASC_NULLS_FIRST = 'atomicSwapFeeFactor_ASC_NULLS_FIRST', + atomicSwapFeeFactor_ASC_NULLS_LAST = 'atomicSwapFeeFactor_ASC_NULLS_LAST', + atomicSwapFeeFactor_DESC = 'atomicSwapFeeFactor_DESC', + atomicSwapFeeFactor_DESC_NULLS_FIRST = 'atomicSwapFeeFactor_DESC_NULLS_FIRST', + atomicSwapFeeFactor_DESC_NULLS_LAST = 'atomicSwapFeeFactor_DESC_NULLS_LAST', + baseBorrowingFactorLong_ASC = 'baseBorrowingFactorLong_ASC', + baseBorrowingFactorLong_ASC_NULLS_FIRST = 'baseBorrowingFactorLong_ASC_NULLS_FIRST', + baseBorrowingFactorLong_ASC_NULLS_LAST = 'baseBorrowingFactorLong_ASC_NULLS_LAST', + baseBorrowingFactorLong_DESC = 'baseBorrowingFactorLong_DESC', + baseBorrowingFactorLong_DESC_NULLS_FIRST = 'baseBorrowingFactorLong_DESC_NULLS_FIRST', + baseBorrowingFactorLong_DESC_NULLS_LAST = 'baseBorrowingFactorLong_DESC_NULLS_LAST', + baseBorrowingFactorShort_ASC = 'baseBorrowingFactorShort_ASC', + baseBorrowingFactorShort_ASC_NULLS_FIRST = 'baseBorrowingFactorShort_ASC_NULLS_FIRST', + baseBorrowingFactorShort_ASC_NULLS_LAST = 'baseBorrowingFactorShort_ASC_NULLS_LAST', + baseBorrowingFactorShort_DESC = 'baseBorrowingFactorShort_DESC', + baseBorrowingFactorShort_DESC_NULLS_FIRST = 'baseBorrowingFactorShort_DESC_NULLS_FIRST', + baseBorrowingFactorShort_DESC_NULLS_LAST = 'baseBorrowingFactorShort_DESC_NULLS_LAST', + borrowingExponentFactorLong_ASC = 'borrowingExponentFactorLong_ASC', + borrowingExponentFactorLong_ASC_NULLS_FIRST = 'borrowingExponentFactorLong_ASC_NULLS_FIRST', + borrowingExponentFactorLong_ASC_NULLS_LAST = 'borrowingExponentFactorLong_ASC_NULLS_LAST', + borrowingExponentFactorLong_DESC = 'borrowingExponentFactorLong_DESC', + borrowingExponentFactorLong_DESC_NULLS_FIRST = 'borrowingExponentFactorLong_DESC_NULLS_FIRST', + borrowingExponentFactorLong_DESC_NULLS_LAST = 'borrowingExponentFactorLong_DESC_NULLS_LAST', + borrowingExponentFactorShort_ASC = 'borrowingExponentFactorShort_ASC', + borrowingExponentFactorShort_ASC_NULLS_FIRST = 'borrowingExponentFactorShort_ASC_NULLS_FIRST', + borrowingExponentFactorShort_ASC_NULLS_LAST = 'borrowingExponentFactorShort_ASC_NULLS_LAST', + borrowingExponentFactorShort_DESC = 'borrowingExponentFactorShort_DESC', + borrowingExponentFactorShort_DESC_NULLS_FIRST = 'borrowingExponentFactorShort_DESC_NULLS_FIRST', + borrowingExponentFactorShort_DESC_NULLS_LAST = 'borrowingExponentFactorShort_DESC_NULLS_LAST', + borrowingFactorLong_ASC = 'borrowingFactorLong_ASC', + borrowingFactorLong_ASC_NULLS_FIRST = 'borrowingFactorLong_ASC_NULLS_FIRST', + borrowingFactorLong_ASC_NULLS_LAST = 'borrowingFactorLong_ASC_NULLS_LAST', + borrowingFactorLong_DESC = 'borrowingFactorLong_DESC', + borrowingFactorLong_DESC_NULLS_FIRST = 'borrowingFactorLong_DESC_NULLS_FIRST', + borrowingFactorLong_DESC_NULLS_LAST = 'borrowingFactorLong_DESC_NULLS_LAST', + borrowingFactorPerSecondForLongs_ASC = 'borrowingFactorPerSecondForLongs_ASC', + borrowingFactorPerSecondForLongs_ASC_NULLS_FIRST = 'borrowingFactorPerSecondForLongs_ASC_NULLS_FIRST', + borrowingFactorPerSecondForLongs_ASC_NULLS_LAST = 'borrowingFactorPerSecondForLongs_ASC_NULLS_LAST', + borrowingFactorPerSecondForLongs_DESC = 'borrowingFactorPerSecondForLongs_DESC', + borrowingFactorPerSecondForLongs_DESC_NULLS_FIRST = 'borrowingFactorPerSecondForLongs_DESC_NULLS_FIRST', + borrowingFactorPerSecondForLongs_DESC_NULLS_LAST = 'borrowingFactorPerSecondForLongs_DESC_NULLS_LAST', + borrowingFactorPerSecondForShorts_ASC = 'borrowingFactorPerSecondForShorts_ASC', + borrowingFactorPerSecondForShorts_ASC_NULLS_FIRST = 'borrowingFactorPerSecondForShorts_ASC_NULLS_FIRST', + borrowingFactorPerSecondForShorts_ASC_NULLS_LAST = 'borrowingFactorPerSecondForShorts_ASC_NULLS_LAST', + borrowingFactorPerSecondForShorts_DESC = 'borrowingFactorPerSecondForShorts_DESC', + borrowingFactorPerSecondForShorts_DESC_NULLS_FIRST = 'borrowingFactorPerSecondForShorts_DESC_NULLS_FIRST', + borrowingFactorPerSecondForShorts_DESC_NULLS_LAST = 'borrowingFactorPerSecondForShorts_DESC_NULLS_LAST', + borrowingFactorShort_ASC = 'borrowingFactorShort_ASC', + borrowingFactorShort_ASC_NULLS_FIRST = 'borrowingFactorShort_ASC_NULLS_FIRST', + borrowingFactorShort_ASC_NULLS_LAST = 'borrowingFactorShort_ASC_NULLS_LAST', + borrowingFactorShort_DESC = 'borrowingFactorShort_DESC', + borrowingFactorShort_DESC_NULLS_FIRST = 'borrowingFactorShort_DESC_NULLS_FIRST', + borrowingFactorShort_DESC_NULLS_LAST = 'borrowingFactorShort_DESC_NULLS_LAST', + fundingDecreaseFactorPerSecond_ASC = 'fundingDecreaseFactorPerSecond_ASC', + fundingDecreaseFactorPerSecond_ASC_NULLS_FIRST = 'fundingDecreaseFactorPerSecond_ASC_NULLS_FIRST', + fundingDecreaseFactorPerSecond_ASC_NULLS_LAST = 'fundingDecreaseFactorPerSecond_ASC_NULLS_LAST', + fundingDecreaseFactorPerSecond_DESC = 'fundingDecreaseFactorPerSecond_DESC', + fundingDecreaseFactorPerSecond_DESC_NULLS_FIRST = 'fundingDecreaseFactorPerSecond_DESC_NULLS_FIRST', + fundingDecreaseFactorPerSecond_DESC_NULLS_LAST = 'fundingDecreaseFactorPerSecond_DESC_NULLS_LAST', + fundingExponentFactor_ASC = 'fundingExponentFactor_ASC', + fundingExponentFactor_ASC_NULLS_FIRST = 'fundingExponentFactor_ASC_NULLS_FIRST', + fundingExponentFactor_ASC_NULLS_LAST = 'fundingExponentFactor_ASC_NULLS_LAST', + fundingExponentFactor_DESC = 'fundingExponentFactor_DESC', + fundingExponentFactor_DESC_NULLS_FIRST = 'fundingExponentFactor_DESC_NULLS_FIRST', + fundingExponentFactor_DESC_NULLS_LAST = 'fundingExponentFactor_DESC_NULLS_LAST', + fundingFactorPerSecond_ASC = 'fundingFactorPerSecond_ASC', + fundingFactorPerSecond_ASC_NULLS_FIRST = 'fundingFactorPerSecond_ASC_NULLS_FIRST', + fundingFactorPerSecond_ASC_NULLS_LAST = 'fundingFactorPerSecond_ASC_NULLS_LAST', + fundingFactorPerSecond_DESC = 'fundingFactorPerSecond_DESC', + fundingFactorPerSecond_DESC_NULLS_FIRST = 'fundingFactorPerSecond_DESC_NULLS_FIRST', + fundingFactorPerSecond_DESC_NULLS_LAST = 'fundingFactorPerSecond_DESC_NULLS_LAST', + fundingFactor_ASC = 'fundingFactor_ASC', + fundingFactor_ASC_NULLS_FIRST = 'fundingFactor_ASC_NULLS_FIRST', + fundingFactor_ASC_NULLS_LAST = 'fundingFactor_ASC_NULLS_LAST', + fundingFactor_DESC = 'fundingFactor_DESC', + fundingFactor_DESC_NULLS_FIRST = 'fundingFactor_DESC_NULLS_FIRST', + fundingFactor_DESC_NULLS_LAST = 'fundingFactor_DESC_NULLS_LAST', + fundingIncreaseFactorPerSecond_ASC = 'fundingIncreaseFactorPerSecond_ASC', + fundingIncreaseFactorPerSecond_ASC_NULLS_FIRST = 'fundingIncreaseFactorPerSecond_ASC_NULLS_FIRST', + fundingIncreaseFactorPerSecond_ASC_NULLS_LAST = 'fundingIncreaseFactorPerSecond_ASC_NULLS_LAST', + fundingIncreaseFactorPerSecond_DESC = 'fundingIncreaseFactorPerSecond_DESC', + fundingIncreaseFactorPerSecond_DESC_NULLS_FIRST = 'fundingIncreaseFactorPerSecond_DESC_NULLS_FIRST', + fundingIncreaseFactorPerSecond_DESC_NULLS_LAST = 'fundingIncreaseFactorPerSecond_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + indexTokenAddress_ASC = 'indexTokenAddress_ASC', + indexTokenAddress_ASC_NULLS_FIRST = 'indexTokenAddress_ASC_NULLS_FIRST', + indexTokenAddress_ASC_NULLS_LAST = 'indexTokenAddress_ASC_NULLS_LAST', + indexTokenAddress_DESC = 'indexTokenAddress_DESC', + indexTokenAddress_DESC_NULLS_FIRST = 'indexTokenAddress_DESC_NULLS_FIRST', + indexTokenAddress_DESC_NULLS_LAST = 'indexTokenAddress_DESC_NULLS_LAST', + isDisabled_ASC = 'isDisabled_ASC', + isDisabled_ASC_NULLS_FIRST = 'isDisabled_ASC_NULLS_FIRST', + isDisabled_ASC_NULLS_LAST = 'isDisabled_ASC_NULLS_LAST', + isDisabled_DESC = 'isDisabled_DESC', + isDisabled_DESC_NULLS_FIRST = 'isDisabled_DESC_NULLS_FIRST', + isDisabled_DESC_NULLS_LAST = 'isDisabled_DESC_NULLS_LAST', + lentPositionImpactPoolAmount_ASC = 'lentPositionImpactPoolAmount_ASC', + lentPositionImpactPoolAmount_ASC_NULLS_FIRST = 'lentPositionImpactPoolAmount_ASC_NULLS_FIRST', + lentPositionImpactPoolAmount_ASC_NULLS_LAST = 'lentPositionImpactPoolAmount_ASC_NULLS_LAST', + lentPositionImpactPoolAmount_DESC = 'lentPositionImpactPoolAmount_DESC', + lentPositionImpactPoolAmount_DESC_NULLS_FIRST = 'lentPositionImpactPoolAmount_DESC_NULLS_FIRST', + lentPositionImpactPoolAmount_DESC_NULLS_LAST = 'lentPositionImpactPoolAmount_DESC_NULLS_LAST', + longOpenInterestInTokensUsingLongToken_ASC = 'longOpenInterestInTokensUsingLongToken_ASC', + longOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST = 'longOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST', + longOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST = 'longOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST', + longOpenInterestInTokensUsingLongToken_DESC = 'longOpenInterestInTokensUsingLongToken_DESC', + longOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST = 'longOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST', + longOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST = 'longOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST', + longOpenInterestInTokensUsingShortToken_ASC = 'longOpenInterestInTokensUsingShortToken_ASC', + longOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST = 'longOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST', + longOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST = 'longOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST', + longOpenInterestInTokensUsingShortToken_DESC = 'longOpenInterestInTokensUsingShortToken_DESC', + longOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST = 'longOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST', + longOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST = 'longOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST', + longOpenInterestInTokens_ASC = 'longOpenInterestInTokens_ASC', + longOpenInterestInTokens_ASC_NULLS_FIRST = 'longOpenInterestInTokens_ASC_NULLS_FIRST', + longOpenInterestInTokens_ASC_NULLS_LAST = 'longOpenInterestInTokens_ASC_NULLS_LAST', + longOpenInterestInTokens_DESC = 'longOpenInterestInTokens_DESC', + longOpenInterestInTokens_DESC_NULLS_FIRST = 'longOpenInterestInTokens_DESC_NULLS_FIRST', + longOpenInterestInTokens_DESC_NULLS_LAST = 'longOpenInterestInTokens_DESC_NULLS_LAST', + longOpenInterestUsd_ASC = 'longOpenInterestUsd_ASC', + longOpenInterestUsd_ASC_NULLS_FIRST = 'longOpenInterestUsd_ASC_NULLS_FIRST', + longOpenInterestUsd_ASC_NULLS_LAST = 'longOpenInterestUsd_ASC_NULLS_LAST', + longOpenInterestUsd_DESC = 'longOpenInterestUsd_DESC', + longOpenInterestUsd_DESC_NULLS_FIRST = 'longOpenInterestUsd_DESC_NULLS_FIRST', + longOpenInterestUsd_DESC_NULLS_LAST = 'longOpenInterestUsd_DESC_NULLS_LAST', + longOpenInterestUsingLongToken_ASC = 'longOpenInterestUsingLongToken_ASC', + longOpenInterestUsingLongToken_ASC_NULLS_FIRST = 'longOpenInterestUsingLongToken_ASC_NULLS_FIRST', + longOpenInterestUsingLongToken_ASC_NULLS_LAST = 'longOpenInterestUsingLongToken_ASC_NULLS_LAST', + longOpenInterestUsingLongToken_DESC = 'longOpenInterestUsingLongToken_DESC', + longOpenInterestUsingLongToken_DESC_NULLS_FIRST = 'longOpenInterestUsingLongToken_DESC_NULLS_FIRST', + longOpenInterestUsingLongToken_DESC_NULLS_LAST = 'longOpenInterestUsingLongToken_DESC_NULLS_LAST', + longOpenInterestUsingShortToken_ASC = 'longOpenInterestUsingShortToken_ASC', + longOpenInterestUsingShortToken_ASC_NULLS_FIRST = 'longOpenInterestUsingShortToken_ASC_NULLS_FIRST', + longOpenInterestUsingShortToken_ASC_NULLS_LAST = 'longOpenInterestUsingShortToken_ASC_NULLS_LAST', + longOpenInterestUsingShortToken_DESC = 'longOpenInterestUsingShortToken_DESC', + longOpenInterestUsingShortToken_DESC_NULLS_FIRST = 'longOpenInterestUsingShortToken_DESC_NULLS_FIRST', + longOpenInterestUsingShortToken_DESC_NULLS_LAST = 'longOpenInterestUsingShortToken_DESC_NULLS_LAST', + longPoolAmount_ASC = 'longPoolAmount_ASC', + longPoolAmount_ASC_NULLS_FIRST = 'longPoolAmount_ASC_NULLS_FIRST', + longPoolAmount_ASC_NULLS_LAST = 'longPoolAmount_ASC_NULLS_LAST', + longPoolAmount_DESC = 'longPoolAmount_DESC', + longPoolAmount_DESC_NULLS_FIRST = 'longPoolAmount_DESC_NULLS_FIRST', + longPoolAmount_DESC_NULLS_LAST = 'longPoolAmount_DESC_NULLS_LAST', + longTokenAddress_ASC = 'longTokenAddress_ASC', + longTokenAddress_ASC_NULLS_FIRST = 'longTokenAddress_ASC_NULLS_FIRST', + longTokenAddress_ASC_NULLS_LAST = 'longTokenAddress_ASC_NULLS_LAST', + longTokenAddress_DESC = 'longTokenAddress_DESC', + longTokenAddress_DESC_NULLS_FIRST = 'longTokenAddress_DESC_NULLS_FIRST', + longTokenAddress_DESC_NULLS_LAST = 'longTokenAddress_DESC_NULLS_LAST', + longsPayShorts_ASC = 'longsPayShorts_ASC', + longsPayShorts_ASC_NULLS_FIRST = 'longsPayShorts_ASC_NULLS_FIRST', + longsPayShorts_ASC_NULLS_LAST = 'longsPayShorts_ASC_NULLS_LAST', + longsPayShorts_DESC = 'longsPayShorts_DESC', + longsPayShorts_DESC_NULLS_FIRST = 'longsPayShorts_DESC_NULLS_FIRST', + longsPayShorts_DESC_NULLS_LAST = 'longsPayShorts_DESC_NULLS_LAST', + marketTokenAddress_ASC = 'marketTokenAddress_ASC', + marketTokenAddress_ASC_NULLS_FIRST = 'marketTokenAddress_ASC_NULLS_FIRST', + marketTokenAddress_ASC_NULLS_LAST = 'marketTokenAddress_ASC_NULLS_LAST', + marketTokenAddress_DESC = 'marketTokenAddress_DESC', + marketTokenAddress_DESC_NULLS_FIRST = 'marketTokenAddress_DESC_NULLS_FIRST', + marketTokenAddress_DESC_NULLS_LAST = 'marketTokenAddress_DESC_NULLS_LAST', + marketTokenSupply_ASC = 'marketTokenSupply_ASC', + marketTokenSupply_ASC_NULLS_FIRST = 'marketTokenSupply_ASC_NULLS_FIRST', + marketTokenSupply_ASC_NULLS_LAST = 'marketTokenSupply_ASC_NULLS_LAST', + marketTokenSupply_DESC = 'marketTokenSupply_DESC', + marketTokenSupply_DESC_NULLS_FIRST = 'marketTokenSupply_DESC_NULLS_FIRST', + marketTokenSupply_DESC_NULLS_LAST = 'marketTokenSupply_DESC_NULLS_LAST', + maxFundingFactorPerSecond_ASC = 'maxFundingFactorPerSecond_ASC', + maxFundingFactorPerSecond_ASC_NULLS_FIRST = 'maxFundingFactorPerSecond_ASC_NULLS_FIRST', + maxFundingFactorPerSecond_ASC_NULLS_LAST = 'maxFundingFactorPerSecond_ASC_NULLS_LAST', + maxFundingFactorPerSecond_DESC = 'maxFundingFactorPerSecond_DESC', + maxFundingFactorPerSecond_DESC_NULLS_FIRST = 'maxFundingFactorPerSecond_DESC_NULLS_FIRST', + maxFundingFactorPerSecond_DESC_NULLS_LAST = 'maxFundingFactorPerSecond_DESC_NULLS_LAST', + maxLendableImpactFactorForWithdrawals_ASC = 'maxLendableImpactFactorForWithdrawals_ASC', + maxLendableImpactFactorForWithdrawals_ASC_NULLS_FIRST = 'maxLendableImpactFactorForWithdrawals_ASC_NULLS_FIRST', + maxLendableImpactFactorForWithdrawals_ASC_NULLS_LAST = 'maxLendableImpactFactorForWithdrawals_ASC_NULLS_LAST', + maxLendableImpactFactorForWithdrawals_DESC = 'maxLendableImpactFactorForWithdrawals_DESC', + maxLendableImpactFactorForWithdrawals_DESC_NULLS_FIRST = 'maxLendableImpactFactorForWithdrawals_DESC_NULLS_FIRST', + maxLendableImpactFactorForWithdrawals_DESC_NULLS_LAST = 'maxLendableImpactFactorForWithdrawals_DESC_NULLS_LAST', + maxLendableImpactFactor_ASC = 'maxLendableImpactFactor_ASC', + maxLendableImpactFactor_ASC_NULLS_FIRST = 'maxLendableImpactFactor_ASC_NULLS_FIRST', + maxLendableImpactFactor_ASC_NULLS_LAST = 'maxLendableImpactFactor_ASC_NULLS_LAST', + maxLendableImpactFactor_DESC = 'maxLendableImpactFactor_DESC', + maxLendableImpactFactor_DESC_NULLS_FIRST = 'maxLendableImpactFactor_DESC_NULLS_FIRST', + maxLendableImpactFactor_DESC_NULLS_LAST = 'maxLendableImpactFactor_DESC_NULLS_LAST', + maxLendableImpactUsd_ASC = 'maxLendableImpactUsd_ASC', + maxLendableImpactUsd_ASC_NULLS_FIRST = 'maxLendableImpactUsd_ASC_NULLS_FIRST', + maxLendableImpactUsd_ASC_NULLS_LAST = 'maxLendableImpactUsd_ASC_NULLS_LAST', + maxLendableImpactUsd_DESC = 'maxLendableImpactUsd_DESC', + maxLendableImpactUsd_DESC_NULLS_FIRST = 'maxLendableImpactUsd_DESC_NULLS_FIRST', + maxLendableImpactUsd_DESC_NULLS_LAST = 'maxLendableImpactUsd_DESC_NULLS_LAST', + maxLongPoolAmount_ASC = 'maxLongPoolAmount_ASC', + maxLongPoolAmount_ASC_NULLS_FIRST = 'maxLongPoolAmount_ASC_NULLS_FIRST', + maxLongPoolAmount_ASC_NULLS_LAST = 'maxLongPoolAmount_ASC_NULLS_LAST', + maxLongPoolAmount_DESC = 'maxLongPoolAmount_DESC', + maxLongPoolAmount_DESC_NULLS_FIRST = 'maxLongPoolAmount_DESC_NULLS_FIRST', + maxLongPoolAmount_DESC_NULLS_LAST = 'maxLongPoolAmount_DESC_NULLS_LAST', + maxLongPoolUsdForDeposit_ASC = 'maxLongPoolUsdForDeposit_ASC', + maxLongPoolUsdForDeposit_ASC_NULLS_FIRST = 'maxLongPoolUsdForDeposit_ASC_NULLS_FIRST', + maxLongPoolUsdForDeposit_ASC_NULLS_LAST = 'maxLongPoolUsdForDeposit_ASC_NULLS_LAST', + maxLongPoolUsdForDeposit_DESC = 'maxLongPoolUsdForDeposit_DESC', + maxLongPoolUsdForDeposit_DESC_NULLS_FIRST = 'maxLongPoolUsdForDeposit_DESC_NULLS_FIRST', + maxLongPoolUsdForDeposit_DESC_NULLS_LAST = 'maxLongPoolUsdForDeposit_DESC_NULLS_LAST', + maxOpenInterestLong_ASC = 'maxOpenInterestLong_ASC', + maxOpenInterestLong_ASC_NULLS_FIRST = 'maxOpenInterestLong_ASC_NULLS_FIRST', + maxOpenInterestLong_ASC_NULLS_LAST = 'maxOpenInterestLong_ASC_NULLS_LAST', + maxOpenInterestLong_DESC = 'maxOpenInterestLong_DESC', + maxOpenInterestLong_DESC_NULLS_FIRST = 'maxOpenInterestLong_DESC_NULLS_FIRST', + maxOpenInterestLong_DESC_NULLS_LAST = 'maxOpenInterestLong_DESC_NULLS_LAST', + maxOpenInterestShort_ASC = 'maxOpenInterestShort_ASC', + maxOpenInterestShort_ASC_NULLS_FIRST = 'maxOpenInterestShort_ASC_NULLS_FIRST', + maxOpenInterestShort_ASC_NULLS_LAST = 'maxOpenInterestShort_ASC_NULLS_LAST', + maxOpenInterestShort_DESC = 'maxOpenInterestShort_DESC', + maxOpenInterestShort_DESC_NULLS_FIRST = 'maxOpenInterestShort_DESC_NULLS_FIRST', + maxOpenInterestShort_DESC_NULLS_LAST = 'maxOpenInterestShort_DESC_NULLS_LAST', + maxPnlFactorForTradersLong_ASC = 'maxPnlFactorForTradersLong_ASC', + maxPnlFactorForTradersLong_ASC_NULLS_FIRST = 'maxPnlFactorForTradersLong_ASC_NULLS_FIRST', + maxPnlFactorForTradersLong_ASC_NULLS_LAST = 'maxPnlFactorForTradersLong_ASC_NULLS_LAST', + maxPnlFactorForTradersLong_DESC = 'maxPnlFactorForTradersLong_DESC', + maxPnlFactorForTradersLong_DESC_NULLS_FIRST = 'maxPnlFactorForTradersLong_DESC_NULLS_FIRST', + maxPnlFactorForTradersLong_DESC_NULLS_LAST = 'maxPnlFactorForTradersLong_DESC_NULLS_LAST', + maxPnlFactorForTradersShort_ASC = 'maxPnlFactorForTradersShort_ASC', + maxPnlFactorForTradersShort_ASC_NULLS_FIRST = 'maxPnlFactorForTradersShort_ASC_NULLS_FIRST', + maxPnlFactorForTradersShort_ASC_NULLS_LAST = 'maxPnlFactorForTradersShort_ASC_NULLS_LAST', + maxPnlFactorForTradersShort_DESC = 'maxPnlFactorForTradersShort_DESC', + maxPnlFactorForTradersShort_DESC_NULLS_FIRST = 'maxPnlFactorForTradersShort_DESC_NULLS_FIRST', + maxPnlFactorForTradersShort_DESC_NULLS_LAST = 'maxPnlFactorForTradersShort_DESC_NULLS_LAST', + maxPositionImpactFactorForLiquidations_ASC = 'maxPositionImpactFactorForLiquidations_ASC', + maxPositionImpactFactorForLiquidations_ASC_NULLS_FIRST = 'maxPositionImpactFactorForLiquidations_ASC_NULLS_FIRST', + maxPositionImpactFactorForLiquidations_ASC_NULLS_LAST = 'maxPositionImpactFactorForLiquidations_ASC_NULLS_LAST', + maxPositionImpactFactorForLiquidations_DESC = 'maxPositionImpactFactorForLiquidations_DESC', + maxPositionImpactFactorForLiquidations_DESC_NULLS_FIRST = 'maxPositionImpactFactorForLiquidations_DESC_NULLS_FIRST', + maxPositionImpactFactorForLiquidations_DESC_NULLS_LAST = 'maxPositionImpactFactorForLiquidations_DESC_NULLS_LAST', + maxPositionImpactFactorNegative_ASC = 'maxPositionImpactFactorNegative_ASC', + maxPositionImpactFactorNegative_ASC_NULLS_FIRST = 'maxPositionImpactFactorNegative_ASC_NULLS_FIRST', + maxPositionImpactFactorNegative_ASC_NULLS_LAST = 'maxPositionImpactFactorNegative_ASC_NULLS_LAST', + maxPositionImpactFactorNegative_DESC = 'maxPositionImpactFactorNegative_DESC', + maxPositionImpactFactorNegative_DESC_NULLS_FIRST = 'maxPositionImpactFactorNegative_DESC_NULLS_FIRST', + maxPositionImpactFactorNegative_DESC_NULLS_LAST = 'maxPositionImpactFactorNegative_DESC_NULLS_LAST', + maxPositionImpactFactorPositive_ASC = 'maxPositionImpactFactorPositive_ASC', + maxPositionImpactFactorPositive_ASC_NULLS_FIRST = 'maxPositionImpactFactorPositive_ASC_NULLS_FIRST', + maxPositionImpactFactorPositive_ASC_NULLS_LAST = 'maxPositionImpactFactorPositive_ASC_NULLS_LAST', + maxPositionImpactFactorPositive_DESC = 'maxPositionImpactFactorPositive_DESC', + maxPositionImpactFactorPositive_DESC_NULLS_FIRST = 'maxPositionImpactFactorPositive_DESC_NULLS_FIRST', + maxPositionImpactFactorPositive_DESC_NULLS_LAST = 'maxPositionImpactFactorPositive_DESC_NULLS_LAST', + maxShortPoolAmount_ASC = 'maxShortPoolAmount_ASC', + maxShortPoolAmount_ASC_NULLS_FIRST = 'maxShortPoolAmount_ASC_NULLS_FIRST', + maxShortPoolAmount_ASC_NULLS_LAST = 'maxShortPoolAmount_ASC_NULLS_LAST', + maxShortPoolAmount_DESC = 'maxShortPoolAmount_DESC', + maxShortPoolAmount_DESC_NULLS_FIRST = 'maxShortPoolAmount_DESC_NULLS_FIRST', + maxShortPoolAmount_DESC_NULLS_LAST = 'maxShortPoolAmount_DESC_NULLS_LAST', + maxShortPoolUsdForDeposit_ASC = 'maxShortPoolUsdForDeposit_ASC', + maxShortPoolUsdForDeposit_ASC_NULLS_FIRST = 'maxShortPoolUsdForDeposit_ASC_NULLS_FIRST', + maxShortPoolUsdForDeposit_ASC_NULLS_LAST = 'maxShortPoolUsdForDeposit_ASC_NULLS_LAST', + maxShortPoolUsdForDeposit_DESC = 'maxShortPoolUsdForDeposit_DESC', + maxShortPoolUsdForDeposit_DESC_NULLS_FIRST = 'maxShortPoolUsdForDeposit_DESC_NULLS_FIRST', + maxShortPoolUsdForDeposit_DESC_NULLS_LAST = 'maxShortPoolUsdForDeposit_DESC_NULLS_LAST', + minCollateralFactorForOpenInterestLong_ASC = 'minCollateralFactorForOpenInterestLong_ASC', + minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST = 'minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST', + minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST = 'minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST', + minCollateralFactorForOpenInterestLong_DESC = 'minCollateralFactorForOpenInterestLong_DESC', + minCollateralFactorForOpenInterestLong_DESC_NULLS_FIRST = 'minCollateralFactorForOpenInterestLong_DESC_NULLS_FIRST', + minCollateralFactorForOpenInterestLong_DESC_NULLS_LAST = 'minCollateralFactorForOpenInterestLong_DESC_NULLS_LAST', + minCollateralFactorForOpenInterestShort_ASC = 'minCollateralFactorForOpenInterestShort_ASC', + minCollateralFactorForOpenInterestShort_ASC_NULLS_FIRST = 'minCollateralFactorForOpenInterestShort_ASC_NULLS_FIRST', + minCollateralFactorForOpenInterestShort_ASC_NULLS_LAST = 'minCollateralFactorForOpenInterestShort_ASC_NULLS_LAST', + minCollateralFactorForOpenInterestShort_DESC = 'minCollateralFactorForOpenInterestShort_DESC', + minCollateralFactorForOpenInterestShort_DESC_NULLS_FIRST = 'minCollateralFactorForOpenInterestShort_DESC_NULLS_FIRST', + minCollateralFactorForOpenInterestShort_DESC_NULLS_LAST = 'minCollateralFactorForOpenInterestShort_DESC_NULLS_LAST', + minCollateralFactor_ASC = 'minCollateralFactor_ASC', + minCollateralFactor_ASC_NULLS_FIRST = 'minCollateralFactor_ASC_NULLS_FIRST', + minCollateralFactor_ASC_NULLS_LAST = 'minCollateralFactor_ASC_NULLS_LAST', + minCollateralFactor_DESC = 'minCollateralFactor_DESC', + minCollateralFactor_DESC_NULLS_FIRST = 'minCollateralFactor_DESC_NULLS_FIRST', + minCollateralFactor_DESC_NULLS_LAST = 'minCollateralFactor_DESC_NULLS_LAST', + minFundingFactorPerSecond_ASC = 'minFundingFactorPerSecond_ASC', + minFundingFactorPerSecond_ASC_NULLS_FIRST = 'minFundingFactorPerSecond_ASC_NULLS_FIRST', + minFundingFactorPerSecond_ASC_NULLS_LAST = 'minFundingFactorPerSecond_ASC_NULLS_LAST', + minFundingFactorPerSecond_DESC = 'minFundingFactorPerSecond_DESC', + minFundingFactorPerSecond_DESC_NULLS_FIRST = 'minFundingFactorPerSecond_DESC_NULLS_FIRST', + minFundingFactorPerSecond_DESC_NULLS_LAST = 'minFundingFactorPerSecond_DESC_NULLS_LAST', + minPositionImpactPoolAmount_ASC = 'minPositionImpactPoolAmount_ASC', + minPositionImpactPoolAmount_ASC_NULLS_FIRST = 'minPositionImpactPoolAmount_ASC_NULLS_FIRST', + minPositionImpactPoolAmount_ASC_NULLS_LAST = 'minPositionImpactPoolAmount_ASC_NULLS_LAST', + minPositionImpactPoolAmount_DESC = 'minPositionImpactPoolAmount_DESC', + minPositionImpactPoolAmount_DESC_NULLS_FIRST = 'minPositionImpactPoolAmount_DESC_NULLS_FIRST', + minPositionImpactPoolAmount_DESC_NULLS_LAST = 'minPositionImpactPoolAmount_DESC_NULLS_LAST', + openInterestReserveFactorLong_ASC = 'openInterestReserveFactorLong_ASC', + openInterestReserveFactorLong_ASC_NULLS_FIRST = 'openInterestReserveFactorLong_ASC_NULLS_FIRST', + openInterestReserveFactorLong_ASC_NULLS_LAST = 'openInterestReserveFactorLong_ASC_NULLS_LAST', + openInterestReserveFactorLong_DESC = 'openInterestReserveFactorLong_DESC', + openInterestReserveFactorLong_DESC_NULLS_FIRST = 'openInterestReserveFactorLong_DESC_NULLS_FIRST', + openInterestReserveFactorLong_DESC_NULLS_LAST = 'openInterestReserveFactorLong_DESC_NULLS_LAST', + openInterestReserveFactorShort_ASC = 'openInterestReserveFactorShort_ASC', + openInterestReserveFactorShort_ASC_NULLS_FIRST = 'openInterestReserveFactorShort_ASC_NULLS_FIRST', + openInterestReserveFactorShort_ASC_NULLS_LAST = 'openInterestReserveFactorShort_ASC_NULLS_LAST', + openInterestReserveFactorShort_DESC = 'openInterestReserveFactorShort_DESC', + openInterestReserveFactorShort_DESC_NULLS_FIRST = 'openInterestReserveFactorShort_DESC_NULLS_FIRST', + openInterestReserveFactorShort_DESC_NULLS_LAST = 'openInterestReserveFactorShort_DESC_NULLS_LAST', + optimalUsageFactorLong_ASC = 'optimalUsageFactorLong_ASC', + optimalUsageFactorLong_ASC_NULLS_FIRST = 'optimalUsageFactorLong_ASC_NULLS_FIRST', + optimalUsageFactorLong_ASC_NULLS_LAST = 'optimalUsageFactorLong_ASC_NULLS_LAST', + optimalUsageFactorLong_DESC = 'optimalUsageFactorLong_DESC', + optimalUsageFactorLong_DESC_NULLS_FIRST = 'optimalUsageFactorLong_DESC_NULLS_FIRST', + optimalUsageFactorLong_DESC_NULLS_LAST = 'optimalUsageFactorLong_DESC_NULLS_LAST', + optimalUsageFactorShort_ASC = 'optimalUsageFactorShort_ASC', + optimalUsageFactorShort_ASC_NULLS_FIRST = 'optimalUsageFactorShort_ASC_NULLS_FIRST', + optimalUsageFactorShort_ASC_NULLS_LAST = 'optimalUsageFactorShort_ASC_NULLS_LAST', + optimalUsageFactorShort_DESC = 'optimalUsageFactorShort_DESC', + optimalUsageFactorShort_DESC_NULLS_FIRST = 'optimalUsageFactorShort_DESC_NULLS_FIRST', + optimalUsageFactorShort_DESC_NULLS_LAST = 'optimalUsageFactorShort_DESC_NULLS_LAST', + poolValueMax_ASC = 'poolValueMax_ASC', + poolValueMax_ASC_NULLS_FIRST = 'poolValueMax_ASC_NULLS_FIRST', + poolValueMax_ASC_NULLS_LAST = 'poolValueMax_ASC_NULLS_LAST', + poolValueMax_DESC = 'poolValueMax_DESC', + poolValueMax_DESC_NULLS_FIRST = 'poolValueMax_DESC_NULLS_FIRST', + poolValueMax_DESC_NULLS_LAST = 'poolValueMax_DESC_NULLS_LAST', + poolValueMin_ASC = 'poolValueMin_ASC', + poolValueMin_ASC_NULLS_FIRST = 'poolValueMin_ASC_NULLS_FIRST', + poolValueMin_ASC_NULLS_LAST = 'poolValueMin_ASC_NULLS_LAST', + poolValueMin_DESC = 'poolValueMin_DESC', + poolValueMin_DESC_NULLS_FIRST = 'poolValueMin_DESC_NULLS_FIRST', + poolValueMin_DESC_NULLS_LAST = 'poolValueMin_DESC_NULLS_LAST', + poolValue_ASC = 'poolValue_ASC', + poolValue_ASC_NULLS_FIRST = 'poolValue_ASC_NULLS_FIRST', + poolValue_ASC_NULLS_LAST = 'poolValue_ASC_NULLS_LAST', + poolValue_DESC = 'poolValue_DESC', + poolValue_DESC_NULLS_FIRST = 'poolValue_DESC_NULLS_FIRST', + poolValue_DESC_NULLS_LAST = 'poolValue_DESC_NULLS_LAST', + positionFeeFactorForNegativeImpact_ASC = 'positionFeeFactorForNegativeImpact_ASC', + positionFeeFactorForNegativeImpact_ASC_NULLS_FIRST = 'positionFeeFactorForNegativeImpact_ASC_NULLS_FIRST', + positionFeeFactorForNegativeImpact_ASC_NULLS_LAST = 'positionFeeFactorForNegativeImpact_ASC_NULLS_LAST', + positionFeeFactorForNegativeImpact_DESC = 'positionFeeFactorForNegativeImpact_DESC', + positionFeeFactorForNegativeImpact_DESC_NULLS_FIRST = 'positionFeeFactorForNegativeImpact_DESC_NULLS_FIRST', + positionFeeFactorForNegativeImpact_DESC_NULLS_LAST = 'positionFeeFactorForNegativeImpact_DESC_NULLS_LAST', + positionFeeFactorForPositiveImpact_ASC = 'positionFeeFactorForPositiveImpact_ASC', + positionFeeFactorForPositiveImpact_ASC_NULLS_FIRST = 'positionFeeFactorForPositiveImpact_ASC_NULLS_FIRST', + positionFeeFactorForPositiveImpact_ASC_NULLS_LAST = 'positionFeeFactorForPositiveImpact_ASC_NULLS_LAST', + positionFeeFactorForPositiveImpact_DESC = 'positionFeeFactorForPositiveImpact_DESC', + positionFeeFactorForPositiveImpact_DESC_NULLS_FIRST = 'positionFeeFactorForPositiveImpact_DESC_NULLS_FIRST', + positionFeeFactorForPositiveImpact_DESC_NULLS_LAST = 'positionFeeFactorForPositiveImpact_DESC_NULLS_LAST', + positionImpactExponentFactor_ASC = 'positionImpactExponentFactor_ASC', + positionImpactExponentFactor_ASC_NULLS_FIRST = 'positionImpactExponentFactor_ASC_NULLS_FIRST', + positionImpactExponentFactor_ASC_NULLS_LAST = 'positionImpactExponentFactor_ASC_NULLS_LAST', + positionImpactExponentFactor_DESC = 'positionImpactExponentFactor_DESC', + positionImpactExponentFactor_DESC_NULLS_FIRST = 'positionImpactExponentFactor_DESC_NULLS_FIRST', + positionImpactExponentFactor_DESC_NULLS_LAST = 'positionImpactExponentFactor_DESC_NULLS_LAST', + positionImpactFactorNegative_ASC = 'positionImpactFactorNegative_ASC', + positionImpactFactorNegative_ASC_NULLS_FIRST = 'positionImpactFactorNegative_ASC_NULLS_FIRST', + positionImpactFactorNegative_ASC_NULLS_LAST = 'positionImpactFactorNegative_ASC_NULLS_LAST', + positionImpactFactorNegative_DESC = 'positionImpactFactorNegative_DESC', + positionImpactFactorNegative_DESC_NULLS_FIRST = 'positionImpactFactorNegative_DESC_NULLS_FIRST', + positionImpactFactorNegative_DESC_NULLS_LAST = 'positionImpactFactorNegative_DESC_NULLS_LAST', + positionImpactFactorPositive_ASC = 'positionImpactFactorPositive_ASC', + positionImpactFactorPositive_ASC_NULLS_FIRST = 'positionImpactFactorPositive_ASC_NULLS_FIRST', + positionImpactFactorPositive_ASC_NULLS_LAST = 'positionImpactFactorPositive_ASC_NULLS_LAST', + positionImpactFactorPositive_DESC = 'positionImpactFactorPositive_DESC', + positionImpactFactorPositive_DESC_NULLS_FIRST = 'positionImpactFactorPositive_DESC_NULLS_FIRST', + positionImpactFactorPositive_DESC_NULLS_LAST = 'positionImpactFactorPositive_DESC_NULLS_LAST', + positionImpactPoolAmount_ASC = 'positionImpactPoolAmount_ASC', + positionImpactPoolAmount_ASC_NULLS_FIRST = 'positionImpactPoolAmount_ASC_NULLS_FIRST', + positionImpactPoolAmount_ASC_NULLS_LAST = 'positionImpactPoolAmount_ASC_NULLS_LAST', + positionImpactPoolAmount_DESC = 'positionImpactPoolAmount_DESC', + positionImpactPoolAmount_DESC_NULLS_FIRST = 'positionImpactPoolAmount_DESC_NULLS_FIRST', + positionImpactPoolAmount_DESC_NULLS_LAST = 'positionImpactPoolAmount_DESC_NULLS_LAST', + positionImpactPoolDistributionRate_ASC = 'positionImpactPoolDistributionRate_ASC', + positionImpactPoolDistributionRate_ASC_NULLS_FIRST = 'positionImpactPoolDistributionRate_ASC_NULLS_FIRST', + positionImpactPoolDistributionRate_ASC_NULLS_LAST = 'positionImpactPoolDistributionRate_ASC_NULLS_LAST', + positionImpactPoolDistributionRate_DESC = 'positionImpactPoolDistributionRate_DESC', + positionImpactPoolDistributionRate_DESC_NULLS_FIRST = 'positionImpactPoolDistributionRate_DESC_NULLS_FIRST', + positionImpactPoolDistributionRate_DESC_NULLS_LAST = 'positionImpactPoolDistributionRate_DESC_NULLS_LAST', + reserveFactorLong_ASC = 'reserveFactorLong_ASC', + reserveFactorLong_ASC_NULLS_FIRST = 'reserveFactorLong_ASC_NULLS_FIRST', + reserveFactorLong_ASC_NULLS_LAST = 'reserveFactorLong_ASC_NULLS_LAST', + reserveFactorLong_DESC = 'reserveFactorLong_DESC', + reserveFactorLong_DESC_NULLS_FIRST = 'reserveFactorLong_DESC_NULLS_FIRST', + reserveFactorLong_DESC_NULLS_LAST = 'reserveFactorLong_DESC_NULLS_LAST', + reserveFactorShort_ASC = 'reserveFactorShort_ASC', + reserveFactorShort_ASC_NULLS_FIRST = 'reserveFactorShort_ASC_NULLS_FIRST', + reserveFactorShort_ASC_NULLS_LAST = 'reserveFactorShort_ASC_NULLS_LAST', + reserveFactorShort_DESC = 'reserveFactorShort_DESC', + reserveFactorShort_DESC_NULLS_FIRST = 'reserveFactorShort_DESC_NULLS_FIRST', + reserveFactorShort_DESC_NULLS_LAST = 'reserveFactorShort_DESC_NULLS_LAST', + shortOpenInterestInTokensUsingLongToken_ASC = 'shortOpenInterestInTokensUsingLongToken_ASC', + shortOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST = 'shortOpenInterestInTokensUsingLongToken_ASC_NULLS_FIRST', + shortOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST = 'shortOpenInterestInTokensUsingLongToken_ASC_NULLS_LAST', + shortOpenInterestInTokensUsingLongToken_DESC = 'shortOpenInterestInTokensUsingLongToken_DESC', + shortOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST = 'shortOpenInterestInTokensUsingLongToken_DESC_NULLS_FIRST', + shortOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST = 'shortOpenInterestInTokensUsingLongToken_DESC_NULLS_LAST', + shortOpenInterestInTokensUsingShortToken_ASC = 'shortOpenInterestInTokensUsingShortToken_ASC', + shortOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST = 'shortOpenInterestInTokensUsingShortToken_ASC_NULLS_FIRST', + shortOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST = 'shortOpenInterestInTokensUsingShortToken_ASC_NULLS_LAST', + shortOpenInterestInTokensUsingShortToken_DESC = 'shortOpenInterestInTokensUsingShortToken_DESC', + shortOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST = 'shortOpenInterestInTokensUsingShortToken_DESC_NULLS_FIRST', + shortOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST = 'shortOpenInterestInTokensUsingShortToken_DESC_NULLS_LAST', + shortOpenInterestInTokens_ASC = 'shortOpenInterestInTokens_ASC', + shortOpenInterestInTokens_ASC_NULLS_FIRST = 'shortOpenInterestInTokens_ASC_NULLS_FIRST', + shortOpenInterestInTokens_ASC_NULLS_LAST = 'shortOpenInterestInTokens_ASC_NULLS_LAST', + shortOpenInterestInTokens_DESC = 'shortOpenInterestInTokens_DESC', + shortOpenInterestInTokens_DESC_NULLS_FIRST = 'shortOpenInterestInTokens_DESC_NULLS_FIRST', + shortOpenInterestInTokens_DESC_NULLS_LAST = 'shortOpenInterestInTokens_DESC_NULLS_LAST', + shortOpenInterestUsd_ASC = 'shortOpenInterestUsd_ASC', + shortOpenInterestUsd_ASC_NULLS_FIRST = 'shortOpenInterestUsd_ASC_NULLS_FIRST', + shortOpenInterestUsd_ASC_NULLS_LAST = 'shortOpenInterestUsd_ASC_NULLS_LAST', + shortOpenInterestUsd_DESC = 'shortOpenInterestUsd_DESC', + shortOpenInterestUsd_DESC_NULLS_FIRST = 'shortOpenInterestUsd_DESC_NULLS_FIRST', + shortOpenInterestUsd_DESC_NULLS_LAST = 'shortOpenInterestUsd_DESC_NULLS_LAST', + shortOpenInterestUsingLongToken_ASC = 'shortOpenInterestUsingLongToken_ASC', + shortOpenInterestUsingLongToken_ASC_NULLS_FIRST = 'shortOpenInterestUsingLongToken_ASC_NULLS_FIRST', + shortOpenInterestUsingLongToken_ASC_NULLS_LAST = 'shortOpenInterestUsingLongToken_ASC_NULLS_LAST', + shortOpenInterestUsingLongToken_DESC = 'shortOpenInterestUsingLongToken_DESC', + shortOpenInterestUsingLongToken_DESC_NULLS_FIRST = 'shortOpenInterestUsingLongToken_DESC_NULLS_FIRST', + shortOpenInterestUsingLongToken_DESC_NULLS_LAST = 'shortOpenInterestUsingLongToken_DESC_NULLS_LAST', + shortOpenInterestUsingShortToken_ASC = 'shortOpenInterestUsingShortToken_ASC', + shortOpenInterestUsingShortToken_ASC_NULLS_FIRST = 'shortOpenInterestUsingShortToken_ASC_NULLS_FIRST', + shortOpenInterestUsingShortToken_ASC_NULLS_LAST = 'shortOpenInterestUsingShortToken_ASC_NULLS_LAST', + shortOpenInterestUsingShortToken_DESC = 'shortOpenInterestUsingShortToken_DESC', + shortOpenInterestUsingShortToken_DESC_NULLS_FIRST = 'shortOpenInterestUsingShortToken_DESC_NULLS_FIRST', + shortOpenInterestUsingShortToken_DESC_NULLS_LAST = 'shortOpenInterestUsingShortToken_DESC_NULLS_LAST', + shortPoolAmount_ASC = 'shortPoolAmount_ASC', + shortPoolAmount_ASC_NULLS_FIRST = 'shortPoolAmount_ASC_NULLS_FIRST', + shortPoolAmount_ASC_NULLS_LAST = 'shortPoolAmount_ASC_NULLS_LAST', + shortPoolAmount_DESC = 'shortPoolAmount_DESC', + shortPoolAmount_DESC_NULLS_FIRST = 'shortPoolAmount_DESC_NULLS_FIRST', + shortPoolAmount_DESC_NULLS_LAST = 'shortPoolAmount_DESC_NULLS_LAST', + shortTokenAddress_ASC = 'shortTokenAddress_ASC', + shortTokenAddress_ASC_NULLS_FIRST = 'shortTokenAddress_ASC_NULLS_FIRST', + shortTokenAddress_ASC_NULLS_LAST = 'shortTokenAddress_ASC_NULLS_LAST', + shortTokenAddress_DESC = 'shortTokenAddress_DESC', + shortTokenAddress_DESC_NULLS_FIRST = 'shortTokenAddress_DESC_NULLS_FIRST', + shortTokenAddress_DESC_NULLS_LAST = 'shortTokenAddress_DESC_NULLS_LAST', + swapFeeFactorForNegativeImpact_ASC = 'swapFeeFactorForNegativeImpact_ASC', + swapFeeFactorForNegativeImpact_ASC_NULLS_FIRST = 'swapFeeFactorForNegativeImpact_ASC_NULLS_FIRST', + swapFeeFactorForNegativeImpact_ASC_NULLS_LAST = 'swapFeeFactorForNegativeImpact_ASC_NULLS_LAST', + swapFeeFactorForNegativeImpact_DESC = 'swapFeeFactorForNegativeImpact_DESC', + swapFeeFactorForNegativeImpact_DESC_NULLS_FIRST = 'swapFeeFactorForNegativeImpact_DESC_NULLS_FIRST', + swapFeeFactorForNegativeImpact_DESC_NULLS_LAST = 'swapFeeFactorForNegativeImpact_DESC_NULLS_LAST', + swapFeeFactorForPositiveImpact_ASC = 'swapFeeFactorForPositiveImpact_ASC', + swapFeeFactorForPositiveImpact_ASC_NULLS_FIRST = 'swapFeeFactorForPositiveImpact_ASC_NULLS_FIRST', + swapFeeFactorForPositiveImpact_ASC_NULLS_LAST = 'swapFeeFactorForPositiveImpact_ASC_NULLS_LAST', + swapFeeFactorForPositiveImpact_DESC = 'swapFeeFactorForPositiveImpact_DESC', + swapFeeFactorForPositiveImpact_DESC_NULLS_FIRST = 'swapFeeFactorForPositiveImpact_DESC_NULLS_FIRST', + swapFeeFactorForPositiveImpact_DESC_NULLS_LAST = 'swapFeeFactorForPositiveImpact_DESC_NULLS_LAST', + swapImpactExponentFactor_ASC = 'swapImpactExponentFactor_ASC', + swapImpactExponentFactor_ASC_NULLS_FIRST = 'swapImpactExponentFactor_ASC_NULLS_FIRST', + swapImpactExponentFactor_ASC_NULLS_LAST = 'swapImpactExponentFactor_ASC_NULLS_LAST', + swapImpactExponentFactor_DESC = 'swapImpactExponentFactor_DESC', + swapImpactExponentFactor_DESC_NULLS_FIRST = 'swapImpactExponentFactor_DESC_NULLS_FIRST', + swapImpactExponentFactor_DESC_NULLS_LAST = 'swapImpactExponentFactor_DESC_NULLS_LAST', + swapImpactFactorNegative_ASC = 'swapImpactFactorNegative_ASC', + swapImpactFactorNegative_ASC_NULLS_FIRST = 'swapImpactFactorNegative_ASC_NULLS_FIRST', + swapImpactFactorNegative_ASC_NULLS_LAST = 'swapImpactFactorNegative_ASC_NULLS_LAST', + swapImpactFactorNegative_DESC = 'swapImpactFactorNegative_DESC', + swapImpactFactorNegative_DESC_NULLS_FIRST = 'swapImpactFactorNegative_DESC_NULLS_FIRST', + swapImpactFactorNegative_DESC_NULLS_LAST = 'swapImpactFactorNegative_DESC_NULLS_LAST', + swapImpactFactorPositive_ASC = 'swapImpactFactorPositive_ASC', + swapImpactFactorPositive_ASC_NULLS_FIRST = 'swapImpactFactorPositive_ASC_NULLS_FIRST', + swapImpactFactorPositive_ASC_NULLS_LAST = 'swapImpactFactorPositive_ASC_NULLS_LAST', + swapImpactFactorPositive_DESC = 'swapImpactFactorPositive_DESC', + swapImpactFactorPositive_DESC_NULLS_FIRST = 'swapImpactFactorPositive_DESC_NULLS_FIRST', + swapImpactFactorPositive_DESC_NULLS_LAST = 'swapImpactFactorPositive_DESC_NULLS_LAST', + swapImpactPoolAmountLong_ASC = 'swapImpactPoolAmountLong_ASC', + swapImpactPoolAmountLong_ASC_NULLS_FIRST = 'swapImpactPoolAmountLong_ASC_NULLS_FIRST', + swapImpactPoolAmountLong_ASC_NULLS_LAST = 'swapImpactPoolAmountLong_ASC_NULLS_LAST', + swapImpactPoolAmountLong_DESC = 'swapImpactPoolAmountLong_DESC', + swapImpactPoolAmountLong_DESC_NULLS_FIRST = 'swapImpactPoolAmountLong_DESC_NULLS_FIRST', + swapImpactPoolAmountLong_DESC_NULLS_LAST = 'swapImpactPoolAmountLong_DESC_NULLS_LAST', + swapImpactPoolAmountShort_ASC = 'swapImpactPoolAmountShort_ASC', + swapImpactPoolAmountShort_ASC_NULLS_FIRST = 'swapImpactPoolAmountShort_ASC_NULLS_FIRST', + swapImpactPoolAmountShort_ASC_NULLS_LAST = 'swapImpactPoolAmountShort_ASC_NULLS_LAST', + swapImpactPoolAmountShort_DESC = 'swapImpactPoolAmountShort_DESC', + swapImpactPoolAmountShort_DESC_NULLS_FIRST = 'swapImpactPoolAmountShort_DESC_NULLS_FIRST', + swapImpactPoolAmountShort_DESC_NULLS_LAST = 'swapImpactPoolAmountShort_DESC_NULLS_LAST', + thresholdForDecreaseFunding_ASC = 'thresholdForDecreaseFunding_ASC', + thresholdForDecreaseFunding_ASC_NULLS_FIRST = 'thresholdForDecreaseFunding_ASC_NULLS_FIRST', + thresholdForDecreaseFunding_ASC_NULLS_LAST = 'thresholdForDecreaseFunding_ASC_NULLS_LAST', + thresholdForDecreaseFunding_DESC = 'thresholdForDecreaseFunding_DESC', + thresholdForDecreaseFunding_DESC_NULLS_FIRST = 'thresholdForDecreaseFunding_DESC_NULLS_FIRST', + thresholdForDecreaseFunding_DESC_NULLS_LAST = 'thresholdForDecreaseFunding_DESC_NULLS_LAST', + thresholdForStableFunding_ASC = 'thresholdForStableFunding_ASC', + thresholdForStableFunding_ASC_NULLS_FIRST = 'thresholdForStableFunding_ASC_NULLS_FIRST', + thresholdForStableFunding_ASC_NULLS_LAST = 'thresholdForStableFunding_ASC_NULLS_LAST', + thresholdForStableFunding_DESC = 'thresholdForStableFunding_DESC', + thresholdForStableFunding_DESC_NULLS_FIRST = 'thresholdForStableFunding_DESC_NULLS_FIRST', + thresholdForStableFunding_DESC_NULLS_LAST = 'thresholdForStableFunding_DESC_NULLS_LAST', + totalBorrowingFees_ASC = 'totalBorrowingFees_ASC', + totalBorrowingFees_ASC_NULLS_FIRST = 'totalBorrowingFees_ASC_NULLS_FIRST', + totalBorrowingFees_ASC_NULLS_LAST = 'totalBorrowingFees_ASC_NULLS_LAST', + totalBorrowingFees_DESC = 'totalBorrowingFees_DESC', + totalBorrowingFees_DESC_NULLS_FIRST = 'totalBorrowingFees_DESC_NULLS_FIRST', + totalBorrowingFees_DESC_NULLS_LAST = 'totalBorrowingFees_DESC_NULLS_LAST', + virtualIndexTokenId_ASC = 'virtualIndexTokenId_ASC', + virtualIndexTokenId_ASC_NULLS_FIRST = 'virtualIndexTokenId_ASC_NULLS_FIRST', + virtualIndexTokenId_ASC_NULLS_LAST = 'virtualIndexTokenId_ASC_NULLS_LAST', + virtualIndexTokenId_DESC = 'virtualIndexTokenId_DESC', + virtualIndexTokenId_DESC_NULLS_FIRST = 'virtualIndexTokenId_DESC_NULLS_FIRST', + virtualIndexTokenId_DESC_NULLS_LAST = 'virtualIndexTokenId_DESC_NULLS_LAST', + virtualInventoryForPositions_ASC = 'virtualInventoryForPositions_ASC', + virtualInventoryForPositions_ASC_NULLS_FIRST = 'virtualInventoryForPositions_ASC_NULLS_FIRST', + virtualInventoryForPositions_ASC_NULLS_LAST = 'virtualInventoryForPositions_ASC_NULLS_LAST', + virtualInventoryForPositions_DESC = 'virtualInventoryForPositions_DESC', + virtualInventoryForPositions_DESC_NULLS_FIRST = 'virtualInventoryForPositions_DESC_NULLS_FIRST', + virtualInventoryForPositions_DESC_NULLS_LAST = 'virtualInventoryForPositions_DESC_NULLS_LAST', + virtualLongTokenId_ASC = 'virtualLongTokenId_ASC', + virtualLongTokenId_ASC_NULLS_FIRST = 'virtualLongTokenId_ASC_NULLS_FIRST', + virtualLongTokenId_ASC_NULLS_LAST = 'virtualLongTokenId_ASC_NULLS_LAST', + virtualLongTokenId_DESC = 'virtualLongTokenId_DESC', + virtualLongTokenId_DESC_NULLS_FIRST = 'virtualLongTokenId_DESC_NULLS_FIRST', + virtualLongTokenId_DESC_NULLS_LAST = 'virtualLongTokenId_DESC_NULLS_LAST', + virtualMarketId_ASC = 'virtualMarketId_ASC', + virtualMarketId_ASC_NULLS_FIRST = 'virtualMarketId_ASC_NULLS_FIRST', + virtualMarketId_ASC_NULLS_LAST = 'virtualMarketId_ASC_NULLS_LAST', + virtualMarketId_DESC = 'virtualMarketId_DESC', + virtualMarketId_DESC_NULLS_FIRST = 'virtualMarketId_DESC_NULLS_FIRST', + virtualMarketId_DESC_NULLS_LAST = 'virtualMarketId_DESC_NULLS_LAST', + virtualPoolAmountForLongToken_ASC = 'virtualPoolAmountForLongToken_ASC', + virtualPoolAmountForLongToken_ASC_NULLS_FIRST = 'virtualPoolAmountForLongToken_ASC_NULLS_FIRST', + virtualPoolAmountForLongToken_ASC_NULLS_LAST = 'virtualPoolAmountForLongToken_ASC_NULLS_LAST', + virtualPoolAmountForLongToken_DESC = 'virtualPoolAmountForLongToken_DESC', + virtualPoolAmountForLongToken_DESC_NULLS_FIRST = 'virtualPoolAmountForLongToken_DESC_NULLS_FIRST', + virtualPoolAmountForLongToken_DESC_NULLS_LAST = 'virtualPoolAmountForLongToken_DESC_NULLS_LAST', + virtualPoolAmountForShortToken_ASC = 'virtualPoolAmountForShortToken_ASC', + virtualPoolAmountForShortToken_ASC_NULLS_FIRST = 'virtualPoolAmountForShortToken_ASC_NULLS_FIRST', + virtualPoolAmountForShortToken_ASC_NULLS_LAST = 'virtualPoolAmountForShortToken_ASC_NULLS_LAST', + virtualPoolAmountForShortToken_DESC = 'virtualPoolAmountForShortToken_DESC', + virtualPoolAmountForShortToken_DESC_NULLS_FIRST = 'virtualPoolAmountForShortToken_DESC_NULLS_FIRST', + virtualPoolAmountForShortToken_DESC_NULLS_LAST = 'virtualPoolAmountForShortToken_DESC_NULLS_LAST', + virtualShortTokenId_ASC = 'virtualShortTokenId_ASC', + virtualShortTokenId_ASC_NULLS_FIRST = 'virtualShortTokenId_ASC_NULLS_FIRST', + virtualShortTokenId_ASC_NULLS_LAST = 'virtualShortTokenId_ASC_NULLS_LAST', + virtualShortTokenId_DESC = 'virtualShortTokenId_DESC', + virtualShortTokenId_DESC_NULLS_FIRST = 'virtualShortTokenId_DESC_NULLS_FIRST', + virtualShortTokenId_DESC_NULLS_LAST = 'virtualShortTokenId_DESC_NULLS_LAST' } export interface MarketInfoWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - aboveOptimalUsageBorrowingFactorLong_eq?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_gt?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_gte?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_in?: InputMaybe>; - aboveOptimalUsageBorrowingFactorLong_isNull?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_lt?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_lte?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_not_eq?: InputMaybe; - aboveOptimalUsageBorrowingFactorLong_not_in?: InputMaybe>; - aboveOptimalUsageBorrowingFactorShort_eq?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_gt?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_gte?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_in?: InputMaybe>; - aboveOptimalUsageBorrowingFactorShort_isNull?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_lt?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_lte?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_not_eq?: InputMaybe; - aboveOptimalUsageBorrowingFactorShort_not_in?: InputMaybe>; - atomicSwapFeeFactor_eq?: InputMaybe; - atomicSwapFeeFactor_gt?: InputMaybe; - atomicSwapFeeFactor_gte?: InputMaybe; - atomicSwapFeeFactor_in?: InputMaybe>; - atomicSwapFeeFactor_isNull?: InputMaybe; - atomicSwapFeeFactor_lt?: InputMaybe; - atomicSwapFeeFactor_lte?: InputMaybe; - atomicSwapFeeFactor_not_eq?: InputMaybe; - atomicSwapFeeFactor_not_in?: InputMaybe>; - baseBorrowingFactorLong_eq?: InputMaybe; - baseBorrowingFactorLong_gt?: InputMaybe; - baseBorrowingFactorLong_gte?: InputMaybe; - baseBorrowingFactorLong_in?: InputMaybe>; - baseBorrowingFactorLong_isNull?: InputMaybe; - baseBorrowingFactorLong_lt?: InputMaybe; - baseBorrowingFactorLong_lte?: InputMaybe; - baseBorrowingFactorLong_not_eq?: InputMaybe; - baseBorrowingFactorLong_not_in?: InputMaybe>; - baseBorrowingFactorShort_eq?: InputMaybe; - baseBorrowingFactorShort_gt?: InputMaybe; - baseBorrowingFactorShort_gte?: InputMaybe; - baseBorrowingFactorShort_in?: InputMaybe>; - baseBorrowingFactorShort_isNull?: InputMaybe; - baseBorrowingFactorShort_lt?: InputMaybe; - baseBorrowingFactorShort_lte?: InputMaybe; - baseBorrowingFactorShort_not_eq?: InputMaybe; - baseBorrowingFactorShort_not_in?: InputMaybe>; - borrowingExponentFactorLong_eq?: InputMaybe; - borrowingExponentFactorLong_gt?: InputMaybe; - borrowingExponentFactorLong_gte?: InputMaybe; - borrowingExponentFactorLong_in?: InputMaybe>; - borrowingExponentFactorLong_isNull?: InputMaybe; - borrowingExponentFactorLong_lt?: InputMaybe; - borrowingExponentFactorLong_lte?: InputMaybe; - borrowingExponentFactorLong_not_eq?: InputMaybe; - borrowingExponentFactorLong_not_in?: InputMaybe>; - borrowingExponentFactorShort_eq?: InputMaybe; - borrowingExponentFactorShort_gt?: InputMaybe; - borrowingExponentFactorShort_gte?: InputMaybe; - borrowingExponentFactorShort_in?: InputMaybe>; - borrowingExponentFactorShort_isNull?: InputMaybe; - borrowingExponentFactorShort_lt?: InputMaybe; - borrowingExponentFactorShort_lte?: InputMaybe; - borrowingExponentFactorShort_not_eq?: InputMaybe; - borrowingExponentFactorShort_not_in?: InputMaybe>; - borrowingFactorLong_eq?: InputMaybe; - borrowingFactorLong_gt?: InputMaybe; - borrowingFactorLong_gte?: InputMaybe; - borrowingFactorLong_in?: InputMaybe>; - borrowingFactorLong_isNull?: InputMaybe; - borrowingFactorLong_lt?: InputMaybe; - borrowingFactorLong_lte?: InputMaybe; - borrowingFactorLong_not_eq?: InputMaybe; - borrowingFactorLong_not_in?: InputMaybe>; - borrowingFactorPerSecondForLongs_eq?: InputMaybe; - borrowingFactorPerSecondForLongs_gt?: InputMaybe; - borrowingFactorPerSecondForLongs_gte?: InputMaybe; - borrowingFactorPerSecondForLongs_in?: InputMaybe>; - borrowingFactorPerSecondForLongs_isNull?: InputMaybe; - borrowingFactorPerSecondForLongs_lt?: InputMaybe; - borrowingFactorPerSecondForLongs_lte?: InputMaybe; - borrowingFactorPerSecondForLongs_not_eq?: InputMaybe; - borrowingFactorPerSecondForLongs_not_in?: InputMaybe>; - borrowingFactorPerSecondForShorts_eq?: InputMaybe; - borrowingFactorPerSecondForShorts_gt?: InputMaybe; - borrowingFactorPerSecondForShorts_gte?: InputMaybe; - borrowingFactorPerSecondForShorts_in?: InputMaybe>; - borrowingFactorPerSecondForShorts_isNull?: InputMaybe; - borrowingFactorPerSecondForShorts_lt?: InputMaybe; - borrowingFactorPerSecondForShorts_lte?: InputMaybe; - borrowingFactorPerSecondForShorts_not_eq?: InputMaybe; - borrowingFactorPerSecondForShorts_not_in?: InputMaybe>; - borrowingFactorShort_eq?: InputMaybe; - borrowingFactorShort_gt?: InputMaybe; - borrowingFactorShort_gte?: InputMaybe; - borrowingFactorShort_in?: InputMaybe>; - borrowingFactorShort_isNull?: InputMaybe; - borrowingFactorShort_lt?: InputMaybe; - borrowingFactorShort_lte?: InputMaybe; - borrowingFactorShort_not_eq?: InputMaybe; - borrowingFactorShort_not_in?: InputMaybe>; - fundingDecreaseFactorPerSecond_eq?: InputMaybe; - fundingDecreaseFactorPerSecond_gt?: InputMaybe; - fundingDecreaseFactorPerSecond_gte?: InputMaybe; - fundingDecreaseFactorPerSecond_in?: InputMaybe>; - fundingDecreaseFactorPerSecond_isNull?: InputMaybe; - fundingDecreaseFactorPerSecond_lt?: InputMaybe; - fundingDecreaseFactorPerSecond_lte?: InputMaybe; - fundingDecreaseFactorPerSecond_not_eq?: InputMaybe; - fundingDecreaseFactorPerSecond_not_in?: InputMaybe>; - fundingExponentFactor_eq?: InputMaybe; - fundingExponentFactor_gt?: InputMaybe; - fundingExponentFactor_gte?: InputMaybe; - fundingExponentFactor_in?: InputMaybe>; - fundingExponentFactor_isNull?: InputMaybe; - fundingExponentFactor_lt?: InputMaybe; - fundingExponentFactor_lte?: InputMaybe; - fundingExponentFactor_not_eq?: InputMaybe; - fundingExponentFactor_not_in?: InputMaybe>; - fundingFactorPerSecond_eq?: InputMaybe; - fundingFactorPerSecond_gt?: InputMaybe; - fundingFactorPerSecond_gte?: InputMaybe; - fundingFactorPerSecond_in?: InputMaybe>; - fundingFactorPerSecond_isNull?: InputMaybe; - fundingFactorPerSecond_lt?: InputMaybe; - fundingFactorPerSecond_lte?: InputMaybe; - fundingFactorPerSecond_not_eq?: InputMaybe; - fundingFactorPerSecond_not_in?: InputMaybe>; - fundingFactor_eq?: InputMaybe; - fundingFactor_gt?: InputMaybe; - fundingFactor_gte?: InputMaybe; - fundingFactor_in?: InputMaybe>; - fundingFactor_isNull?: InputMaybe; - fundingFactor_lt?: InputMaybe; - fundingFactor_lte?: InputMaybe; - fundingFactor_not_eq?: InputMaybe; - fundingFactor_not_in?: InputMaybe>; - fundingIncreaseFactorPerSecond_eq?: InputMaybe; - fundingIncreaseFactorPerSecond_gt?: InputMaybe; - fundingIncreaseFactorPerSecond_gte?: InputMaybe; - fundingIncreaseFactorPerSecond_in?: InputMaybe>; - fundingIncreaseFactorPerSecond_isNull?: InputMaybe; - fundingIncreaseFactorPerSecond_lt?: InputMaybe; - fundingIncreaseFactorPerSecond_lte?: InputMaybe; - fundingIncreaseFactorPerSecond_not_eq?: InputMaybe; - fundingIncreaseFactorPerSecond_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - indexTokenAddress_contains?: InputMaybe; - indexTokenAddress_containsInsensitive?: InputMaybe; - indexTokenAddress_endsWith?: InputMaybe; - indexTokenAddress_eq?: InputMaybe; - indexTokenAddress_gt?: InputMaybe; - indexTokenAddress_gte?: InputMaybe; - indexTokenAddress_in?: InputMaybe>; - indexTokenAddress_isNull?: InputMaybe; - indexTokenAddress_lt?: InputMaybe; - indexTokenAddress_lte?: InputMaybe; - indexTokenAddress_not_contains?: InputMaybe; - indexTokenAddress_not_containsInsensitive?: InputMaybe; - indexTokenAddress_not_endsWith?: InputMaybe; - indexTokenAddress_not_eq?: InputMaybe; - indexTokenAddress_not_in?: InputMaybe>; - indexTokenAddress_not_startsWith?: InputMaybe; - indexTokenAddress_startsWith?: InputMaybe; - isDisabled_eq?: InputMaybe; - isDisabled_isNull?: InputMaybe; - isDisabled_not_eq?: InputMaybe; - lentPositionImpactPoolAmount_eq?: InputMaybe; - lentPositionImpactPoolAmount_gt?: InputMaybe; - lentPositionImpactPoolAmount_gte?: InputMaybe; - lentPositionImpactPoolAmount_in?: InputMaybe>; - lentPositionImpactPoolAmount_isNull?: InputMaybe; - lentPositionImpactPoolAmount_lt?: InputMaybe; - lentPositionImpactPoolAmount_lte?: InputMaybe; - lentPositionImpactPoolAmount_not_eq?: InputMaybe; - lentPositionImpactPoolAmount_not_in?: InputMaybe>; - longOpenInterestInTokensUsingLongToken_eq?: InputMaybe; - longOpenInterestInTokensUsingLongToken_gt?: InputMaybe; - longOpenInterestInTokensUsingLongToken_gte?: InputMaybe; - longOpenInterestInTokensUsingLongToken_in?: InputMaybe>; - longOpenInterestInTokensUsingLongToken_isNull?: InputMaybe; - longOpenInterestInTokensUsingLongToken_lt?: InputMaybe; - longOpenInterestInTokensUsingLongToken_lte?: InputMaybe; - longOpenInterestInTokensUsingLongToken_not_eq?: InputMaybe; - longOpenInterestInTokensUsingLongToken_not_in?: InputMaybe>; - longOpenInterestInTokensUsingShortToken_eq?: InputMaybe; - longOpenInterestInTokensUsingShortToken_gt?: InputMaybe; - longOpenInterestInTokensUsingShortToken_gte?: InputMaybe; - longOpenInterestInTokensUsingShortToken_in?: InputMaybe>; - longOpenInterestInTokensUsingShortToken_isNull?: InputMaybe; - longOpenInterestInTokensUsingShortToken_lt?: InputMaybe; - longOpenInterestInTokensUsingShortToken_lte?: InputMaybe; - longOpenInterestInTokensUsingShortToken_not_eq?: InputMaybe; - longOpenInterestInTokensUsingShortToken_not_in?: InputMaybe>; - longOpenInterestInTokens_eq?: InputMaybe; - longOpenInterestInTokens_gt?: InputMaybe; - longOpenInterestInTokens_gte?: InputMaybe; - longOpenInterestInTokens_in?: InputMaybe>; - longOpenInterestInTokens_isNull?: InputMaybe; - longOpenInterestInTokens_lt?: InputMaybe; - longOpenInterestInTokens_lte?: InputMaybe; - longOpenInterestInTokens_not_eq?: InputMaybe; - longOpenInterestInTokens_not_in?: InputMaybe>; - longOpenInterestUsd_eq?: InputMaybe; - longOpenInterestUsd_gt?: InputMaybe; - longOpenInterestUsd_gte?: InputMaybe; - longOpenInterestUsd_in?: InputMaybe>; - longOpenInterestUsd_isNull?: InputMaybe; - longOpenInterestUsd_lt?: InputMaybe; - longOpenInterestUsd_lte?: InputMaybe; - longOpenInterestUsd_not_eq?: InputMaybe; - longOpenInterestUsd_not_in?: InputMaybe>; - longOpenInterestUsingLongToken_eq?: InputMaybe; - longOpenInterestUsingLongToken_gt?: InputMaybe; - longOpenInterestUsingLongToken_gte?: InputMaybe; - longOpenInterestUsingLongToken_in?: InputMaybe>; - longOpenInterestUsingLongToken_isNull?: InputMaybe; - longOpenInterestUsingLongToken_lt?: InputMaybe; - longOpenInterestUsingLongToken_lte?: InputMaybe; - longOpenInterestUsingLongToken_not_eq?: InputMaybe; - longOpenInterestUsingLongToken_not_in?: InputMaybe>; - longOpenInterestUsingShortToken_eq?: InputMaybe; - longOpenInterestUsingShortToken_gt?: InputMaybe; - longOpenInterestUsingShortToken_gte?: InputMaybe; - longOpenInterestUsingShortToken_in?: InputMaybe>; - longOpenInterestUsingShortToken_isNull?: InputMaybe; - longOpenInterestUsingShortToken_lt?: InputMaybe; - longOpenInterestUsingShortToken_lte?: InputMaybe; - longOpenInterestUsingShortToken_not_eq?: InputMaybe; - longOpenInterestUsingShortToken_not_in?: InputMaybe>; - longPoolAmountAdjustment_eq?: InputMaybe; - longPoolAmountAdjustment_gt?: InputMaybe; - longPoolAmountAdjustment_gte?: InputMaybe; - longPoolAmountAdjustment_in?: InputMaybe>; - longPoolAmountAdjustment_isNull?: InputMaybe; - longPoolAmountAdjustment_lt?: InputMaybe; - longPoolAmountAdjustment_lte?: InputMaybe; - longPoolAmountAdjustment_not_eq?: InputMaybe; - longPoolAmountAdjustment_not_in?: InputMaybe>; - longPoolAmount_eq?: InputMaybe; - longPoolAmount_gt?: InputMaybe; - longPoolAmount_gte?: InputMaybe; - longPoolAmount_in?: InputMaybe>; - longPoolAmount_isNull?: InputMaybe; - longPoolAmount_lt?: InputMaybe; - longPoolAmount_lte?: InputMaybe; - longPoolAmount_not_eq?: InputMaybe; - longPoolAmount_not_in?: InputMaybe>; - longTokenAddress_contains?: InputMaybe; - longTokenAddress_containsInsensitive?: InputMaybe; - longTokenAddress_endsWith?: InputMaybe; - longTokenAddress_eq?: InputMaybe; - longTokenAddress_gt?: InputMaybe; - longTokenAddress_gte?: InputMaybe; - longTokenAddress_in?: InputMaybe>; - longTokenAddress_isNull?: InputMaybe; - longTokenAddress_lt?: InputMaybe; - longTokenAddress_lte?: InputMaybe; - longTokenAddress_not_contains?: InputMaybe; - longTokenAddress_not_containsInsensitive?: InputMaybe; - longTokenAddress_not_endsWith?: InputMaybe; - longTokenAddress_not_eq?: InputMaybe; - longTokenAddress_not_in?: InputMaybe>; - longTokenAddress_not_startsWith?: InputMaybe; - longTokenAddress_startsWith?: InputMaybe; - longsPayShorts_eq?: InputMaybe; - longsPayShorts_isNull?: InputMaybe; - longsPayShorts_not_eq?: InputMaybe; - marketTokenAddress_contains?: InputMaybe; - marketTokenAddress_containsInsensitive?: InputMaybe; - marketTokenAddress_endsWith?: InputMaybe; - marketTokenAddress_eq?: InputMaybe; - marketTokenAddress_gt?: InputMaybe; - marketTokenAddress_gte?: InputMaybe; - marketTokenAddress_in?: InputMaybe>; - marketTokenAddress_isNull?: InputMaybe; - marketTokenAddress_lt?: InputMaybe; - marketTokenAddress_lte?: InputMaybe; - marketTokenAddress_not_contains?: InputMaybe; - marketTokenAddress_not_containsInsensitive?: InputMaybe; - marketTokenAddress_not_endsWith?: InputMaybe; - marketTokenAddress_not_eq?: InputMaybe; - marketTokenAddress_not_in?: InputMaybe>; - marketTokenAddress_not_startsWith?: InputMaybe; - marketTokenAddress_startsWith?: InputMaybe; - marketTokenSupply_eq?: InputMaybe; - marketTokenSupply_gt?: InputMaybe; - marketTokenSupply_gte?: InputMaybe; - marketTokenSupply_in?: InputMaybe>; - marketTokenSupply_isNull?: InputMaybe; - marketTokenSupply_lt?: InputMaybe; - marketTokenSupply_lte?: InputMaybe; - marketTokenSupply_not_eq?: InputMaybe; - marketTokenSupply_not_in?: InputMaybe>; - maxFundingFactorPerSecond_eq?: InputMaybe; - maxFundingFactorPerSecond_gt?: InputMaybe; - maxFundingFactorPerSecond_gte?: InputMaybe; - maxFundingFactorPerSecond_in?: InputMaybe>; - maxFundingFactorPerSecond_isNull?: InputMaybe; - maxFundingFactorPerSecond_lt?: InputMaybe; - maxFundingFactorPerSecond_lte?: InputMaybe; - maxFundingFactorPerSecond_not_eq?: InputMaybe; - maxFundingFactorPerSecond_not_in?: InputMaybe>; - maxLendableImpactFactorForWithdrawals_eq?: InputMaybe; - maxLendableImpactFactorForWithdrawals_gt?: InputMaybe; - maxLendableImpactFactorForWithdrawals_gte?: InputMaybe; - maxLendableImpactFactorForWithdrawals_in?: InputMaybe>; - maxLendableImpactFactorForWithdrawals_isNull?: InputMaybe; - maxLendableImpactFactorForWithdrawals_lt?: InputMaybe; - maxLendableImpactFactorForWithdrawals_lte?: InputMaybe; - maxLendableImpactFactorForWithdrawals_not_eq?: InputMaybe; - maxLendableImpactFactorForWithdrawals_not_in?: InputMaybe>; - maxLendableImpactFactor_eq?: InputMaybe; - maxLendableImpactFactor_gt?: InputMaybe; - maxLendableImpactFactor_gte?: InputMaybe; - maxLendableImpactFactor_in?: InputMaybe>; - maxLendableImpactFactor_isNull?: InputMaybe; - maxLendableImpactFactor_lt?: InputMaybe; - maxLendableImpactFactor_lte?: InputMaybe; - maxLendableImpactFactor_not_eq?: InputMaybe; - maxLendableImpactFactor_not_in?: InputMaybe>; - maxLendableImpactUsd_eq?: InputMaybe; - maxLendableImpactUsd_gt?: InputMaybe; - maxLendableImpactUsd_gte?: InputMaybe; - maxLendableImpactUsd_in?: InputMaybe>; - maxLendableImpactUsd_isNull?: InputMaybe; - maxLendableImpactUsd_lt?: InputMaybe; - maxLendableImpactUsd_lte?: InputMaybe; - maxLendableImpactUsd_not_eq?: InputMaybe; - maxLendableImpactUsd_not_in?: InputMaybe>; - maxLongPoolAmount_eq?: InputMaybe; - maxLongPoolAmount_gt?: InputMaybe; - maxLongPoolAmount_gte?: InputMaybe; - maxLongPoolAmount_in?: InputMaybe>; - maxLongPoolAmount_isNull?: InputMaybe; - maxLongPoolAmount_lt?: InputMaybe; - maxLongPoolAmount_lte?: InputMaybe; - maxLongPoolAmount_not_eq?: InputMaybe; - maxLongPoolAmount_not_in?: InputMaybe>; - maxLongPoolUsdForDeposit_eq?: InputMaybe; - maxLongPoolUsdForDeposit_gt?: InputMaybe; - maxLongPoolUsdForDeposit_gte?: InputMaybe; - maxLongPoolUsdForDeposit_in?: InputMaybe>; - maxLongPoolUsdForDeposit_isNull?: InputMaybe; - maxLongPoolUsdForDeposit_lt?: InputMaybe; - maxLongPoolUsdForDeposit_lte?: InputMaybe; - maxLongPoolUsdForDeposit_not_eq?: InputMaybe; - maxLongPoolUsdForDeposit_not_in?: InputMaybe>; - maxOpenInterestLong_eq?: InputMaybe; - maxOpenInterestLong_gt?: InputMaybe; - maxOpenInterestLong_gte?: InputMaybe; - maxOpenInterestLong_in?: InputMaybe>; - maxOpenInterestLong_isNull?: InputMaybe; - maxOpenInterestLong_lt?: InputMaybe; - maxOpenInterestLong_lte?: InputMaybe; - maxOpenInterestLong_not_eq?: InputMaybe; - maxOpenInterestLong_not_in?: InputMaybe>; - maxOpenInterestShort_eq?: InputMaybe; - maxOpenInterestShort_gt?: InputMaybe; - maxOpenInterestShort_gte?: InputMaybe; - maxOpenInterestShort_in?: InputMaybe>; - maxOpenInterestShort_isNull?: InputMaybe; - maxOpenInterestShort_lt?: InputMaybe; - maxOpenInterestShort_lte?: InputMaybe; - maxOpenInterestShort_not_eq?: InputMaybe; - maxOpenInterestShort_not_in?: InputMaybe>; - maxPnlFactorForTradersLong_eq?: InputMaybe; - maxPnlFactorForTradersLong_gt?: InputMaybe; - maxPnlFactorForTradersLong_gte?: InputMaybe; - maxPnlFactorForTradersLong_in?: InputMaybe>; - maxPnlFactorForTradersLong_isNull?: InputMaybe; - maxPnlFactorForTradersLong_lt?: InputMaybe; - maxPnlFactorForTradersLong_lte?: InputMaybe; - maxPnlFactorForTradersLong_not_eq?: InputMaybe; - maxPnlFactorForTradersLong_not_in?: InputMaybe>; - maxPnlFactorForTradersShort_eq?: InputMaybe; - maxPnlFactorForTradersShort_gt?: InputMaybe; - maxPnlFactorForTradersShort_gte?: InputMaybe; - maxPnlFactorForTradersShort_in?: InputMaybe>; - maxPnlFactorForTradersShort_isNull?: InputMaybe; - maxPnlFactorForTradersShort_lt?: InputMaybe; - maxPnlFactorForTradersShort_lte?: InputMaybe; - maxPnlFactorForTradersShort_not_eq?: InputMaybe; - maxPnlFactorForTradersShort_not_in?: InputMaybe>; - maxPositionImpactFactorForLiquidations_eq?: InputMaybe; - maxPositionImpactFactorForLiquidations_gt?: InputMaybe; - maxPositionImpactFactorForLiquidations_gte?: InputMaybe; - maxPositionImpactFactorForLiquidations_in?: InputMaybe>; - maxPositionImpactFactorForLiquidations_isNull?: InputMaybe; - maxPositionImpactFactorForLiquidations_lt?: InputMaybe; - maxPositionImpactFactorForLiquidations_lte?: InputMaybe; - maxPositionImpactFactorForLiquidations_not_eq?: InputMaybe; - maxPositionImpactFactorForLiquidations_not_in?: InputMaybe>; - maxPositionImpactFactorNegative_eq?: InputMaybe; - maxPositionImpactFactorNegative_gt?: InputMaybe; - maxPositionImpactFactorNegative_gte?: InputMaybe; - maxPositionImpactFactorNegative_in?: InputMaybe>; - maxPositionImpactFactorNegative_isNull?: InputMaybe; - maxPositionImpactFactorNegative_lt?: InputMaybe; - maxPositionImpactFactorNegative_lte?: InputMaybe; - maxPositionImpactFactorNegative_not_eq?: InputMaybe; - maxPositionImpactFactorNegative_not_in?: InputMaybe>; - maxPositionImpactFactorPositive_eq?: InputMaybe; - maxPositionImpactFactorPositive_gt?: InputMaybe; - maxPositionImpactFactorPositive_gte?: InputMaybe; - maxPositionImpactFactorPositive_in?: InputMaybe>; - maxPositionImpactFactorPositive_isNull?: InputMaybe; - maxPositionImpactFactorPositive_lt?: InputMaybe; - maxPositionImpactFactorPositive_lte?: InputMaybe; - maxPositionImpactFactorPositive_not_eq?: InputMaybe; - maxPositionImpactFactorPositive_not_in?: InputMaybe>; - maxShortPoolAmount_eq?: InputMaybe; - maxShortPoolAmount_gt?: InputMaybe; - maxShortPoolAmount_gte?: InputMaybe; - maxShortPoolAmount_in?: InputMaybe>; - maxShortPoolAmount_isNull?: InputMaybe; - maxShortPoolAmount_lt?: InputMaybe; - maxShortPoolAmount_lte?: InputMaybe; - maxShortPoolAmount_not_eq?: InputMaybe; - maxShortPoolAmount_not_in?: InputMaybe>; - maxShortPoolUsdForDeposit_eq?: InputMaybe; - maxShortPoolUsdForDeposit_gt?: InputMaybe; - maxShortPoolUsdForDeposit_gte?: InputMaybe; - maxShortPoolUsdForDeposit_in?: InputMaybe>; - maxShortPoolUsdForDeposit_isNull?: InputMaybe; - maxShortPoolUsdForDeposit_lt?: InputMaybe; - maxShortPoolUsdForDeposit_lte?: InputMaybe; - maxShortPoolUsdForDeposit_not_eq?: InputMaybe; - maxShortPoolUsdForDeposit_not_in?: InputMaybe>; - minCollateralFactorForOpenInterestLong_eq?: InputMaybe; - minCollateralFactorForOpenInterestLong_gt?: InputMaybe; - minCollateralFactorForOpenInterestLong_gte?: InputMaybe; - minCollateralFactorForOpenInterestLong_in?: InputMaybe>; - minCollateralFactorForOpenInterestLong_isNull?: InputMaybe; - minCollateralFactorForOpenInterestLong_lt?: InputMaybe; - minCollateralFactorForOpenInterestLong_lte?: InputMaybe; - minCollateralFactorForOpenInterestLong_not_eq?: InputMaybe; - minCollateralFactorForOpenInterestLong_not_in?: InputMaybe>; - minCollateralFactorForOpenInterestShort_eq?: InputMaybe; - minCollateralFactorForOpenInterestShort_gt?: InputMaybe; - minCollateralFactorForOpenInterestShort_gte?: InputMaybe; - minCollateralFactorForOpenInterestShort_in?: InputMaybe>; - minCollateralFactorForOpenInterestShort_isNull?: InputMaybe; - minCollateralFactorForOpenInterestShort_lt?: InputMaybe; - minCollateralFactorForOpenInterestShort_lte?: InputMaybe; - minCollateralFactorForOpenInterestShort_not_eq?: InputMaybe; - minCollateralFactorForOpenInterestShort_not_in?: InputMaybe>; - minCollateralFactor_eq?: InputMaybe; - minCollateralFactor_gt?: InputMaybe; - minCollateralFactor_gte?: InputMaybe; - minCollateralFactor_in?: InputMaybe>; - minCollateralFactor_isNull?: InputMaybe; - minCollateralFactor_lt?: InputMaybe; - minCollateralFactor_lte?: InputMaybe; - minCollateralFactor_not_eq?: InputMaybe; - minCollateralFactor_not_in?: InputMaybe>; - minFundingFactorPerSecond_eq?: InputMaybe; - minFundingFactorPerSecond_gt?: InputMaybe; - minFundingFactorPerSecond_gte?: InputMaybe; - minFundingFactorPerSecond_in?: InputMaybe>; - minFundingFactorPerSecond_isNull?: InputMaybe; - minFundingFactorPerSecond_lt?: InputMaybe; - minFundingFactorPerSecond_lte?: InputMaybe; - minFundingFactorPerSecond_not_eq?: InputMaybe; - minFundingFactorPerSecond_not_in?: InputMaybe>; - minPositionImpactPoolAmount_eq?: InputMaybe; - minPositionImpactPoolAmount_gt?: InputMaybe; - minPositionImpactPoolAmount_gte?: InputMaybe; - minPositionImpactPoolAmount_in?: InputMaybe>; - minPositionImpactPoolAmount_isNull?: InputMaybe; - minPositionImpactPoolAmount_lt?: InputMaybe; - minPositionImpactPoolAmount_lte?: InputMaybe; - minPositionImpactPoolAmount_not_eq?: InputMaybe; - minPositionImpactPoolAmount_not_in?: InputMaybe>; - openInterestReserveFactorLong_eq?: InputMaybe; - openInterestReserveFactorLong_gt?: InputMaybe; - openInterestReserveFactorLong_gte?: InputMaybe; - openInterestReserveFactorLong_in?: InputMaybe>; - openInterestReserveFactorLong_isNull?: InputMaybe; - openInterestReserveFactorLong_lt?: InputMaybe; - openInterestReserveFactorLong_lte?: InputMaybe; - openInterestReserveFactorLong_not_eq?: InputMaybe; - openInterestReserveFactorLong_not_in?: InputMaybe>; - openInterestReserveFactorShort_eq?: InputMaybe; - openInterestReserveFactorShort_gt?: InputMaybe; - openInterestReserveFactorShort_gte?: InputMaybe; - openInterestReserveFactorShort_in?: InputMaybe>; - openInterestReserveFactorShort_isNull?: InputMaybe; - openInterestReserveFactorShort_lt?: InputMaybe; - openInterestReserveFactorShort_lte?: InputMaybe; - openInterestReserveFactorShort_not_eq?: InputMaybe; - openInterestReserveFactorShort_not_in?: InputMaybe>; - optimalUsageFactorLong_eq?: InputMaybe; - optimalUsageFactorLong_gt?: InputMaybe; - optimalUsageFactorLong_gte?: InputMaybe; - optimalUsageFactorLong_in?: InputMaybe>; - optimalUsageFactorLong_isNull?: InputMaybe; - optimalUsageFactorLong_lt?: InputMaybe; - optimalUsageFactorLong_lte?: InputMaybe; - optimalUsageFactorLong_not_eq?: InputMaybe; - optimalUsageFactorLong_not_in?: InputMaybe>; - optimalUsageFactorShort_eq?: InputMaybe; - optimalUsageFactorShort_gt?: InputMaybe; - optimalUsageFactorShort_gte?: InputMaybe; - optimalUsageFactorShort_in?: InputMaybe>; - optimalUsageFactorShort_isNull?: InputMaybe; - optimalUsageFactorShort_lt?: InputMaybe; - optimalUsageFactorShort_lte?: InputMaybe; - optimalUsageFactorShort_not_eq?: InputMaybe; - optimalUsageFactorShort_not_in?: InputMaybe>; - poolValueMax_eq?: InputMaybe; - poolValueMax_gt?: InputMaybe; - poolValueMax_gte?: InputMaybe; - poolValueMax_in?: InputMaybe>; - poolValueMax_isNull?: InputMaybe; - poolValueMax_lt?: InputMaybe; - poolValueMax_lte?: InputMaybe; - poolValueMax_not_eq?: InputMaybe; - poolValueMax_not_in?: InputMaybe>; - poolValueMin_eq?: InputMaybe; - poolValueMin_gt?: InputMaybe; - poolValueMin_gte?: InputMaybe; - poolValueMin_in?: InputMaybe>; - poolValueMin_isNull?: InputMaybe; - poolValueMin_lt?: InputMaybe; - poolValueMin_lte?: InputMaybe; - poolValueMin_not_eq?: InputMaybe; - poolValueMin_not_in?: InputMaybe>; - poolValue_eq?: InputMaybe; - poolValue_gt?: InputMaybe; - poolValue_gte?: InputMaybe; - poolValue_in?: InputMaybe>; - poolValue_isNull?: InputMaybe; - poolValue_lt?: InputMaybe; - poolValue_lte?: InputMaybe; - poolValue_not_eq?: InputMaybe; - poolValue_not_in?: InputMaybe>; - positionFeeFactorForNegativeImpact_eq?: InputMaybe; - positionFeeFactorForNegativeImpact_gt?: InputMaybe; - positionFeeFactorForNegativeImpact_gte?: InputMaybe; - positionFeeFactorForNegativeImpact_in?: InputMaybe>; - positionFeeFactorForNegativeImpact_isNull?: InputMaybe; - positionFeeFactorForNegativeImpact_lt?: InputMaybe; - positionFeeFactorForNegativeImpact_lte?: InputMaybe; - positionFeeFactorForNegativeImpact_not_eq?: InputMaybe; - positionFeeFactorForNegativeImpact_not_in?: InputMaybe>; - positionFeeFactorForPositiveImpact_eq?: InputMaybe; - positionFeeFactorForPositiveImpact_gt?: InputMaybe; - positionFeeFactorForPositiveImpact_gte?: InputMaybe; - positionFeeFactorForPositiveImpact_in?: InputMaybe>; - positionFeeFactorForPositiveImpact_isNull?: InputMaybe; - positionFeeFactorForPositiveImpact_lt?: InputMaybe; - positionFeeFactorForPositiveImpact_lte?: InputMaybe; - positionFeeFactorForPositiveImpact_not_eq?: InputMaybe; - positionFeeFactorForPositiveImpact_not_in?: InputMaybe>; - positionImpactExponentFactor_eq?: InputMaybe; - positionImpactExponentFactor_gt?: InputMaybe; - positionImpactExponentFactor_gte?: InputMaybe; - positionImpactExponentFactor_in?: InputMaybe>; - positionImpactExponentFactor_isNull?: InputMaybe; - positionImpactExponentFactor_lt?: InputMaybe; - positionImpactExponentFactor_lte?: InputMaybe; - positionImpactExponentFactor_not_eq?: InputMaybe; - positionImpactExponentFactor_not_in?: InputMaybe>; - positionImpactFactorNegative_eq?: InputMaybe; - positionImpactFactorNegative_gt?: InputMaybe; - positionImpactFactorNegative_gte?: InputMaybe; - positionImpactFactorNegative_in?: InputMaybe>; - positionImpactFactorNegative_isNull?: InputMaybe; - positionImpactFactorNegative_lt?: InputMaybe; - positionImpactFactorNegative_lte?: InputMaybe; - positionImpactFactorNegative_not_eq?: InputMaybe; - positionImpactFactorNegative_not_in?: InputMaybe>; - positionImpactFactorPositive_eq?: InputMaybe; - positionImpactFactorPositive_gt?: InputMaybe; - positionImpactFactorPositive_gte?: InputMaybe; - positionImpactFactorPositive_in?: InputMaybe>; - positionImpactFactorPositive_isNull?: InputMaybe; - positionImpactFactorPositive_lt?: InputMaybe; - positionImpactFactorPositive_lte?: InputMaybe; - positionImpactFactorPositive_not_eq?: InputMaybe; - positionImpactFactorPositive_not_in?: InputMaybe>; - positionImpactPoolAmount_eq?: InputMaybe; - positionImpactPoolAmount_gt?: InputMaybe; - positionImpactPoolAmount_gte?: InputMaybe; - positionImpactPoolAmount_in?: InputMaybe>; - positionImpactPoolAmount_isNull?: InputMaybe; - positionImpactPoolAmount_lt?: InputMaybe; - positionImpactPoolAmount_lte?: InputMaybe; - positionImpactPoolAmount_not_eq?: InputMaybe; - positionImpactPoolAmount_not_in?: InputMaybe>; - positionImpactPoolDistributionRate_eq?: InputMaybe; - positionImpactPoolDistributionRate_gt?: InputMaybe; - positionImpactPoolDistributionRate_gte?: InputMaybe; - positionImpactPoolDistributionRate_in?: InputMaybe>; - positionImpactPoolDistributionRate_isNull?: InputMaybe; - positionImpactPoolDistributionRate_lt?: InputMaybe; - positionImpactPoolDistributionRate_lte?: InputMaybe; - positionImpactPoolDistributionRate_not_eq?: InputMaybe; - positionImpactPoolDistributionRate_not_in?: InputMaybe>; - reserveFactorLong_eq?: InputMaybe; - reserveFactorLong_gt?: InputMaybe; - reserveFactorLong_gte?: InputMaybe; - reserveFactorLong_in?: InputMaybe>; - reserveFactorLong_isNull?: InputMaybe; - reserveFactorLong_lt?: InputMaybe; - reserveFactorLong_lte?: InputMaybe; - reserveFactorLong_not_eq?: InputMaybe; - reserveFactorLong_not_in?: InputMaybe>; - reserveFactorShort_eq?: InputMaybe; - reserveFactorShort_gt?: InputMaybe; - reserveFactorShort_gte?: InputMaybe; - reserveFactorShort_in?: InputMaybe>; - reserveFactorShort_isNull?: InputMaybe; - reserveFactorShort_lt?: InputMaybe; - reserveFactorShort_lte?: InputMaybe; - reserveFactorShort_not_eq?: InputMaybe; - reserveFactorShort_not_in?: InputMaybe>; - shortOpenInterestInTokensUsingLongToken_eq?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_gt?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_gte?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_in?: InputMaybe>; - shortOpenInterestInTokensUsingLongToken_isNull?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_lt?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_lte?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_not_eq?: InputMaybe; - shortOpenInterestInTokensUsingLongToken_not_in?: InputMaybe>; - shortOpenInterestInTokensUsingShortToken_eq?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_gt?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_gte?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_in?: InputMaybe>; - shortOpenInterestInTokensUsingShortToken_isNull?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_lt?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_lte?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_not_eq?: InputMaybe; - shortOpenInterestInTokensUsingShortToken_not_in?: InputMaybe>; - shortOpenInterestInTokens_eq?: InputMaybe; - shortOpenInterestInTokens_gt?: InputMaybe; - shortOpenInterestInTokens_gte?: InputMaybe; - shortOpenInterestInTokens_in?: InputMaybe>; - shortOpenInterestInTokens_isNull?: InputMaybe; - shortOpenInterestInTokens_lt?: InputMaybe; - shortOpenInterestInTokens_lte?: InputMaybe; - shortOpenInterestInTokens_not_eq?: InputMaybe; - shortOpenInterestInTokens_not_in?: InputMaybe>; - shortOpenInterestUsd_eq?: InputMaybe; - shortOpenInterestUsd_gt?: InputMaybe; - shortOpenInterestUsd_gte?: InputMaybe; - shortOpenInterestUsd_in?: InputMaybe>; - shortOpenInterestUsd_isNull?: InputMaybe; - shortOpenInterestUsd_lt?: InputMaybe; - shortOpenInterestUsd_lte?: InputMaybe; - shortOpenInterestUsd_not_eq?: InputMaybe; - shortOpenInterestUsd_not_in?: InputMaybe>; - shortOpenInterestUsingLongToken_eq?: InputMaybe; - shortOpenInterestUsingLongToken_gt?: InputMaybe; - shortOpenInterestUsingLongToken_gte?: InputMaybe; - shortOpenInterestUsingLongToken_in?: InputMaybe>; - shortOpenInterestUsingLongToken_isNull?: InputMaybe; - shortOpenInterestUsingLongToken_lt?: InputMaybe; - shortOpenInterestUsingLongToken_lte?: InputMaybe; - shortOpenInterestUsingLongToken_not_eq?: InputMaybe; - shortOpenInterestUsingLongToken_not_in?: InputMaybe>; - shortOpenInterestUsingShortToken_eq?: InputMaybe; - shortOpenInterestUsingShortToken_gt?: InputMaybe; - shortOpenInterestUsingShortToken_gte?: InputMaybe; - shortOpenInterestUsingShortToken_in?: InputMaybe>; - shortOpenInterestUsingShortToken_isNull?: InputMaybe; - shortOpenInterestUsingShortToken_lt?: InputMaybe; - shortOpenInterestUsingShortToken_lte?: InputMaybe; - shortOpenInterestUsingShortToken_not_eq?: InputMaybe; - shortOpenInterestUsingShortToken_not_in?: InputMaybe>; - shortPoolAmountAdjustment_eq?: InputMaybe; - shortPoolAmountAdjustment_gt?: InputMaybe; - shortPoolAmountAdjustment_gte?: InputMaybe; - shortPoolAmountAdjustment_in?: InputMaybe>; - shortPoolAmountAdjustment_isNull?: InputMaybe; - shortPoolAmountAdjustment_lt?: InputMaybe; - shortPoolAmountAdjustment_lte?: InputMaybe; - shortPoolAmountAdjustment_not_eq?: InputMaybe; - shortPoolAmountAdjustment_not_in?: InputMaybe>; - shortPoolAmount_eq?: InputMaybe; - shortPoolAmount_gt?: InputMaybe; - shortPoolAmount_gte?: InputMaybe; - shortPoolAmount_in?: InputMaybe>; - shortPoolAmount_isNull?: InputMaybe; - shortPoolAmount_lt?: InputMaybe; - shortPoolAmount_lte?: InputMaybe; - shortPoolAmount_not_eq?: InputMaybe; - shortPoolAmount_not_in?: InputMaybe>; - shortTokenAddress_contains?: InputMaybe; - shortTokenAddress_containsInsensitive?: InputMaybe; - shortTokenAddress_endsWith?: InputMaybe; - shortTokenAddress_eq?: InputMaybe; - shortTokenAddress_gt?: InputMaybe; - shortTokenAddress_gte?: InputMaybe; - shortTokenAddress_in?: InputMaybe>; - shortTokenAddress_isNull?: InputMaybe; - shortTokenAddress_lt?: InputMaybe; - shortTokenAddress_lte?: InputMaybe; - shortTokenAddress_not_contains?: InputMaybe; - shortTokenAddress_not_containsInsensitive?: InputMaybe; - shortTokenAddress_not_endsWith?: InputMaybe; - shortTokenAddress_not_eq?: InputMaybe; - shortTokenAddress_not_in?: InputMaybe>; - shortTokenAddress_not_startsWith?: InputMaybe; - shortTokenAddress_startsWith?: InputMaybe; - swapFeeFactorForNegativeImpact_eq?: InputMaybe; - swapFeeFactorForNegativeImpact_gt?: InputMaybe; - swapFeeFactorForNegativeImpact_gte?: InputMaybe; - swapFeeFactorForNegativeImpact_in?: InputMaybe>; - swapFeeFactorForNegativeImpact_isNull?: InputMaybe; - swapFeeFactorForNegativeImpact_lt?: InputMaybe; - swapFeeFactorForNegativeImpact_lte?: InputMaybe; - swapFeeFactorForNegativeImpact_not_eq?: InputMaybe; - swapFeeFactorForNegativeImpact_not_in?: InputMaybe>; - swapFeeFactorForPositiveImpact_eq?: InputMaybe; - swapFeeFactorForPositiveImpact_gt?: InputMaybe; - swapFeeFactorForPositiveImpact_gte?: InputMaybe; - swapFeeFactorForPositiveImpact_in?: InputMaybe>; - swapFeeFactorForPositiveImpact_isNull?: InputMaybe; - swapFeeFactorForPositiveImpact_lt?: InputMaybe; - swapFeeFactorForPositiveImpact_lte?: InputMaybe; - swapFeeFactorForPositiveImpact_not_eq?: InputMaybe; - swapFeeFactorForPositiveImpact_not_in?: InputMaybe>; - swapImpactExponentFactor_eq?: InputMaybe; - swapImpactExponentFactor_gt?: InputMaybe; - swapImpactExponentFactor_gte?: InputMaybe; - swapImpactExponentFactor_in?: InputMaybe>; - swapImpactExponentFactor_isNull?: InputMaybe; - swapImpactExponentFactor_lt?: InputMaybe; - swapImpactExponentFactor_lte?: InputMaybe; - swapImpactExponentFactor_not_eq?: InputMaybe; - swapImpactExponentFactor_not_in?: InputMaybe>; - swapImpactFactorNegative_eq?: InputMaybe; - swapImpactFactorNegative_gt?: InputMaybe; - swapImpactFactorNegative_gte?: InputMaybe; - swapImpactFactorNegative_in?: InputMaybe>; - swapImpactFactorNegative_isNull?: InputMaybe; - swapImpactFactorNegative_lt?: InputMaybe; - swapImpactFactorNegative_lte?: InputMaybe; - swapImpactFactorNegative_not_eq?: InputMaybe; - swapImpactFactorNegative_not_in?: InputMaybe>; - swapImpactFactorPositive_eq?: InputMaybe; - swapImpactFactorPositive_gt?: InputMaybe; - swapImpactFactorPositive_gte?: InputMaybe; - swapImpactFactorPositive_in?: InputMaybe>; - swapImpactFactorPositive_isNull?: InputMaybe; - swapImpactFactorPositive_lt?: InputMaybe; - swapImpactFactorPositive_lte?: InputMaybe; - swapImpactFactorPositive_not_eq?: InputMaybe; - swapImpactFactorPositive_not_in?: InputMaybe>; - swapImpactPoolAmountLong_eq?: InputMaybe; - swapImpactPoolAmountLong_gt?: InputMaybe; - swapImpactPoolAmountLong_gte?: InputMaybe; - swapImpactPoolAmountLong_in?: InputMaybe>; - swapImpactPoolAmountLong_isNull?: InputMaybe; - swapImpactPoolAmountLong_lt?: InputMaybe; - swapImpactPoolAmountLong_lte?: InputMaybe; - swapImpactPoolAmountLong_not_eq?: InputMaybe; - swapImpactPoolAmountLong_not_in?: InputMaybe>; - swapImpactPoolAmountShort_eq?: InputMaybe; - swapImpactPoolAmountShort_gt?: InputMaybe; - swapImpactPoolAmountShort_gte?: InputMaybe; - swapImpactPoolAmountShort_in?: InputMaybe>; - swapImpactPoolAmountShort_isNull?: InputMaybe; - swapImpactPoolAmountShort_lt?: InputMaybe; - swapImpactPoolAmountShort_lte?: InputMaybe; - swapImpactPoolAmountShort_not_eq?: InputMaybe; - swapImpactPoolAmountShort_not_in?: InputMaybe>; - thresholdForDecreaseFunding_eq?: InputMaybe; - thresholdForDecreaseFunding_gt?: InputMaybe; - thresholdForDecreaseFunding_gte?: InputMaybe; - thresholdForDecreaseFunding_in?: InputMaybe>; - thresholdForDecreaseFunding_isNull?: InputMaybe; - thresholdForDecreaseFunding_lt?: InputMaybe; - thresholdForDecreaseFunding_lte?: InputMaybe; - thresholdForDecreaseFunding_not_eq?: InputMaybe; - thresholdForDecreaseFunding_not_in?: InputMaybe>; - thresholdForStableFunding_eq?: InputMaybe; - thresholdForStableFunding_gt?: InputMaybe; - thresholdForStableFunding_gte?: InputMaybe; - thresholdForStableFunding_in?: InputMaybe>; - thresholdForStableFunding_isNull?: InputMaybe; - thresholdForStableFunding_lt?: InputMaybe; - thresholdForStableFunding_lte?: InputMaybe; - thresholdForStableFunding_not_eq?: InputMaybe; - thresholdForStableFunding_not_in?: InputMaybe>; - totalBorrowingFees_eq?: InputMaybe; - totalBorrowingFees_gt?: InputMaybe; - totalBorrowingFees_gte?: InputMaybe; - totalBorrowingFees_in?: InputMaybe>; - totalBorrowingFees_isNull?: InputMaybe; - totalBorrowingFees_lt?: InputMaybe; - totalBorrowingFees_lte?: InputMaybe; - totalBorrowingFees_not_eq?: InputMaybe; - totalBorrowingFees_not_in?: InputMaybe>; - virtualIndexTokenId_contains?: InputMaybe; - virtualIndexTokenId_containsInsensitive?: InputMaybe; - virtualIndexTokenId_endsWith?: InputMaybe; - virtualIndexTokenId_eq?: InputMaybe; - virtualIndexTokenId_gt?: InputMaybe; - virtualIndexTokenId_gte?: InputMaybe; - virtualIndexTokenId_in?: InputMaybe>; - virtualIndexTokenId_isNull?: InputMaybe; - virtualIndexTokenId_lt?: InputMaybe; - virtualIndexTokenId_lte?: InputMaybe; - virtualIndexTokenId_not_contains?: InputMaybe; - virtualIndexTokenId_not_containsInsensitive?: InputMaybe; - virtualIndexTokenId_not_endsWith?: InputMaybe; - virtualIndexTokenId_not_eq?: InputMaybe; - virtualIndexTokenId_not_in?: InputMaybe>; - virtualIndexTokenId_not_startsWith?: InputMaybe; - virtualIndexTokenId_startsWith?: InputMaybe; - virtualInventoryForPositions_eq?: InputMaybe; - virtualInventoryForPositions_gt?: InputMaybe; - virtualInventoryForPositions_gte?: InputMaybe; - virtualInventoryForPositions_in?: InputMaybe>; - virtualInventoryForPositions_isNull?: InputMaybe; - virtualInventoryForPositions_lt?: InputMaybe; - virtualInventoryForPositions_lte?: InputMaybe; - virtualInventoryForPositions_not_eq?: InputMaybe; - virtualInventoryForPositions_not_in?: InputMaybe>; - virtualLongTokenId_contains?: InputMaybe; - virtualLongTokenId_containsInsensitive?: InputMaybe; - virtualLongTokenId_endsWith?: InputMaybe; - virtualLongTokenId_eq?: InputMaybe; - virtualLongTokenId_gt?: InputMaybe; - virtualLongTokenId_gte?: InputMaybe; - virtualLongTokenId_in?: InputMaybe>; - virtualLongTokenId_isNull?: InputMaybe; - virtualLongTokenId_lt?: InputMaybe; - virtualLongTokenId_lte?: InputMaybe; - virtualLongTokenId_not_contains?: InputMaybe; - virtualLongTokenId_not_containsInsensitive?: InputMaybe; - virtualLongTokenId_not_endsWith?: InputMaybe; - virtualLongTokenId_not_eq?: InputMaybe; - virtualLongTokenId_not_in?: InputMaybe>; - virtualLongTokenId_not_startsWith?: InputMaybe; - virtualLongTokenId_startsWith?: InputMaybe; - virtualMarketId_contains?: InputMaybe; - virtualMarketId_containsInsensitive?: InputMaybe; - virtualMarketId_endsWith?: InputMaybe; - virtualMarketId_eq?: InputMaybe; - virtualMarketId_gt?: InputMaybe; - virtualMarketId_gte?: InputMaybe; - virtualMarketId_in?: InputMaybe>; - virtualMarketId_isNull?: InputMaybe; - virtualMarketId_lt?: InputMaybe; - virtualMarketId_lte?: InputMaybe; - virtualMarketId_not_contains?: InputMaybe; - virtualMarketId_not_containsInsensitive?: InputMaybe; - virtualMarketId_not_endsWith?: InputMaybe; - virtualMarketId_not_eq?: InputMaybe; - virtualMarketId_not_in?: InputMaybe>; - virtualMarketId_not_startsWith?: InputMaybe; - virtualMarketId_startsWith?: InputMaybe; - virtualPoolAmountForLongToken_eq?: InputMaybe; - virtualPoolAmountForLongToken_gt?: InputMaybe; - virtualPoolAmountForLongToken_gte?: InputMaybe; - virtualPoolAmountForLongToken_in?: InputMaybe>; - virtualPoolAmountForLongToken_isNull?: InputMaybe; - virtualPoolAmountForLongToken_lt?: InputMaybe; - virtualPoolAmountForLongToken_lte?: InputMaybe; - virtualPoolAmountForLongToken_not_eq?: InputMaybe; - virtualPoolAmountForLongToken_not_in?: InputMaybe>; - virtualPoolAmountForShortToken_eq?: InputMaybe; - virtualPoolAmountForShortToken_gt?: InputMaybe; - virtualPoolAmountForShortToken_gte?: InputMaybe; - virtualPoolAmountForShortToken_in?: InputMaybe>; - virtualPoolAmountForShortToken_isNull?: InputMaybe; - virtualPoolAmountForShortToken_lt?: InputMaybe; - virtualPoolAmountForShortToken_lte?: InputMaybe; - virtualPoolAmountForShortToken_not_eq?: InputMaybe; - virtualPoolAmountForShortToken_not_in?: InputMaybe>; - virtualShortTokenId_contains?: InputMaybe; - virtualShortTokenId_containsInsensitive?: InputMaybe; - virtualShortTokenId_endsWith?: InputMaybe; - virtualShortTokenId_eq?: InputMaybe; - virtualShortTokenId_gt?: InputMaybe; - virtualShortTokenId_gte?: InputMaybe; - virtualShortTokenId_in?: InputMaybe>; - virtualShortTokenId_isNull?: InputMaybe; - virtualShortTokenId_lt?: InputMaybe; - virtualShortTokenId_lte?: InputMaybe; - virtualShortTokenId_not_contains?: InputMaybe; - virtualShortTokenId_not_containsInsensitive?: InputMaybe; - virtualShortTokenId_not_endsWith?: InputMaybe; - virtualShortTokenId_not_eq?: InputMaybe; - virtualShortTokenId_not_in?: InputMaybe>; - virtualShortTokenId_not_startsWith?: InputMaybe; - virtualShortTokenId_startsWith?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_eq?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_gt?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_gte?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_in?: InputMaybe>; + aboveOptimalUsageBorrowingFactorLong_isNull?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_lt?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_lte?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_not_eq?: InputMaybe; + aboveOptimalUsageBorrowingFactorLong_not_in?: InputMaybe>; + aboveOptimalUsageBorrowingFactorShort_eq?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_gt?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_gte?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_in?: InputMaybe>; + aboveOptimalUsageBorrowingFactorShort_isNull?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_lt?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_lte?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_not_eq?: InputMaybe; + aboveOptimalUsageBorrowingFactorShort_not_in?: InputMaybe>; + atomicSwapFeeFactor_eq?: InputMaybe; + atomicSwapFeeFactor_gt?: InputMaybe; + atomicSwapFeeFactor_gte?: InputMaybe; + atomicSwapFeeFactor_in?: InputMaybe>; + atomicSwapFeeFactor_isNull?: InputMaybe; + atomicSwapFeeFactor_lt?: InputMaybe; + atomicSwapFeeFactor_lte?: InputMaybe; + atomicSwapFeeFactor_not_eq?: InputMaybe; + atomicSwapFeeFactor_not_in?: InputMaybe>; + baseBorrowingFactorLong_eq?: InputMaybe; + baseBorrowingFactorLong_gt?: InputMaybe; + baseBorrowingFactorLong_gte?: InputMaybe; + baseBorrowingFactorLong_in?: InputMaybe>; + baseBorrowingFactorLong_isNull?: InputMaybe; + baseBorrowingFactorLong_lt?: InputMaybe; + baseBorrowingFactorLong_lte?: InputMaybe; + baseBorrowingFactorLong_not_eq?: InputMaybe; + baseBorrowingFactorLong_not_in?: InputMaybe>; + baseBorrowingFactorShort_eq?: InputMaybe; + baseBorrowingFactorShort_gt?: InputMaybe; + baseBorrowingFactorShort_gte?: InputMaybe; + baseBorrowingFactorShort_in?: InputMaybe>; + baseBorrowingFactorShort_isNull?: InputMaybe; + baseBorrowingFactorShort_lt?: InputMaybe; + baseBorrowingFactorShort_lte?: InputMaybe; + baseBorrowingFactorShort_not_eq?: InputMaybe; + baseBorrowingFactorShort_not_in?: InputMaybe>; + borrowingExponentFactorLong_eq?: InputMaybe; + borrowingExponentFactorLong_gt?: InputMaybe; + borrowingExponentFactorLong_gte?: InputMaybe; + borrowingExponentFactorLong_in?: InputMaybe>; + borrowingExponentFactorLong_isNull?: InputMaybe; + borrowingExponentFactorLong_lt?: InputMaybe; + borrowingExponentFactorLong_lte?: InputMaybe; + borrowingExponentFactorLong_not_eq?: InputMaybe; + borrowingExponentFactorLong_not_in?: InputMaybe>; + borrowingExponentFactorShort_eq?: InputMaybe; + borrowingExponentFactorShort_gt?: InputMaybe; + borrowingExponentFactorShort_gte?: InputMaybe; + borrowingExponentFactorShort_in?: InputMaybe>; + borrowingExponentFactorShort_isNull?: InputMaybe; + borrowingExponentFactorShort_lt?: InputMaybe; + borrowingExponentFactorShort_lte?: InputMaybe; + borrowingExponentFactorShort_not_eq?: InputMaybe; + borrowingExponentFactorShort_not_in?: InputMaybe>; + borrowingFactorLong_eq?: InputMaybe; + borrowingFactorLong_gt?: InputMaybe; + borrowingFactorLong_gte?: InputMaybe; + borrowingFactorLong_in?: InputMaybe>; + borrowingFactorLong_isNull?: InputMaybe; + borrowingFactorLong_lt?: InputMaybe; + borrowingFactorLong_lte?: InputMaybe; + borrowingFactorLong_not_eq?: InputMaybe; + borrowingFactorLong_not_in?: InputMaybe>; + borrowingFactorPerSecondForLongs_eq?: InputMaybe; + borrowingFactorPerSecondForLongs_gt?: InputMaybe; + borrowingFactorPerSecondForLongs_gte?: InputMaybe; + borrowingFactorPerSecondForLongs_in?: InputMaybe>; + borrowingFactorPerSecondForLongs_isNull?: InputMaybe; + borrowingFactorPerSecondForLongs_lt?: InputMaybe; + borrowingFactorPerSecondForLongs_lte?: InputMaybe; + borrowingFactorPerSecondForLongs_not_eq?: InputMaybe; + borrowingFactorPerSecondForLongs_not_in?: InputMaybe>; + borrowingFactorPerSecondForShorts_eq?: InputMaybe; + borrowingFactorPerSecondForShorts_gt?: InputMaybe; + borrowingFactorPerSecondForShorts_gte?: InputMaybe; + borrowingFactorPerSecondForShorts_in?: InputMaybe>; + borrowingFactorPerSecondForShorts_isNull?: InputMaybe; + borrowingFactorPerSecondForShorts_lt?: InputMaybe; + borrowingFactorPerSecondForShorts_lte?: InputMaybe; + borrowingFactorPerSecondForShorts_not_eq?: InputMaybe; + borrowingFactorPerSecondForShorts_not_in?: InputMaybe>; + borrowingFactorShort_eq?: InputMaybe; + borrowingFactorShort_gt?: InputMaybe; + borrowingFactorShort_gte?: InputMaybe; + borrowingFactorShort_in?: InputMaybe>; + borrowingFactorShort_isNull?: InputMaybe; + borrowingFactorShort_lt?: InputMaybe; + borrowingFactorShort_lte?: InputMaybe; + borrowingFactorShort_not_eq?: InputMaybe; + borrowingFactorShort_not_in?: InputMaybe>; + fundingDecreaseFactorPerSecond_eq?: InputMaybe; + fundingDecreaseFactorPerSecond_gt?: InputMaybe; + fundingDecreaseFactorPerSecond_gte?: InputMaybe; + fundingDecreaseFactorPerSecond_in?: InputMaybe>; + fundingDecreaseFactorPerSecond_isNull?: InputMaybe; + fundingDecreaseFactorPerSecond_lt?: InputMaybe; + fundingDecreaseFactorPerSecond_lte?: InputMaybe; + fundingDecreaseFactorPerSecond_not_eq?: InputMaybe; + fundingDecreaseFactorPerSecond_not_in?: InputMaybe>; + fundingExponentFactor_eq?: InputMaybe; + fundingExponentFactor_gt?: InputMaybe; + fundingExponentFactor_gte?: InputMaybe; + fundingExponentFactor_in?: InputMaybe>; + fundingExponentFactor_isNull?: InputMaybe; + fundingExponentFactor_lt?: InputMaybe; + fundingExponentFactor_lte?: InputMaybe; + fundingExponentFactor_not_eq?: InputMaybe; + fundingExponentFactor_not_in?: InputMaybe>; + fundingFactorPerSecond_eq?: InputMaybe; + fundingFactorPerSecond_gt?: InputMaybe; + fundingFactorPerSecond_gte?: InputMaybe; + fundingFactorPerSecond_in?: InputMaybe>; + fundingFactorPerSecond_isNull?: InputMaybe; + fundingFactorPerSecond_lt?: InputMaybe; + fundingFactorPerSecond_lte?: InputMaybe; + fundingFactorPerSecond_not_eq?: InputMaybe; + fundingFactorPerSecond_not_in?: InputMaybe>; + fundingFactor_eq?: InputMaybe; + fundingFactor_gt?: InputMaybe; + fundingFactor_gte?: InputMaybe; + fundingFactor_in?: InputMaybe>; + fundingFactor_isNull?: InputMaybe; + fundingFactor_lt?: InputMaybe; + fundingFactor_lte?: InputMaybe; + fundingFactor_not_eq?: InputMaybe; + fundingFactor_not_in?: InputMaybe>; + fundingIncreaseFactorPerSecond_eq?: InputMaybe; + fundingIncreaseFactorPerSecond_gt?: InputMaybe; + fundingIncreaseFactorPerSecond_gte?: InputMaybe; + fundingIncreaseFactorPerSecond_in?: InputMaybe>; + fundingIncreaseFactorPerSecond_isNull?: InputMaybe; + fundingIncreaseFactorPerSecond_lt?: InputMaybe; + fundingIncreaseFactorPerSecond_lte?: InputMaybe; + fundingIncreaseFactorPerSecond_not_eq?: InputMaybe; + fundingIncreaseFactorPerSecond_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + indexTokenAddress_contains?: InputMaybe; + indexTokenAddress_containsInsensitive?: InputMaybe; + indexTokenAddress_endsWith?: InputMaybe; + indexTokenAddress_eq?: InputMaybe; + indexTokenAddress_gt?: InputMaybe; + indexTokenAddress_gte?: InputMaybe; + indexTokenAddress_in?: InputMaybe>; + indexTokenAddress_isNull?: InputMaybe; + indexTokenAddress_lt?: InputMaybe; + indexTokenAddress_lte?: InputMaybe; + indexTokenAddress_not_contains?: InputMaybe; + indexTokenAddress_not_containsInsensitive?: InputMaybe; + indexTokenAddress_not_endsWith?: InputMaybe; + indexTokenAddress_not_eq?: InputMaybe; + indexTokenAddress_not_in?: InputMaybe>; + indexTokenAddress_not_startsWith?: InputMaybe; + indexTokenAddress_startsWith?: InputMaybe; + isDisabled_eq?: InputMaybe; + isDisabled_isNull?: InputMaybe; + isDisabled_not_eq?: InputMaybe; + lentPositionImpactPoolAmount_eq?: InputMaybe; + lentPositionImpactPoolAmount_gt?: InputMaybe; + lentPositionImpactPoolAmount_gte?: InputMaybe; + lentPositionImpactPoolAmount_in?: InputMaybe>; + lentPositionImpactPoolAmount_isNull?: InputMaybe; + lentPositionImpactPoolAmount_lt?: InputMaybe; + lentPositionImpactPoolAmount_lte?: InputMaybe; + lentPositionImpactPoolAmount_not_eq?: InputMaybe; + lentPositionImpactPoolAmount_not_in?: InputMaybe>; + longOpenInterestInTokensUsingLongToken_eq?: InputMaybe; + longOpenInterestInTokensUsingLongToken_gt?: InputMaybe; + longOpenInterestInTokensUsingLongToken_gte?: InputMaybe; + longOpenInterestInTokensUsingLongToken_in?: InputMaybe>; + longOpenInterestInTokensUsingLongToken_isNull?: InputMaybe; + longOpenInterestInTokensUsingLongToken_lt?: InputMaybe; + longOpenInterestInTokensUsingLongToken_lte?: InputMaybe; + longOpenInterestInTokensUsingLongToken_not_eq?: InputMaybe; + longOpenInterestInTokensUsingLongToken_not_in?: InputMaybe>; + longOpenInterestInTokensUsingShortToken_eq?: InputMaybe; + longOpenInterestInTokensUsingShortToken_gt?: InputMaybe; + longOpenInterestInTokensUsingShortToken_gte?: InputMaybe; + longOpenInterestInTokensUsingShortToken_in?: InputMaybe>; + longOpenInterestInTokensUsingShortToken_isNull?: InputMaybe; + longOpenInterestInTokensUsingShortToken_lt?: InputMaybe; + longOpenInterestInTokensUsingShortToken_lte?: InputMaybe; + longOpenInterestInTokensUsingShortToken_not_eq?: InputMaybe; + longOpenInterestInTokensUsingShortToken_not_in?: InputMaybe>; + longOpenInterestInTokens_eq?: InputMaybe; + longOpenInterestInTokens_gt?: InputMaybe; + longOpenInterestInTokens_gte?: InputMaybe; + longOpenInterestInTokens_in?: InputMaybe>; + longOpenInterestInTokens_isNull?: InputMaybe; + longOpenInterestInTokens_lt?: InputMaybe; + longOpenInterestInTokens_lte?: InputMaybe; + longOpenInterestInTokens_not_eq?: InputMaybe; + longOpenInterestInTokens_not_in?: InputMaybe>; + longOpenInterestUsd_eq?: InputMaybe; + longOpenInterestUsd_gt?: InputMaybe; + longOpenInterestUsd_gte?: InputMaybe; + longOpenInterestUsd_in?: InputMaybe>; + longOpenInterestUsd_isNull?: InputMaybe; + longOpenInterestUsd_lt?: InputMaybe; + longOpenInterestUsd_lte?: InputMaybe; + longOpenInterestUsd_not_eq?: InputMaybe; + longOpenInterestUsd_not_in?: InputMaybe>; + longOpenInterestUsingLongToken_eq?: InputMaybe; + longOpenInterestUsingLongToken_gt?: InputMaybe; + longOpenInterestUsingLongToken_gte?: InputMaybe; + longOpenInterestUsingLongToken_in?: InputMaybe>; + longOpenInterestUsingLongToken_isNull?: InputMaybe; + longOpenInterestUsingLongToken_lt?: InputMaybe; + longOpenInterestUsingLongToken_lte?: InputMaybe; + longOpenInterestUsingLongToken_not_eq?: InputMaybe; + longOpenInterestUsingLongToken_not_in?: InputMaybe>; + longOpenInterestUsingShortToken_eq?: InputMaybe; + longOpenInterestUsingShortToken_gt?: InputMaybe; + longOpenInterestUsingShortToken_gte?: InputMaybe; + longOpenInterestUsingShortToken_in?: InputMaybe>; + longOpenInterestUsingShortToken_isNull?: InputMaybe; + longOpenInterestUsingShortToken_lt?: InputMaybe; + longOpenInterestUsingShortToken_lte?: InputMaybe; + longOpenInterestUsingShortToken_not_eq?: InputMaybe; + longOpenInterestUsingShortToken_not_in?: InputMaybe>; + longPoolAmount_eq?: InputMaybe; + longPoolAmount_gt?: InputMaybe; + longPoolAmount_gte?: InputMaybe; + longPoolAmount_in?: InputMaybe>; + longPoolAmount_isNull?: InputMaybe; + longPoolAmount_lt?: InputMaybe; + longPoolAmount_lte?: InputMaybe; + longPoolAmount_not_eq?: InputMaybe; + longPoolAmount_not_in?: InputMaybe>; + longTokenAddress_contains?: InputMaybe; + longTokenAddress_containsInsensitive?: InputMaybe; + longTokenAddress_endsWith?: InputMaybe; + longTokenAddress_eq?: InputMaybe; + longTokenAddress_gt?: InputMaybe; + longTokenAddress_gte?: InputMaybe; + longTokenAddress_in?: InputMaybe>; + longTokenAddress_isNull?: InputMaybe; + longTokenAddress_lt?: InputMaybe; + longTokenAddress_lte?: InputMaybe; + longTokenAddress_not_contains?: InputMaybe; + longTokenAddress_not_containsInsensitive?: InputMaybe; + longTokenAddress_not_endsWith?: InputMaybe; + longTokenAddress_not_eq?: InputMaybe; + longTokenAddress_not_in?: InputMaybe>; + longTokenAddress_not_startsWith?: InputMaybe; + longTokenAddress_startsWith?: InputMaybe; + longsPayShorts_eq?: InputMaybe; + longsPayShorts_isNull?: InputMaybe; + longsPayShorts_not_eq?: InputMaybe; + marketTokenAddress_contains?: InputMaybe; + marketTokenAddress_containsInsensitive?: InputMaybe; + marketTokenAddress_endsWith?: InputMaybe; + marketTokenAddress_eq?: InputMaybe; + marketTokenAddress_gt?: InputMaybe; + marketTokenAddress_gte?: InputMaybe; + marketTokenAddress_in?: InputMaybe>; + marketTokenAddress_isNull?: InputMaybe; + marketTokenAddress_lt?: InputMaybe; + marketTokenAddress_lte?: InputMaybe; + marketTokenAddress_not_contains?: InputMaybe; + marketTokenAddress_not_containsInsensitive?: InputMaybe; + marketTokenAddress_not_endsWith?: InputMaybe; + marketTokenAddress_not_eq?: InputMaybe; + marketTokenAddress_not_in?: InputMaybe>; + marketTokenAddress_not_startsWith?: InputMaybe; + marketTokenAddress_startsWith?: InputMaybe; + marketTokenSupply_eq?: InputMaybe; + marketTokenSupply_gt?: InputMaybe; + marketTokenSupply_gte?: InputMaybe; + marketTokenSupply_in?: InputMaybe>; + marketTokenSupply_isNull?: InputMaybe; + marketTokenSupply_lt?: InputMaybe; + marketTokenSupply_lte?: InputMaybe; + marketTokenSupply_not_eq?: InputMaybe; + marketTokenSupply_not_in?: InputMaybe>; + maxFundingFactorPerSecond_eq?: InputMaybe; + maxFundingFactorPerSecond_gt?: InputMaybe; + maxFundingFactorPerSecond_gte?: InputMaybe; + maxFundingFactorPerSecond_in?: InputMaybe>; + maxFundingFactorPerSecond_isNull?: InputMaybe; + maxFundingFactorPerSecond_lt?: InputMaybe; + maxFundingFactorPerSecond_lte?: InputMaybe; + maxFundingFactorPerSecond_not_eq?: InputMaybe; + maxFundingFactorPerSecond_not_in?: InputMaybe>; + maxLendableImpactFactorForWithdrawals_eq?: InputMaybe; + maxLendableImpactFactorForWithdrawals_gt?: InputMaybe; + maxLendableImpactFactorForWithdrawals_gte?: InputMaybe; + maxLendableImpactFactorForWithdrawals_in?: InputMaybe>; + maxLendableImpactFactorForWithdrawals_isNull?: InputMaybe; + maxLendableImpactFactorForWithdrawals_lt?: InputMaybe; + maxLendableImpactFactorForWithdrawals_lte?: InputMaybe; + maxLendableImpactFactorForWithdrawals_not_eq?: InputMaybe; + maxLendableImpactFactorForWithdrawals_not_in?: InputMaybe>; + maxLendableImpactFactor_eq?: InputMaybe; + maxLendableImpactFactor_gt?: InputMaybe; + maxLendableImpactFactor_gte?: InputMaybe; + maxLendableImpactFactor_in?: InputMaybe>; + maxLendableImpactFactor_isNull?: InputMaybe; + maxLendableImpactFactor_lt?: InputMaybe; + maxLendableImpactFactor_lte?: InputMaybe; + maxLendableImpactFactor_not_eq?: InputMaybe; + maxLendableImpactFactor_not_in?: InputMaybe>; + maxLendableImpactUsd_eq?: InputMaybe; + maxLendableImpactUsd_gt?: InputMaybe; + maxLendableImpactUsd_gte?: InputMaybe; + maxLendableImpactUsd_in?: InputMaybe>; + maxLendableImpactUsd_isNull?: InputMaybe; + maxLendableImpactUsd_lt?: InputMaybe; + maxLendableImpactUsd_lte?: InputMaybe; + maxLendableImpactUsd_not_eq?: InputMaybe; + maxLendableImpactUsd_not_in?: InputMaybe>; + maxLongPoolAmount_eq?: InputMaybe; + maxLongPoolAmount_gt?: InputMaybe; + maxLongPoolAmount_gte?: InputMaybe; + maxLongPoolAmount_in?: InputMaybe>; + maxLongPoolAmount_isNull?: InputMaybe; + maxLongPoolAmount_lt?: InputMaybe; + maxLongPoolAmount_lte?: InputMaybe; + maxLongPoolAmount_not_eq?: InputMaybe; + maxLongPoolAmount_not_in?: InputMaybe>; + maxLongPoolUsdForDeposit_eq?: InputMaybe; + maxLongPoolUsdForDeposit_gt?: InputMaybe; + maxLongPoolUsdForDeposit_gte?: InputMaybe; + maxLongPoolUsdForDeposit_in?: InputMaybe>; + maxLongPoolUsdForDeposit_isNull?: InputMaybe; + maxLongPoolUsdForDeposit_lt?: InputMaybe; + maxLongPoolUsdForDeposit_lte?: InputMaybe; + maxLongPoolUsdForDeposit_not_eq?: InputMaybe; + maxLongPoolUsdForDeposit_not_in?: InputMaybe>; + maxOpenInterestLong_eq?: InputMaybe; + maxOpenInterestLong_gt?: InputMaybe; + maxOpenInterestLong_gte?: InputMaybe; + maxOpenInterestLong_in?: InputMaybe>; + maxOpenInterestLong_isNull?: InputMaybe; + maxOpenInterestLong_lt?: InputMaybe; + maxOpenInterestLong_lte?: InputMaybe; + maxOpenInterestLong_not_eq?: InputMaybe; + maxOpenInterestLong_not_in?: InputMaybe>; + maxOpenInterestShort_eq?: InputMaybe; + maxOpenInterestShort_gt?: InputMaybe; + maxOpenInterestShort_gte?: InputMaybe; + maxOpenInterestShort_in?: InputMaybe>; + maxOpenInterestShort_isNull?: InputMaybe; + maxOpenInterestShort_lt?: InputMaybe; + maxOpenInterestShort_lte?: InputMaybe; + maxOpenInterestShort_not_eq?: InputMaybe; + maxOpenInterestShort_not_in?: InputMaybe>; + maxPnlFactorForTradersLong_eq?: InputMaybe; + maxPnlFactorForTradersLong_gt?: InputMaybe; + maxPnlFactorForTradersLong_gte?: InputMaybe; + maxPnlFactorForTradersLong_in?: InputMaybe>; + maxPnlFactorForTradersLong_isNull?: InputMaybe; + maxPnlFactorForTradersLong_lt?: InputMaybe; + maxPnlFactorForTradersLong_lte?: InputMaybe; + maxPnlFactorForTradersLong_not_eq?: InputMaybe; + maxPnlFactorForTradersLong_not_in?: InputMaybe>; + maxPnlFactorForTradersShort_eq?: InputMaybe; + maxPnlFactorForTradersShort_gt?: InputMaybe; + maxPnlFactorForTradersShort_gte?: InputMaybe; + maxPnlFactorForTradersShort_in?: InputMaybe>; + maxPnlFactorForTradersShort_isNull?: InputMaybe; + maxPnlFactorForTradersShort_lt?: InputMaybe; + maxPnlFactorForTradersShort_lte?: InputMaybe; + maxPnlFactorForTradersShort_not_eq?: InputMaybe; + maxPnlFactorForTradersShort_not_in?: InputMaybe>; + maxPositionImpactFactorForLiquidations_eq?: InputMaybe; + maxPositionImpactFactorForLiquidations_gt?: InputMaybe; + maxPositionImpactFactorForLiquidations_gte?: InputMaybe; + maxPositionImpactFactorForLiquidations_in?: InputMaybe>; + maxPositionImpactFactorForLiquidations_isNull?: InputMaybe; + maxPositionImpactFactorForLiquidations_lt?: InputMaybe; + maxPositionImpactFactorForLiquidations_lte?: InputMaybe; + maxPositionImpactFactorForLiquidations_not_eq?: InputMaybe; + maxPositionImpactFactorForLiquidations_not_in?: InputMaybe>; + maxPositionImpactFactorNegative_eq?: InputMaybe; + maxPositionImpactFactorNegative_gt?: InputMaybe; + maxPositionImpactFactorNegative_gte?: InputMaybe; + maxPositionImpactFactorNegative_in?: InputMaybe>; + maxPositionImpactFactorNegative_isNull?: InputMaybe; + maxPositionImpactFactorNegative_lt?: InputMaybe; + maxPositionImpactFactorNegative_lte?: InputMaybe; + maxPositionImpactFactorNegative_not_eq?: InputMaybe; + maxPositionImpactFactorNegative_not_in?: InputMaybe>; + maxPositionImpactFactorPositive_eq?: InputMaybe; + maxPositionImpactFactorPositive_gt?: InputMaybe; + maxPositionImpactFactorPositive_gte?: InputMaybe; + maxPositionImpactFactorPositive_in?: InputMaybe>; + maxPositionImpactFactorPositive_isNull?: InputMaybe; + maxPositionImpactFactorPositive_lt?: InputMaybe; + maxPositionImpactFactorPositive_lte?: InputMaybe; + maxPositionImpactFactorPositive_not_eq?: InputMaybe; + maxPositionImpactFactorPositive_not_in?: InputMaybe>; + maxShortPoolAmount_eq?: InputMaybe; + maxShortPoolAmount_gt?: InputMaybe; + maxShortPoolAmount_gte?: InputMaybe; + maxShortPoolAmount_in?: InputMaybe>; + maxShortPoolAmount_isNull?: InputMaybe; + maxShortPoolAmount_lt?: InputMaybe; + maxShortPoolAmount_lte?: InputMaybe; + maxShortPoolAmount_not_eq?: InputMaybe; + maxShortPoolAmount_not_in?: InputMaybe>; + maxShortPoolUsdForDeposit_eq?: InputMaybe; + maxShortPoolUsdForDeposit_gt?: InputMaybe; + maxShortPoolUsdForDeposit_gte?: InputMaybe; + maxShortPoolUsdForDeposit_in?: InputMaybe>; + maxShortPoolUsdForDeposit_isNull?: InputMaybe; + maxShortPoolUsdForDeposit_lt?: InputMaybe; + maxShortPoolUsdForDeposit_lte?: InputMaybe; + maxShortPoolUsdForDeposit_not_eq?: InputMaybe; + maxShortPoolUsdForDeposit_not_in?: InputMaybe>; + minCollateralFactorForOpenInterestLong_eq?: InputMaybe; + minCollateralFactorForOpenInterestLong_gt?: InputMaybe; + minCollateralFactorForOpenInterestLong_gte?: InputMaybe; + minCollateralFactorForOpenInterestLong_in?: InputMaybe>; + minCollateralFactorForOpenInterestLong_isNull?: InputMaybe; + minCollateralFactorForOpenInterestLong_lt?: InputMaybe; + minCollateralFactorForOpenInterestLong_lte?: InputMaybe; + minCollateralFactorForOpenInterestLong_not_eq?: InputMaybe; + minCollateralFactorForOpenInterestLong_not_in?: InputMaybe>; + minCollateralFactorForOpenInterestShort_eq?: InputMaybe; + minCollateralFactorForOpenInterestShort_gt?: InputMaybe; + minCollateralFactorForOpenInterestShort_gte?: InputMaybe; + minCollateralFactorForOpenInterestShort_in?: InputMaybe>; + minCollateralFactorForOpenInterestShort_isNull?: InputMaybe; + minCollateralFactorForOpenInterestShort_lt?: InputMaybe; + minCollateralFactorForOpenInterestShort_lte?: InputMaybe; + minCollateralFactorForOpenInterestShort_not_eq?: InputMaybe; + minCollateralFactorForOpenInterestShort_not_in?: InputMaybe>; + minCollateralFactor_eq?: InputMaybe; + minCollateralFactor_gt?: InputMaybe; + minCollateralFactor_gte?: InputMaybe; + minCollateralFactor_in?: InputMaybe>; + minCollateralFactor_isNull?: InputMaybe; + minCollateralFactor_lt?: InputMaybe; + minCollateralFactor_lte?: InputMaybe; + minCollateralFactor_not_eq?: InputMaybe; + minCollateralFactor_not_in?: InputMaybe>; + minFundingFactorPerSecond_eq?: InputMaybe; + minFundingFactorPerSecond_gt?: InputMaybe; + minFundingFactorPerSecond_gte?: InputMaybe; + minFundingFactorPerSecond_in?: InputMaybe>; + minFundingFactorPerSecond_isNull?: InputMaybe; + minFundingFactorPerSecond_lt?: InputMaybe; + minFundingFactorPerSecond_lte?: InputMaybe; + minFundingFactorPerSecond_not_eq?: InputMaybe; + minFundingFactorPerSecond_not_in?: InputMaybe>; + minPositionImpactPoolAmount_eq?: InputMaybe; + minPositionImpactPoolAmount_gt?: InputMaybe; + minPositionImpactPoolAmount_gte?: InputMaybe; + minPositionImpactPoolAmount_in?: InputMaybe>; + minPositionImpactPoolAmount_isNull?: InputMaybe; + minPositionImpactPoolAmount_lt?: InputMaybe; + minPositionImpactPoolAmount_lte?: InputMaybe; + minPositionImpactPoolAmount_not_eq?: InputMaybe; + minPositionImpactPoolAmount_not_in?: InputMaybe>; + openInterestReserveFactorLong_eq?: InputMaybe; + openInterestReserveFactorLong_gt?: InputMaybe; + openInterestReserveFactorLong_gte?: InputMaybe; + openInterestReserveFactorLong_in?: InputMaybe>; + openInterestReserveFactorLong_isNull?: InputMaybe; + openInterestReserveFactorLong_lt?: InputMaybe; + openInterestReserveFactorLong_lte?: InputMaybe; + openInterestReserveFactorLong_not_eq?: InputMaybe; + openInterestReserveFactorLong_not_in?: InputMaybe>; + openInterestReserveFactorShort_eq?: InputMaybe; + openInterestReserveFactorShort_gt?: InputMaybe; + openInterestReserveFactorShort_gte?: InputMaybe; + openInterestReserveFactorShort_in?: InputMaybe>; + openInterestReserveFactorShort_isNull?: InputMaybe; + openInterestReserveFactorShort_lt?: InputMaybe; + openInterestReserveFactorShort_lte?: InputMaybe; + openInterestReserveFactorShort_not_eq?: InputMaybe; + openInterestReserveFactorShort_not_in?: InputMaybe>; + optimalUsageFactorLong_eq?: InputMaybe; + optimalUsageFactorLong_gt?: InputMaybe; + optimalUsageFactorLong_gte?: InputMaybe; + optimalUsageFactorLong_in?: InputMaybe>; + optimalUsageFactorLong_isNull?: InputMaybe; + optimalUsageFactorLong_lt?: InputMaybe; + optimalUsageFactorLong_lte?: InputMaybe; + optimalUsageFactorLong_not_eq?: InputMaybe; + optimalUsageFactorLong_not_in?: InputMaybe>; + optimalUsageFactorShort_eq?: InputMaybe; + optimalUsageFactorShort_gt?: InputMaybe; + optimalUsageFactorShort_gte?: InputMaybe; + optimalUsageFactorShort_in?: InputMaybe>; + optimalUsageFactorShort_isNull?: InputMaybe; + optimalUsageFactorShort_lt?: InputMaybe; + optimalUsageFactorShort_lte?: InputMaybe; + optimalUsageFactorShort_not_eq?: InputMaybe; + optimalUsageFactorShort_not_in?: InputMaybe>; + poolValueMax_eq?: InputMaybe; + poolValueMax_gt?: InputMaybe; + poolValueMax_gte?: InputMaybe; + poolValueMax_in?: InputMaybe>; + poolValueMax_isNull?: InputMaybe; + poolValueMax_lt?: InputMaybe; + poolValueMax_lte?: InputMaybe; + poolValueMax_not_eq?: InputMaybe; + poolValueMax_not_in?: InputMaybe>; + poolValueMin_eq?: InputMaybe; + poolValueMin_gt?: InputMaybe; + poolValueMin_gte?: InputMaybe; + poolValueMin_in?: InputMaybe>; + poolValueMin_isNull?: InputMaybe; + poolValueMin_lt?: InputMaybe; + poolValueMin_lte?: InputMaybe; + poolValueMin_not_eq?: InputMaybe; + poolValueMin_not_in?: InputMaybe>; + poolValue_eq?: InputMaybe; + poolValue_gt?: InputMaybe; + poolValue_gte?: InputMaybe; + poolValue_in?: InputMaybe>; + poolValue_isNull?: InputMaybe; + poolValue_lt?: InputMaybe; + poolValue_lte?: InputMaybe; + poolValue_not_eq?: InputMaybe; + poolValue_not_in?: InputMaybe>; + positionFeeFactorForNegativeImpact_eq?: InputMaybe; + positionFeeFactorForNegativeImpact_gt?: InputMaybe; + positionFeeFactorForNegativeImpact_gte?: InputMaybe; + positionFeeFactorForNegativeImpact_in?: InputMaybe>; + positionFeeFactorForNegativeImpact_isNull?: InputMaybe; + positionFeeFactorForNegativeImpact_lt?: InputMaybe; + positionFeeFactorForNegativeImpact_lte?: InputMaybe; + positionFeeFactorForNegativeImpact_not_eq?: InputMaybe; + positionFeeFactorForNegativeImpact_not_in?: InputMaybe>; + positionFeeFactorForPositiveImpact_eq?: InputMaybe; + positionFeeFactorForPositiveImpact_gt?: InputMaybe; + positionFeeFactorForPositiveImpact_gte?: InputMaybe; + positionFeeFactorForPositiveImpact_in?: InputMaybe>; + positionFeeFactorForPositiveImpact_isNull?: InputMaybe; + positionFeeFactorForPositiveImpact_lt?: InputMaybe; + positionFeeFactorForPositiveImpact_lte?: InputMaybe; + positionFeeFactorForPositiveImpact_not_eq?: InputMaybe; + positionFeeFactorForPositiveImpact_not_in?: InputMaybe>; + positionImpactExponentFactor_eq?: InputMaybe; + positionImpactExponentFactor_gt?: InputMaybe; + positionImpactExponentFactor_gte?: InputMaybe; + positionImpactExponentFactor_in?: InputMaybe>; + positionImpactExponentFactor_isNull?: InputMaybe; + positionImpactExponentFactor_lt?: InputMaybe; + positionImpactExponentFactor_lte?: InputMaybe; + positionImpactExponentFactor_not_eq?: InputMaybe; + positionImpactExponentFactor_not_in?: InputMaybe>; + positionImpactFactorNegative_eq?: InputMaybe; + positionImpactFactorNegative_gt?: InputMaybe; + positionImpactFactorNegative_gte?: InputMaybe; + positionImpactFactorNegative_in?: InputMaybe>; + positionImpactFactorNegative_isNull?: InputMaybe; + positionImpactFactorNegative_lt?: InputMaybe; + positionImpactFactorNegative_lte?: InputMaybe; + positionImpactFactorNegative_not_eq?: InputMaybe; + positionImpactFactorNegative_not_in?: InputMaybe>; + positionImpactFactorPositive_eq?: InputMaybe; + positionImpactFactorPositive_gt?: InputMaybe; + positionImpactFactorPositive_gte?: InputMaybe; + positionImpactFactorPositive_in?: InputMaybe>; + positionImpactFactorPositive_isNull?: InputMaybe; + positionImpactFactorPositive_lt?: InputMaybe; + positionImpactFactorPositive_lte?: InputMaybe; + positionImpactFactorPositive_not_eq?: InputMaybe; + positionImpactFactorPositive_not_in?: InputMaybe>; + positionImpactPoolAmount_eq?: InputMaybe; + positionImpactPoolAmount_gt?: InputMaybe; + positionImpactPoolAmount_gte?: InputMaybe; + positionImpactPoolAmount_in?: InputMaybe>; + positionImpactPoolAmount_isNull?: InputMaybe; + positionImpactPoolAmount_lt?: InputMaybe; + positionImpactPoolAmount_lte?: InputMaybe; + positionImpactPoolAmount_not_eq?: InputMaybe; + positionImpactPoolAmount_not_in?: InputMaybe>; + positionImpactPoolDistributionRate_eq?: InputMaybe; + positionImpactPoolDistributionRate_gt?: InputMaybe; + positionImpactPoolDistributionRate_gte?: InputMaybe; + positionImpactPoolDistributionRate_in?: InputMaybe>; + positionImpactPoolDistributionRate_isNull?: InputMaybe; + positionImpactPoolDistributionRate_lt?: InputMaybe; + positionImpactPoolDistributionRate_lte?: InputMaybe; + positionImpactPoolDistributionRate_not_eq?: InputMaybe; + positionImpactPoolDistributionRate_not_in?: InputMaybe>; + reserveFactorLong_eq?: InputMaybe; + reserveFactorLong_gt?: InputMaybe; + reserveFactorLong_gte?: InputMaybe; + reserveFactorLong_in?: InputMaybe>; + reserveFactorLong_isNull?: InputMaybe; + reserveFactorLong_lt?: InputMaybe; + reserveFactorLong_lte?: InputMaybe; + reserveFactorLong_not_eq?: InputMaybe; + reserveFactorLong_not_in?: InputMaybe>; + reserveFactorShort_eq?: InputMaybe; + reserveFactorShort_gt?: InputMaybe; + reserveFactorShort_gte?: InputMaybe; + reserveFactorShort_in?: InputMaybe>; + reserveFactorShort_isNull?: InputMaybe; + reserveFactorShort_lt?: InputMaybe; + reserveFactorShort_lte?: InputMaybe; + reserveFactorShort_not_eq?: InputMaybe; + reserveFactorShort_not_in?: InputMaybe>; + shortOpenInterestInTokensUsingLongToken_eq?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_gt?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_gte?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_in?: InputMaybe>; + shortOpenInterestInTokensUsingLongToken_isNull?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_lt?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_lte?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_not_eq?: InputMaybe; + shortOpenInterestInTokensUsingLongToken_not_in?: InputMaybe>; + shortOpenInterestInTokensUsingShortToken_eq?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_gt?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_gte?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_in?: InputMaybe>; + shortOpenInterestInTokensUsingShortToken_isNull?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_lt?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_lte?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_not_eq?: InputMaybe; + shortOpenInterestInTokensUsingShortToken_not_in?: InputMaybe>; + shortOpenInterestInTokens_eq?: InputMaybe; + shortOpenInterestInTokens_gt?: InputMaybe; + shortOpenInterestInTokens_gte?: InputMaybe; + shortOpenInterestInTokens_in?: InputMaybe>; + shortOpenInterestInTokens_isNull?: InputMaybe; + shortOpenInterestInTokens_lt?: InputMaybe; + shortOpenInterestInTokens_lte?: InputMaybe; + shortOpenInterestInTokens_not_eq?: InputMaybe; + shortOpenInterestInTokens_not_in?: InputMaybe>; + shortOpenInterestUsd_eq?: InputMaybe; + shortOpenInterestUsd_gt?: InputMaybe; + shortOpenInterestUsd_gte?: InputMaybe; + shortOpenInterestUsd_in?: InputMaybe>; + shortOpenInterestUsd_isNull?: InputMaybe; + shortOpenInterestUsd_lt?: InputMaybe; + shortOpenInterestUsd_lte?: InputMaybe; + shortOpenInterestUsd_not_eq?: InputMaybe; + shortOpenInterestUsd_not_in?: InputMaybe>; + shortOpenInterestUsingLongToken_eq?: InputMaybe; + shortOpenInterestUsingLongToken_gt?: InputMaybe; + shortOpenInterestUsingLongToken_gte?: InputMaybe; + shortOpenInterestUsingLongToken_in?: InputMaybe>; + shortOpenInterestUsingLongToken_isNull?: InputMaybe; + shortOpenInterestUsingLongToken_lt?: InputMaybe; + shortOpenInterestUsingLongToken_lte?: InputMaybe; + shortOpenInterestUsingLongToken_not_eq?: InputMaybe; + shortOpenInterestUsingLongToken_not_in?: InputMaybe>; + shortOpenInterestUsingShortToken_eq?: InputMaybe; + shortOpenInterestUsingShortToken_gt?: InputMaybe; + shortOpenInterestUsingShortToken_gte?: InputMaybe; + shortOpenInterestUsingShortToken_in?: InputMaybe>; + shortOpenInterestUsingShortToken_isNull?: InputMaybe; + shortOpenInterestUsingShortToken_lt?: InputMaybe; + shortOpenInterestUsingShortToken_lte?: InputMaybe; + shortOpenInterestUsingShortToken_not_eq?: InputMaybe; + shortOpenInterestUsingShortToken_not_in?: InputMaybe>; + shortPoolAmount_eq?: InputMaybe; + shortPoolAmount_gt?: InputMaybe; + shortPoolAmount_gte?: InputMaybe; + shortPoolAmount_in?: InputMaybe>; + shortPoolAmount_isNull?: InputMaybe; + shortPoolAmount_lt?: InputMaybe; + shortPoolAmount_lte?: InputMaybe; + shortPoolAmount_not_eq?: InputMaybe; + shortPoolAmount_not_in?: InputMaybe>; + shortTokenAddress_contains?: InputMaybe; + shortTokenAddress_containsInsensitive?: InputMaybe; + shortTokenAddress_endsWith?: InputMaybe; + shortTokenAddress_eq?: InputMaybe; + shortTokenAddress_gt?: InputMaybe; + shortTokenAddress_gte?: InputMaybe; + shortTokenAddress_in?: InputMaybe>; + shortTokenAddress_isNull?: InputMaybe; + shortTokenAddress_lt?: InputMaybe; + shortTokenAddress_lte?: InputMaybe; + shortTokenAddress_not_contains?: InputMaybe; + shortTokenAddress_not_containsInsensitive?: InputMaybe; + shortTokenAddress_not_endsWith?: InputMaybe; + shortTokenAddress_not_eq?: InputMaybe; + shortTokenAddress_not_in?: InputMaybe>; + shortTokenAddress_not_startsWith?: InputMaybe; + shortTokenAddress_startsWith?: InputMaybe; + swapFeeFactorForNegativeImpact_eq?: InputMaybe; + swapFeeFactorForNegativeImpact_gt?: InputMaybe; + swapFeeFactorForNegativeImpact_gte?: InputMaybe; + swapFeeFactorForNegativeImpact_in?: InputMaybe>; + swapFeeFactorForNegativeImpact_isNull?: InputMaybe; + swapFeeFactorForNegativeImpact_lt?: InputMaybe; + swapFeeFactorForNegativeImpact_lte?: InputMaybe; + swapFeeFactorForNegativeImpact_not_eq?: InputMaybe; + swapFeeFactorForNegativeImpact_not_in?: InputMaybe>; + swapFeeFactorForPositiveImpact_eq?: InputMaybe; + swapFeeFactorForPositiveImpact_gt?: InputMaybe; + swapFeeFactorForPositiveImpact_gte?: InputMaybe; + swapFeeFactorForPositiveImpact_in?: InputMaybe>; + swapFeeFactorForPositiveImpact_isNull?: InputMaybe; + swapFeeFactorForPositiveImpact_lt?: InputMaybe; + swapFeeFactorForPositiveImpact_lte?: InputMaybe; + swapFeeFactorForPositiveImpact_not_eq?: InputMaybe; + swapFeeFactorForPositiveImpact_not_in?: InputMaybe>; + swapImpactExponentFactor_eq?: InputMaybe; + swapImpactExponentFactor_gt?: InputMaybe; + swapImpactExponentFactor_gte?: InputMaybe; + swapImpactExponentFactor_in?: InputMaybe>; + swapImpactExponentFactor_isNull?: InputMaybe; + swapImpactExponentFactor_lt?: InputMaybe; + swapImpactExponentFactor_lte?: InputMaybe; + swapImpactExponentFactor_not_eq?: InputMaybe; + swapImpactExponentFactor_not_in?: InputMaybe>; + swapImpactFactorNegative_eq?: InputMaybe; + swapImpactFactorNegative_gt?: InputMaybe; + swapImpactFactorNegative_gte?: InputMaybe; + swapImpactFactorNegative_in?: InputMaybe>; + swapImpactFactorNegative_isNull?: InputMaybe; + swapImpactFactorNegative_lt?: InputMaybe; + swapImpactFactorNegative_lte?: InputMaybe; + swapImpactFactorNegative_not_eq?: InputMaybe; + swapImpactFactorNegative_not_in?: InputMaybe>; + swapImpactFactorPositive_eq?: InputMaybe; + swapImpactFactorPositive_gt?: InputMaybe; + swapImpactFactorPositive_gte?: InputMaybe; + swapImpactFactorPositive_in?: InputMaybe>; + swapImpactFactorPositive_isNull?: InputMaybe; + swapImpactFactorPositive_lt?: InputMaybe; + swapImpactFactorPositive_lte?: InputMaybe; + swapImpactFactorPositive_not_eq?: InputMaybe; + swapImpactFactorPositive_not_in?: InputMaybe>; + swapImpactPoolAmountLong_eq?: InputMaybe; + swapImpactPoolAmountLong_gt?: InputMaybe; + swapImpactPoolAmountLong_gte?: InputMaybe; + swapImpactPoolAmountLong_in?: InputMaybe>; + swapImpactPoolAmountLong_isNull?: InputMaybe; + swapImpactPoolAmountLong_lt?: InputMaybe; + swapImpactPoolAmountLong_lte?: InputMaybe; + swapImpactPoolAmountLong_not_eq?: InputMaybe; + swapImpactPoolAmountLong_not_in?: InputMaybe>; + swapImpactPoolAmountShort_eq?: InputMaybe; + swapImpactPoolAmountShort_gt?: InputMaybe; + swapImpactPoolAmountShort_gte?: InputMaybe; + swapImpactPoolAmountShort_in?: InputMaybe>; + swapImpactPoolAmountShort_isNull?: InputMaybe; + swapImpactPoolAmountShort_lt?: InputMaybe; + swapImpactPoolAmountShort_lte?: InputMaybe; + swapImpactPoolAmountShort_not_eq?: InputMaybe; + swapImpactPoolAmountShort_not_in?: InputMaybe>; + thresholdForDecreaseFunding_eq?: InputMaybe; + thresholdForDecreaseFunding_gt?: InputMaybe; + thresholdForDecreaseFunding_gte?: InputMaybe; + thresholdForDecreaseFunding_in?: InputMaybe>; + thresholdForDecreaseFunding_isNull?: InputMaybe; + thresholdForDecreaseFunding_lt?: InputMaybe; + thresholdForDecreaseFunding_lte?: InputMaybe; + thresholdForDecreaseFunding_not_eq?: InputMaybe; + thresholdForDecreaseFunding_not_in?: InputMaybe>; + thresholdForStableFunding_eq?: InputMaybe; + thresholdForStableFunding_gt?: InputMaybe; + thresholdForStableFunding_gte?: InputMaybe; + thresholdForStableFunding_in?: InputMaybe>; + thresholdForStableFunding_isNull?: InputMaybe; + thresholdForStableFunding_lt?: InputMaybe; + thresholdForStableFunding_lte?: InputMaybe; + thresholdForStableFunding_not_eq?: InputMaybe; + thresholdForStableFunding_not_in?: InputMaybe>; + totalBorrowingFees_eq?: InputMaybe; + totalBorrowingFees_gt?: InputMaybe; + totalBorrowingFees_gte?: InputMaybe; + totalBorrowingFees_in?: InputMaybe>; + totalBorrowingFees_isNull?: InputMaybe; + totalBorrowingFees_lt?: InputMaybe; + totalBorrowingFees_lte?: InputMaybe; + totalBorrowingFees_not_eq?: InputMaybe; + totalBorrowingFees_not_in?: InputMaybe>; + virtualIndexTokenId_contains?: InputMaybe; + virtualIndexTokenId_containsInsensitive?: InputMaybe; + virtualIndexTokenId_endsWith?: InputMaybe; + virtualIndexTokenId_eq?: InputMaybe; + virtualIndexTokenId_gt?: InputMaybe; + virtualIndexTokenId_gte?: InputMaybe; + virtualIndexTokenId_in?: InputMaybe>; + virtualIndexTokenId_isNull?: InputMaybe; + virtualIndexTokenId_lt?: InputMaybe; + virtualIndexTokenId_lte?: InputMaybe; + virtualIndexTokenId_not_contains?: InputMaybe; + virtualIndexTokenId_not_containsInsensitive?: InputMaybe; + virtualIndexTokenId_not_endsWith?: InputMaybe; + virtualIndexTokenId_not_eq?: InputMaybe; + virtualIndexTokenId_not_in?: InputMaybe>; + virtualIndexTokenId_not_startsWith?: InputMaybe; + virtualIndexTokenId_startsWith?: InputMaybe; + virtualInventoryForPositions_eq?: InputMaybe; + virtualInventoryForPositions_gt?: InputMaybe; + virtualInventoryForPositions_gte?: InputMaybe; + virtualInventoryForPositions_in?: InputMaybe>; + virtualInventoryForPositions_isNull?: InputMaybe; + virtualInventoryForPositions_lt?: InputMaybe; + virtualInventoryForPositions_lte?: InputMaybe; + virtualInventoryForPositions_not_eq?: InputMaybe; + virtualInventoryForPositions_not_in?: InputMaybe>; + virtualLongTokenId_contains?: InputMaybe; + virtualLongTokenId_containsInsensitive?: InputMaybe; + virtualLongTokenId_endsWith?: InputMaybe; + virtualLongTokenId_eq?: InputMaybe; + virtualLongTokenId_gt?: InputMaybe; + virtualLongTokenId_gte?: InputMaybe; + virtualLongTokenId_in?: InputMaybe>; + virtualLongTokenId_isNull?: InputMaybe; + virtualLongTokenId_lt?: InputMaybe; + virtualLongTokenId_lte?: InputMaybe; + virtualLongTokenId_not_contains?: InputMaybe; + virtualLongTokenId_not_containsInsensitive?: InputMaybe; + virtualLongTokenId_not_endsWith?: InputMaybe; + virtualLongTokenId_not_eq?: InputMaybe; + virtualLongTokenId_not_in?: InputMaybe>; + virtualLongTokenId_not_startsWith?: InputMaybe; + virtualLongTokenId_startsWith?: InputMaybe; + virtualMarketId_contains?: InputMaybe; + virtualMarketId_containsInsensitive?: InputMaybe; + virtualMarketId_endsWith?: InputMaybe; + virtualMarketId_eq?: InputMaybe; + virtualMarketId_gt?: InputMaybe; + virtualMarketId_gte?: InputMaybe; + virtualMarketId_in?: InputMaybe>; + virtualMarketId_isNull?: InputMaybe; + virtualMarketId_lt?: InputMaybe; + virtualMarketId_lte?: InputMaybe; + virtualMarketId_not_contains?: InputMaybe; + virtualMarketId_not_containsInsensitive?: InputMaybe; + virtualMarketId_not_endsWith?: InputMaybe; + virtualMarketId_not_eq?: InputMaybe; + virtualMarketId_not_in?: InputMaybe>; + virtualMarketId_not_startsWith?: InputMaybe; + virtualMarketId_startsWith?: InputMaybe; + virtualPoolAmountForLongToken_eq?: InputMaybe; + virtualPoolAmountForLongToken_gt?: InputMaybe; + virtualPoolAmountForLongToken_gte?: InputMaybe; + virtualPoolAmountForLongToken_in?: InputMaybe>; + virtualPoolAmountForLongToken_isNull?: InputMaybe; + virtualPoolAmountForLongToken_lt?: InputMaybe; + virtualPoolAmountForLongToken_lte?: InputMaybe; + virtualPoolAmountForLongToken_not_eq?: InputMaybe; + virtualPoolAmountForLongToken_not_in?: InputMaybe>; + virtualPoolAmountForShortToken_eq?: InputMaybe; + virtualPoolAmountForShortToken_gt?: InputMaybe; + virtualPoolAmountForShortToken_gte?: InputMaybe; + virtualPoolAmountForShortToken_in?: InputMaybe>; + virtualPoolAmountForShortToken_isNull?: InputMaybe; + virtualPoolAmountForShortToken_lt?: InputMaybe; + virtualPoolAmountForShortToken_lte?: InputMaybe; + virtualPoolAmountForShortToken_not_eq?: InputMaybe; + virtualPoolAmountForShortToken_not_in?: InputMaybe>; + virtualShortTokenId_contains?: InputMaybe; + virtualShortTokenId_containsInsensitive?: InputMaybe; + virtualShortTokenId_endsWith?: InputMaybe; + virtualShortTokenId_eq?: InputMaybe; + virtualShortTokenId_gt?: InputMaybe; + virtualShortTokenId_gte?: InputMaybe; + virtualShortTokenId_in?: InputMaybe>; + virtualShortTokenId_isNull?: InputMaybe; + virtualShortTokenId_lt?: InputMaybe; + virtualShortTokenId_lte?: InputMaybe; + virtualShortTokenId_not_contains?: InputMaybe; + virtualShortTokenId_not_containsInsensitive?: InputMaybe; + virtualShortTokenId_not_endsWith?: InputMaybe; + virtualShortTokenId_not_eq?: InputMaybe; + virtualShortTokenId_not_in?: InputMaybe>; + virtualShortTokenId_not_startsWith?: InputMaybe; + virtualShortTokenId_startsWith?: InputMaybe; } export interface MarketInfosConnection { - __typename?: "MarketInfosConnection"; + __typename?: 'MarketInfosConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export enum MarketOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - indexToken_ASC = "indexToken_ASC", - indexToken_ASC_NULLS_FIRST = "indexToken_ASC_NULLS_FIRST", - indexToken_ASC_NULLS_LAST = "indexToken_ASC_NULLS_LAST", - indexToken_DESC = "indexToken_DESC", - indexToken_DESC_NULLS_FIRST = "indexToken_DESC_NULLS_FIRST", - indexToken_DESC_NULLS_LAST = "indexToken_DESC_NULLS_LAST", - longToken_ASC = "longToken_ASC", - longToken_ASC_NULLS_FIRST = "longToken_ASC_NULLS_FIRST", - longToken_ASC_NULLS_LAST = "longToken_ASC_NULLS_LAST", - longToken_DESC = "longToken_DESC", - longToken_DESC_NULLS_FIRST = "longToken_DESC_NULLS_FIRST", - longToken_DESC_NULLS_LAST = "longToken_DESC_NULLS_LAST", - shortToken_ASC = "shortToken_ASC", - shortToken_ASC_NULLS_FIRST = "shortToken_ASC_NULLS_FIRST", - shortToken_ASC_NULLS_LAST = "shortToken_ASC_NULLS_LAST", - shortToken_DESC = "shortToken_DESC", - shortToken_DESC_NULLS_FIRST = "shortToken_DESC_NULLS_FIRST", - shortToken_DESC_NULLS_LAST = "shortToken_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + indexToken_ASC = 'indexToken_ASC', + indexToken_ASC_NULLS_FIRST = 'indexToken_ASC_NULLS_FIRST', + indexToken_ASC_NULLS_LAST = 'indexToken_ASC_NULLS_LAST', + indexToken_DESC = 'indexToken_DESC', + indexToken_DESC_NULLS_FIRST = 'indexToken_DESC_NULLS_FIRST', + indexToken_DESC_NULLS_LAST = 'indexToken_DESC_NULLS_LAST', + longToken_ASC = 'longToken_ASC', + longToken_ASC_NULLS_FIRST = 'longToken_ASC_NULLS_FIRST', + longToken_ASC_NULLS_LAST = 'longToken_ASC_NULLS_LAST', + longToken_DESC = 'longToken_DESC', + longToken_DESC_NULLS_FIRST = 'longToken_DESC_NULLS_FIRST', + longToken_DESC_NULLS_LAST = 'longToken_DESC_NULLS_LAST', + shortToken_ASC = 'shortToken_ASC', + shortToken_ASC_NULLS_FIRST = 'shortToken_ASC_NULLS_FIRST', + shortToken_ASC_NULLS_LAST = 'shortToken_ASC_NULLS_LAST', + shortToken_DESC = 'shortToken_DESC', + shortToken_DESC_NULLS_FIRST = 'shortToken_DESC_NULLS_FIRST', + shortToken_DESC_NULLS_LAST = 'shortToken_DESC_NULLS_LAST' } export interface MarketPnlApr { - __typename?: "MarketPnlApr"; - apr: Scalars["BigInt"]["output"]; - marketAddress: Scalars["String"]["output"]; - periodRealizedPnlLong: Scalars["BigInt"]["output"]; - periodRealizedPnlShort: Scalars["BigInt"]["output"]; - periodUnrealizedPnlLong: Scalars["BigInt"]["output"]; - periodUnrealizedPnlShort: Scalars["BigInt"]["output"]; - timeWeightedPoolValue: Scalars["BigInt"]["output"]; + __typename?: 'MarketPnlApr'; + apr: Scalars['BigInt']['output']; + marketAddress: Scalars['String']['output']; + periodRealizedPnlLong: Scalars['BigInt']['output']; + periodRealizedPnlShort: Scalars['BigInt']['output']; + periodUnrealizedPnlLong: Scalars['BigInt']['output']; + periodUnrealizedPnlShort: Scalars['BigInt']['output']; + timeWeightedPoolValue: Scalars['BigInt']['output']; } export interface MarketPnlAprsWhereInput { - marketAddresses?: InputMaybe>; - periodEnd: Scalars["Float"]["input"]; - periodStart: Scalars["Float"]["input"]; + marketAddresses?: InputMaybe>; + periodEnd: Scalars['Float']['input']; + periodStart: Scalars['Float']['input']; } export interface MarketWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - indexToken_contains?: InputMaybe; - indexToken_containsInsensitive?: InputMaybe; - indexToken_endsWith?: InputMaybe; - indexToken_eq?: InputMaybe; - indexToken_gt?: InputMaybe; - indexToken_gte?: InputMaybe; - indexToken_in?: InputMaybe>; - indexToken_isNull?: InputMaybe; - indexToken_lt?: InputMaybe; - indexToken_lte?: InputMaybe; - indexToken_not_contains?: InputMaybe; - indexToken_not_containsInsensitive?: InputMaybe; - indexToken_not_endsWith?: InputMaybe; - indexToken_not_eq?: InputMaybe; - indexToken_not_in?: InputMaybe>; - indexToken_not_startsWith?: InputMaybe; - indexToken_startsWith?: InputMaybe; - longToken_contains?: InputMaybe; - longToken_containsInsensitive?: InputMaybe; - longToken_endsWith?: InputMaybe; - longToken_eq?: InputMaybe; - longToken_gt?: InputMaybe; - longToken_gte?: InputMaybe; - longToken_in?: InputMaybe>; - longToken_isNull?: InputMaybe; - longToken_lt?: InputMaybe; - longToken_lte?: InputMaybe; - longToken_not_contains?: InputMaybe; - longToken_not_containsInsensitive?: InputMaybe; - longToken_not_endsWith?: InputMaybe; - longToken_not_eq?: InputMaybe; - longToken_not_in?: InputMaybe>; - longToken_not_startsWith?: InputMaybe; - longToken_startsWith?: InputMaybe; - shortToken_contains?: InputMaybe; - shortToken_containsInsensitive?: InputMaybe; - shortToken_endsWith?: InputMaybe; - shortToken_eq?: InputMaybe; - shortToken_gt?: InputMaybe; - shortToken_gte?: InputMaybe; - shortToken_in?: InputMaybe>; - shortToken_isNull?: InputMaybe; - shortToken_lt?: InputMaybe; - shortToken_lte?: InputMaybe; - shortToken_not_contains?: InputMaybe; - shortToken_not_containsInsensitive?: InputMaybe; - shortToken_not_endsWith?: InputMaybe; - shortToken_not_eq?: InputMaybe; - shortToken_not_in?: InputMaybe>; - shortToken_not_startsWith?: InputMaybe; - shortToken_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + indexToken_contains?: InputMaybe; + indexToken_containsInsensitive?: InputMaybe; + indexToken_endsWith?: InputMaybe; + indexToken_eq?: InputMaybe; + indexToken_gt?: InputMaybe; + indexToken_gte?: InputMaybe; + indexToken_in?: InputMaybe>; + indexToken_isNull?: InputMaybe; + indexToken_lt?: InputMaybe; + indexToken_lte?: InputMaybe; + indexToken_not_contains?: InputMaybe; + indexToken_not_containsInsensitive?: InputMaybe; + indexToken_not_endsWith?: InputMaybe; + indexToken_not_eq?: InputMaybe; + indexToken_not_in?: InputMaybe>; + indexToken_not_startsWith?: InputMaybe; + indexToken_startsWith?: InputMaybe; + longToken_contains?: InputMaybe; + longToken_containsInsensitive?: InputMaybe; + longToken_endsWith?: InputMaybe; + longToken_eq?: InputMaybe; + longToken_gt?: InputMaybe; + longToken_gte?: InputMaybe; + longToken_in?: InputMaybe>; + longToken_isNull?: InputMaybe; + longToken_lt?: InputMaybe; + longToken_lte?: InputMaybe; + longToken_not_contains?: InputMaybe; + longToken_not_containsInsensitive?: InputMaybe; + longToken_not_endsWith?: InputMaybe; + longToken_not_eq?: InputMaybe; + longToken_not_in?: InputMaybe>; + longToken_not_startsWith?: InputMaybe; + longToken_startsWith?: InputMaybe; + shortToken_contains?: InputMaybe; + shortToken_containsInsensitive?: InputMaybe; + shortToken_endsWith?: InputMaybe; + shortToken_eq?: InputMaybe; + shortToken_gt?: InputMaybe; + shortToken_gte?: InputMaybe; + shortToken_in?: InputMaybe>; + shortToken_isNull?: InputMaybe; + shortToken_lt?: InputMaybe; + shortToken_lte?: InputMaybe; + shortToken_not_contains?: InputMaybe; + shortToken_not_containsInsensitive?: InputMaybe; + shortToken_not_endsWith?: InputMaybe; + shortToken_not_eq?: InputMaybe; + shortToken_not_in?: InputMaybe>; + shortToken_not_startsWith?: InputMaybe; + shortToken_startsWith?: InputMaybe; } export interface MarketsConnection { - __typename?: "MarketsConnection"; + __typename?: 'MarketsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface MultichainFundingInfo { - __typename?: "MultichainFundingInfo"; - account: Scalars["String"]["output"]; - executedTimestamp?: Maybe; - executedTxn?: Maybe; - expectedReceivedAmount: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - isExecutionError?: Maybe; - operation: Scalars["String"]["output"]; - receivedAmount?: Maybe; - receivedTimestamp?: Maybe; - receivedTxn?: Maybe; - sentAmount: Scalars["BigInt"]["output"]; - sentTimestamp: Scalars["Float"]["output"]; - sentTxn: Scalars["String"]["output"]; - settlementChainId: Scalars["Float"]["output"]; - sourceChainId: Scalars["Float"]["output"]; - step: Scalars["String"]["output"]; - token: Scalars["String"]["output"]; + __typename?: 'MultichainFundingInfo'; + account: Scalars['String']['output']; + executedTimestamp?: Maybe; + executedTxn?: Maybe; + expectedReceivedAmount: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + isExecutionError?: Maybe; + operation: Scalars['String']['output']; + receivedAmount?: Maybe; + receivedTimestamp?: Maybe; + receivedTxn?: Maybe; + sentAmount: Scalars['BigInt']['output']; + sentTimestamp: Scalars['Float']['output']; + sentTxn: Scalars['String']['output']; + settlementChainId: Scalars['Float']['output']; + sourceChainId: Scalars['Float']['output']; + step: Scalars['String']['output']; + token: Scalars['String']['output']; } export enum MultichainFundingOperation { - deposit = "deposit", - withdrawal = "withdrawal", + deposit = 'deposit', + withdrawal = 'withdrawal' } export interface MultichainFundingReceiveEvent { - __typename?: "MultichainFundingReceiveEvent"; - deliveredTxn?: Maybe; - id: Scalars["String"]["output"]; - isDeliveryError?: Maybe; - isUncertain: Scalars["Boolean"]["output"]; + __typename?: 'MultichainFundingReceiveEvent'; + deliveredTimestamp?: Maybe; + deliveredTxn?: Maybe; + id: Scalars['String']['output']; + isDeliveryError?: Maybe; + isUncertain: Scalars['Boolean']['output']; operation: MultichainFundingOperation; - receivedAmount: Scalars["BigInt"]["output"]; - receivedTxn: Transaction; - sourceChainId: Scalars["Int"]["output"]; + receivedAmount: Scalars['BigInt']['output']; + receivedTimestamp: Scalars['Int']['output']; + receivedTxn: Scalars['String']['output']; + sourceChainId: Scalars['Int']['output']; } export interface MultichainFundingReceiveEventEdge { - __typename?: "MultichainFundingReceiveEventEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'MultichainFundingReceiveEventEdge'; + cursor: Scalars['String']['output']; node: MultichainFundingReceiveEvent; } export enum MultichainFundingReceiveEventOrderByInput { - deliveredTxn_blockNumber_ASC = "deliveredTxn_blockNumber_ASC", - deliveredTxn_blockNumber_ASC_NULLS_FIRST = "deliveredTxn_blockNumber_ASC_NULLS_FIRST", - deliveredTxn_blockNumber_ASC_NULLS_LAST = "deliveredTxn_blockNumber_ASC_NULLS_LAST", - deliveredTxn_blockNumber_DESC = "deliveredTxn_blockNumber_DESC", - deliveredTxn_blockNumber_DESC_NULLS_FIRST = "deliveredTxn_blockNumber_DESC_NULLS_FIRST", - deliveredTxn_blockNumber_DESC_NULLS_LAST = "deliveredTxn_blockNumber_DESC_NULLS_LAST", - deliveredTxn_chainId_ASC = "deliveredTxn_chainId_ASC", - deliveredTxn_chainId_ASC_NULLS_FIRST = "deliveredTxn_chainId_ASC_NULLS_FIRST", - deliveredTxn_chainId_ASC_NULLS_LAST = "deliveredTxn_chainId_ASC_NULLS_LAST", - deliveredTxn_chainId_DESC = "deliveredTxn_chainId_DESC", - deliveredTxn_chainId_DESC_NULLS_FIRST = "deliveredTxn_chainId_DESC_NULLS_FIRST", - deliveredTxn_chainId_DESC_NULLS_LAST = "deliveredTxn_chainId_DESC_NULLS_LAST", - deliveredTxn_from_ASC = "deliveredTxn_from_ASC", - deliveredTxn_from_ASC_NULLS_FIRST = "deliveredTxn_from_ASC_NULLS_FIRST", - deliveredTxn_from_ASC_NULLS_LAST = "deliveredTxn_from_ASC_NULLS_LAST", - deliveredTxn_from_DESC = "deliveredTxn_from_DESC", - deliveredTxn_from_DESC_NULLS_FIRST = "deliveredTxn_from_DESC_NULLS_FIRST", - deliveredTxn_from_DESC_NULLS_LAST = "deliveredTxn_from_DESC_NULLS_LAST", - deliveredTxn_hash_ASC = "deliveredTxn_hash_ASC", - deliveredTxn_hash_ASC_NULLS_FIRST = "deliveredTxn_hash_ASC_NULLS_FIRST", - deliveredTxn_hash_ASC_NULLS_LAST = "deliveredTxn_hash_ASC_NULLS_LAST", - deliveredTxn_hash_DESC = "deliveredTxn_hash_DESC", - deliveredTxn_hash_DESC_NULLS_FIRST = "deliveredTxn_hash_DESC_NULLS_FIRST", - deliveredTxn_hash_DESC_NULLS_LAST = "deliveredTxn_hash_DESC_NULLS_LAST", - deliveredTxn_id_ASC = "deliveredTxn_id_ASC", - deliveredTxn_id_ASC_NULLS_FIRST = "deliveredTxn_id_ASC_NULLS_FIRST", - deliveredTxn_id_ASC_NULLS_LAST = "deliveredTxn_id_ASC_NULLS_LAST", - deliveredTxn_id_DESC = "deliveredTxn_id_DESC", - deliveredTxn_id_DESC_NULLS_FIRST = "deliveredTxn_id_DESC_NULLS_FIRST", - deliveredTxn_id_DESC_NULLS_LAST = "deliveredTxn_id_DESC_NULLS_LAST", - deliveredTxn_timestamp_ASC = "deliveredTxn_timestamp_ASC", - deliveredTxn_timestamp_ASC_NULLS_FIRST = "deliveredTxn_timestamp_ASC_NULLS_FIRST", - deliveredTxn_timestamp_ASC_NULLS_LAST = "deliveredTxn_timestamp_ASC_NULLS_LAST", - deliveredTxn_timestamp_DESC = "deliveredTxn_timestamp_DESC", - deliveredTxn_timestamp_DESC_NULLS_FIRST = "deliveredTxn_timestamp_DESC_NULLS_FIRST", - deliveredTxn_timestamp_DESC_NULLS_LAST = "deliveredTxn_timestamp_DESC_NULLS_LAST", - deliveredTxn_to_ASC = "deliveredTxn_to_ASC", - deliveredTxn_to_ASC_NULLS_FIRST = "deliveredTxn_to_ASC_NULLS_FIRST", - deliveredTxn_to_ASC_NULLS_LAST = "deliveredTxn_to_ASC_NULLS_LAST", - deliveredTxn_to_DESC = "deliveredTxn_to_DESC", - deliveredTxn_to_DESC_NULLS_FIRST = "deliveredTxn_to_DESC_NULLS_FIRST", - deliveredTxn_to_DESC_NULLS_LAST = "deliveredTxn_to_DESC_NULLS_LAST", - deliveredTxn_transactionIndex_ASC = "deliveredTxn_transactionIndex_ASC", - deliveredTxn_transactionIndex_ASC_NULLS_FIRST = "deliveredTxn_transactionIndex_ASC_NULLS_FIRST", - deliveredTxn_transactionIndex_ASC_NULLS_LAST = "deliveredTxn_transactionIndex_ASC_NULLS_LAST", - deliveredTxn_transactionIndex_DESC = "deliveredTxn_transactionIndex_DESC", - deliveredTxn_transactionIndex_DESC_NULLS_FIRST = "deliveredTxn_transactionIndex_DESC_NULLS_FIRST", - deliveredTxn_transactionIndex_DESC_NULLS_LAST = "deliveredTxn_transactionIndex_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isDeliveryError_ASC = "isDeliveryError_ASC", - isDeliveryError_ASC_NULLS_FIRST = "isDeliveryError_ASC_NULLS_FIRST", - isDeliveryError_ASC_NULLS_LAST = "isDeliveryError_ASC_NULLS_LAST", - isDeliveryError_DESC = "isDeliveryError_DESC", - isDeliveryError_DESC_NULLS_FIRST = "isDeliveryError_DESC_NULLS_FIRST", - isDeliveryError_DESC_NULLS_LAST = "isDeliveryError_DESC_NULLS_LAST", - isUncertain_ASC = "isUncertain_ASC", - isUncertain_ASC_NULLS_FIRST = "isUncertain_ASC_NULLS_FIRST", - isUncertain_ASC_NULLS_LAST = "isUncertain_ASC_NULLS_LAST", - isUncertain_DESC = "isUncertain_DESC", - isUncertain_DESC_NULLS_FIRST = "isUncertain_DESC_NULLS_FIRST", - isUncertain_DESC_NULLS_LAST = "isUncertain_DESC_NULLS_LAST", - operation_ASC = "operation_ASC", - operation_ASC_NULLS_FIRST = "operation_ASC_NULLS_FIRST", - operation_ASC_NULLS_LAST = "operation_ASC_NULLS_LAST", - operation_DESC = "operation_DESC", - operation_DESC_NULLS_FIRST = "operation_DESC_NULLS_FIRST", - operation_DESC_NULLS_LAST = "operation_DESC_NULLS_LAST", - receivedAmount_ASC = "receivedAmount_ASC", - receivedAmount_ASC_NULLS_FIRST = "receivedAmount_ASC_NULLS_FIRST", - receivedAmount_ASC_NULLS_LAST = "receivedAmount_ASC_NULLS_LAST", - receivedAmount_DESC = "receivedAmount_DESC", - receivedAmount_DESC_NULLS_FIRST = "receivedAmount_DESC_NULLS_FIRST", - receivedAmount_DESC_NULLS_LAST = "receivedAmount_DESC_NULLS_LAST", - receivedTxn_blockNumber_ASC = "receivedTxn_blockNumber_ASC", - receivedTxn_blockNumber_ASC_NULLS_FIRST = "receivedTxn_blockNumber_ASC_NULLS_FIRST", - receivedTxn_blockNumber_ASC_NULLS_LAST = "receivedTxn_blockNumber_ASC_NULLS_LAST", - receivedTxn_blockNumber_DESC = "receivedTxn_blockNumber_DESC", - receivedTxn_blockNumber_DESC_NULLS_FIRST = "receivedTxn_blockNumber_DESC_NULLS_FIRST", - receivedTxn_blockNumber_DESC_NULLS_LAST = "receivedTxn_blockNumber_DESC_NULLS_LAST", - receivedTxn_chainId_ASC = "receivedTxn_chainId_ASC", - receivedTxn_chainId_ASC_NULLS_FIRST = "receivedTxn_chainId_ASC_NULLS_FIRST", - receivedTxn_chainId_ASC_NULLS_LAST = "receivedTxn_chainId_ASC_NULLS_LAST", - receivedTxn_chainId_DESC = "receivedTxn_chainId_DESC", - receivedTxn_chainId_DESC_NULLS_FIRST = "receivedTxn_chainId_DESC_NULLS_FIRST", - receivedTxn_chainId_DESC_NULLS_LAST = "receivedTxn_chainId_DESC_NULLS_LAST", - receivedTxn_from_ASC = "receivedTxn_from_ASC", - receivedTxn_from_ASC_NULLS_FIRST = "receivedTxn_from_ASC_NULLS_FIRST", - receivedTxn_from_ASC_NULLS_LAST = "receivedTxn_from_ASC_NULLS_LAST", - receivedTxn_from_DESC = "receivedTxn_from_DESC", - receivedTxn_from_DESC_NULLS_FIRST = "receivedTxn_from_DESC_NULLS_FIRST", - receivedTxn_from_DESC_NULLS_LAST = "receivedTxn_from_DESC_NULLS_LAST", - receivedTxn_hash_ASC = "receivedTxn_hash_ASC", - receivedTxn_hash_ASC_NULLS_FIRST = "receivedTxn_hash_ASC_NULLS_FIRST", - receivedTxn_hash_ASC_NULLS_LAST = "receivedTxn_hash_ASC_NULLS_LAST", - receivedTxn_hash_DESC = "receivedTxn_hash_DESC", - receivedTxn_hash_DESC_NULLS_FIRST = "receivedTxn_hash_DESC_NULLS_FIRST", - receivedTxn_hash_DESC_NULLS_LAST = "receivedTxn_hash_DESC_NULLS_LAST", - receivedTxn_id_ASC = "receivedTxn_id_ASC", - receivedTxn_id_ASC_NULLS_FIRST = "receivedTxn_id_ASC_NULLS_FIRST", - receivedTxn_id_ASC_NULLS_LAST = "receivedTxn_id_ASC_NULLS_LAST", - receivedTxn_id_DESC = "receivedTxn_id_DESC", - receivedTxn_id_DESC_NULLS_FIRST = "receivedTxn_id_DESC_NULLS_FIRST", - receivedTxn_id_DESC_NULLS_LAST = "receivedTxn_id_DESC_NULLS_LAST", - receivedTxn_timestamp_ASC = "receivedTxn_timestamp_ASC", - receivedTxn_timestamp_ASC_NULLS_FIRST = "receivedTxn_timestamp_ASC_NULLS_FIRST", - receivedTxn_timestamp_ASC_NULLS_LAST = "receivedTxn_timestamp_ASC_NULLS_LAST", - receivedTxn_timestamp_DESC = "receivedTxn_timestamp_DESC", - receivedTxn_timestamp_DESC_NULLS_FIRST = "receivedTxn_timestamp_DESC_NULLS_FIRST", - receivedTxn_timestamp_DESC_NULLS_LAST = "receivedTxn_timestamp_DESC_NULLS_LAST", - receivedTxn_to_ASC = "receivedTxn_to_ASC", - receivedTxn_to_ASC_NULLS_FIRST = "receivedTxn_to_ASC_NULLS_FIRST", - receivedTxn_to_ASC_NULLS_LAST = "receivedTxn_to_ASC_NULLS_LAST", - receivedTxn_to_DESC = "receivedTxn_to_DESC", - receivedTxn_to_DESC_NULLS_FIRST = "receivedTxn_to_DESC_NULLS_FIRST", - receivedTxn_to_DESC_NULLS_LAST = "receivedTxn_to_DESC_NULLS_LAST", - receivedTxn_transactionIndex_ASC = "receivedTxn_transactionIndex_ASC", - receivedTxn_transactionIndex_ASC_NULLS_FIRST = "receivedTxn_transactionIndex_ASC_NULLS_FIRST", - receivedTxn_transactionIndex_ASC_NULLS_LAST = "receivedTxn_transactionIndex_ASC_NULLS_LAST", - receivedTxn_transactionIndex_DESC = "receivedTxn_transactionIndex_DESC", - receivedTxn_transactionIndex_DESC_NULLS_FIRST = "receivedTxn_transactionIndex_DESC_NULLS_FIRST", - receivedTxn_transactionIndex_DESC_NULLS_LAST = "receivedTxn_transactionIndex_DESC_NULLS_LAST", - sourceChainId_ASC = "sourceChainId_ASC", - sourceChainId_ASC_NULLS_FIRST = "sourceChainId_ASC_NULLS_FIRST", - sourceChainId_ASC_NULLS_LAST = "sourceChainId_ASC_NULLS_LAST", - sourceChainId_DESC = "sourceChainId_DESC", - sourceChainId_DESC_NULLS_FIRST = "sourceChainId_DESC_NULLS_FIRST", - sourceChainId_DESC_NULLS_LAST = "sourceChainId_DESC_NULLS_LAST", + deliveredTimestamp_ASC = 'deliveredTimestamp_ASC', + deliveredTimestamp_ASC_NULLS_FIRST = 'deliveredTimestamp_ASC_NULLS_FIRST', + deliveredTimestamp_ASC_NULLS_LAST = 'deliveredTimestamp_ASC_NULLS_LAST', + deliveredTimestamp_DESC = 'deliveredTimestamp_DESC', + deliveredTimestamp_DESC_NULLS_FIRST = 'deliveredTimestamp_DESC_NULLS_FIRST', + deliveredTimestamp_DESC_NULLS_LAST = 'deliveredTimestamp_DESC_NULLS_LAST', + deliveredTxn_ASC = 'deliveredTxn_ASC', + deliveredTxn_ASC_NULLS_FIRST = 'deliveredTxn_ASC_NULLS_FIRST', + deliveredTxn_ASC_NULLS_LAST = 'deliveredTxn_ASC_NULLS_LAST', + deliveredTxn_DESC = 'deliveredTxn_DESC', + deliveredTxn_DESC_NULLS_FIRST = 'deliveredTxn_DESC_NULLS_FIRST', + deliveredTxn_DESC_NULLS_LAST = 'deliveredTxn_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isDeliveryError_ASC = 'isDeliveryError_ASC', + isDeliveryError_ASC_NULLS_FIRST = 'isDeliveryError_ASC_NULLS_FIRST', + isDeliveryError_ASC_NULLS_LAST = 'isDeliveryError_ASC_NULLS_LAST', + isDeliveryError_DESC = 'isDeliveryError_DESC', + isDeliveryError_DESC_NULLS_FIRST = 'isDeliveryError_DESC_NULLS_FIRST', + isDeliveryError_DESC_NULLS_LAST = 'isDeliveryError_DESC_NULLS_LAST', + isUncertain_ASC = 'isUncertain_ASC', + isUncertain_ASC_NULLS_FIRST = 'isUncertain_ASC_NULLS_FIRST', + isUncertain_ASC_NULLS_LAST = 'isUncertain_ASC_NULLS_LAST', + isUncertain_DESC = 'isUncertain_DESC', + isUncertain_DESC_NULLS_FIRST = 'isUncertain_DESC_NULLS_FIRST', + isUncertain_DESC_NULLS_LAST = 'isUncertain_DESC_NULLS_LAST', + operation_ASC = 'operation_ASC', + operation_ASC_NULLS_FIRST = 'operation_ASC_NULLS_FIRST', + operation_ASC_NULLS_LAST = 'operation_ASC_NULLS_LAST', + operation_DESC = 'operation_DESC', + operation_DESC_NULLS_FIRST = 'operation_DESC_NULLS_FIRST', + operation_DESC_NULLS_LAST = 'operation_DESC_NULLS_LAST', + receivedAmount_ASC = 'receivedAmount_ASC', + receivedAmount_ASC_NULLS_FIRST = 'receivedAmount_ASC_NULLS_FIRST', + receivedAmount_ASC_NULLS_LAST = 'receivedAmount_ASC_NULLS_LAST', + receivedAmount_DESC = 'receivedAmount_DESC', + receivedAmount_DESC_NULLS_FIRST = 'receivedAmount_DESC_NULLS_FIRST', + receivedAmount_DESC_NULLS_LAST = 'receivedAmount_DESC_NULLS_LAST', + receivedTimestamp_ASC = 'receivedTimestamp_ASC', + receivedTimestamp_ASC_NULLS_FIRST = 'receivedTimestamp_ASC_NULLS_FIRST', + receivedTimestamp_ASC_NULLS_LAST = 'receivedTimestamp_ASC_NULLS_LAST', + receivedTimestamp_DESC = 'receivedTimestamp_DESC', + receivedTimestamp_DESC_NULLS_FIRST = 'receivedTimestamp_DESC_NULLS_FIRST', + receivedTimestamp_DESC_NULLS_LAST = 'receivedTimestamp_DESC_NULLS_LAST', + receivedTxn_ASC = 'receivedTxn_ASC', + receivedTxn_ASC_NULLS_FIRST = 'receivedTxn_ASC_NULLS_FIRST', + receivedTxn_ASC_NULLS_LAST = 'receivedTxn_ASC_NULLS_LAST', + receivedTxn_DESC = 'receivedTxn_DESC', + receivedTxn_DESC_NULLS_FIRST = 'receivedTxn_DESC_NULLS_FIRST', + receivedTxn_DESC_NULLS_LAST = 'receivedTxn_DESC_NULLS_LAST', + sourceChainId_ASC = 'sourceChainId_ASC', + sourceChainId_ASC_NULLS_FIRST = 'sourceChainId_ASC_NULLS_FIRST', + sourceChainId_ASC_NULLS_LAST = 'sourceChainId_ASC_NULLS_LAST', + sourceChainId_DESC = 'sourceChainId_DESC', + sourceChainId_DESC_NULLS_FIRST = 'sourceChainId_DESC_NULLS_FIRST', + sourceChainId_DESC_NULLS_LAST = 'sourceChainId_DESC_NULLS_LAST' } export interface MultichainFundingReceiveEventWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - deliveredTxn?: InputMaybe; - deliveredTxn_isNull?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isDeliveryError_eq?: InputMaybe; - isDeliveryError_isNull?: InputMaybe; - isDeliveryError_not_eq?: InputMaybe; - isUncertain_eq?: InputMaybe; - isUncertain_isNull?: InputMaybe; - isUncertain_not_eq?: InputMaybe; + deliveredTimestamp_eq?: InputMaybe; + deliveredTimestamp_gt?: InputMaybe; + deliveredTimestamp_gte?: InputMaybe; + deliveredTimestamp_in?: InputMaybe>; + deliveredTimestamp_isNull?: InputMaybe; + deliveredTimestamp_lt?: InputMaybe; + deliveredTimestamp_lte?: InputMaybe; + deliveredTimestamp_not_eq?: InputMaybe; + deliveredTimestamp_not_in?: InputMaybe>; + deliveredTxn_contains?: InputMaybe; + deliveredTxn_containsInsensitive?: InputMaybe; + deliveredTxn_endsWith?: InputMaybe; + deliveredTxn_eq?: InputMaybe; + deliveredTxn_gt?: InputMaybe; + deliveredTxn_gte?: InputMaybe; + deliveredTxn_in?: InputMaybe>; + deliveredTxn_isNull?: InputMaybe; + deliveredTxn_lt?: InputMaybe; + deliveredTxn_lte?: InputMaybe; + deliveredTxn_not_contains?: InputMaybe; + deliveredTxn_not_containsInsensitive?: InputMaybe; + deliveredTxn_not_endsWith?: InputMaybe; + deliveredTxn_not_eq?: InputMaybe; + deliveredTxn_not_in?: InputMaybe>; + deliveredTxn_not_startsWith?: InputMaybe; + deliveredTxn_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isDeliveryError_eq?: InputMaybe; + isDeliveryError_isNull?: InputMaybe; + isDeliveryError_not_eq?: InputMaybe; + isUncertain_eq?: InputMaybe; + isUncertain_isNull?: InputMaybe; + isUncertain_not_eq?: InputMaybe; operation_eq?: InputMaybe; operation_in?: InputMaybe>; - operation_isNull?: InputMaybe; + operation_isNull?: InputMaybe; operation_not_eq?: InputMaybe; operation_not_in?: InputMaybe>; - receivedAmount_eq?: InputMaybe; - receivedAmount_gt?: InputMaybe; - receivedAmount_gte?: InputMaybe; - receivedAmount_in?: InputMaybe>; - receivedAmount_isNull?: InputMaybe; - receivedAmount_lt?: InputMaybe; - receivedAmount_lte?: InputMaybe; - receivedAmount_not_eq?: InputMaybe; - receivedAmount_not_in?: InputMaybe>; - receivedTxn?: InputMaybe; - receivedTxn_isNull?: InputMaybe; - sourceChainId_eq?: InputMaybe; - sourceChainId_gt?: InputMaybe; - sourceChainId_gte?: InputMaybe; - sourceChainId_in?: InputMaybe>; - sourceChainId_isNull?: InputMaybe; - sourceChainId_lt?: InputMaybe; - sourceChainId_lte?: InputMaybe; - sourceChainId_not_eq?: InputMaybe; - sourceChainId_not_in?: InputMaybe>; + receivedAmount_eq?: InputMaybe; + receivedAmount_gt?: InputMaybe; + receivedAmount_gte?: InputMaybe; + receivedAmount_in?: InputMaybe>; + receivedAmount_isNull?: InputMaybe; + receivedAmount_lt?: InputMaybe; + receivedAmount_lte?: InputMaybe; + receivedAmount_not_eq?: InputMaybe; + receivedAmount_not_in?: InputMaybe>; + receivedTimestamp_eq?: InputMaybe; + receivedTimestamp_gt?: InputMaybe; + receivedTimestamp_gte?: InputMaybe; + receivedTimestamp_in?: InputMaybe>; + receivedTimestamp_isNull?: InputMaybe; + receivedTimestamp_lt?: InputMaybe; + receivedTimestamp_lte?: InputMaybe; + receivedTimestamp_not_eq?: InputMaybe; + receivedTimestamp_not_in?: InputMaybe>; + receivedTxn_contains?: InputMaybe; + receivedTxn_containsInsensitive?: InputMaybe; + receivedTxn_endsWith?: InputMaybe; + receivedTxn_eq?: InputMaybe; + receivedTxn_gt?: InputMaybe; + receivedTxn_gte?: InputMaybe; + receivedTxn_in?: InputMaybe>; + receivedTxn_isNull?: InputMaybe; + receivedTxn_lt?: InputMaybe; + receivedTxn_lte?: InputMaybe; + receivedTxn_not_contains?: InputMaybe; + receivedTxn_not_containsInsensitive?: InputMaybe; + receivedTxn_not_endsWith?: InputMaybe; + receivedTxn_not_eq?: InputMaybe; + receivedTxn_not_in?: InputMaybe>; + receivedTxn_not_startsWith?: InputMaybe; + receivedTxn_startsWith?: InputMaybe; + sourceChainId_eq?: InputMaybe; + sourceChainId_gt?: InputMaybe; + sourceChainId_gte?: InputMaybe; + sourceChainId_in?: InputMaybe>; + sourceChainId_isNull?: InputMaybe; + sourceChainId_lt?: InputMaybe; + sourceChainId_lte?: InputMaybe; + sourceChainId_not_eq?: InputMaybe; + sourceChainId_not_in?: InputMaybe>; } export interface MultichainFundingReceiveEventsConnection { - __typename?: "MultichainFundingReceiveEventsConnection"; + __typename?: 'MultichainFundingReceiveEventsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface MultichainFundingSendEvent { - __typename?: "MultichainFundingSendEvent"; - account: Scalars["String"]["output"]; - expectedReceivedAmount: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; + __typename?: 'MultichainFundingSendEvent'; + account: Scalars['String']['output']; + expectedReceivedAmount: Scalars['BigInt']['output']; + id: Scalars['String']['output']; operation: MultichainFundingOperation; - sentAmount: Scalars["BigInt"]["output"]; - settlementChainId: Scalars["Int"]["output"]; - sourceChainId: Scalars["Int"]["output"]; - token: Scalars["String"]["output"]; - txn: Transaction; + sentAmount: Scalars['BigInt']['output']; + settlementChainId: Scalars['Int']['output']; + sourceChainId: Scalars['Int']['output']; + timestamp: Scalars['Int']['output']; + token: Scalars['String']['output']; + txn: Scalars['String']['output']; } export interface MultichainFundingSendEventEdge { - __typename?: "MultichainFundingSendEventEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'MultichainFundingSendEventEdge'; + cursor: Scalars['String']['output']; node: MultichainFundingSendEvent; } export enum MultichainFundingSendEventOrderByInput { - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - expectedReceivedAmount_ASC = "expectedReceivedAmount_ASC", - expectedReceivedAmount_ASC_NULLS_FIRST = "expectedReceivedAmount_ASC_NULLS_FIRST", - expectedReceivedAmount_ASC_NULLS_LAST = "expectedReceivedAmount_ASC_NULLS_LAST", - expectedReceivedAmount_DESC = "expectedReceivedAmount_DESC", - expectedReceivedAmount_DESC_NULLS_FIRST = "expectedReceivedAmount_DESC_NULLS_FIRST", - expectedReceivedAmount_DESC_NULLS_LAST = "expectedReceivedAmount_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - operation_ASC = "operation_ASC", - operation_ASC_NULLS_FIRST = "operation_ASC_NULLS_FIRST", - operation_ASC_NULLS_LAST = "operation_ASC_NULLS_LAST", - operation_DESC = "operation_DESC", - operation_DESC_NULLS_FIRST = "operation_DESC_NULLS_FIRST", - operation_DESC_NULLS_LAST = "operation_DESC_NULLS_LAST", - sentAmount_ASC = "sentAmount_ASC", - sentAmount_ASC_NULLS_FIRST = "sentAmount_ASC_NULLS_FIRST", - sentAmount_ASC_NULLS_LAST = "sentAmount_ASC_NULLS_LAST", - sentAmount_DESC = "sentAmount_DESC", - sentAmount_DESC_NULLS_FIRST = "sentAmount_DESC_NULLS_FIRST", - sentAmount_DESC_NULLS_LAST = "sentAmount_DESC_NULLS_LAST", - settlementChainId_ASC = "settlementChainId_ASC", - settlementChainId_ASC_NULLS_FIRST = "settlementChainId_ASC_NULLS_FIRST", - settlementChainId_ASC_NULLS_LAST = "settlementChainId_ASC_NULLS_LAST", - settlementChainId_DESC = "settlementChainId_DESC", - settlementChainId_DESC_NULLS_FIRST = "settlementChainId_DESC_NULLS_FIRST", - settlementChainId_DESC_NULLS_LAST = "settlementChainId_DESC_NULLS_LAST", - sourceChainId_ASC = "sourceChainId_ASC", - sourceChainId_ASC_NULLS_FIRST = "sourceChainId_ASC_NULLS_FIRST", - sourceChainId_ASC_NULLS_LAST = "sourceChainId_ASC_NULLS_LAST", - sourceChainId_DESC = "sourceChainId_DESC", - sourceChainId_DESC_NULLS_FIRST = "sourceChainId_DESC_NULLS_FIRST", - sourceChainId_DESC_NULLS_LAST = "sourceChainId_DESC_NULLS_LAST", - token_ASC = "token_ASC", - token_ASC_NULLS_FIRST = "token_ASC_NULLS_FIRST", - token_ASC_NULLS_LAST = "token_ASC_NULLS_LAST", - token_DESC = "token_DESC", - token_DESC_NULLS_FIRST = "token_DESC_NULLS_FIRST", - token_DESC_NULLS_LAST = "token_DESC_NULLS_LAST", - txn_blockNumber_ASC = "txn_blockNumber_ASC", - txn_blockNumber_ASC_NULLS_FIRST = "txn_blockNumber_ASC_NULLS_FIRST", - txn_blockNumber_ASC_NULLS_LAST = "txn_blockNumber_ASC_NULLS_LAST", - txn_blockNumber_DESC = "txn_blockNumber_DESC", - txn_blockNumber_DESC_NULLS_FIRST = "txn_blockNumber_DESC_NULLS_FIRST", - txn_blockNumber_DESC_NULLS_LAST = "txn_blockNumber_DESC_NULLS_LAST", - txn_chainId_ASC = "txn_chainId_ASC", - txn_chainId_ASC_NULLS_FIRST = "txn_chainId_ASC_NULLS_FIRST", - txn_chainId_ASC_NULLS_LAST = "txn_chainId_ASC_NULLS_LAST", - txn_chainId_DESC = "txn_chainId_DESC", - txn_chainId_DESC_NULLS_FIRST = "txn_chainId_DESC_NULLS_FIRST", - txn_chainId_DESC_NULLS_LAST = "txn_chainId_DESC_NULLS_LAST", - txn_from_ASC = "txn_from_ASC", - txn_from_ASC_NULLS_FIRST = "txn_from_ASC_NULLS_FIRST", - txn_from_ASC_NULLS_LAST = "txn_from_ASC_NULLS_LAST", - txn_from_DESC = "txn_from_DESC", - txn_from_DESC_NULLS_FIRST = "txn_from_DESC_NULLS_FIRST", - txn_from_DESC_NULLS_LAST = "txn_from_DESC_NULLS_LAST", - txn_hash_ASC = "txn_hash_ASC", - txn_hash_ASC_NULLS_FIRST = "txn_hash_ASC_NULLS_FIRST", - txn_hash_ASC_NULLS_LAST = "txn_hash_ASC_NULLS_LAST", - txn_hash_DESC = "txn_hash_DESC", - txn_hash_DESC_NULLS_FIRST = "txn_hash_DESC_NULLS_FIRST", - txn_hash_DESC_NULLS_LAST = "txn_hash_DESC_NULLS_LAST", - txn_id_ASC = "txn_id_ASC", - txn_id_ASC_NULLS_FIRST = "txn_id_ASC_NULLS_FIRST", - txn_id_ASC_NULLS_LAST = "txn_id_ASC_NULLS_LAST", - txn_id_DESC = "txn_id_DESC", - txn_id_DESC_NULLS_FIRST = "txn_id_DESC_NULLS_FIRST", - txn_id_DESC_NULLS_LAST = "txn_id_DESC_NULLS_LAST", - txn_timestamp_ASC = "txn_timestamp_ASC", - txn_timestamp_ASC_NULLS_FIRST = "txn_timestamp_ASC_NULLS_FIRST", - txn_timestamp_ASC_NULLS_LAST = "txn_timestamp_ASC_NULLS_LAST", - txn_timestamp_DESC = "txn_timestamp_DESC", - txn_timestamp_DESC_NULLS_FIRST = "txn_timestamp_DESC_NULLS_FIRST", - txn_timestamp_DESC_NULLS_LAST = "txn_timestamp_DESC_NULLS_LAST", - txn_to_ASC = "txn_to_ASC", - txn_to_ASC_NULLS_FIRST = "txn_to_ASC_NULLS_FIRST", - txn_to_ASC_NULLS_LAST = "txn_to_ASC_NULLS_LAST", - txn_to_DESC = "txn_to_DESC", - txn_to_DESC_NULLS_FIRST = "txn_to_DESC_NULLS_FIRST", - txn_to_DESC_NULLS_LAST = "txn_to_DESC_NULLS_LAST", - txn_transactionIndex_ASC = "txn_transactionIndex_ASC", - txn_transactionIndex_ASC_NULLS_FIRST = "txn_transactionIndex_ASC_NULLS_FIRST", - txn_transactionIndex_ASC_NULLS_LAST = "txn_transactionIndex_ASC_NULLS_LAST", - txn_transactionIndex_DESC = "txn_transactionIndex_DESC", - txn_transactionIndex_DESC_NULLS_FIRST = "txn_transactionIndex_DESC_NULLS_FIRST", - txn_transactionIndex_DESC_NULLS_LAST = "txn_transactionIndex_DESC_NULLS_LAST", + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + expectedReceivedAmount_ASC = 'expectedReceivedAmount_ASC', + expectedReceivedAmount_ASC_NULLS_FIRST = 'expectedReceivedAmount_ASC_NULLS_FIRST', + expectedReceivedAmount_ASC_NULLS_LAST = 'expectedReceivedAmount_ASC_NULLS_LAST', + expectedReceivedAmount_DESC = 'expectedReceivedAmount_DESC', + expectedReceivedAmount_DESC_NULLS_FIRST = 'expectedReceivedAmount_DESC_NULLS_FIRST', + expectedReceivedAmount_DESC_NULLS_LAST = 'expectedReceivedAmount_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + operation_ASC = 'operation_ASC', + operation_ASC_NULLS_FIRST = 'operation_ASC_NULLS_FIRST', + operation_ASC_NULLS_LAST = 'operation_ASC_NULLS_LAST', + operation_DESC = 'operation_DESC', + operation_DESC_NULLS_FIRST = 'operation_DESC_NULLS_FIRST', + operation_DESC_NULLS_LAST = 'operation_DESC_NULLS_LAST', + sentAmount_ASC = 'sentAmount_ASC', + sentAmount_ASC_NULLS_FIRST = 'sentAmount_ASC_NULLS_FIRST', + sentAmount_ASC_NULLS_LAST = 'sentAmount_ASC_NULLS_LAST', + sentAmount_DESC = 'sentAmount_DESC', + sentAmount_DESC_NULLS_FIRST = 'sentAmount_DESC_NULLS_FIRST', + sentAmount_DESC_NULLS_LAST = 'sentAmount_DESC_NULLS_LAST', + settlementChainId_ASC = 'settlementChainId_ASC', + settlementChainId_ASC_NULLS_FIRST = 'settlementChainId_ASC_NULLS_FIRST', + settlementChainId_ASC_NULLS_LAST = 'settlementChainId_ASC_NULLS_LAST', + settlementChainId_DESC = 'settlementChainId_DESC', + settlementChainId_DESC_NULLS_FIRST = 'settlementChainId_DESC_NULLS_FIRST', + settlementChainId_DESC_NULLS_LAST = 'settlementChainId_DESC_NULLS_LAST', + sourceChainId_ASC = 'sourceChainId_ASC', + sourceChainId_ASC_NULLS_FIRST = 'sourceChainId_ASC_NULLS_FIRST', + sourceChainId_ASC_NULLS_LAST = 'sourceChainId_ASC_NULLS_LAST', + sourceChainId_DESC = 'sourceChainId_DESC', + sourceChainId_DESC_NULLS_FIRST = 'sourceChainId_DESC_NULLS_FIRST', + sourceChainId_DESC_NULLS_LAST = 'sourceChainId_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + token_ASC = 'token_ASC', + token_ASC_NULLS_FIRST = 'token_ASC_NULLS_FIRST', + token_ASC_NULLS_LAST = 'token_ASC_NULLS_LAST', + token_DESC = 'token_DESC', + token_DESC_NULLS_FIRST = 'token_DESC_NULLS_FIRST', + token_DESC_NULLS_LAST = 'token_DESC_NULLS_LAST', + txn_ASC = 'txn_ASC', + txn_ASC_NULLS_FIRST = 'txn_ASC_NULLS_FIRST', + txn_ASC_NULLS_LAST = 'txn_ASC_NULLS_LAST', + txn_DESC = 'txn_DESC', + txn_DESC_NULLS_FIRST = 'txn_DESC_NULLS_FIRST', + txn_DESC_NULLS_LAST = 'txn_DESC_NULLS_LAST' } export interface MultichainFundingSendEventWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - expectedReceivedAmount_eq?: InputMaybe; - expectedReceivedAmount_gt?: InputMaybe; - expectedReceivedAmount_gte?: InputMaybe; - expectedReceivedAmount_in?: InputMaybe>; - expectedReceivedAmount_isNull?: InputMaybe; - expectedReceivedAmount_lt?: InputMaybe; - expectedReceivedAmount_lte?: InputMaybe; - expectedReceivedAmount_not_eq?: InputMaybe; - expectedReceivedAmount_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + expectedReceivedAmount_eq?: InputMaybe; + expectedReceivedAmount_gt?: InputMaybe; + expectedReceivedAmount_gte?: InputMaybe; + expectedReceivedAmount_in?: InputMaybe>; + expectedReceivedAmount_isNull?: InputMaybe; + expectedReceivedAmount_lt?: InputMaybe; + expectedReceivedAmount_lte?: InputMaybe; + expectedReceivedAmount_not_eq?: InputMaybe; + expectedReceivedAmount_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; operation_eq?: InputMaybe; operation_in?: InputMaybe>; - operation_isNull?: InputMaybe; + operation_isNull?: InputMaybe; operation_not_eq?: InputMaybe; operation_not_in?: InputMaybe>; - sentAmount_eq?: InputMaybe; - sentAmount_gt?: InputMaybe; - sentAmount_gte?: InputMaybe; - sentAmount_in?: InputMaybe>; - sentAmount_isNull?: InputMaybe; - sentAmount_lt?: InputMaybe; - sentAmount_lte?: InputMaybe; - sentAmount_not_eq?: InputMaybe; - sentAmount_not_in?: InputMaybe>; - settlementChainId_eq?: InputMaybe; - settlementChainId_gt?: InputMaybe; - settlementChainId_gte?: InputMaybe; - settlementChainId_in?: InputMaybe>; - settlementChainId_isNull?: InputMaybe; - settlementChainId_lt?: InputMaybe; - settlementChainId_lte?: InputMaybe; - settlementChainId_not_eq?: InputMaybe; - settlementChainId_not_in?: InputMaybe>; - sourceChainId_eq?: InputMaybe; - sourceChainId_gt?: InputMaybe; - sourceChainId_gte?: InputMaybe; - sourceChainId_in?: InputMaybe>; - sourceChainId_isNull?: InputMaybe; - sourceChainId_lt?: InputMaybe; - sourceChainId_lte?: InputMaybe; - sourceChainId_not_eq?: InputMaybe; - sourceChainId_not_in?: InputMaybe>; - token_contains?: InputMaybe; - token_containsInsensitive?: InputMaybe; - token_endsWith?: InputMaybe; - token_eq?: InputMaybe; - token_gt?: InputMaybe; - token_gte?: InputMaybe; - token_in?: InputMaybe>; - token_isNull?: InputMaybe; - token_lt?: InputMaybe; - token_lte?: InputMaybe; - token_not_contains?: InputMaybe; - token_not_containsInsensitive?: InputMaybe; - token_not_endsWith?: InputMaybe; - token_not_eq?: InputMaybe; - token_not_in?: InputMaybe>; - token_not_startsWith?: InputMaybe; - token_startsWith?: InputMaybe; - txn?: InputMaybe; - txn_isNull?: InputMaybe; + sentAmount_eq?: InputMaybe; + sentAmount_gt?: InputMaybe; + sentAmount_gte?: InputMaybe; + sentAmount_in?: InputMaybe>; + sentAmount_isNull?: InputMaybe; + sentAmount_lt?: InputMaybe; + sentAmount_lte?: InputMaybe; + sentAmount_not_eq?: InputMaybe; + sentAmount_not_in?: InputMaybe>; + settlementChainId_eq?: InputMaybe; + settlementChainId_gt?: InputMaybe; + settlementChainId_gte?: InputMaybe; + settlementChainId_in?: InputMaybe>; + settlementChainId_isNull?: InputMaybe; + settlementChainId_lt?: InputMaybe; + settlementChainId_lte?: InputMaybe; + settlementChainId_not_eq?: InputMaybe; + settlementChainId_not_in?: InputMaybe>; + sourceChainId_eq?: InputMaybe; + sourceChainId_gt?: InputMaybe; + sourceChainId_gte?: InputMaybe; + sourceChainId_in?: InputMaybe>; + sourceChainId_isNull?: InputMaybe; + sourceChainId_lt?: InputMaybe; + sourceChainId_lte?: InputMaybe; + sourceChainId_not_eq?: InputMaybe; + sourceChainId_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token_contains?: InputMaybe; + token_containsInsensitive?: InputMaybe; + token_endsWith?: InputMaybe; + token_eq?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_isNull?: InputMaybe; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_containsInsensitive?: InputMaybe; + token_not_endsWith?: InputMaybe; + token_not_eq?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_startsWith?: InputMaybe; + token_startsWith?: InputMaybe; + txn_contains?: InputMaybe; + txn_containsInsensitive?: InputMaybe; + txn_endsWith?: InputMaybe; + txn_eq?: InputMaybe; + txn_gt?: InputMaybe; + txn_gte?: InputMaybe; + txn_in?: InputMaybe>; + txn_isNull?: InputMaybe; + txn_lt?: InputMaybe; + txn_lte?: InputMaybe; + txn_not_contains?: InputMaybe; + txn_not_containsInsensitive?: InputMaybe; + txn_not_endsWith?: InputMaybe; + txn_not_eq?: InputMaybe; + txn_not_in?: InputMaybe>; + txn_not_startsWith?: InputMaybe; + txn_startsWith?: InputMaybe; } export interface MultichainFundingSendEventsConnection { - __typename?: "MultichainFundingSendEventsConnection"; + __typename?: 'MultichainFundingSendEventsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface MultichainFundingWhereInput { - account?: InputMaybe; - id?: InputMaybe; + account?: InputMaybe; + id?: InputMaybe; + sourceChainId?: InputMaybe; } export interface MultichainMetadata { - __typename?: "MultichainMetadata"; - id: Scalars["String"]["output"]; - lastBlockNumber: Scalars["Int"]["output"]; - lastBlockTimestamp: Scalars["Int"]["output"]; + __typename?: 'MultichainMetadata'; + id: Scalars['String']['output']; + lastBlockNumber: Scalars['Int']['output']; + lastBlockTimestamp: Scalars['Int']['output']; } export interface MultichainMetadataConnection { - __typename?: "MultichainMetadataConnection"; + __typename?: 'MultichainMetadataConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface MultichainMetadataEdge { - __typename?: "MultichainMetadataEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'MultichainMetadataEdge'; + cursor: Scalars['String']['output']; node: MultichainMetadata; } export enum MultichainMetadataOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - lastBlockNumber_ASC = "lastBlockNumber_ASC", - lastBlockNumber_ASC_NULLS_FIRST = "lastBlockNumber_ASC_NULLS_FIRST", - lastBlockNumber_ASC_NULLS_LAST = "lastBlockNumber_ASC_NULLS_LAST", - lastBlockNumber_DESC = "lastBlockNumber_DESC", - lastBlockNumber_DESC_NULLS_FIRST = "lastBlockNumber_DESC_NULLS_FIRST", - lastBlockNumber_DESC_NULLS_LAST = "lastBlockNumber_DESC_NULLS_LAST", - lastBlockTimestamp_ASC = "lastBlockTimestamp_ASC", - lastBlockTimestamp_ASC_NULLS_FIRST = "lastBlockTimestamp_ASC_NULLS_FIRST", - lastBlockTimestamp_ASC_NULLS_LAST = "lastBlockTimestamp_ASC_NULLS_LAST", - lastBlockTimestamp_DESC = "lastBlockTimestamp_DESC", - lastBlockTimestamp_DESC_NULLS_FIRST = "lastBlockTimestamp_DESC_NULLS_FIRST", - lastBlockTimestamp_DESC_NULLS_LAST = "lastBlockTimestamp_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + lastBlockNumber_ASC = 'lastBlockNumber_ASC', + lastBlockNumber_ASC_NULLS_FIRST = 'lastBlockNumber_ASC_NULLS_FIRST', + lastBlockNumber_ASC_NULLS_LAST = 'lastBlockNumber_ASC_NULLS_LAST', + lastBlockNumber_DESC = 'lastBlockNumber_DESC', + lastBlockNumber_DESC_NULLS_FIRST = 'lastBlockNumber_DESC_NULLS_FIRST', + lastBlockNumber_DESC_NULLS_LAST = 'lastBlockNumber_DESC_NULLS_LAST', + lastBlockTimestamp_ASC = 'lastBlockTimestamp_ASC', + lastBlockTimestamp_ASC_NULLS_FIRST = 'lastBlockTimestamp_ASC_NULLS_FIRST', + lastBlockTimestamp_ASC_NULLS_LAST = 'lastBlockTimestamp_ASC_NULLS_LAST', + lastBlockTimestamp_DESC = 'lastBlockTimestamp_DESC', + lastBlockTimestamp_DESC_NULLS_FIRST = 'lastBlockTimestamp_DESC_NULLS_FIRST', + lastBlockTimestamp_DESC_NULLS_LAST = 'lastBlockTimestamp_DESC_NULLS_LAST' } export interface MultichainMetadataWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - lastBlockNumber_eq?: InputMaybe; - lastBlockNumber_gt?: InputMaybe; - lastBlockNumber_gte?: InputMaybe; - lastBlockNumber_in?: InputMaybe>; - lastBlockNumber_isNull?: InputMaybe; - lastBlockNumber_lt?: InputMaybe; - lastBlockNumber_lte?: InputMaybe; - lastBlockNumber_not_eq?: InputMaybe; - lastBlockNumber_not_in?: InputMaybe>; - lastBlockTimestamp_eq?: InputMaybe; - lastBlockTimestamp_gt?: InputMaybe; - lastBlockTimestamp_gte?: InputMaybe; - lastBlockTimestamp_in?: InputMaybe>; - lastBlockTimestamp_isNull?: InputMaybe; - lastBlockTimestamp_lt?: InputMaybe; - lastBlockTimestamp_lte?: InputMaybe; - lastBlockTimestamp_not_eq?: InputMaybe; - lastBlockTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + lastBlockNumber_eq?: InputMaybe; + lastBlockNumber_gt?: InputMaybe; + lastBlockNumber_gte?: InputMaybe; + lastBlockNumber_in?: InputMaybe>; + lastBlockNumber_isNull?: InputMaybe; + lastBlockNumber_lt?: InputMaybe; + lastBlockNumber_lte?: InputMaybe; + lastBlockNumber_not_eq?: InputMaybe; + lastBlockNumber_not_in?: InputMaybe>; + lastBlockTimestamp_eq?: InputMaybe; + lastBlockTimestamp_gt?: InputMaybe; + lastBlockTimestamp_gte?: InputMaybe; + lastBlockTimestamp_in?: InputMaybe>; + lastBlockTimestamp_isNull?: InputMaybe; + lastBlockTimestamp_lt?: InputMaybe; + lastBlockTimestamp_lte?: InputMaybe; + lastBlockTimestamp_not_eq?: InputMaybe; + lastBlockTimestamp_not_in?: InputMaybe>; } export interface OnChainSetting { - __typename?: "OnChainSetting"; - id: Scalars["String"]["output"]; - key: Scalars["String"]["output"]; + __typename?: 'OnChainSetting'; + id: Scalars['String']['output']; + key: Scalars['String']['output']; type: OnChainSettingType; - value: Scalars["String"]["output"]; + value: Scalars['String']['output']; } export interface OnChainSettingEdge { - __typename?: "OnChainSettingEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'OnChainSettingEdge'; + cursor: Scalars['String']['output']; node: OnChainSetting; } export enum OnChainSettingOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - key_ASC = "key_ASC", - key_ASC_NULLS_FIRST = "key_ASC_NULLS_FIRST", - key_ASC_NULLS_LAST = "key_ASC_NULLS_LAST", - key_DESC = "key_DESC", - key_DESC_NULLS_FIRST = "key_DESC_NULLS_FIRST", - key_DESC_NULLS_LAST = "key_DESC_NULLS_LAST", - type_ASC = "type_ASC", - type_ASC_NULLS_FIRST = "type_ASC_NULLS_FIRST", - type_ASC_NULLS_LAST = "type_ASC_NULLS_LAST", - type_DESC = "type_DESC", - type_DESC_NULLS_FIRST = "type_DESC_NULLS_FIRST", - type_DESC_NULLS_LAST = "type_DESC_NULLS_LAST", - value_ASC = "value_ASC", - value_ASC_NULLS_FIRST = "value_ASC_NULLS_FIRST", - value_ASC_NULLS_LAST = "value_ASC_NULLS_LAST", - value_DESC = "value_DESC", - value_DESC_NULLS_FIRST = "value_DESC_NULLS_FIRST", - value_DESC_NULLS_LAST = "value_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + key_ASC = 'key_ASC', + key_ASC_NULLS_FIRST = 'key_ASC_NULLS_FIRST', + key_ASC_NULLS_LAST = 'key_ASC_NULLS_LAST', + key_DESC = 'key_DESC', + key_DESC_NULLS_FIRST = 'key_DESC_NULLS_FIRST', + key_DESC_NULLS_LAST = 'key_DESC_NULLS_LAST', + type_ASC = 'type_ASC', + type_ASC_NULLS_FIRST = 'type_ASC_NULLS_FIRST', + type_ASC_NULLS_LAST = 'type_ASC_NULLS_LAST', + type_DESC = 'type_DESC', + type_DESC_NULLS_FIRST = 'type_DESC_NULLS_FIRST', + type_DESC_NULLS_LAST = 'type_DESC_NULLS_LAST', + value_ASC = 'value_ASC', + value_ASC_NULLS_FIRST = 'value_ASC_NULLS_FIRST', + value_ASC_NULLS_LAST = 'value_ASC_NULLS_LAST', + value_DESC = 'value_DESC', + value_DESC_NULLS_FIRST = 'value_DESC_NULLS_FIRST', + value_DESC_NULLS_LAST = 'value_DESC_NULLS_LAST' } export enum OnChainSettingType { - bool = "bool", - bytes32 = "bytes32", - string = "string", - uint = "uint", + bool = 'bool', + bytes32 = 'bytes32', + string = 'string', + uint = 'uint' } export interface OnChainSettingWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - key_contains?: InputMaybe; - key_containsInsensitive?: InputMaybe; - key_endsWith?: InputMaybe; - key_eq?: InputMaybe; - key_gt?: InputMaybe; - key_gte?: InputMaybe; - key_in?: InputMaybe>; - key_isNull?: InputMaybe; - key_lt?: InputMaybe; - key_lte?: InputMaybe; - key_not_contains?: InputMaybe; - key_not_containsInsensitive?: InputMaybe; - key_not_endsWith?: InputMaybe; - key_not_eq?: InputMaybe; - key_not_in?: InputMaybe>; - key_not_startsWith?: InputMaybe; - key_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + key_contains?: InputMaybe; + key_containsInsensitive?: InputMaybe; + key_endsWith?: InputMaybe; + key_eq?: InputMaybe; + key_gt?: InputMaybe; + key_gte?: InputMaybe; + key_in?: InputMaybe>; + key_isNull?: InputMaybe; + key_lt?: InputMaybe; + key_lte?: InputMaybe; + key_not_contains?: InputMaybe; + key_not_containsInsensitive?: InputMaybe; + key_not_endsWith?: InputMaybe; + key_not_eq?: InputMaybe; + key_not_in?: InputMaybe>; + key_not_startsWith?: InputMaybe; + key_startsWith?: InputMaybe; type_eq?: InputMaybe; type_in?: InputMaybe>; - type_isNull?: InputMaybe; + type_isNull?: InputMaybe; type_not_eq?: InputMaybe; type_not_in?: InputMaybe>; - value_contains?: InputMaybe; - value_containsInsensitive?: InputMaybe; - value_endsWith?: InputMaybe; - value_eq?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; - value_isNull?: InputMaybe; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not_contains?: InputMaybe; - value_not_containsInsensitive?: InputMaybe; - value_not_endsWith?: InputMaybe; - value_not_eq?: InputMaybe; - value_not_in?: InputMaybe>; - value_not_startsWith?: InputMaybe; - value_startsWith?: InputMaybe; + value_contains?: InputMaybe; + value_containsInsensitive?: InputMaybe; + value_endsWith?: InputMaybe; + value_eq?: InputMaybe; + value_gt?: InputMaybe; + value_gte?: InputMaybe; + value_in?: InputMaybe>; + value_isNull?: InputMaybe; + value_lt?: InputMaybe; + value_lte?: InputMaybe; + value_not_contains?: InputMaybe; + value_not_containsInsensitive?: InputMaybe; + value_not_endsWith?: InputMaybe; + value_not_eq?: InputMaybe; + value_not_in?: InputMaybe>; + value_not_startsWith?: InputMaybe; + value_startsWith?: InputMaybe; } export interface OnChainSettingsConnection { - __typename?: "OnChainSettingsConnection"; + __typename?: 'OnChainSettingsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Order { - __typename?: "Order"; - acceptablePrice: Scalars["BigInt"]["output"]; - account: Scalars["String"]["output"]; - callbackContract: Scalars["String"]["output"]; - callbackGasLimit: Scalars["BigInt"]["output"]; - cancelledReason?: Maybe; - cancelledReasonBytes?: Maybe; + __typename?: 'Order'; + acceptablePrice: Scalars['BigInt']['output']; + account: Scalars['String']['output']; + callbackContract: Scalars['String']['output']; + callbackGasLimit: Scalars['BigInt']['output']; + cancelledReason?: Maybe; + cancelledReasonBytes?: Maybe; cancelledTxn?: Maybe; createdTxn: Transaction; executedTxn?: Maybe; - executionFee: Scalars["BigInt"]["output"]; - frozenReason?: Maybe; - frozenReasonBytes?: Maybe; - id: Scalars["String"]["output"]; - initialCollateralDeltaAmount: Scalars["BigInt"]["output"]; - initialCollateralTokenAddress: Scalars["String"]["output"]; - isLong: Scalars["Boolean"]["output"]; - marketAddress: Scalars["String"]["output"]; - minOutputAmount: Scalars["BigInt"]["output"]; - numberOfParts?: Maybe; - orderType: Scalars["Int"]["output"]; - receiver: Scalars["String"]["output"]; - shouldUnwrapNativeToken: Scalars["Boolean"]["output"]; - sizeDeltaUsd: Scalars["BigInt"]["output"]; - srcChainId?: Maybe; + executionFee: Scalars['BigInt']['output']; + frozenReason?: Maybe; + frozenReasonBytes?: Maybe; + id: Scalars['String']['output']; + initialCollateralDeltaAmount: Scalars['BigInt']['output']; + initialCollateralTokenAddress: Scalars['String']['output']; + isLong: Scalars['Boolean']['output']; + marketAddress: Scalars['String']['output']; + minOutputAmount: Scalars['BigInt']['output']; + numberOfParts?: Maybe; + orderType: Scalars['Int']['output']; + receiver: Scalars['String']['output']; + shouldUnwrapNativeToken: Scalars['Boolean']['output']; + sizeDeltaUsd: Scalars['BigInt']['output']; + srcChainId?: Maybe; status: OrderStatus; - swapPath: Array; - triggerPrice: Scalars["BigInt"]["output"]; - twapGroupId?: Maybe; - uiFeeReceiver: Scalars["String"]["output"]; - updatedAtBlock: Scalars["BigInt"]["output"]; + swapPath: Array; + triggerPrice: Scalars['BigInt']['output']; + twapGroupId?: Maybe; + uiFeeReceiver: Scalars['String']['output']; + updatedAtBlock: Scalars['BigInt']['output']; } export interface OrderEdge { - __typename?: "OrderEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'OrderEdge'; + cursor: Scalars['String']['output']; node: Order; } export enum OrderOrderByInput { - acceptablePrice_ASC = "acceptablePrice_ASC", - acceptablePrice_ASC_NULLS_FIRST = "acceptablePrice_ASC_NULLS_FIRST", - acceptablePrice_ASC_NULLS_LAST = "acceptablePrice_ASC_NULLS_LAST", - acceptablePrice_DESC = "acceptablePrice_DESC", - acceptablePrice_DESC_NULLS_FIRST = "acceptablePrice_DESC_NULLS_FIRST", - acceptablePrice_DESC_NULLS_LAST = "acceptablePrice_DESC_NULLS_LAST", - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - callbackContract_ASC = "callbackContract_ASC", - callbackContract_ASC_NULLS_FIRST = "callbackContract_ASC_NULLS_FIRST", - callbackContract_ASC_NULLS_LAST = "callbackContract_ASC_NULLS_LAST", - callbackContract_DESC = "callbackContract_DESC", - callbackContract_DESC_NULLS_FIRST = "callbackContract_DESC_NULLS_FIRST", - callbackContract_DESC_NULLS_LAST = "callbackContract_DESC_NULLS_LAST", - callbackGasLimit_ASC = "callbackGasLimit_ASC", - callbackGasLimit_ASC_NULLS_FIRST = "callbackGasLimit_ASC_NULLS_FIRST", - callbackGasLimit_ASC_NULLS_LAST = "callbackGasLimit_ASC_NULLS_LAST", - callbackGasLimit_DESC = "callbackGasLimit_DESC", - callbackGasLimit_DESC_NULLS_FIRST = "callbackGasLimit_DESC_NULLS_FIRST", - callbackGasLimit_DESC_NULLS_LAST = "callbackGasLimit_DESC_NULLS_LAST", - cancelledReasonBytes_ASC = "cancelledReasonBytes_ASC", - cancelledReasonBytes_ASC_NULLS_FIRST = "cancelledReasonBytes_ASC_NULLS_FIRST", - cancelledReasonBytes_ASC_NULLS_LAST = "cancelledReasonBytes_ASC_NULLS_LAST", - cancelledReasonBytes_DESC = "cancelledReasonBytes_DESC", - cancelledReasonBytes_DESC_NULLS_FIRST = "cancelledReasonBytes_DESC_NULLS_FIRST", - cancelledReasonBytes_DESC_NULLS_LAST = "cancelledReasonBytes_DESC_NULLS_LAST", - cancelledReason_ASC = "cancelledReason_ASC", - cancelledReason_ASC_NULLS_FIRST = "cancelledReason_ASC_NULLS_FIRST", - cancelledReason_ASC_NULLS_LAST = "cancelledReason_ASC_NULLS_LAST", - cancelledReason_DESC = "cancelledReason_DESC", - cancelledReason_DESC_NULLS_FIRST = "cancelledReason_DESC_NULLS_FIRST", - cancelledReason_DESC_NULLS_LAST = "cancelledReason_DESC_NULLS_LAST", - cancelledTxn_blockNumber_ASC = "cancelledTxn_blockNumber_ASC", - cancelledTxn_blockNumber_ASC_NULLS_FIRST = "cancelledTxn_blockNumber_ASC_NULLS_FIRST", - cancelledTxn_blockNumber_ASC_NULLS_LAST = "cancelledTxn_blockNumber_ASC_NULLS_LAST", - cancelledTxn_blockNumber_DESC = "cancelledTxn_blockNumber_DESC", - cancelledTxn_blockNumber_DESC_NULLS_FIRST = "cancelledTxn_blockNumber_DESC_NULLS_FIRST", - cancelledTxn_blockNumber_DESC_NULLS_LAST = "cancelledTxn_blockNumber_DESC_NULLS_LAST", - cancelledTxn_chainId_ASC = "cancelledTxn_chainId_ASC", - cancelledTxn_chainId_ASC_NULLS_FIRST = "cancelledTxn_chainId_ASC_NULLS_FIRST", - cancelledTxn_chainId_ASC_NULLS_LAST = "cancelledTxn_chainId_ASC_NULLS_LAST", - cancelledTxn_chainId_DESC = "cancelledTxn_chainId_DESC", - cancelledTxn_chainId_DESC_NULLS_FIRST = "cancelledTxn_chainId_DESC_NULLS_FIRST", - cancelledTxn_chainId_DESC_NULLS_LAST = "cancelledTxn_chainId_DESC_NULLS_LAST", - cancelledTxn_from_ASC = "cancelledTxn_from_ASC", - cancelledTxn_from_ASC_NULLS_FIRST = "cancelledTxn_from_ASC_NULLS_FIRST", - cancelledTxn_from_ASC_NULLS_LAST = "cancelledTxn_from_ASC_NULLS_LAST", - cancelledTxn_from_DESC = "cancelledTxn_from_DESC", - cancelledTxn_from_DESC_NULLS_FIRST = "cancelledTxn_from_DESC_NULLS_FIRST", - cancelledTxn_from_DESC_NULLS_LAST = "cancelledTxn_from_DESC_NULLS_LAST", - cancelledTxn_hash_ASC = "cancelledTxn_hash_ASC", - cancelledTxn_hash_ASC_NULLS_FIRST = "cancelledTxn_hash_ASC_NULLS_FIRST", - cancelledTxn_hash_ASC_NULLS_LAST = "cancelledTxn_hash_ASC_NULLS_LAST", - cancelledTxn_hash_DESC = "cancelledTxn_hash_DESC", - cancelledTxn_hash_DESC_NULLS_FIRST = "cancelledTxn_hash_DESC_NULLS_FIRST", - cancelledTxn_hash_DESC_NULLS_LAST = "cancelledTxn_hash_DESC_NULLS_LAST", - cancelledTxn_id_ASC = "cancelledTxn_id_ASC", - cancelledTxn_id_ASC_NULLS_FIRST = "cancelledTxn_id_ASC_NULLS_FIRST", - cancelledTxn_id_ASC_NULLS_LAST = "cancelledTxn_id_ASC_NULLS_LAST", - cancelledTxn_id_DESC = "cancelledTxn_id_DESC", - cancelledTxn_id_DESC_NULLS_FIRST = "cancelledTxn_id_DESC_NULLS_FIRST", - cancelledTxn_id_DESC_NULLS_LAST = "cancelledTxn_id_DESC_NULLS_LAST", - cancelledTxn_timestamp_ASC = "cancelledTxn_timestamp_ASC", - cancelledTxn_timestamp_ASC_NULLS_FIRST = "cancelledTxn_timestamp_ASC_NULLS_FIRST", - cancelledTxn_timestamp_ASC_NULLS_LAST = "cancelledTxn_timestamp_ASC_NULLS_LAST", - cancelledTxn_timestamp_DESC = "cancelledTxn_timestamp_DESC", - cancelledTxn_timestamp_DESC_NULLS_FIRST = "cancelledTxn_timestamp_DESC_NULLS_FIRST", - cancelledTxn_timestamp_DESC_NULLS_LAST = "cancelledTxn_timestamp_DESC_NULLS_LAST", - cancelledTxn_to_ASC = "cancelledTxn_to_ASC", - cancelledTxn_to_ASC_NULLS_FIRST = "cancelledTxn_to_ASC_NULLS_FIRST", - cancelledTxn_to_ASC_NULLS_LAST = "cancelledTxn_to_ASC_NULLS_LAST", - cancelledTxn_to_DESC = "cancelledTxn_to_DESC", - cancelledTxn_to_DESC_NULLS_FIRST = "cancelledTxn_to_DESC_NULLS_FIRST", - cancelledTxn_to_DESC_NULLS_LAST = "cancelledTxn_to_DESC_NULLS_LAST", - cancelledTxn_transactionIndex_ASC = "cancelledTxn_transactionIndex_ASC", - cancelledTxn_transactionIndex_ASC_NULLS_FIRST = "cancelledTxn_transactionIndex_ASC_NULLS_FIRST", - cancelledTxn_transactionIndex_ASC_NULLS_LAST = "cancelledTxn_transactionIndex_ASC_NULLS_LAST", - cancelledTxn_transactionIndex_DESC = "cancelledTxn_transactionIndex_DESC", - cancelledTxn_transactionIndex_DESC_NULLS_FIRST = "cancelledTxn_transactionIndex_DESC_NULLS_FIRST", - cancelledTxn_transactionIndex_DESC_NULLS_LAST = "cancelledTxn_transactionIndex_DESC_NULLS_LAST", - createdTxn_blockNumber_ASC = "createdTxn_blockNumber_ASC", - createdTxn_blockNumber_ASC_NULLS_FIRST = "createdTxn_blockNumber_ASC_NULLS_FIRST", - createdTxn_blockNumber_ASC_NULLS_LAST = "createdTxn_blockNumber_ASC_NULLS_LAST", - createdTxn_blockNumber_DESC = "createdTxn_blockNumber_DESC", - createdTxn_blockNumber_DESC_NULLS_FIRST = "createdTxn_blockNumber_DESC_NULLS_FIRST", - createdTxn_blockNumber_DESC_NULLS_LAST = "createdTxn_blockNumber_DESC_NULLS_LAST", - createdTxn_chainId_ASC = "createdTxn_chainId_ASC", - createdTxn_chainId_ASC_NULLS_FIRST = "createdTxn_chainId_ASC_NULLS_FIRST", - createdTxn_chainId_ASC_NULLS_LAST = "createdTxn_chainId_ASC_NULLS_LAST", - createdTxn_chainId_DESC = "createdTxn_chainId_DESC", - createdTxn_chainId_DESC_NULLS_FIRST = "createdTxn_chainId_DESC_NULLS_FIRST", - createdTxn_chainId_DESC_NULLS_LAST = "createdTxn_chainId_DESC_NULLS_LAST", - createdTxn_from_ASC = "createdTxn_from_ASC", - createdTxn_from_ASC_NULLS_FIRST = "createdTxn_from_ASC_NULLS_FIRST", - createdTxn_from_ASC_NULLS_LAST = "createdTxn_from_ASC_NULLS_LAST", - createdTxn_from_DESC = "createdTxn_from_DESC", - createdTxn_from_DESC_NULLS_FIRST = "createdTxn_from_DESC_NULLS_FIRST", - createdTxn_from_DESC_NULLS_LAST = "createdTxn_from_DESC_NULLS_LAST", - createdTxn_hash_ASC = "createdTxn_hash_ASC", - createdTxn_hash_ASC_NULLS_FIRST = "createdTxn_hash_ASC_NULLS_FIRST", - createdTxn_hash_ASC_NULLS_LAST = "createdTxn_hash_ASC_NULLS_LAST", - createdTxn_hash_DESC = "createdTxn_hash_DESC", - createdTxn_hash_DESC_NULLS_FIRST = "createdTxn_hash_DESC_NULLS_FIRST", - createdTxn_hash_DESC_NULLS_LAST = "createdTxn_hash_DESC_NULLS_LAST", - createdTxn_id_ASC = "createdTxn_id_ASC", - createdTxn_id_ASC_NULLS_FIRST = "createdTxn_id_ASC_NULLS_FIRST", - createdTxn_id_ASC_NULLS_LAST = "createdTxn_id_ASC_NULLS_LAST", - createdTxn_id_DESC = "createdTxn_id_DESC", - createdTxn_id_DESC_NULLS_FIRST = "createdTxn_id_DESC_NULLS_FIRST", - createdTxn_id_DESC_NULLS_LAST = "createdTxn_id_DESC_NULLS_LAST", - createdTxn_timestamp_ASC = "createdTxn_timestamp_ASC", - createdTxn_timestamp_ASC_NULLS_FIRST = "createdTxn_timestamp_ASC_NULLS_FIRST", - createdTxn_timestamp_ASC_NULLS_LAST = "createdTxn_timestamp_ASC_NULLS_LAST", - createdTxn_timestamp_DESC = "createdTxn_timestamp_DESC", - createdTxn_timestamp_DESC_NULLS_FIRST = "createdTxn_timestamp_DESC_NULLS_FIRST", - createdTxn_timestamp_DESC_NULLS_LAST = "createdTxn_timestamp_DESC_NULLS_LAST", - createdTxn_to_ASC = "createdTxn_to_ASC", - createdTxn_to_ASC_NULLS_FIRST = "createdTxn_to_ASC_NULLS_FIRST", - createdTxn_to_ASC_NULLS_LAST = "createdTxn_to_ASC_NULLS_LAST", - createdTxn_to_DESC = "createdTxn_to_DESC", - createdTxn_to_DESC_NULLS_FIRST = "createdTxn_to_DESC_NULLS_FIRST", - createdTxn_to_DESC_NULLS_LAST = "createdTxn_to_DESC_NULLS_LAST", - createdTxn_transactionIndex_ASC = "createdTxn_transactionIndex_ASC", - createdTxn_transactionIndex_ASC_NULLS_FIRST = "createdTxn_transactionIndex_ASC_NULLS_FIRST", - createdTxn_transactionIndex_ASC_NULLS_LAST = "createdTxn_transactionIndex_ASC_NULLS_LAST", - createdTxn_transactionIndex_DESC = "createdTxn_transactionIndex_DESC", - createdTxn_transactionIndex_DESC_NULLS_FIRST = "createdTxn_transactionIndex_DESC_NULLS_FIRST", - createdTxn_transactionIndex_DESC_NULLS_LAST = "createdTxn_transactionIndex_DESC_NULLS_LAST", - executedTxn_blockNumber_ASC = "executedTxn_blockNumber_ASC", - executedTxn_blockNumber_ASC_NULLS_FIRST = "executedTxn_blockNumber_ASC_NULLS_FIRST", - executedTxn_blockNumber_ASC_NULLS_LAST = "executedTxn_blockNumber_ASC_NULLS_LAST", - executedTxn_blockNumber_DESC = "executedTxn_blockNumber_DESC", - executedTxn_blockNumber_DESC_NULLS_FIRST = "executedTxn_blockNumber_DESC_NULLS_FIRST", - executedTxn_blockNumber_DESC_NULLS_LAST = "executedTxn_blockNumber_DESC_NULLS_LAST", - executedTxn_chainId_ASC = "executedTxn_chainId_ASC", - executedTxn_chainId_ASC_NULLS_FIRST = "executedTxn_chainId_ASC_NULLS_FIRST", - executedTxn_chainId_ASC_NULLS_LAST = "executedTxn_chainId_ASC_NULLS_LAST", - executedTxn_chainId_DESC = "executedTxn_chainId_DESC", - executedTxn_chainId_DESC_NULLS_FIRST = "executedTxn_chainId_DESC_NULLS_FIRST", - executedTxn_chainId_DESC_NULLS_LAST = "executedTxn_chainId_DESC_NULLS_LAST", - executedTxn_from_ASC = "executedTxn_from_ASC", - executedTxn_from_ASC_NULLS_FIRST = "executedTxn_from_ASC_NULLS_FIRST", - executedTxn_from_ASC_NULLS_LAST = "executedTxn_from_ASC_NULLS_LAST", - executedTxn_from_DESC = "executedTxn_from_DESC", - executedTxn_from_DESC_NULLS_FIRST = "executedTxn_from_DESC_NULLS_FIRST", - executedTxn_from_DESC_NULLS_LAST = "executedTxn_from_DESC_NULLS_LAST", - executedTxn_hash_ASC = "executedTxn_hash_ASC", - executedTxn_hash_ASC_NULLS_FIRST = "executedTxn_hash_ASC_NULLS_FIRST", - executedTxn_hash_ASC_NULLS_LAST = "executedTxn_hash_ASC_NULLS_LAST", - executedTxn_hash_DESC = "executedTxn_hash_DESC", - executedTxn_hash_DESC_NULLS_FIRST = "executedTxn_hash_DESC_NULLS_FIRST", - executedTxn_hash_DESC_NULLS_LAST = "executedTxn_hash_DESC_NULLS_LAST", - executedTxn_id_ASC = "executedTxn_id_ASC", - executedTxn_id_ASC_NULLS_FIRST = "executedTxn_id_ASC_NULLS_FIRST", - executedTxn_id_ASC_NULLS_LAST = "executedTxn_id_ASC_NULLS_LAST", - executedTxn_id_DESC = "executedTxn_id_DESC", - executedTxn_id_DESC_NULLS_FIRST = "executedTxn_id_DESC_NULLS_FIRST", - executedTxn_id_DESC_NULLS_LAST = "executedTxn_id_DESC_NULLS_LAST", - executedTxn_timestamp_ASC = "executedTxn_timestamp_ASC", - executedTxn_timestamp_ASC_NULLS_FIRST = "executedTxn_timestamp_ASC_NULLS_FIRST", - executedTxn_timestamp_ASC_NULLS_LAST = "executedTxn_timestamp_ASC_NULLS_LAST", - executedTxn_timestamp_DESC = "executedTxn_timestamp_DESC", - executedTxn_timestamp_DESC_NULLS_FIRST = "executedTxn_timestamp_DESC_NULLS_FIRST", - executedTxn_timestamp_DESC_NULLS_LAST = "executedTxn_timestamp_DESC_NULLS_LAST", - executedTxn_to_ASC = "executedTxn_to_ASC", - executedTxn_to_ASC_NULLS_FIRST = "executedTxn_to_ASC_NULLS_FIRST", - executedTxn_to_ASC_NULLS_LAST = "executedTxn_to_ASC_NULLS_LAST", - executedTxn_to_DESC = "executedTxn_to_DESC", - executedTxn_to_DESC_NULLS_FIRST = "executedTxn_to_DESC_NULLS_FIRST", - executedTxn_to_DESC_NULLS_LAST = "executedTxn_to_DESC_NULLS_LAST", - executedTxn_transactionIndex_ASC = "executedTxn_transactionIndex_ASC", - executedTxn_transactionIndex_ASC_NULLS_FIRST = "executedTxn_transactionIndex_ASC_NULLS_FIRST", - executedTxn_transactionIndex_ASC_NULLS_LAST = "executedTxn_transactionIndex_ASC_NULLS_LAST", - executedTxn_transactionIndex_DESC = "executedTxn_transactionIndex_DESC", - executedTxn_transactionIndex_DESC_NULLS_FIRST = "executedTxn_transactionIndex_DESC_NULLS_FIRST", - executedTxn_transactionIndex_DESC_NULLS_LAST = "executedTxn_transactionIndex_DESC_NULLS_LAST", - executionFee_ASC = "executionFee_ASC", - executionFee_ASC_NULLS_FIRST = "executionFee_ASC_NULLS_FIRST", - executionFee_ASC_NULLS_LAST = "executionFee_ASC_NULLS_LAST", - executionFee_DESC = "executionFee_DESC", - executionFee_DESC_NULLS_FIRST = "executionFee_DESC_NULLS_FIRST", - executionFee_DESC_NULLS_LAST = "executionFee_DESC_NULLS_LAST", - frozenReasonBytes_ASC = "frozenReasonBytes_ASC", - frozenReasonBytes_ASC_NULLS_FIRST = "frozenReasonBytes_ASC_NULLS_FIRST", - frozenReasonBytes_ASC_NULLS_LAST = "frozenReasonBytes_ASC_NULLS_LAST", - frozenReasonBytes_DESC = "frozenReasonBytes_DESC", - frozenReasonBytes_DESC_NULLS_FIRST = "frozenReasonBytes_DESC_NULLS_FIRST", - frozenReasonBytes_DESC_NULLS_LAST = "frozenReasonBytes_DESC_NULLS_LAST", - frozenReason_ASC = "frozenReason_ASC", - frozenReason_ASC_NULLS_FIRST = "frozenReason_ASC_NULLS_FIRST", - frozenReason_ASC_NULLS_LAST = "frozenReason_ASC_NULLS_LAST", - frozenReason_DESC = "frozenReason_DESC", - frozenReason_DESC_NULLS_FIRST = "frozenReason_DESC_NULLS_FIRST", - frozenReason_DESC_NULLS_LAST = "frozenReason_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - initialCollateralDeltaAmount_ASC = "initialCollateralDeltaAmount_ASC", - initialCollateralDeltaAmount_ASC_NULLS_FIRST = "initialCollateralDeltaAmount_ASC_NULLS_FIRST", - initialCollateralDeltaAmount_ASC_NULLS_LAST = "initialCollateralDeltaAmount_ASC_NULLS_LAST", - initialCollateralDeltaAmount_DESC = "initialCollateralDeltaAmount_DESC", - initialCollateralDeltaAmount_DESC_NULLS_FIRST = "initialCollateralDeltaAmount_DESC_NULLS_FIRST", - initialCollateralDeltaAmount_DESC_NULLS_LAST = "initialCollateralDeltaAmount_DESC_NULLS_LAST", - initialCollateralTokenAddress_ASC = "initialCollateralTokenAddress_ASC", - initialCollateralTokenAddress_ASC_NULLS_FIRST = "initialCollateralTokenAddress_ASC_NULLS_FIRST", - initialCollateralTokenAddress_ASC_NULLS_LAST = "initialCollateralTokenAddress_ASC_NULLS_LAST", - initialCollateralTokenAddress_DESC = "initialCollateralTokenAddress_DESC", - initialCollateralTokenAddress_DESC_NULLS_FIRST = "initialCollateralTokenAddress_DESC_NULLS_FIRST", - initialCollateralTokenAddress_DESC_NULLS_LAST = "initialCollateralTokenAddress_DESC_NULLS_LAST", - isLong_ASC = "isLong_ASC", - isLong_ASC_NULLS_FIRST = "isLong_ASC_NULLS_FIRST", - isLong_ASC_NULLS_LAST = "isLong_ASC_NULLS_LAST", - isLong_DESC = "isLong_DESC", - isLong_DESC_NULLS_FIRST = "isLong_DESC_NULLS_FIRST", - isLong_DESC_NULLS_LAST = "isLong_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - minOutputAmount_ASC = "minOutputAmount_ASC", - minOutputAmount_ASC_NULLS_FIRST = "minOutputAmount_ASC_NULLS_FIRST", - minOutputAmount_ASC_NULLS_LAST = "minOutputAmount_ASC_NULLS_LAST", - minOutputAmount_DESC = "minOutputAmount_DESC", - minOutputAmount_DESC_NULLS_FIRST = "minOutputAmount_DESC_NULLS_FIRST", - minOutputAmount_DESC_NULLS_LAST = "minOutputAmount_DESC_NULLS_LAST", - numberOfParts_ASC = "numberOfParts_ASC", - numberOfParts_ASC_NULLS_FIRST = "numberOfParts_ASC_NULLS_FIRST", - numberOfParts_ASC_NULLS_LAST = "numberOfParts_ASC_NULLS_LAST", - numberOfParts_DESC = "numberOfParts_DESC", - numberOfParts_DESC_NULLS_FIRST = "numberOfParts_DESC_NULLS_FIRST", - numberOfParts_DESC_NULLS_LAST = "numberOfParts_DESC_NULLS_LAST", - orderType_ASC = "orderType_ASC", - orderType_ASC_NULLS_FIRST = "orderType_ASC_NULLS_FIRST", - orderType_ASC_NULLS_LAST = "orderType_ASC_NULLS_LAST", - orderType_DESC = "orderType_DESC", - orderType_DESC_NULLS_FIRST = "orderType_DESC_NULLS_FIRST", - orderType_DESC_NULLS_LAST = "orderType_DESC_NULLS_LAST", - receiver_ASC = "receiver_ASC", - receiver_ASC_NULLS_FIRST = "receiver_ASC_NULLS_FIRST", - receiver_ASC_NULLS_LAST = "receiver_ASC_NULLS_LAST", - receiver_DESC = "receiver_DESC", - receiver_DESC_NULLS_FIRST = "receiver_DESC_NULLS_FIRST", - receiver_DESC_NULLS_LAST = "receiver_DESC_NULLS_LAST", - shouldUnwrapNativeToken_ASC = "shouldUnwrapNativeToken_ASC", - shouldUnwrapNativeToken_ASC_NULLS_FIRST = "shouldUnwrapNativeToken_ASC_NULLS_FIRST", - shouldUnwrapNativeToken_ASC_NULLS_LAST = "shouldUnwrapNativeToken_ASC_NULLS_LAST", - shouldUnwrapNativeToken_DESC = "shouldUnwrapNativeToken_DESC", - shouldUnwrapNativeToken_DESC_NULLS_FIRST = "shouldUnwrapNativeToken_DESC_NULLS_FIRST", - shouldUnwrapNativeToken_DESC_NULLS_LAST = "shouldUnwrapNativeToken_DESC_NULLS_LAST", - sizeDeltaUsd_ASC = "sizeDeltaUsd_ASC", - sizeDeltaUsd_ASC_NULLS_FIRST = "sizeDeltaUsd_ASC_NULLS_FIRST", - sizeDeltaUsd_ASC_NULLS_LAST = "sizeDeltaUsd_ASC_NULLS_LAST", - sizeDeltaUsd_DESC = "sizeDeltaUsd_DESC", - sizeDeltaUsd_DESC_NULLS_FIRST = "sizeDeltaUsd_DESC_NULLS_FIRST", - sizeDeltaUsd_DESC_NULLS_LAST = "sizeDeltaUsd_DESC_NULLS_LAST", - srcChainId_ASC = "srcChainId_ASC", - srcChainId_ASC_NULLS_FIRST = "srcChainId_ASC_NULLS_FIRST", - srcChainId_ASC_NULLS_LAST = "srcChainId_ASC_NULLS_LAST", - srcChainId_DESC = "srcChainId_DESC", - srcChainId_DESC_NULLS_FIRST = "srcChainId_DESC_NULLS_FIRST", - srcChainId_DESC_NULLS_LAST = "srcChainId_DESC_NULLS_LAST", - status_ASC = "status_ASC", - status_ASC_NULLS_FIRST = "status_ASC_NULLS_FIRST", - status_ASC_NULLS_LAST = "status_ASC_NULLS_LAST", - status_DESC = "status_DESC", - status_DESC_NULLS_FIRST = "status_DESC_NULLS_FIRST", - status_DESC_NULLS_LAST = "status_DESC_NULLS_LAST", - triggerPrice_ASC = "triggerPrice_ASC", - triggerPrice_ASC_NULLS_FIRST = "triggerPrice_ASC_NULLS_FIRST", - triggerPrice_ASC_NULLS_LAST = "triggerPrice_ASC_NULLS_LAST", - triggerPrice_DESC = "triggerPrice_DESC", - triggerPrice_DESC_NULLS_FIRST = "triggerPrice_DESC_NULLS_FIRST", - triggerPrice_DESC_NULLS_LAST = "triggerPrice_DESC_NULLS_LAST", - twapGroupId_ASC = "twapGroupId_ASC", - twapGroupId_ASC_NULLS_FIRST = "twapGroupId_ASC_NULLS_FIRST", - twapGroupId_ASC_NULLS_LAST = "twapGroupId_ASC_NULLS_LAST", - twapGroupId_DESC = "twapGroupId_DESC", - twapGroupId_DESC_NULLS_FIRST = "twapGroupId_DESC_NULLS_FIRST", - twapGroupId_DESC_NULLS_LAST = "twapGroupId_DESC_NULLS_LAST", - uiFeeReceiver_ASC = "uiFeeReceiver_ASC", - uiFeeReceiver_ASC_NULLS_FIRST = "uiFeeReceiver_ASC_NULLS_FIRST", - uiFeeReceiver_ASC_NULLS_LAST = "uiFeeReceiver_ASC_NULLS_LAST", - uiFeeReceiver_DESC = "uiFeeReceiver_DESC", - uiFeeReceiver_DESC_NULLS_FIRST = "uiFeeReceiver_DESC_NULLS_FIRST", - uiFeeReceiver_DESC_NULLS_LAST = "uiFeeReceiver_DESC_NULLS_LAST", - updatedAtBlock_ASC = "updatedAtBlock_ASC", - updatedAtBlock_ASC_NULLS_FIRST = "updatedAtBlock_ASC_NULLS_FIRST", - updatedAtBlock_ASC_NULLS_LAST = "updatedAtBlock_ASC_NULLS_LAST", - updatedAtBlock_DESC = "updatedAtBlock_DESC", - updatedAtBlock_DESC_NULLS_FIRST = "updatedAtBlock_DESC_NULLS_FIRST", - updatedAtBlock_DESC_NULLS_LAST = "updatedAtBlock_DESC_NULLS_LAST", + acceptablePrice_ASC = 'acceptablePrice_ASC', + acceptablePrice_ASC_NULLS_FIRST = 'acceptablePrice_ASC_NULLS_FIRST', + acceptablePrice_ASC_NULLS_LAST = 'acceptablePrice_ASC_NULLS_LAST', + acceptablePrice_DESC = 'acceptablePrice_DESC', + acceptablePrice_DESC_NULLS_FIRST = 'acceptablePrice_DESC_NULLS_FIRST', + acceptablePrice_DESC_NULLS_LAST = 'acceptablePrice_DESC_NULLS_LAST', + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + callbackContract_ASC = 'callbackContract_ASC', + callbackContract_ASC_NULLS_FIRST = 'callbackContract_ASC_NULLS_FIRST', + callbackContract_ASC_NULLS_LAST = 'callbackContract_ASC_NULLS_LAST', + callbackContract_DESC = 'callbackContract_DESC', + callbackContract_DESC_NULLS_FIRST = 'callbackContract_DESC_NULLS_FIRST', + callbackContract_DESC_NULLS_LAST = 'callbackContract_DESC_NULLS_LAST', + callbackGasLimit_ASC = 'callbackGasLimit_ASC', + callbackGasLimit_ASC_NULLS_FIRST = 'callbackGasLimit_ASC_NULLS_FIRST', + callbackGasLimit_ASC_NULLS_LAST = 'callbackGasLimit_ASC_NULLS_LAST', + callbackGasLimit_DESC = 'callbackGasLimit_DESC', + callbackGasLimit_DESC_NULLS_FIRST = 'callbackGasLimit_DESC_NULLS_FIRST', + callbackGasLimit_DESC_NULLS_LAST = 'callbackGasLimit_DESC_NULLS_LAST', + cancelledReasonBytes_ASC = 'cancelledReasonBytes_ASC', + cancelledReasonBytes_ASC_NULLS_FIRST = 'cancelledReasonBytes_ASC_NULLS_FIRST', + cancelledReasonBytes_ASC_NULLS_LAST = 'cancelledReasonBytes_ASC_NULLS_LAST', + cancelledReasonBytes_DESC = 'cancelledReasonBytes_DESC', + cancelledReasonBytes_DESC_NULLS_FIRST = 'cancelledReasonBytes_DESC_NULLS_FIRST', + cancelledReasonBytes_DESC_NULLS_LAST = 'cancelledReasonBytes_DESC_NULLS_LAST', + cancelledReason_ASC = 'cancelledReason_ASC', + cancelledReason_ASC_NULLS_FIRST = 'cancelledReason_ASC_NULLS_FIRST', + cancelledReason_ASC_NULLS_LAST = 'cancelledReason_ASC_NULLS_LAST', + cancelledReason_DESC = 'cancelledReason_DESC', + cancelledReason_DESC_NULLS_FIRST = 'cancelledReason_DESC_NULLS_FIRST', + cancelledReason_DESC_NULLS_LAST = 'cancelledReason_DESC_NULLS_LAST', + cancelledTxn_blockNumber_ASC = 'cancelledTxn_blockNumber_ASC', + cancelledTxn_blockNumber_ASC_NULLS_FIRST = 'cancelledTxn_blockNumber_ASC_NULLS_FIRST', + cancelledTxn_blockNumber_ASC_NULLS_LAST = 'cancelledTxn_blockNumber_ASC_NULLS_LAST', + cancelledTxn_blockNumber_DESC = 'cancelledTxn_blockNumber_DESC', + cancelledTxn_blockNumber_DESC_NULLS_FIRST = 'cancelledTxn_blockNumber_DESC_NULLS_FIRST', + cancelledTxn_blockNumber_DESC_NULLS_LAST = 'cancelledTxn_blockNumber_DESC_NULLS_LAST', + cancelledTxn_from_ASC = 'cancelledTxn_from_ASC', + cancelledTxn_from_ASC_NULLS_FIRST = 'cancelledTxn_from_ASC_NULLS_FIRST', + cancelledTxn_from_ASC_NULLS_LAST = 'cancelledTxn_from_ASC_NULLS_LAST', + cancelledTxn_from_DESC = 'cancelledTxn_from_DESC', + cancelledTxn_from_DESC_NULLS_FIRST = 'cancelledTxn_from_DESC_NULLS_FIRST', + cancelledTxn_from_DESC_NULLS_LAST = 'cancelledTxn_from_DESC_NULLS_LAST', + cancelledTxn_hash_ASC = 'cancelledTxn_hash_ASC', + cancelledTxn_hash_ASC_NULLS_FIRST = 'cancelledTxn_hash_ASC_NULLS_FIRST', + cancelledTxn_hash_ASC_NULLS_LAST = 'cancelledTxn_hash_ASC_NULLS_LAST', + cancelledTxn_hash_DESC = 'cancelledTxn_hash_DESC', + cancelledTxn_hash_DESC_NULLS_FIRST = 'cancelledTxn_hash_DESC_NULLS_FIRST', + cancelledTxn_hash_DESC_NULLS_LAST = 'cancelledTxn_hash_DESC_NULLS_LAST', + cancelledTxn_id_ASC = 'cancelledTxn_id_ASC', + cancelledTxn_id_ASC_NULLS_FIRST = 'cancelledTxn_id_ASC_NULLS_FIRST', + cancelledTxn_id_ASC_NULLS_LAST = 'cancelledTxn_id_ASC_NULLS_LAST', + cancelledTxn_id_DESC = 'cancelledTxn_id_DESC', + cancelledTxn_id_DESC_NULLS_FIRST = 'cancelledTxn_id_DESC_NULLS_FIRST', + cancelledTxn_id_DESC_NULLS_LAST = 'cancelledTxn_id_DESC_NULLS_LAST', + cancelledTxn_timestamp_ASC = 'cancelledTxn_timestamp_ASC', + cancelledTxn_timestamp_ASC_NULLS_FIRST = 'cancelledTxn_timestamp_ASC_NULLS_FIRST', + cancelledTxn_timestamp_ASC_NULLS_LAST = 'cancelledTxn_timestamp_ASC_NULLS_LAST', + cancelledTxn_timestamp_DESC = 'cancelledTxn_timestamp_DESC', + cancelledTxn_timestamp_DESC_NULLS_FIRST = 'cancelledTxn_timestamp_DESC_NULLS_FIRST', + cancelledTxn_timestamp_DESC_NULLS_LAST = 'cancelledTxn_timestamp_DESC_NULLS_LAST', + cancelledTxn_to_ASC = 'cancelledTxn_to_ASC', + cancelledTxn_to_ASC_NULLS_FIRST = 'cancelledTxn_to_ASC_NULLS_FIRST', + cancelledTxn_to_ASC_NULLS_LAST = 'cancelledTxn_to_ASC_NULLS_LAST', + cancelledTxn_to_DESC = 'cancelledTxn_to_DESC', + cancelledTxn_to_DESC_NULLS_FIRST = 'cancelledTxn_to_DESC_NULLS_FIRST', + cancelledTxn_to_DESC_NULLS_LAST = 'cancelledTxn_to_DESC_NULLS_LAST', + cancelledTxn_transactionIndex_ASC = 'cancelledTxn_transactionIndex_ASC', + cancelledTxn_transactionIndex_ASC_NULLS_FIRST = 'cancelledTxn_transactionIndex_ASC_NULLS_FIRST', + cancelledTxn_transactionIndex_ASC_NULLS_LAST = 'cancelledTxn_transactionIndex_ASC_NULLS_LAST', + cancelledTxn_transactionIndex_DESC = 'cancelledTxn_transactionIndex_DESC', + cancelledTxn_transactionIndex_DESC_NULLS_FIRST = 'cancelledTxn_transactionIndex_DESC_NULLS_FIRST', + cancelledTxn_transactionIndex_DESC_NULLS_LAST = 'cancelledTxn_transactionIndex_DESC_NULLS_LAST', + createdTxn_blockNumber_ASC = 'createdTxn_blockNumber_ASC', + createdTxn_blockNumber_ASC_NULLS_FIRST = 'createdTxn_blockNumber_ASC_NULLS_FIRST', + createdTxn_blockNumber_ASC_NULLS_LAST = 'createdTxn_blockNumber_ASC_NULLS_LAST', + createdTxn_blockNumber_DESC = 'createdTxn_blockNumber_DESC', + createdTxn_blockNumber_DESC_NULLS_FIRST = 'createdTxn_blockNumber_DESC_NULLS_FIRST', + createdTxn_blockNumber_DESC_NULLS_LAST = 'createdTxn_blockNumber_DESC_NULLS_LAST', + createdTxn_from_ASC = 'createdTxn_from_ASC', + createdTxn_from_ASC_NULLS_FIRST = 'createdTxn_from_ASC_NULLS_FIRST', + createdTxn_from_ASC_NULLS_LAST = 'createdTxn_from_ASC_NULLS_LAST', + createdTxn_from_DESC = 'createdTxn_from_DESC', + createdTxn_from_DESC_NULLS_FIRST = 'createdTxn_from_DESC_NULLS_FIRST', + createdTxn_from_DESC_NULLS_LAST = 'createdTxn_from_DESC_NULLS_LAST', + createdTxn_hash_ASC = 'createdTxn_hash_ASC', + createdTxn_hash_ASC_NULLS_FIRST = 'createdTxn_hash_ASC_NULLS_FIRST', + createdTxn_hash_ASC_NULLS_LAST = 'createdTxn_hash_ASC_NULLS_LAST', + createdTxn_hash_DESC = 'createdTxn_hash_DESC', + createdTxn_hash_DESC_NULLS_FIRST = 'createdTxn_hash_DESC_NULLS_FIRST', + createdTxn_hash_DESC_NULLS_LAST = 'createdTxn_hash_DESC_NULLS_LAST', + createdTxn_id_ASC = 'createdTxn_id_ASC', + createdTxn_id_ASC_NULLS_FIRST = 'createdTxn_id_ASC_NULLS_FIRST', + createdTxn_id_ASC_NULLS_LAST = 'createdTxn_id_ASC_NULLS_LAST', + createdTxn_id_DESC = 'createdTxn_id_DESC', + createdTxn_id_DESC_NULLS_FIRST = 'createdTxn_id_DESC_NULLS_FIRST', + createdTxn_id_DESC_NULLS_LAST = 'createdTxn_id_DESC_NULLS_LAST', + createdTxn_timestamp_ASC = 'createdTxn_timestamp_ASC', + createdTxn_timestamp_ASC_NULLS_FIRST = 'createdTxn_timestamp_ASC_NULLS_FIRST', + createdTxn_timestamp_ASC_NULLS_LAST = 'createdTxn_timestamp_ASC_NULLS_LAST', + createdTxn_timestamp_DESC = 'createdTxn_timestamp_DESC', + createdTxn_timestamp_DESC_NULLS_FIRST = 'createdTxn_timestamp_DESC_NULLS_FIRST', + createdTxn_timestamp_DESC_NULLS_LAST = 'createdTxn_timestamp_DESC_NULLS_LAST', + createdTxn_to_ASC = 'createdTxn_to_ASC', + createdTxn_to_ASC_NULLS_FIRST = 'createdTxn_to_ASC_NULLS_FIRST', + createdTxn_to_ASC_NULLS_LAST = 'createdTxn_to_ASC_NULLS_LAST', + createdTxn_to_DESC = 'createdTxn_to_DESC', + createdTxn_to_DESC_NULLS_FIRST = 'createdTxn_to_DESC_NULLS_FIRST', + createdTxn_to_DESC_NULLS_LAST = 'createdTxn_to_DESC_NULLS_LAST', + createdTxn_transactionIndex_ASC = 'createdTxn_transactionIndex_ASC', + createdTxn_transactionIndex_ASC_NULLS_FIRST = 'createdTxn_transactionIndex_ASC_NULLS_FIRST', + createdTxn_transactionIndex_ASC_NULLS_LAST = 'createdTxn_transactionIndex_ASC_NULLS_LAST', + createdTxn_transactionIndex_DESC = 'createdTxn_transactionIndex_DESC', + createdTxn_transactionIndex_DESC_NULLS_FIRST = 'createdTxn_transactionIndex_DESC_NULLS_FIRST', + createdTxn_transactionIndex_DESC_NULLS_LAST = 'createdTxn_transactionIndex_DESC_NULLS_LAST', + executedTxn_blockNumber_ASC = 'executedTxn_blockNumber_ASC', + executedTxn_blockNumber_ASC_NULLS_FIRST = 'executedTxn_blockNumber_ASC_NULLS_FIRST', + executedTxn_blockNumber_ASC_NULLS_LAST = 'executedTxn_blockNumber_ASC_NULLS_LAST', + executedTxn_blockNumber_DESC = 'executedTxn_blockNumber_DESC', + executedTxn_blockNumber_DESC_NULLS_FIRST = 'executedTxn_blockNumber_DESC_NULLS_FIRST', + executedTxn_blockNumber_DESC_NULLS_LAST = 'executedTxn_blockNumber_DESC_NULLS_LAST', + executedTxn_from_ASC = 'executedTxn_from_ASC', + executedTxn_from_ASC_NULLS_FIRST = 'executedTxn_from_ASC_NULLS_FIRST', + executedTxn_from_ASC_NULLS_LAST = 'executedTxn_from_ASC_NULLS_LAST', + executedTxn_from_DESC = 'executedTxn_from_DESC', + executedTxn_from_DESC_NULLS_FIRST = 'executedTxn_from_DESC_NULLS_FIRST', + executedTxn_from_DESC_NULLS_LAST = 'executedTxn_from_DESC_NULLS_LAST', + executedTxn_hash_ASC = 'executedTxn_hash_ASC', + executedTxn_hash_ASC_NULLS_FIRST = 'executedTxn_hash_ASC_NULLS_FIRST', + executedTxn_hash_ASC_NULLS_LAST = 'executedTxn_hash_ASC_NULLS_LAST', + executedTxn_hash_DESC = 'executedTxn_hash_DESC', + executedTxn_hash_DESC_NULLS_FIRST = 'executedTxn_hash_DESC_NULLS_FIRST', + executedTxn_hash_DESC_NULLS_LAST = 'executedTxn_hash_DESC_NULLS_LAST', + executedTxn_id_ASC = 'executedTxn_id_ASC', + executedTxn_id_ASC_NULLS_FIRST = 'executedTxn_id_ASC_NULLS_FIRST', + executedTxn_id_ASC_NULLS_LAST = 'executedTxn_id_ASC_NULLS_LAST', + executedTxn_id_DESC = 'executedTxn_id_DESC', + executedTxn_id_DESC_NULLS_FIRST = 'executedTxn_id_DESC_NULLS_FIRST', + executedTxn_id_DESC_NULLS_LAST = 'executedTxn_id_DESC_NULLS_LAST', + executedTxn_timestamp_ASC = 'executedTxn_timestamp_ASC', + executedTxn_timestamp_ASC_NULLS_FIRST = 'executedTxn_timestamp_ASC_NULLS_FIRST', + executedTxn_timestamp_ASC_NULLS_LAST = 'executedTxn_timestamp_ASC_NULLS_LAST', + executedTxn_timestamp_DESC = 'executedTxn_timestamp_DESC', + executedTxn_timestamp_DESC_NULLS_FIRST = 'executedTxn_timestamp_DESC_NULLS_FIRST', + executedTxn_timestamp_DESC_NULLS_LAST = 'executedTxn_timestamp_DESC_NULLS_LAST', + executedTxn_to_ASC = 'executedTxn_to_ASC', + executedTxn_to_ASC_NULLS_FIRST = 'executedTxn_to_ASC_NULLS_FIRST', + executedTxn_to_ASC_NULLS_LAST = 'executedTxn_to_ASC_NULLS_LAST', + executedTxn_to_DESC = 'executedTxn_to_DESC', + executedTxn_to_DESC_NULLS_FIRST = 'executedTxn_to_DESC_NULLS_FIRST', + executedTxn_to_DESC_NULLS_LAST = 'executedTxn_to_DESC_NULLS_LAST', + executedTxn_transactionIndex_ASC = 'executedTxn_transactionIndex_ASC', + executedTxn_transactionIndex_ASC_NULLS_FIRST = 'executedTxn_transactionIndex_ASC_NULLS_FIRST', + executedTxn_transactionIndex_ASC_NULLS_LAST = 'executedTxn_transactionIndex_ASC_NULLS_LAST', + executedTxn_transactionIndex_DESC = 'executedTxn_transactionIndex_DESC', + executedTxn_transactionIndex_DESC_NULLS_FIRST = 'executedTxn_transactionIndex_DESC_NULLS_FIRST', + executedTxn_transactionIndex_DESC_NULLS_LAST = 'executedTxn_transactionIndex_DESC_NULLS_LAST', + executionFee_ASC = 'executionFee_ASC', + executionFee_ASC_NULLS_FIRST = 'executionFee_ASC_NULLS_FIRST', + executionFee_ASC_NULLS_LAST = 'executionFee_ASC_NULLS_LAST', + executionFee_DESC = 'executionFee_DESC', + executionFee_DESC_NULLS_FIRST = 'executionFee_DESC_NULLS_FIRST', + executionFee_DESC_NULLS_LAST = 'executionFee_DESC_NULLS_LAST', + frozenReasonBytes_ASC = 'frozenReasonBytes_ASC', + frozenReasonBytes_ASC_NULLS_FIRST = 'frozenReasonBytes_ASC_NULLS_FIRST', + frozenReasonBytes_ASC_NULLS_LAST = 'frozenReasonBytes_ASC_NULLS_LAST', + frozenReasonBytes_DESC = 'frozenReasonBytes_DESC', + frozenReasonBytes_DESC_NULLS_FIRST = 'frozenReasonBytes_DESC_NULLS_FIRST', + frozenReasonBytes_DESC_NULLS_LAST = 'frozenReasonBytes_DESC_NULLS_LAST', + frozenReason_ASC = 'frozenReason_ASC', + frozenReason_ASC_NULLS_FIRST = 'frozenReason_ASC_NULLS_FIRST', + frozenReason_ASC_NULLS_LAST = 'frozenReason_ASC_NULLS_LAST', + frozenReason_DESC = 'frozenReason_DESC', + frozenReason_DESC_NULLS_FIRST = 'frozenReason_DESC_NULLS_FIRST', + frozenReason_DESC_NULLS_LAST = 'frozenReason_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + initialCollateralDeltaAmount_ASC = 'initialCollateralDeltaAmount_ASC', + initialCollateralDeltaAmount_ASC_NULLS_FIRST = 'initialCollateralDeltaAmount_ASC_NULLS_FIRST', + initialCollateralDeltaAmount_ASC_NULLS_LAST = 'initialCollateralDeltaAmount_ASC_NULLS_LAST', + initialCollateralDeltaAmount_DESC = 'initialCollateralDeltaAmount_DESC', + initialCollateralDeltaAmount_DESC_NULLS_FIRST = 'initialCollateralDeltaAmount_DESC_NULLS_FIRST', + initialCollateralDeltaAmount_DESC_NULLS_LAST = 'initialCollateralDeltaAmount_DESC_NULLS_LAST', + initialCollateralTokenAddress_ASC = 'initialCollateralTokenAddress_ASC', + initialCollateralTokenAddress_ASC_NULLS_FIRST = 'initialCollateralTokenAddress_ASC_NULLS_FIRST', + initialCollateralTokenAddress_ASC_NULLS_LAST = 'initialCollateralTokenAddress_ASC_NULLS_LAST', + initialCollateralTokenAddress_DESC = 'initialCollateralTokenAddress_DESC', + initialCollateralTokenAddress_DESC_NULLS_FIRST = 'initialCollateralTokenAddress_DESC_NULLS_FIRST', + initialCollateralTokenAddress_DESC_NULLS_LAST = 'initialCollateralTokenAddress_DESC_NULLS_LAST', + isLong_ASC = 'isLong_ASC', + isLong_ASC_NULLS_FIRST = 'isLong_ASC_NULLS_FIRST', + isLong_ASC_NULLS_LAST = 'isLong_ASC_NULLS_LAST', + isLong_DESC = 'isLong_DESC', + isLong_DESC_NULLS_FIRST = 'isLong_DESC_NULLS_FIRST', + isLong_DESC_NULLS_LAST = 'isLong_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + minOutputAmount_ASC = 'minOutputAmount_ASC', + minOutputAmount_ASC_NULLS_FIRST = 'minOutputAmount_ASC_NULLS_FIRST', + minOutputAmount_ASC_NULLS_LAST = 'minOutputAmount_ASC_NULLS_LAST', + minOutputAmount_DESC = 'minOutputAmount_DESC', + minOutputAmount_DESC_NULLS_FIRST = 'minOutputAmount_DESC_NULLS_FIRST', + minOutputAmount_DESC_NULLS_LAST = 'minOutputAmount_DESC_NULLS_LAST', + numberOfParts_ASC = 'numberOfParts_ASC', + numberOfParts_ASC_NULLS_FIRST = 'numberOfParts_ASC_NULLS_FIRST', + numberOfParts_ASC_NULLS_LAST = 'numberOfParts_ASC_NULLS_LAST', + numberOfParts_DESC = 'numberOfParts_DESC', + numberOfParts_DESC_NULLS_FIRST = 'numberOfParts_DESC_NULLS_FIRST', + numberOfParts_DESC_NULLS_LAST = 'numberOfParts_DESC_NULLS_LAST', + orderType_ASC = 'orderType_ASC', + orderType_ASC_NULLS_FIRST = 'orderType_ASC_NULLS_FIRST', + orderType_ASC_NULLS_LAST = 'orderType_ASC_NULLS_LAST', + orderType_DESC = 'orderType_DESC', + orderType_DESC_NULLS_FIRST = 'orderType_DESC_NULLS_FIRST', + orderType_DESC_NULLS_LAST = 'orderType_DESC_NULLS_LAST', + receiver_ASC = 'receiver_ASC', + receiver_ASC_NULLS_FIRST = 'receiver_ASC_NULLS_FIRST', + receiver_ASC_NULLS_LAST = 'receiver_ASC_NULLS_LAST', + receiver_DESC = 'receiver_DESC', + receiver_DESC_NULLS_FIRST = 'receiver_DESC_NULLS_FIRST', + receiver_DESC_NULLS_LAST = 'receiver_DESC_NULLS_LAST', + shouldUnwrapNativeToken_ASC = 'shouldUnwrapNativeToken_ASC', + shouldUnwrapNativeToken_ASC_NULLS_FIRST = 'shouldUnwrapNativeToken_ASC_NULLS_FIRST', + shouldUnwrapNativeToken_ASC_NULLS_LAST = 'shouldUnwrapNativeToken_ASC_NULLS_LAST', + shouldUnwrapNativeToken_DESC = 'shouldUnwrapNativeToken_DESC', + shouldUnwrapNativeToken_DESC_NULLS_FIRST = 'shouldUnwrapNativeToken_DESC_NULLS_FIRST', + shouldUnwrapNativeToken_DESC_NULLS_LAST = 'shouldUnwrapNativeToken_DESC_NULLS_LAST', + sizeDeltaUsd_ASC = 'sizeDeltaUsd_ASC', + sizeDeltaUsd_ASC_NULLS_FIRST = 'sizeDeltaUsd_ASC_NULLS_FIRST', + sizeDeltaUsd_ASC_NULLS_LAST = 'sizeDeltaUsd_ASC_NULLS_LAST', + sizeDeltaUsd_DESC = 'sizeDeltaUsd_DESC', + sizeDeltaUsd_DESC_NULLS_FIRST = 'sizeDeltaUsd_DESC_NULLS_FIRST', + sizeDeltaUsd_DESC_NULLS_LAST = 'sizeDeltaUsd_DESC_NULLS_LAST', + srcChainId_ASC = 'srcChainId_ASC', + srcChainId_ASC_NULLS_FIRST = 'srcChainId_ASC_NULLS_FIRST', + srcChainId_ASC_NULLS_LAST = 'srcChainId_ASC_NULLS_LAST', + srcChainId_DESC = 'srcChainId_DESC', + srcChainId_DESC_NULLS_FIRST = 'srcChainId_DESC_NULLS_FIRST', + srcChainId_DESC_NULLS_LAST = 'srcChainId_DESC_NULLS_LAST', + status_ASC = 'status_ASC', + status_ASC_NULLS_FIRST = 'status_ASC_NULLS_FIRST', + status_ASC_NULLS_LAST = 'status_ASC_NULLS_LAST', + status_DESC = 'status_DESC', + status_DESC_NULLS_FIRST = 'status_DESC_NULLS_FIRST', + status_DESC_NULLS_LAST = 'status_DESC_NULLS_LAST', + triggerPrice_ASC = 'triggerPrice_ASC', + triggerPrice_ASC_NULLS_FIRST = 'triggerPrice_ASC_NULLS_FIRST', + triggerPrice_ASC_NULLS_LAST = 'triggerPrice_ASC_NULLS_LAST', + triggerPrice_DESC = 'triggerPrice_DESC', + triggerPrice_DESC_NULLS_FIRST = 'triggerPrice_DESC_NULLS_FIRST', + triggerPrice_DESC_NULLS_LAST = 'triggerPrice_DESC_NULLS_LAST', + twapGroupId_ASC = 'twapGroupId_ASC', + twapGroupId_ASC_NULLS_FIRST = 'twapGroupId_ASC_NULLS_FIRST', + twapGroupId_ASC_NULLS_LAST = 'twapGroupId_ASC_NULLS_LAST', + twapGroupId_DESC = 'twapGroupId_DESC', + twapGroupId_DESC_NULLS_FIRST = 'twapGroupId_DESC_NULLS_FIRST', + twapGroupId_DESC_NULLS_LAST = 'twapGroupId_DESC_NULLS_LAST', + uiFeeReceiver_ASC = 'uiFeeReceiver_ASC', + uiFeeReceiver_ASC_NULLS_FIRST = 'uiFeeReceiver_ASC_NULLS_FIRST', + uiFeeReceiver_ASC_NULLS_LAST = 'uiFeeReceiver_ASC_NULLS_LAST', + uiFeeReceiver_DESC = 'uiFeeReceiver_DESC', + uiFeeReceiver_DESC_NULLS_FIRST = 'uiFeeReceiver_DESC_NULLS_FIRST', + uiFeeReceiver_DESC_NULLS_LAST = 'uiFeeReceiver_DESC_NULLS_LAST', + updatedAtBlock_ASC = 'updatedAtBlock_ASC', + updatedAtBlock_ASC_NULLS_FIRST = 'updatedAtBlock_ASC_NULLS_FIRST', + updatedAtBlock_ASC_NULLS_LAST = 'updatedAtBlock_ASC_NULLS_LAST', + updatedAtBlock_DESC = 'updatedAtBlock_DESC', + updatedAtBlock_DESC_NULLS_FIRST = 'updatedAtBlock_DESC_NULLS_FIRST', + updatedAtBlock_DESC_NULLS_LAST = 'updatedAtBlock_DESC_NULLS_LAST' } export enum OrderStatus { - Cancelled = "Cancelled", - Created = "Created", - Executed = "Executed", - Frozen = "Frozen", + Cancelled = 'Cancelled', + Created = 'Created', + Executed = 'Executed', + Frozen = 'Frozen' } export interface OrderWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - acceptablePrice_eq?: InputMaybe; - acceptablePrice_gt?: InputMaybe; - acceptablePrice_gte?: InputMaybe; - acceptablePrice_in?: InputMaybe>; - acceptablePrice_isNull?: InputMaybe; - acceptablePrice_lt?: InputMaybe; - acceptablePrice_lte?: InputMaybe; - acceptablePrice_not_eq?: InputMaybe; - acceptablePrice_not_in?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - callbackContract_contains?: InputMaybe; - callbackContract_containsInsensitive?: InputMaybe; - callbackContract_endsWith?: InputMaybe; - callbackContract_eq?: InputMaybe; - callbackContract_gt?: InputMaybe; - callbackContract_gte?: InputMaybe; - callbackContract_in?: InputMaybe>; - callbackContract_isNull?: InputMaybe; - callbackContract_lt?: InputMaybe; - callbackContract_lte?: InputMaybe; - callbackContract_not_contains?: InputMaybe; - callbackContract_not_containsInsensitive?: InputMaybe; - callbackContract_not_endsWith?: InputMaybe; - callbackContract_not_eq?: InputMaybe; - callbackContract_not_in?: InputMaybe>; - callbackContract_not_startsWith?: InputMaybe; - callbackContract_startsWith?: InputMaybe; - callbackGasLimit_eq?: InputMaybe; - callbackGasLimit_gt?: InputMaybe; - callbackGasLimit_gte?: InputMaybe; - callbackGasLimit_in?: InputMaybe>; - callbackGasLimit_isNull?: InputMaybe; - callbackGasLimit_lt?: InputMaybe; - callbackGasLimit_lte?: InputMaybe; - callbackGasLimit_not_eq?: InputMaybe; - callbackGasLimit_not_in?: InputMaybe>; - cancelledReasonBytes_contains?: InputMaybe; - cancelledReasonBytes_containsInsensitive?: InputMaybe; - cancelledReasonBytes_endsWith?: InputMaybe; - cancelledReasonBytes_eq?: InputMaybe; - cancelledReasonBytes_gt?: InputMaybe; - cancelledReasonBytes_gte?: InputMaybe; - cancelledReasonBytes_in?: InputMaybe>; - cancelledReasonBytes_isNull?: InputMaybe; - cancelledReasonBytes_lt?: InputMaybe; - cancelledReasonBytes_lte?: InputMaybe; - cancelledReasonBytes_not_contains?: InputMaybe; - cancelledReasonBytes_not_containsInsensitive?: InputMaybe; - cancelledReasonBytes_not_endsWith?: InputMaybe; - cancelledReasonBytes_not_eq?: InputMaybe; - cancelledReasonBytes_not_in?: InputMaybe>; - cancelledReasonBytes_not_startsWith?: InputMaybe; - cancelledReasonBytes_startsWith?: InputMaybe; - cancelledReason_contains?: InputMaybe; - cancelledReason_containsInsensitive?: InputMaybe; - cancelledReason_endsWith?: InputMaybe; - cancelledReason_eq?: InputMaybe; - cancelledReason_gt?: InputMaybe; - cancelledReason_gte?: InputMaybe; - cancelledReason_in?: InputMaybe>; - cancelledReason_isNull?: InputMaybe; - cancelledReason_lt?: InputMaybe; - cancelledReason_lte?: InputMaybe; - cancelledReason_not_contains?: InputMaybe; - cancelledReason_not_containsInsensitive?: InputMaybe; - cancelledReason_not_endsWith?: InputMaybe; - cancelledReason_not_eq?: InputMaybe; - cancelledReason_not_in?: InputMaybe>; - cancelledReason_not_startsWith?: InputMaybe; - cancelledReason_startsWith?: InputMaybe; + acceptablePrice_eq?: InputMaybe; + acceptablePrice_gt?: InputMaybe; + acceptablePrice_gte?: InputMaybe; + acceptablePrice_in?: InputMaybe>; + acceptablePrice_isNull?: InputMaybe; + acceptablePrice_lt?: InputMaybe; + acceptablePrice_lte?: InputMaybe; + acceptablePrice_not_eq?: InputMaybe; + acceptablePrice_not_in?: InputMaybe>; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + callbackContract_contains?: InputMaybe; + callbackContract_containsInsensitive?: InputMaybe; + callbackContract_endsWith?: InputMaybe; + callbackContract_eq?: InputMaybe; + callbackContract_gt?: InputMaybe; + callbackContract_gte?: InputMaybe; + callbackContract_in?: InputMaybe>; + callbackContract_isNull?: InputMaybe; + callbackContract_lt?: InputMaybe; + callbackContract_lte?: InputMaybe; + callbackContract_not_contains?: InputMaybe; + callbackContract_not_containsInsensitive?: InputMaybe; + callbackContract_not_endsWith?: InputMaybe; + callbackContract_not_eq?: InputMaybe; + callbackContract_not_in?: InputMaybe>; + callbackContract_not_startsWith?: InputMaybe; + callbackContract_startsWith?: InputMaybe; + callbackGasLimit_eq?: InputMaybe; + callbackGasLimit_gt?: InputMaybe; + callbackGasLimit_gte?: InputMaybe; + callbackGasLimit_in?: InputMaybe>; + callbackGasLimit_isNull?: InputMaybe; + callbackGasLimit_lt?: InputMaybe; + callbackGasLimit_lte?: InputMaybe; + callbackGasLimit_not_eq?: InputMaybe; + callbackGasLimit_not_in?: InputMaybe>; + cancelledReasonBytes_contains?: InputMaybe; + cancelledReasonBytes_containsInsensitive?: InputMaybe; + cancelledReasonBytes_endsWith?: InputMaybe; + cancelledReasonBytes_eq?: InputMaybe; + cancelledReasonBytes_gt?: InputMaybe; + cancelledReasonBytes_gte?: InputMaybe; + cancelledReasonBytes_in?: InputMaybe>; + cancelledReasonBytes_isNull?: InputMaybe; + cancelledReasonBytes_lt?: InputMaybe; + cancelledReasonBytes_lte?: InputMaybe; + cancelledReasonBytes_not_contains?: InputMaybe; + cancelledReasonBytes_not_containsInsensitive?: InputMaybe; + cancelledReasonBytes_not_endsWith?: InputMaybe; + cancelledReasonBytes_not_eq?: InputMaybe; + cancelledReasonBytes_not_in?: InputMaybe>; + cancelledReasonBytes_not_startsWith?: InputMaybe; + cancelledReasonBytes_startsWith?: InputMaybe; + cancelledReason_contains?: InputMaybe; + cancelledReason_containsInsensitive?: InputMaybe; + cancelledReason_endsWith?: InputMaybe; + cancelledReason_eq?: InputMaybe; + cancelledReason_gt?: InputMaybe; + cancelledReason_gte?: InputMaybe; + cancelledReason_in?: InputMaybe>; + cancelledReason_isNull?: InputMaybe; + cancelledReason_lt?: InputMaybe; + cancelledReason_lte?: InputMaybe; + cancelledReason_not_contains?: InputMaybe; + cancelledReason_not_containsInsensitive?: InputMaybe; + cancelledReason_not_endsWith?: InputMaybe; + cancelledReason_not_eq?: InputMaybe; + cancelledReason_not_in?: InputMaybe>; + cancelledReason_not_startsWith?: InputMaybe; + cancelledReason_startsWith?: InputMaybe; cancelledTxn?: InputMaybe; - cancelledTxn_isNull?: InputMaybe; + cancelledTxn_isNull?: InputMaybe; createdTxn?: InputMaybe; - createdTxn_isNull?: InputMaybe; + createdTxn_isNull?: InputMaybe; executedTxn?: InputMaybe; - executedTxn_isNull?: InputMaybe; - executionFee_eq?: InputMaybe; - executionFee_gt?: InputMaybe; - executionFee_gte?: InputMaybe; - executionFee_in?: InputMaybe>; - executionFee_isNull?: InputMaybe; - executionFee_lt?: InputMaybe; - executionFee_lte?: InputMaybe; - executionFee_not_eq?: InputMaybe; - executionFee_not_in?: InputMaybe>; - frozenReasonBytes_contains?: InputMaybe; - frozenReasonBytes_containsInsensitive?: InputMaybe; - frozenReasonBytes_endsWith?: InputMaybe; - frozenReasonBytes_eq?: InputMaybe; - frozenReasonBytes_gt?: InputMaybe; - frozenReasonBytes_gte?: InputMaybe; - frozenReasonBytes_in?: InputMaybe>; - frozenReasonBytes_isNull?: InputMaybe; - frozenReasonBytes_lt?: InputMaybe; - frozenReasonBytes_lte?: InputMaybe; - frozenReasonBytes_not_contains?: InputMaybe; - frozenReasonBytes_not_containsInsensitive?: InputMaybe; - frozenReasonBytes_not_endsWith?: InputMaybe; - frozenReasonBytes_not_eq?: InputMaybe; - frozenReasonBytes_not_in?: InputMaybe>; - frozenReasonBytes_not_startsWith?: InputMaybe; - frozenReasonBytes_startsWith?: InputMaybe; - frozenReason_contains?: InputMaybe; - frozenReason_containsInsensitive?: InputMaybe; - frozenReason_endsWith?: InputMaybe; - frozenReason_eq?: InputMaybe; - frozenReason_gt?: InputMaybe; - frozenReason_gte?: InputMaybe; - frozenReason_in?: InputMaybe>; - frozenReason_isNull?: InputMaybe; - frozenReason_lt?: InputMaybe; - frozenReason_lte?: InputMaybe; - frozenReason_not_contains?: InputMaybe; - frozenReason_not_containsInsensitive?: InputMaybe; - frozenReason_not_endsWith?: InputMaybe; - frozenReason_not_eq?: InputMaybe; - frozenReason_not_in?: InputMaybe>; - frozenReason_not_startsWith?: InputMaybe; - frozenReason_startsWith?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - initialCollateralDeltaAmount_eq?: InputMaybe; - initialCollateralDeltaAmount_gt?: InputMaybe; - initialCollateralDeltaAmount_gte?: InputMaybe; - initialCollateralDeltaAmount_in?: InputMaybe>; - initialCollateralDeltaAmount_isNull?: InputMaybe; - initialCollateralDeltaAmount_lt?: InputMaybe; - initialCollateralDeltaAmount_lte?: InputMaybe; - initialCollateralDeltaAmount_not_eq?: InputMaybe; - initialCollateralDeltaAmount_not_in?: InputMaybe>; - initialCollateralTokenAddress_contains?: InputMaybe; - initialCollateralTokenAddress_containsInsensitive?: InputMaybe; - initialCollateralTokenAddress_endsWith?: InputMaybe; - initialCollateralTokenAddress_eq?: InputMaybe; - initialCollateralTokenAddress_gt?: InputMaybe; - initialCollateralTokenAddress_gte?: InputMaybe; - initialCollateralTokenAddress_in?: InputMaybe>; - initialCollateralTokenAddress_isNull?: InputMaybe; - initialCollateralTokenAddress_lt?: InputMaybe; - initialCollateralTokenAddress_lte?: InputMaybe; - initialCollateralTokenAddress_not_contains?: InputMaybe; - initialCollateralTokenAddress_not_containsInsensitive?: InputMaybe; - initialCollateralTokenAddress_not_endsWith?: InputMaybe; - initialCollateralTokenAddress_not_eq?: InputMaybe; - initialCollateralTokenAddress_not_in?: InputMaybe>; - initialCollateralTokenAddress_not_startsWith?: InputMaybe; - initialCollateralTokenAddress_startsWith?: InputMaybe; - isLong_eq?: InputMaybe; - isLong_isNull?: InputMaybe; - isLong_not_eq?: InputMaybe; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - minOutputAmount_eq?: InputMaybe; - minOutputAmount_gt?: InputMaybe; - minOutputAmount_gte?: InputMaybe; - minOutputAmount_in?: InputMaybe>; - minOutputAmount_isNull?: InputMaybe; - minOutputAmount_lt?: InputMaybe; - minOutputAmount_lte?: InputMaybe; - minOutputAmount_not_eq?: InputMaybe; - minOutputAmount_not_in?: InputMaybe>; - numberOfParts_eq?: InputMaybe; - numberOfParts_gt?: InputMaybe; - numberOfParts_gte?: InputMaybe; - numberOfParts_in?: InputMaybe>; - numberOfParts_isNull?: InputMaybe; - numberOfParts_lt?: InputMaybe; - numberOfParts_lte?: InputMaybe; - numberOfParts_not_eq?: InputMaybe; - numberOfParts_not_in?: InputMaybe>; - orderType_eq?: InputMaybe; - orderType_gt?: InputMaybe; - orderType_gte?: InputMaybe; - orderType_in?: InputMaybe>; - orderType_isNull?: InputMaybe; - orderType_lt?: InputMaybe; - orderType_lte?: InputMaybe; - orderType_not_eq?: InputMaybe; - orderType_not_in?: InputMaybe>; - receiver_contains?: InputMaybe; - receiver_containsInsensitive?: InputMaybe; - receiver_endsWith?: InputMaybe; - receiver_eq?: InputMaybe; - receiver_gt?: InputMaybe; - receiver_gte?: InputMaybe; - receiver_in?: InputMaybe>; - receiver_isNull?: InputMaybe; - receiver_lt?: InputMaybe; - receiver_lte?: InputMaybe; - receiver_not_contains?: InputMaybe; - receiver_not_containsInsensitive?: InputMaybe; - receiver_not_endsWith?: InputMaybe; - receiver_not_eq?: InputMaybe; - receiver_not_in?: InputMaybe>; - receiver_not_startsWith?: InputMaybe; - receiver_startsWith?: InputMaybe; - shouldUnwrapNativeToken_eq?: InputMaybe; - shouldUnwrapNativeToken_isNull?: InputMaybe; - shouldUnwrapNativeToken_not_eq?: InputMaybe; - sizeDeltaUsd_eq?: InputMaybe; - sizeDeltaUsd_gt?: InputMaybe; - sizeDeltaUsd_gte?: InputMaybe; - sizeDeltaUsd_in?: InputMaybe>; - sizeDeltaUsd_isNull?: InputMaybe; - sizeDeltaUsd_lt?: InputMaybe; - sizeDeltaUsd_lte?: InputMaybe; - sizeDeltaUsd_not_eq?: InputMaybe; - sizeDeltaUsd_not_in?: InputMaybe>; - srcChainId_eq?: InputMaybe; - srcChainId_gt?: InputMaybe; - srcChainId_gte?: InputMaybe; - srcChainId_in?: InputMaybe>; - srcChainId_isNull?: InputMaybe; - srcChainId_lt?: InputMaybe; - srcChainId_lte?: InputMaybe; - srcChainId_not_eq?: InputMaybe; - srcChainId_not_in?: InputMaybe>; + executedTxn_isNull?: InputMaybe; + executionFee_eq?: InputMaybe; + executionFee_gt?: InputMaybe; + executionFee_gte?: InputMaybe; + executionFee_in?: InputMaybe>; + executionFee_isNull?: InputMaybe; + executionFee_lt?: InputMaybe; + executionFee_lte?: InputMaybe; + executionFee_not_eq?: InputMaybe; + executionFee_not_in?: InputMaybe>; + frozenReasonBytes_contains?: InputMaybe; + frozenReasonBytes_containsInsensitive?: InputMaybe; + frozenReasonBytes_endsWith?: InputMaybe; + frozenReasonBytes_eq?: InputMaybe; + frozenReasonBytes_gt?: InputMaybe; + frozenReasonBytes_gte?: InputMaybe; + frozenReasonBytes_in?: InputMaybe>; + frozenReasonBytes_isNull?: InputMaybe; + frozenReasonBytes_lt?: InputMaybe; + frozenReasonBytes_lte?: InputMaybe; + frozenReasonBytes_not_contains?: InputMaybe; + frozenReasonBytes_not_containsInsensitive?: InputMaybe; + frozenReasonBytes_not_endsWith?: InputMaybe; + frozenReasonBytes_not_eq?: InputMaybe; + frozenReasonBytes_not_in?: InputMaybe>; + frozenReasonBytes_not_startsWith?: InputMaybe; + frozenReasonBytes_startsWith?: InputMaybe; + frozenReason_contains?: InputMaybe; + frozenReason_containsInsensitive?: InputMaybe; + frozenReason_endsWith?: InputMaybe; + frozenReason_eq?: InputMaybe; + frozenReason_gt?: InputMaybe; + frozenReason_gte?: InputMaybe; + frozenReason_in?: InputMaybe>; + frozenReason_isNull?: InputMaybe; + frozenReason_lt?: InputMaybe; + frozenReason_lte?: InputMaybe; + frozenReason_not_contains?: InputMaybe; + frozenReason_not_containsInsensitive?: InputMaybe; + frozenReason_not_endsWith?: InputMaybe; + frozenReason_not_eq?: InputMaybe; + frozenReason_not_in?: InputMaybe>; + frozenReason_not_startsWith?: InputMaybe; + frozenReason_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + initialCollateralDeltaAmount_eq?: InputMaybe; + initialCollateralDeltaAmount_gt?: InputMaybe; + initialCollateralDeltaAmount_gte?: InputMaybe; + initialCollateralDeltaAmount_in?: InputMaybe>; + initialCollateralDeltaAmount_isNull?: InputMaybe; + initialCollateralDeltaAmount_lt?: InputMaybe; + initialCollateralDeltaAmount_lte?: InputMaybe; + initialCollateralDeltaAmount_not_eq?: InputMaybe; + initialCollateralDeltaAmount_not_in?: InputMaybe>; + initialCollateralTokenAddress_contains?: InputMaybe; + initialCollateralTokenAddress_containsInsensitive?: InputMaybe; + initialCollateralTokenAddress_endsWith?: InputMaybe; + initialCollateralTokenAddress_eq?: InputMaybe; + initialCollateralTokenAddress_gt?: InputMaybe; + initialCollateralTokenAddress_gte?: InputMaybe; + initialCollateralTokenAddress_in?: InputMaybe>; + initialCollateralTokenAddress_isNull?: InputMaybe; + initialCollateralTokenAddress_lt?: InputMaybe; + initialCollateralTokenAddress_lte?: InputMaybe; + initialCollateralTokenAddress_not_contains?: InputMaybe; + initialCollateralTokenAddress_not_containsInsensitive?: InputMaybe; + initialCollateralTokenAddress_not_endsWith?: InputMaybe; + initialCollateralTokenAddress_not_eq?: InputMaybe; + initialCollateralTokenAddress_not_in?: InputMaybe>; + initialCollateralTokenAddress_not_startsWith?: InputMaybe; + initialCollateralTokenAddress_startsWith?: InputMaybe; + isLong_eq?: InputMaybe; + isLong_isNull?: InputMaybe; + isLong_not_eq?: InputMaybe; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + minOutputAmount_eq?: InputMaybe; + minOutputAmount_gt?: InputMaybe; + minOutputAmount_gte?: InputMaybe; + minOutputAmount_in?: InputMaybe>; + minOutputAmount_isNull?: InputMaybe; + minOutputAmount_lt?: InputMaybe; + minOutputAmount_lte?: InputMaybe; + minOutputAmount_not_eq?: InputMaybe; + minOutputAmount_not_in?: InputMaybe>; + numberOfParts_eq?: InputMaybe; + numberOfParts_gt?: InputMaybe; + numberOfParts_gte?: InputMaybe; + numberOfParts_in?: InputMaybe>; + numberOfParts_isNull?: InputMaybe; + numberOfParts_lt?: InputMaybe; + numberOfParts_lte?: InputMaybe; + numberOfParts_not_eq?: InputMaybe; + numberOfParts_not_in?: InputMaybe>; + orderType_eq?: InputMaybe; + orderType_gt?: InputMaybe; + orderType_gte?: InputMaybe; + orderType_in?: InputMaybe>; + orderType_isNull?: InputMaybe; + orderType_lt?: InputMaybe; + orderType_lte?: InputMaybe; + orderType_not_eq?: InputMaybe; + orderType_not_in?: InputMaybe>; + receiver_contains?: InputMaybe; + receiver_containsInsensitive?: InputMaybe; + receiver_endsWith?: InputMaybe; + receiver_eq?: InputMaybe; + receiver_gt?: InputMaybe; + receiver_gte?: InputMaybe; + receiver_in?: InputMaybe>; + receiver_isNull?: InputMaybe; + receiver_lt?: InputMaybe; + receiver_lte?: InputMaybe; + receiver_not_contains?: InputMaybe; + receiver_not_containsInsensitive?: InputMaybe; + receiver_not_endsWith?: InputMaybe; + receiver_not_eq?: InputMaybe; + receiver_not_in?: InputMaybe>; + receiver_not_startsWith?: InputMaybe; + receiver_startsWith?: InputMaybe; + shouldUnwrapNativeToken_eq?: InputMaybe; + shouldUnwrapNativeToken_isNull?: InputMaybe; + shouldUnwrapNativeToken_not_eq?: InputMaybe; + sizeDeltaUsd_eq?: InputMaybe; + sizeDeltaUsd_gt?: InputMaybe; + sizeDeltaUsd_gte?: InputMaybe; + sizeDeltaUsd_in?: InputMaybe>; + sizeDeltaUsd_isNull?: InputMaybe; + sizeDeltaUsd_lt?: InputMaybe; + sizeDeltaUsd_lte?: InputMaybe; + sizeDeltaUsd_not_eq?: InputMaybe; + sizeDeltaUsd_not_in?: InputMaybe>; + srcChainId_eq?: InputMaybe; + srcChainId_gt?: InputMaybe; + srcChainId_gte?: InputMaybe; + srcChainId_in?: InputMaybe>; + srcChainId_isNull?: InputMaybe; + srcChainId_lt?: InputMaybe; + srcChainId_lte?: InputMaybe; + srcChainId_not_eq?: InputMaybe; + srcChainId_not_in?: InputMaybe>; status_eq?: InputMaybe; status_in?: InputMaybe>; - status_isNull?: InputMaybe; + status_isNull?: InputMaybe; status_not_eq?: InputMaybe; status_not_in?: InputMaybe>; - swapPath_containsAll?: InputMaybe>; - swapPath_containsAny?: InputMaybe>; - swapPath_containsNone?: InputMaybe>; - swapPath_isNull?: InputMaybe; - triggerPrice_eq?: InputMaybe; - triggerPrice_gt?: InputMaybe; - triggerPrice_gte?: InputMaybe; - triggerPrice_in?: InputMaybe>; - triggerPrice_isNull?: InputMaybe; - triggerPrice_lt?: InputMaybe; - triggerPrice_lte?: InputMaybe; - triggerPrice_not_eq?: InputMaybe; - triggerPrice_not_in?: InputMaybe>; - twapGroupId_contains?: InputMaybe; - twapGroupId_containsInsensitive?: InputMaybe; - twapGroupId_endsWith?: InputMaybe; - twapGroupId_eq?: InputMaybe; - twapGroupId_gt?: InputMaybe; - twapGroupId_gte?: InputMaybe; - twapGroupId_in?: InputMaybe>; - twapGroupId_isNull?: InputMaybe; - twapGroupId_lt?: InputMaybe; - twapGroupId_lte?: InputMaybe; - twapGroupId_not_contains?: InputMaybe; - twapGroupId_not_containsInsensitive?: InputMaybe; - twapGroupId_not_endsWith?: InputMaybe; - twapGroupId_not_eq?: InputMaybe; - twapGroupId_not_in?: InputMaybe>; - twapGroupId_not_startsWith?: InputMaybe; - twapGroupId_startsWith?: InputMaybe; - uiFeeReceiver_contains?: InputMaybe; - uiFeeReceiver_containsInsensitive?: InputMaybe; - uiFeeReceiver_endsWith?: InputMaybe; - uiFeeReceiver_eq?: InputMaybe; - uiFeeReceiver_gt?: InputMaybe; - uiFeeReceiver_gte?: InputMaybe; - uiFeeReceiver_in?: InputMaybe>; - uiFeeReceiver_isNull?: InputMaybe; - uiFeeReceiver_lt?: InputMaybe; - uiFeeReceiver_lte?: InputMaybe; - uiFeeReceiver_not_contains?: InputMaybe; - uiFeeReceiver_not_containsInsensitive?: InputMaybe; - uiFeeReceiver_not_endsWith?: InputMaybe; - uiFeeReceiver_not_eq?: InputMaybe; - uiFeeReceiver_not_in?: InputMaybe>; - uiFeeReceiver_not_startsWith?: InputMaybe; - uiFeeReceiver_startsWith?: InputMaybe; - updatedAtBlock_eq?: InputMaybe; - updatedAtBlock_gt?: InputMaybe; - updatedAtBlock_gte?: InputMaybe; - updatedAtBlock_in?: InputMaybe>; - updatedAtBlock_isNull?: InputMaybe; - updatedAtBlock_lt?: InputMaybe; - updatedAtBlock_lte?: InputMaybe; - updatedAtBlock_not_eq?: InputMaybe; - updatedAtBlock_not_in?: InputMaybe>; + swapPath_containsAll?: InputMaybe>; + swapPath_containsAny?: InputMaybe>; + swapPath_containsNone?: InputMaybe>; + swapPath_isNull?: InputMaybe; + triggerPrice_eq?: InputMaybe; + triggerPrice_gt?: InputMaybe; + triggerPrice_gte?: InputMaybe; + triggerPrice_in?: InputMaybe>; + triggerPrice_isNull?: InputMaybe; + triggerPrice_lt?: InputMaybe; + triggerPrice_lte?: InputMaybe; + triggerPrice_not_eq?: InputMaybe; + triggerPrice_not_in?: InputMaybe>; + twapGroupId_contains?: InputMaybe; + twapGroupId_containsInsensitive?: InputMaybe; + twapGroupId_endsWith?: InputMaybe; + twapGroupId_eq?: InputMaybe; + twapGroupId_gt?: InputMaybe; + twapGroupId_gte?: InputMaybe; + twapGroupId_in?: InputMaybe>; + twapGroupId_isNull?: InputMaybe; + twapGroupId_lt?: InputMaybe; + twapGroupId_lte?: InputMaybe; + twapGroupId_not_contains?: InputMaybe; + twapGroupId_not_containsInsensitive?: InputMaybe; + twapGroupId_not_endsWith?: InputMaybe; + twapGroupId_not_eq?: InputMaybe; + twapGroupId_not_in?: InputMaybe>; + twapGroupId_not_startsWith?: InputMaybe; + twapGroupId_startsWith?: InputMaybe; + uiFeeReceiver_contains?: InputMaybe; + uiFeeReceiver_containsInsensitive?: InputMaybe; + uiFeeReceiver_endsWith?: InputMaybe; + uiFeeReceiver_eq?: InputMaybe; + uiFeeReceiver_gt?: InputMaybe; + uiFeeReceiver_gte?: InputMaybe; + uiFeeReceiver_in?: InputMaybe>; + uiFeeReceiver_isNull?: InputMaybe; + uiFeeReceiver_lt?: InputMaybe; + uiFeeReceiver_lte?: InputMaybe; + uiFeeReceiver_not_contains?: InputMaybe; + uiFeeReceiver_not_containsInsensitive?: InputMaybe; + uiFeeReceiver_not_endsWith?: InputMaybe; + uiFeeReceiver_not_eq?: InputMaybe; + uiFeeReceiver_not_in?: InputMaybe>; + uiFeeReceiver_not_startsWith?: InputMaybe; + uiFeeReceiver_startsWith?: InputMaybe; + updatedAtBlock_eq?: InputMaybe; + updatedAtBlock_gt?: InputMaybe; + updatedAtBlock_gte?: InputMaybe; + updatedAtBlock_in?: InputMaybe>; + updatedAtBlock_isNull?: InputMaybe; + updatedAtBlock_lt?: InputMaybe; + updatedAtBlock_lte?: InputMaybe; + updatedAtBlock_not_eq?: InputMaybe; + updatedAtBlock_not_in?: InputMaybe>; } export interface OrdersConnection { - __typename?: "OrdersConnection"; + __typename?: 'OrdersConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface PageInfo { - __typename?: "PageInfo"; - endCursor: Scalars["String"]["output"]; - hasNextPage: Scalars["Boolean"]["output"]; - hasPreviousPage: Scalars["Boolean"]["output"]; - startCursor: Scalars["String"]["output"]; + __typename?: 'PageInfo'; + endCursor: Scalars['String']['output']; + hasNextPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output']; + startCursor: Scalars['String']['output']; } export interface PerformanceSnapshotObject { - __typename?: "PerformanceSnapshotObject"; - snapshotTimestamp: Scalars["String"]["output"]; - uniswapV2Performance: Scalars["String"]["output"]; + __typename?: 'PerformanceSnapshotObject'; + snapshotTimestamp: Scalars['String']['output']; + uniswapV2Performance: Scalars['String']['output']; } export interface PerformanceSnapshots { - __typename?: "PerformanceSnapshots"; - address: Scalars["String"]["output"]; - entity: Scalars["String"]["output"]; + __typename?: 'PerformanceSnapshots'; + address: Scalars['String']['output']; + entity: Scalars['String']['output']; snapshots: Array; } export interface PerformanceWhereInput { - addresses?: InputMaybe>; - period: Scalars["String"]["input"]; + addresses?: InputMaybe>; + period: Scalars['String']['input']; } export interface PeriodAccountStatObject { - __typename?: "PeriodAccountStatObject"; - closedCount: Scalars["Float"]["output"]; - cumsumCollateral: Scalars["BigInt"]["output"]; - cumsumSize: Scalars["BigInt"]["output"]; - id: Scalars["ID"]["output"]; - losses: Scalars["Float"]["output"]; - maxCapital: Scalars["BigInt"]["output"]; - netCapital: Scalars["BigInt"]["output"]; - realizedFees: Scalars["BigInt"]["output"]; - realizedPnl: Scalars["BigInt"]["output"]; - realizedPriceImpact: Scalars["BigInt"]["output"]; - startUnrealizedFees: Scalars["BigInt"]["output"]; - startUnrealizedPnl: Scalars["BigInt"]["output"]; - startUnrealizedPriceImpact: Scalars["BigInt"]["output"]; - sumMaxSize: Scalars["BigInt"]["output"]; - volume: Scalars["BigInt"]["output"]; - wins: Scalars["Float"]["output"]; + __typename?: 'PeriodAccountStatObject'; + closedCount: Scalars['Float']['output']; + cumsumCollateral: Scalars['BigInt']['output']; + cumsumSize: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + losses: Scalars['Float']['output']; + maxCapital: Scalars['BigInt']['output']; + netCapital: Scalars['BigInt']['output']; + realizedFees: Scalars['BigInt']['output']; + realizedPnl: Scalars['BigInt']['output']; + realizedPriceImpact: Scalars['BigInt']['output']; + startUnrealizedFees: Scalars['BigInt']['output']; + startUnrealizedPnl: Scalars['BigInt']['output']; + startUnrealizedPriceImpact: Scalars['BigInt']['output']; + sumMaxSize: Scalars['BigInt']['output']; + volume: Scalars['BigInt']['output']; + wins: Scalars['Float']['output']; } export interface PlatformStats { - __typename?: "PlatformStats"; - depositedUsers: Scalars["Int"]["output"]; - id: Scalars["String"]["output"]; - tradedUsers: Scalars["Int"]["output"]; - volume: Scalars["BigInt"]["output"]; + __typename?: 'PlatformStats'; + depositedUsers: Scalars['Int']['output']; + id: Scalars['String']['output']; + tradedUsers: Scalars['Int']['output']; + volume: Scalars['BigInt']['output']; } export interface PlatformStatsConnection { - __typename?: "PlatformStatsConnection"; + __typename?: 'PlatformStatsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface PlatformStatsEdge { - __typename?: "PlatformStatsEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PlatformStatsEdge'; + cursor: Scalars['String']['output']; node: PlatformStats; } export enum PlatformStatsOrderByInput { - depositedUsers_ASC = "depositedUsers_ASC", - depositedUsers_ASC_NULLS_FIRST = "depositedUsers_ASC_NULLS_FIRST", - depositedUsers_ASC_NULLS_LAST = "depositedUsers_ASC_NULLS_LAST", - depositedUsers_DESC = "depositedUsers_DESC", - depositedUsers_DESC_NULLS_FIRST = "depositedUsers_DESC_NULLS_FIRST", - depositedUsers_DESC_NULLS_LAST = "depositedUsers_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - tradedUsers_ASC = "tradedUsers_ASC", - tradedUsers_ASC_NULLS_FIRST = "tradedUsers_ASC_NULLS_FIRST", - tradedUsers_ASC_NULLS_LAST = "tradedUsers_ASC_NULLS_LAST", - tradedUsers_DESC = "tradedUsers_DESC", - tradedUsers_DESC_NULLS_FIRST = "tradedUsers_DESC_NULLS_FIRST", - tradedUsers_DESC_NULLS_LAST = "tradedUsers_DESC_NULLS_LAST", - volume_ASC = "volume_ASC", - volume_ASC_NULLS_FIRST = "volume_ASC_NULLS_FIRST", - volume_ASC_NULLS_LAST = "volume_ASC_NULLS_LAST", - volume_DESC = "volume_DESC", - volume_DESC_NULLS_FIRST = "volume_DESC_NULLS_FIRST", - volume_DESC_NULLS_LAST = "volume_DESC_NULLS_LAST", + depositedUsers_ASC = 'depositedUsers_ASC', + depositedUsers_ASC_NULLS_FIRST = 'depositedUsers_ASC_NULLS_FIRST', + depositedUsers_ASC_NULLS_LAST = 'depositedUsers_ASC_NULLS_LAST', + depositedUsers_DESC = 'depositedUsers_DESC', + depositedUsers_DESC_NULLS_FIRST = 'depositedUsers_DESC_NULLS_FIRST', + depositedUsers_DESC_NULLS_LAST = 'depositedUsers_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + tradedUsers_ASC = 'tradedUsers_ASC', + tradedUsers_ASC_NULLS_FIRST = 'tradedUsers_ASC_NULLS_FIRST', + tradedUsers_ASC_NULLS_LAST = 'tradedUsers_ASC_NULLS_LAST', + tradedUsers_DESC = 'tradedUsers_DESC', + tradedUsers_DESC_NULLS_FIRST = 'tradedUsers_DESC_NULLS_FIRST', + tradedUsers_DESC_NULLS_LAST = 'tradedUsers_DESC_NULLS_LAST', + volume_ASC = 'volume_ASC', + volume_ASC_NULLS_FIRST = 'volume_ASC_NULLS_FIRST', + volume_ASC_NULLS_LAST = 'volume_ASC_NULLS_LAST', + volume_DESC = 'volume_DESC', + volume_DESC_NULLS_FIRST = 'volume_DESC_NULLS_FIRST', + volume_DESC_NULLS_LAST = 'volume_DESC_NULLS_LAST' } export interface PlatformStatsWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - depositedUsers_eq?: InputMaybe; - depositedUsers_gt?: InputMaybe; - depositedUsers_gte?: InputMaybe; - depositedUsers_in?: InputMaybe>; - depositedUsers_isNull?: InputMaybe; - depositedUsers_lt?: InputMaybe; - depositedUsers_lte?: InputMaybe; - depositedUsers_not_eq?: InputMaybe; - depositedUsers_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - tradedUsers_eq?: InputMaybe; - tradedUsers_gt?: InputMaybe; - tradedUsers_gte?: InputMaybe; - tradedUsers_in?: InputMaybe>; - tradedUsers_isNull?: InputMaybe; - tradedUsers_lt?: InputMaybe; - tradedUsers_lte?: InputMaybe; - tradedUsers_not_eq?: InputMaybe; - tradedUsers_not_in?: InputMaybe>; - volume_eq?: InputMaybe; - volume_gt?: InputMaybe; - volume_gte?: InputMaybe; - volume_in?: InputMaybe>; - volume_isNull?: InputMaybe; - volume_lt?: InputMaybe; - volume_lte?: InputMaybe; - volume_not_eq?: InputMaybe; - volume_not_in?: InputMaybe>; + depositedUsers_eq?: InputMaybe; + depositedUsers_gt?: InputMaybe; + depositedUsers_gte?: InputMaybe; + depositedUsers_in?: InputMaybe>; + depositedUsers_isNull?: InputMaybe; + depositedUsers_lt?: InputMaybe; + depositedUsers_lte?: InputMaybe; + depositedUsers_not_eq?: InputMaybe; + depositedUsers_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + tradedUsers_eq?: InputMaybe; + tradedUsers_gt?: InputMaybe; + tradedUsers_gte?: InputMaybe; + tradedUsers_in?: InputMaybe>; + tradedUsers_isNull?: InputMaybe; + tradedUsers_lt?: InputMaybe; + tradedUsers_lte?: InputMaybe; + tradedUsers_not_eq?: InputMaybe; + tradedUsers_not_in?: InputMaybe>; + volume_eq?: InputMaybe; + volume_gt?: InputMaybe; + volume_gte?: InputMaybe; + volume_in?: InputMaybe>; + volume_isNull?: InputMaybe; + volume_lt?: InputMaybe; + volume_lte?: InputMaybe; + volume_not_eq?: InputMaybe; + volume_not_in?: InputMaybe>; } export interface PnlAprSnapshot { - __typename?: "PnlAprSnapshot"; - address: Scalars["String"]["output"]; - apr: Scalars["BigInt"]["output"]; + __typename?: 'PnlAprSnapshot'; + address: Scalars['String']['output']; + apr: Scalars['BigInt']['output']; entityType: EntityType; - id: Scalars["String"]["output"]; - snapshotTimestamp: Scalars["Int"]["output"]; + id: Scalars['String']['output']; + snapshotTimestamp: Scalars['Int']['output']; } export interface PnlAprSnapshotEdge { - __typename?: "PnlAprSnapshotEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PnlAprSnapshotEdge'; + cursor: Scalars['String']['output']; node: PnlAprSnapshot; } export enum PnlAprSnapshotOrderByInput { - address_ASC = "address_ASC", - address_ASC_NULLS_FIRST = "address_ASC_NULLS_FIRST", - address_ASC_NULLS_LAST = "address_ASC_NULLS_LAST", - address_DESC = "address_DESC", - address_DESC_NULLS_FIRST = "address_DESC_NULLS_FIRST", - address_DESC_NULLS_LAST = "address_DESC_NULLS_LAST", - apr_ASC = "apr_ASC", - apr_ASC_NULLS_FIRST = "apr_ASC_NULLS_FIRST", - apr_ASC_NULLS_LAST = "apr_ASC_NULLS_LAST", - apr_DESC = "apr_DESC", - apr_DESC_NULLS_FIRST = "apr_DESC_NULLS_FIRST", - apr_DESC_NULLS_LAST = "apr_DESC_NULLS_LAST", - entityType_ASC = "entityType_ASC", - entityType_ASC_NULLS_FIRST = "entityType_ASC_NULLS_FIRST", - entityType_ASC_NULLS_LAST = "entityType_ASC_NULLS_LAST", - entityType_DESC = "entityType_DESC", - entityType_DESC_NULLS_FIRST = "entityType_DESC_NULLS_FIRST", - entityType_DESC_NULLS_LAST = "entityType_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", + address_ASC = 'address_ASC', + address_ASC_NULLS_FIRST = 'address_ASC_NULLS_FIRST', + address_ASC_NULLS_LAST = 'address_ASC_NULLS_LAST', + address_DESC = 'address_DESC', + address_DESC_NULLS_FIRST = 'address_DESC_NULLS_FIRST', + address_DESC_NULLS_LAST = 'address_DESC_NULLS_LAST', + apr_ASC = 'apr_ASC', + apr_ASC_NULLS_FIRST = 'apr_ASC_NULLS_FIRST', + apr_ASC_NULLS_LAST = 'apr_ASC_NULLS_LAST', + apr_DESC = 'apr_DESC', + apr_DESC_NULLS_FIRST = 'apr_DESC_NULLS_FIRST', + apr_DESC_NULLS_LAST = 'apr_DESC_NULLS_LAST', + entityType_ASC = 'entityType_ASC', + entityType_ASC_NULLS_FIRST = 'entityType_ASC_NULLS_FIRST', + entityType_ASC_NULLS_LAST = 'entityType_ASC_NULLS_LAST', + entityType_DESC = 'entityType_DESC', + entityType_DESC_NULLS_FIRST = 'entityType_DESC_NULLS_FIRST', + entityType_DESC_NULLS_LAST = 'entityType_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST' } export interface PnlAprSnapshotWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - address_contains?: InputMaybe; - address_containsInsensitive?: InputMaybe; - address_endsWith?: InputMaybe; - address_eq?: InputMaybe; - address_gt?: InputMaybe; - address_gte?: InputMaybe; - address_in?: InputMaybe>; - address_isNull?: InputMaybe; - address_lt?: InputMaybe; - address_lte?: InputMaybe; - address_not_contains?: InputMaybe; - address_not_containsInsensitive?: InputMaybe; - address_not_endsWith?: InputMaybe; - address_not_eq?: InputMaybe; - address_not_in?: InputMaybe>; - address_not_startsWith?: InputMaybe; - address_startsWith?: InputMaybe; - apr_eq?: InputMaybe; - apr_gt?: InputMaybe; - apr_gte?: InputMaybe; - apr_in?: InputMaybe>; - apr_isNull?: InputMaybe; - apr_lt?: InputMaybe; - apr_lte?: InputMaybe; - apr_not_eq?: InputMaybe; - apr_not_in?: InputMaybe>; + address_contains?: InputMaybe; + address_containsInsensitive?: InputMaybe; + address_endsWith?: InputMaybe; + address_eq?: InputMaybe; + address_gt?: InputMaybe; + address_gte?: InputMaybe; + address_in?: InputMaybe>; + address_isNull?: InputMaybe; + address_lt?: InputMaybe; + address_lte?: InputMaybe; + address_not_contains?: InputMaybe; + address_not_containsInsensitive?: InputMaybe; + address_not_endsWith?: InputMaybe; + address_not_eq?: InputMaybe; + address_not_in?: InputMaybe>; + address_not_startsWith?: InputMaybe; + address_startsWith?: InputMaybe; + apr_eq?: InputMaybe; + apr_gt?: InputMaybe; + apr_gte?: InputMaybe; + apr_in?: InputMaybe>; + apr_isNull?: InputMaybe; + apr_lt?: InputMaybe; + apr_lte?: InputMaybe; + apr_not_eq?: InputMaybe; + apr_not_in?: InputMaybe>; entityType_eq?: InputMaybe; entityType_in?: InputMaybe>; - entityType_isNull?: InputMaybe; + entityType_isNull?: InputMaybe; entityType_not_eq?: InputMaybe; entityType_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; } export interface PnlAprSnapshotsConnection { - __typename?: "PnlAprSnapshotsConnection"; + __typename?: 'PnlAprSnapshotsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Position { - __typename?: "Position"; - account: Scalars["String"]["output"]; + __typename?: 'Position'; + account: Scalars['String']['output']; accountStat: AccountStat; - collateralAmount: Scalars["BigInt"]["output"]; - collateralToken: Scalars["String"]["output"]; - entryPrice: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - isLong: Scalars["Boolean"]["output"]; - isSnapshot: Scalars["Boolean"]["output"]; - market: Scalars["String"]["output"]; - maxSize: Scalars["BigInt"]["output"]; - openedAt: Scalars["Int"]["output"]; - positionKey: Scalars["String"]["output"]; - realizedFees: Scalars["BigInt"]["output"]; - realizedPnl: Scalars["BigInt"]["output"]; - realizedPriceImpact: Scalars["BigInt"]["output"]; - sizeInTokens: Scalars["BigInt"]["output"]; - sizeInUsd: Scalars["BigInt"]["output"]; - snapshotTimestamp?: Maybe; - unrealizedFees: Scalars["BigInt"]["output"]; - unrealizedPnl: Scalars["BigInt"]["output"]; - unrealizedPriceImpact: Scalars["BigInt"]["output"]; + collateralAmount: Scalars['BigInt']['output']; + collateralToken: Scalars['String']['output']; + entryPrice: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + isLong: Scalars['Boolean']['output']; + isSnapshot: Scalars['Boolean']['output']; + market: Scalars['String']['output']; + maxSize: Scalars['BigInt']['output']; + openedAt: Scalars['Int']['output']; + positionKey: Scalars['String']['output']; + realizedFees: Scalars['BigInt']['output']; + realizedPnl: Scalars['BigInt']['output']; + realizedPriceImpact: Scalars['BigInt']['output']; + sizeInTokens: Scalars['BigInt']['output']; + sizeInUsd: Scalars['BigInt']['output']; + snapshotTimestamp?: Maybe; + unrealizedFees: Scalars['BigInt']['output']; + unrealizedPnl: Scalars['BigInt']['output']; + unrealizedPriceImpact: Scalars['BigInt']['output']; } export interface PositionChange { - __typename?: "PositionChange"; - account: Scalars["String"]["output"]; - basePnlUsd: Scalars["BigInt"]["output"]; - block: Scalars["Int"]["output"]; - collateralAmount: Scalars["BigInt"]["output"]; - collateralDeltaAmount: Scalars["BigInt"]["output"]; - collateralToken: Scalars["String"]["output"]; - collateralTokenPriceMin: Scalars["BigInt"]["output"]; - executionPrice: Scalars["BigInt"]["output"]; - feesAmount: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - isLong: Scalars["Boolean"]["output"]; - isWin?: Maybe; - market: Scalars["String"]["output"]; - maxSize: Scalars["BigInt"]["output"]; - priceImpactAmount?: Maybe; - priceImpactDiffUsd?: Maybe; - priceImpactUsd: Scalars["BigInt"]["output"]; - proportionalPendingImpactUsd?: Maybe; - sizeDeltaUsd: Scalars["BigInt"]["output"]; - sizeInUsd: Scalars["BigInt"]["output"]; - timestamp: Scalars["Int"]["output"]; - totalImpactUsd?: Maybe; + __typename?: 'PositionChange'; + account: Scalars['String']['output']; + basePnlUsd: Scalars['BigInt']['output']; + block: Scalars['Int']['output']; + collateralAmount: Scalars['BigInt']['output']; + collateralDeltaAmount: Scalars['BigInt']['output']; + collateralToken: Scalars['String']['output']; + collateralTokenPriceMin: Scalars['BigInt']['output']; + executionPrice: Scalars['BigInt']['output']; + feesAmount: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + isLong: Scalars['Boolean']['output']; + isWin?: Maybe; + market: Scalars['String']['output']; + maxSize: Scalars['BigInt']['output']; + priceImpactAmount?: Maybe; + priceImpactDiffUsd?: Maybe; + priceImpactUsd: Scalars['BigInt']['output']; + proportionalPendingImpactUsd?: Maybe; + sizeDeltaUsd: Scalars['BigInt']['output']; + sizeInUsd: Scalars['BigInt']['output']; + timestamp: Scalars['Int']['output']; + totalImpactUsd?: Maybe; type: PositionChangeType; } export interface PositionChangeEdge { - __typename?: "PositionChangeEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PositionChangeEdge'; + cursor: Scalars['String']['output']; node: PositionChange; } export enum PositionChangeOrderByInput { - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - basePnlUsd_ASC = "basePnlUsd_ASC", - basePnlUsd_ASC_NULLS_FIRST = "basePnlUsd_ASC_NULLS_FIRST", - basePnlUsd_ASC_NULLS_LAST = "basePnlUsd_ASC_NULLS_LAST", - basePnlUsd_DESC = "basePnlUsd_DESC", - basePnlUsd_DESC_NULLS_FIRST = "basePnlUsd_DESC_NULLS_FIRST", - basePnlUsd_DESC_NULLS_LAST = "basePnlUsd_DESC_NULLS_LAST", - block_ASC = "block_ASC", - block_ASC_NULLS_FIRST = "block_ASC_NULLS_FIRST", - block_ASC_NULLS_LAST = "block_ASC_NULLS_LAST", - block_DESC = "block_DESC", - block_DESC_NULLS_FIRST = "block_DESC_NULLS_FIRST", - block_DESC_NULLS_LAST = "block_DESC_NULLS_LAST", - collateralAmount_ASC = "collateralAmount_ASC", - collateralAmount_ASC_NULLS_FIRST = "collateralAmount_ASC_NULLS_FIRST", - collateralAmount_ASC_NULLS_LAST = "collateralAmount_ASC_NULLS_LAST", - collateralAmount_DESC = "collateralAmount_DESC", - collateralAmount_DESC_NULLS_FIRST = "collateralAmount_DESC_NULLS_FIRST", - collateralAmount_DESC_NULLS_LAST = "collateralAmount_DESC_NULLS_LAST", - collateralDeltaAmount_ASC = "collateralDeltaAmount_ASC", - collateralDeltaAmount_ASC_NULLS_FIRST = "collateralDeltaAmount_ASC_NULLS_FIRST", - collateralDeltaAmount_ASC_NULLS_LAST = "collateralDeltaAmount_ASC_NULLS_LAST", - collateralDeltaAmount_DESC = "collateralDeltaAmount_DESC", - collateralDeltaAmount_DESC_NULLS_FIRST = "collateralDeltaAmount_DESC_NULLS_FIRST", - collateralDeltaAmount_DESC_NULLS_LAST = "collateralDeltaAmount_DESC_NULLS_LAST", - collateralTokenPriceMin_ASC = "collateralTokenPriceMin_ASC", - collateralTokenPriceMin_ASC_NULLS_FIRST = "collateralTokenPriceMin_ASC_NULLS_FIRST", - collateralTokenPriceMin_ASC_NULLS_LAST = "collateralTokenPriceMin_ASC_NULLS_LAST", - collateralTokenPriceMin_DESC = "collateralTokenPriceMin_DESC", - collateralTokenPriceMin_DESC_NULLS_FIRST = "collateralTokenPriceMin_DESC_NULLS_FIRST", - collateralTokenPriceMin_DESC_NULLS_LAST = "collateralTokenPriceMin_DESC_NULLS_LAST", - collateralToken_ASC = "collateralToken_ASC", - collateralToken_ASC_NULLS_FIRST = "collateralToken_ASC_NULLS_FIRST", - collateralToken_ASC_NULLS_LAST = "collateralToken_ASC_NULLS_LAST", - collateralToken_DESC = "collateralToken_DESC", - collateralToken_DESC_NULLS_FIRST = "collateralToken_DESC_NULLS_FIRST", - collateralToken_DESC_NULLS_LAST = "collateralToken_DESC_NULLS_LAST", - executionPrice_ASC = "executionPrice_ASC", - executionPrice_ASC_NULLS_FIRST = "executionPrice_ASC_NULLS_FIRST", - executionPrice_ASC_NULLS_LAST = "executionPrice_ASC_NULLS_LAST", - executionPrice_DESC = "executionPrice_DESC", - executionPrice_DESC_NULLS_FIRST = "executionPrice_DESC_NULLS_FIRST", - executionPrice_DESC_NULLS_LAST = "executionPrice_DESC_NULLS_LAST", - feesAmount_ASC = "feesAmount_ASC", - feesAmount_ASC_NULLS_FIRST = "feesAmount_ASC_NULLS_FIRST", - feesAmount_ASC_NULLS_LAST = "feesAmount_ASC_NULLS_LAST", - feesAmount_DESC = "feesAmount_DESC", - feesAmount_DESC_NULLS_FIRST = "feesAmount_DESC_NULLS_FIRST", - feesAmount_DESC_NULLS_LAST = "feesAmount_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isLong_ASC = "isLong_ASC", - isLong_ASC_NULLS_FIRST = "isLong_ASC_NULLS_FIRST", - isLong_ASC_NULLS_LAST = "isLong_ASC_NULLS_LAST", - isLong_DESC = "isLong_DESC", - isLong_DESC_NULLS_FIRST = "isLong_DESC_NULLS_FIRST", - isLong_DESC_NULLS_LAST = "isLong_DESC_NULLS_LAST", - isWin_ASC = "isWin_ASC", - isWin_ASC_NULLS_FIRST = "isWin_ASC_NULLS_FIRST", - isWin_ASC_NULLS_LAST = "isWin_ASC_NULLS_LAST", - isWin_DESC = "isWin_DESC", - isWin_DESC_NULLS_FIRST = "isWin_DESC_NULLS_FIRST", - isWin_DESC_NULLS_LAST = "isWin_DESC_NULLS_LAST", - market_ASC = "market_ASC", - market_ASC_NULLS_FIRST = "market_ASC_NULLS_FIRST", - market_ASC_NULLS_LAST = "market_ASC_NULLS_LAST", - market_DESC = "market_DESC", - market_DESC_NULLS_FIRST = "market_DESC_NULLS_FIRST", - market_DESC_NULLS_LAST = "market_DESC_NULLS_LAST", - maxSize_ASC = "maxSize_ASC", - maxSize_ASC_NULLS_FIRST = "maxSize_ASC_NULLS_FIRST", - maxSize_ASC_NULLS_LAST = "maxSize_ASC_NULLS_LAST", - maxSize_DESC = "maxSize_DESC", - maxSize_DESC_NULLS_FIRST = "maxSize_DESC_NULLS_FIRST", - maxSize_DESC_NULLS_LAST = "maxSize_DESC_NULLS_LAST", - priceImpactAmount_ASC = "priceImpactAmount_ASC", - priceImpactAmount_ASC_NULLS_FIRST = "priceImpactAmount_ASC_NULLS_FIRST", - priceImpactAmount_ASC_NULLS_LAST = "priceImpactAmount_ASC_NULLS_LAST", - priceImpactAmount_DESC = "priceImpactAmount_DESC", - priceImpactAmount_DESC_NULLS_FIRST = "priceImpactAmount_DESC_NULLS_FIRST", - priceImpactAmount_DESC_NULLS_LAST = "priceImpactAmount_DESC_NULLS_LAST", - priceImpactDiffUsd_ASC = "priceImpactDiffUsd_ASC", - priceImpactDiffUsd_ASC_NULLS_FIRST = "priceImpactDiffUsd_ASC_NULLS_FIRST", - priceImpactDiffUsd_ASC_NULLS_LAST = "priceImpactDiffUsd_ASC_NULLS_LAST", - priceImpactDiffUsd_DESC = "priceImpactDiffUsd_DESC", - priceImpactDiffUsd_DESC_NULLS_FIRST = "priceImpactDiffUsd_DESC_NULLS_FIRST", - priceImpactDiffUsd_DESC_NULLS_LAST = "priceImpactDiffUsd_DESC_NULLS_LAST", - priceImpactUsd_ASC = "priceImpactUsd_ASC", - priceImpactUsd_ASC_NULLS_FIRST = "priceImpactUsd_ASC_NULLS_FIRST", - priceImpactUsd_ASC_NULLS_LAST = "priceImpactUsd_ASC_NULLS_LAST", - priceImpactUsd_DESC = "priceImpactUsd_DESC", - priceImpactUsd_DESC_NULLS_FIRST = "priceImpactUsd_DESC_NULLS_FIRST", - priceImpactUsd_DESC_NULLS_LAST = "priceImpactUsd_DESC_NULLS_LAST", - proportionalPendingImpactUsd_ASC = "proportionalPendingImpactUsd_ASC", - proportionalPendingImpactUsd_ASC_NULLS_FIRST = "proportionalPendingImpactUsd_ASC_NULLS_FIRST", - proportionalPendingImpactUsd_ASC_NULLS_LAST = "proportionalPendingImpactUsd_ASC_NULLS_LAST", - proportionalPendingImpactUsd_DESC = "proportionalPendingImpactUsd_DESC", - proportionalPendingImpactUsd_DESC_NULLS_FIRST = "proportionalPendingImpactUsd_DESC_NULLS_FIRST", - proportionalPendingImpactUsd_DESC_NULLS_LAST = "proportionalPendingImpactUsd_DESC_NULLS_LAST", - sizeDeltaUsd_ASC = "sizeDeltaUsd_ASC", - sizeDeltaUsd_ASC_NULLS_FIRST = "sizeDeltaUsd_ASC_NULLS_FIRST", - sizeDeltaUsd_ASC_NULLS_LAST = "sizeDeltaUsd_ASC_NULLS_LAST", - sizeDeltaUsd_DESC = "sizeDeltaUsd_DESC", - sizeDeltaUsd_DESC_NULLS_FIRST = "sizeDeltaUsd_DESC_NULLS_FIRST", - sizeDeltaUsd_DESC_NULLS_LAST = "sizeDeltaUsd_DESC_NULLS_LAST", - sizeInUsd_ASC = "sizeInUsd_ASC", - sizeInUsd_ASC_NULLS_FIRST = "sizeInUsd_ASC_NULLS_FIRST", - sizeInUsd_ASC_NULLS_LAST = "sizeInUsd_ASC_NULLS_LAST", - sizeInUsd_DESC = "sizeInUsd_DESC", - sizeInUsd_DESC_NULLS_FIRST = "sizeInUsd_DESC_NULLS_FIRST", - sizeInUsd_DESC_NULLS_LAST = "sizeInUsd_DESC_NULLS_LAST", - timestamp_ASC = "timestamp_ASC", - timestamp_ASC_NULLS_FIRST = "timestamp_ASC_NULLS_FIRST", - timestamp_ASC_NULLS_LAST = "timestamp_ASC_NULLS_LAST", - timestamp_DESC = "timestamp_DESC", - timestamp_DESC_NULLS_FIRST = "timestamp_DESC_NULLS_FIRST", - timestamp_DESC_NULLS_LAST = "timestamp_DESC_NULLS_LAST", - totalImpactUsd_ASC = "totalImpactUsd_ASC", - totalImpactUsd_ASC_NULLS_FIRST = "totalImpactUsd_ASC_NULLS_FIRST", - totalImpactUsd_ASC_NULLS_LAST = "totalImpactUsd_ASC_NULLS_LAST", - totalImpactUsd_DESC = "totalImpactUsd_DESC", - totalImpactUsd_DESC_NULLS_FIRST = "totalImpactUsd_DESC_NULLS_FIRST", - totalImpactUsd_DESC_NULLS_LAST = "totalImpactUsd_DESC_NULLS_LAST", - type_ASC = "type_ASC", - type_ASC_NULLS_FIRST = "type_ASC_NULLS_FIRST", - type_ASC_NULLS_LAST = "type_ASC_NULLS_LAST", - type_DESC = "type_DESC", - type_DESC_NULLS_FIRST = "type_DESC_NULLS_FIRST", - type_DESC_NULLS_LAST = "type_DESC_NULLS_LAST", + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + basePnlUsd_ASC = 'basePnlUsd_ASC', + basePnlUsd_ASC_NULLS_FIRST = 'basePnlUsd_ASC_NULLS_FIRST', + basePnlUsd_ASC_NULLS_LAST = 'basePnlUsd_ASC_NULLS_LAST', + basePnlUsd_DESC = 'basePnlUsd_DESC', + basePnlUsd_DESC_NULLS_FIRST = 'basePnlUsd_DESC_NULLS_FIRST', + basePnlUsd_DESC_NULLS_LAST = 'basePnlUsd_DESC_NULLS_LAST', + block_ASC = 'block_ASC', + block_ASC_NULLS_FIRST = 'block_ASC_NULLS_FIRST', + block_ASC_NULLS_LAST = 'block_ASC_NULLS_LAST', + block_DESC = 'block_DESC', + block_DESC_NULLS_FIRST = 'block_DESC_NULLS_FIRST', + block_DESC_NULLS_LAST = 'block_DESC_NULLS_LAST', + collateralAmount_ASC = 'collateralAmount_ASC', + collateralAmount_ASC_NULLS_FIRST = 'collateralAmount_ASC_NULLS_FIRST', + collateralAmount_ASC_NULLS_LAST = 'collateralAmount_ASC_NULLS_LAST', + collateralAmount_DESC = 'collateralAmount_DESC', + collateralAmount_DESC_NULLS_FIRST = 'collateralAmount_DESC_NULLS_FIRST', + collateralAmount_DESC_NULLS_LAST = 'collateralAmount_DESC_NULLS_LAST', + collateralDeltaAmount_ASC = 'collateralDeltaAmount_ASC', + collateralDeltaAmount_ASC_NULLS_FIRST = 'collateralDeltaAmount_ASC_NULLS_FIRST', + collateralDeltaAmount_ASC_NULLS_LAST = 'collateralDeltaAmount_ASC_NULLS_LAST', + collateralDeltaAmount_DESC = 'collateralDeltaAmount_DESC', + collateralDeltaAmount_DESC_NULLS_FIRST = 'collateralDeltaAmount_DESC_NULLS_FIRST', + collateralDeltaAmount_DESC_NULLS_LAST = 'collateralDeltaAmount_DESC_NULLS_LAST', + collateralTokenPriceMin_ASC = 'collateralTokenPriceMin_ASC', + collateralTokenPriceMin_ASC_NULLS_FIRST = 'collateralTokenPriceMin_ASC_NULLS_FIRST', + collateralTokenPriceMin_ASC_NULLS_LAST = 'collateralTokenPriceMin_ASC_NULLS_LAST', + collateralTokenPriceMin_DESC = 'collateralTokenPriceMin_DESC', + collateralTokenPriceMin_DESC_NULLS_FIRST = 'collateralTokenPriceMin_DESC_NULLS_FIRST', + collateralTokenPriceMin_DESC_NULLS_LAST = 'collateralTokenPriceMin_DESC_NULLS_LAST', + collateralToken_ASC = 'collateralToken_ASC', + collateralToken_ASC_NULLS_FIRST = 'collateralToken_ASC_NULLS_FIRST', + collateralToken_ASC_NULLS_LAST = 'collateralToken_ASC_NULLS_LAST', + collateralToken_DESC = 'collateralToken_DESC', + collateralToken_DESC_NULLS_FIRST = 'collateralToken_DESC_NULLS_FIRST', + collateralToken_DESC_NULLS_LAST = 'collateralToken_DESC_NULLS_LAST', + executionPrice_ASC = 'executionPrice_ASC', + executionPrice_ASC_NULLS_FIRST = 'executionPrice_ASC_NULLS_FIRST', + executionPrice_ASC_NULLS_LAST = 'executionPrice_ASC_NULLS_LAST', + executionPrice_DESC = 'executionPrice_DESC', + executionPrice_DESC_NULLS_FIRST = 'executionPrice_DESC_NULLS_FIRST', + executionPrice_DESC_NULLS_LAST = 'executionPrice_DESC_NULLS_LAST', + feesAmount_ASC = 'feesAmount_ASC', + feesAmount_ASC_NULLS_FIRST = 'feesAmount_ASC_NULLS_FIRST', + feesAmount_ASC_NULLS_LAST = 'feesAmount_ASC_NULLS_LAST', + feesAmount_DESC = 'feesAmount_DESC', + feesAmount_DESC_NULLS_FIRST = 'feesAmount_DESC_NULLS_FIRST', + feesAmount_DESC_NULLS_LAST = 'feesAmount_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isLong_ASC = 'isLong_ASC', + isLong_ASC_NULLS_FIRST = 'isLong_ASC_NULLS_FIRST', + isLong_ASC_NULLS_LAST = 'isLong_ASC_NULLS_LAST', + isLong_DESC = 'isLong_DESC', + isLong_DESC_NULLS_FIRST = 'isLong_DESC_NULLS_FIRST', + isLong_DESC_NULLS_LAST = 'isLong_DESC_NULLS_LAST', + isWin_ASC = 'isWin_ASC', + isWin_ASC_NULLS_FIRST = 'isWin_ASC_NULLS_FIRST', + isWin_ASC_NULLS_LAST = 'isWin_ASC_NULLS_LAST', + isWin_DESC = 'isWin_DESC', + isWin_DESC_NULLS_FIRST = 'isWin_DESC_NULLS_FIRST', + isWin_DESC_NULLS_LAST = 'isWin_DESC_NULLS_LAST', + market_ASC = 'market_ASC', + market_ASC_NULLS_FIRST = 'market_ASC_NULLS_FIRST', + market_ASC_NULLS_LAST = 'market_ASC_NULLS_LAST', + market_DESC = 'market_DESC', + market_DESC_NULLS_FIRST = 'market_DESC_NULLS_FIRST', + market_DESC_NULLS_LAST = 'market_DESC_NULLS_LAST', + maxSize_ASC = 'maxSize_ASC', + maxSize_ASC_NULLS_FIRST = 'maxSize_ASC_NULLS_FIRST', + maxSize_ASC_NULLS_LAST = 'maxSize_ASC_NULLS_LAST', + maxSize_DESC = 'maxSize_DESC', + maxSize_DESC_NULLS_FIRST = 'maxSize_DESC_NULLS_FIRST', + maxSize_DESC_NULLS_LAST = 'maxSize_DESC_NULLS_LAST', + priceImpactAmount_ASC = 'priceImpactAmount_ASC', + priceImpactAmount_ASC_NULLS_FIRST = 'priceImpactAmount_ASC_NULLS_FIRST', + priceImpactAmount_ASC_NULLS_LAST = 'priceImpactAmount_ASC_NULLS_LAST', + priceImpactAmount_DESC = 'priceImpactAmount_DESC', + priceImpactAmount_DESC_NULLS_FIRST = 'priceImpactAmount_DESC_NULLS_FIRST', + priceImpactAmount_DESC_NULLS_LAST = 'priceImpactAmount_DESC_NULLS_LAST', + priceImpactDiffUsd_ASC = 'priceImpactDiffUsd_ASC', + priceImpactDiffUsd_ASC_NULLS_FIRST = 'priceImpactDiffUsd_ASC_NULLS_FIRST', + priceImpactDiffUsd_ASC_NULLS_LAST = 'priceImpactDiffUsd_ASC_NULLS_LAST', + priceImpactDiffUsd_DESC = 'priceImpactDiffUsd_DESC', + priceImpactDiffUsd_DESC_NULLS_FIRST = 'priceImpactDiffUsd_DESC_NULLS_FIRST', + priceImpactDiffUsd_DESC_NULLS_LAST = 'priceImpactDiffUsd_DESC_NULLS_LAST', + priceImpactUsd_ASC = 'priceImpactUsd_ASC', + priceImpactUsd_ASC_NULLS_FIRST = 'priceImpactUsd_ASC_NULLS_FIRST', + priceImpactUsd_ASC_NULLS_LAST = 'priceImpactUsd_ASC_NULLS_LAST', + priceImpactUsd_DESC = 'priceImpactUsd_DESC', + priceImpactUsd_DESC_NULLS_FIRST = 'priceImpactUsd_DESC_NULLS_FIRST', + priceImpactUsd_DESC_NULLS_LAST = 'priceImpactUsd_DESC_NULLS_LAST', + proportionalPendingImpactUsd_ASC = 'proportionalPendingImpactUsd_ASC', + proportionalPendingImpactUsd_ASC_NULLS_FIRST = 'proportionalPendingImpactUsd_ASC_NULLS_FIRST', + proportionalPendingImpactUsd_ASC_NULLS_LAST = 'proportionalPendingImpactUsd_ASC_NULLS_LAST', + proportionalPendingImpactUsd_DESC = 'proportionalPendingImpactUsd_DESC', + proportionalPendingImpactUsd_DESC_NULLS_FIRST = 'proportionalPendingImpactUsd_DESC_NULLS_FIRST', + proportionalPendingImpactUsd_DESC_NULLS_LAST = 'proportionalPendingImpactUsd_DESC_NULLS_LAST', + sizeDeltaUsd_ASC = 'sizeDeltaUsd_ASC', + sizeDeltaUsd_ASC_NULLS_FIRST = 'sizeDeltaUsd_ASC_NULLS_FIRST', + sizeDeltaUsd_ASC_NULLS_LAST = 'sizeDeltaUsd_ASC_NULLS_LAST', + sizeDeltaUsd_DESC = 'sizeDeltaUsd_DESC', + sizeDeltaUsd_DESC_NULLS_FIRST = 'sizeDeltaUsd_DESC_NULLS_FIRST', + sizeDeltaUsd_DESC_NULLS_LAST = 'sizeDeltaUsd_DESC_NULLS_LAST', + sizeInUsd_ASC = 'sizeInUsd_ASC', + sizeInUsd_ASC_NULLS_FIRST = 'sizeInUsd_ASC_NULLS_FIRST', + sizeInUsd_ASC_NULLS_LAST = 'sizeInUsd_ASC_NULLS_LAST', + sizeInUsd_DESC = 'sizeInUsd_DESC', + sizeInUsd_DESC_NULLS_FIRST = 'sizeInUsd_DESC_NULLS_FIRST', + sizeInUsd_DESC_NULLS_LAST = 'sizeInUsd_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + totalImpactUsd_ASC = 'totalImpactUsd_ASC', + totalImpactUsd_ASC_NULLS_FIRST = 'totalImpactUsd_ASC_NULLS_FIRST', + totalImpactUsd_ASC_NULLS_LAST = 'totalImpactUsd_ASC_NULLS_LAST', + totalImpactUsd_DESC = 'totalImpactUsd_DESC', + totalImpactUsd_DESC_NULLS_FIRST = 'totalImpactUsd_DESC_NULLS_FIRST', + totalImpactUsd_DESC_NULLS_LAST = 'totalImpactUsd_DESC_NULLS_LAST', + type_ASC = 'type_ASC', + type_ASC_NULLS_FIRST = 'type_ASC_NULLS_FIRST', + type_ASC_NULLS_LAST = 'type_ASC_NULLS_LAST', + type_DESC = 'type_DESC', + type_DESC_NULLS_FIRST = 'type_DESC_NULLS_FIRST', + type_DESC_NULLS_LAST = 'type_DESC_NULLS_LAST' } export enum PositionChangeType { - decrease = "decrease", - increase = "increase", + decrease = 'decrease', + increase = 'increase' } export interface PositionChangeWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - basePnlUsd_eq?: InputMaybe; - basePnlUsd_gt?: InputMaybe; - basePnlUsd_gte?: InputMaybe; - basePnlUsd_in?: InputMaybe>; - basePnlUsd_isNull?: InputMaybe; - basePnlUsd_lt?: InputMaybe; - basePnlUsd_lte?: InputMaybe; - basePnlUsd_not_eq?: InputMaybe; - basePnlUsd_not_in?: InputMaybe>; - block_eq?: InputMaybe; - block_gt?: InputMaybe; - block_gte?: InputMaybe; - block_in?: InputMaybe>; - block_isNull?: InputMaybe; - block_lt?: InputMaybe; - block_lte?: InputMaybe; - block_not_eq?: InputMaybe; - block_not_in?: InputMaybe>; - collateralAmount_eq?: InputMaybe; - collateralAmount_gt?: InputMaybe; - collateralAmount_gte?: InputMaybe; - collateralAmount_in?: InputMaybe>; - collateralAmount_isNull?: InputMaybe; - collateralAmount_lt?: InputMaybe; - collateralAmount_lte?: InputMaybe; - collateralAmount_not_eq?: InputMaybe; - collateralAmount_not_in?: InputMaybe>; - collateralDeltaAmount_eq?: InputMaybe; - collateralDeltaAmount_gt?: InputMaybe; - collateralDeltaAmount_gte?: InputMaybe; - collateralDeltaAmount_in?: InputMaybe>; - collateralDeltaAmount_isNull?: InputMaybe; - collateralDeltaAmount_lt?: InputMaybe; - collateralDeltaAmount_lte?: InputMaybe; - collateralDeltaAmount_not_eq?: InputMaybe; - collateralDeltaAmount_not_in?: InputMaybe>; - collateralTokenPriceMin_eq?: InputMaybe; - collateralTokenPriceMin_gt?: InputMaybe; - collateralTokenPriceMin_gte?: InputMaybe; - collateralTokenPriceMin_in?: InputMaybe>; - collateralTokenPriceMin_isNull?: InputMaybe; - collateralTokenPriceMin_lt?: InputMaybe; - collateralTokenPriceMin_lte?: InputMaybe; - collateralTokenPriceMin_not_eq?: InputMaybe; - collateralTokenPriceMin_not_in?: InputMaybe>; - collateralToken_contains?: InputMaybe; - collateralToken_containsInsensitive?: InputMaybe; - collateralToken_endsWith?: InputMaybe; - collateralToken_eq?: InputMaybe; - collateralToken_gt?: InputMaybe; - collateralToken_gte?: InputMaybe; - collateralToken_in?: InputMaybe>; - collateralToken_isNull?: InputMaybe; - collateralToken_lt?: InputMaybe; - collateralToken_lte?: InputMaybe; - collateralToken_not_contains?: InputMaybe; - collateralToken_not_containsInsensitive?: InputMaybe; - collateralToken_not_endsWith?: InputMaybe; - collateralToken_not_eq?: InputMaybe; - collateralToken_not_in?: InputMaybe>; - collateralToken_not_startsWith?: InputMaybe; - collateralToken_startsWith?: InputMaybe; - executionPrice_eq?: InputMaybe; - executionPrice_gt?: InputMaybe; - executionPrice_gte?: InputMaybe; - executionPrice_in?: InputMaybe>; - executionPrice_isNull?: InputMaybe; - executionPrice_lt?: InputMaybe; - executionPrice_lte?: InputMaybe; - executionPrice_not_eq?: InputMaybe; - executionPrice_not_in?: InputMaybe>; - feesAmount_eq?: InputMaybe; - feesAmount_gt?: InputMaybe; - feesAmount_gte?: InputMaybe; - feesAmount_in?: InputMaybe>; - feesAmount_isNull?: InputMaybe; - feesAmount_lt?: InputMaybe; - feesAmount_lte?: InputMaybe; - feesAmount_not_eq?: InputMaybe; - feesAmount_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isLong_eq?: InputMaybe; - isLong_isNull?: InputMaybe; - isLong_not_eq?: InputMaybe; - isWin_eq?: InputMaybe; - isWin_isNull?: InputMaybe; - isWin_not_eq?: InputMaybe; - market_contains?: InputMaybe; - market_containsInsensitive?: InputMaybe; - market_endsWith?: InputMaybe; - market_eq?: InputMaybe; - market_gt?: InputMaybe; - market_gte?: InputMaybe; - market_in?: InputMaybe>; - market_isNull?: InputMaybe; - market_lt?: InputMaybe; - market_lte?: InputMaybe; - market_not_contains?: InputMaybe; - market_not_containsInsensitive?: InputMaybe; - market_not_endsWith?: InputMaybe; - market_not_eq?: InputMaybe; - market_not_in?: InputMaybe>; - market_not_startsWith?: InputMaybe; - market_startsWith?: InputMaybe; - maxSize_eq?: InputMaybe; - maxSize_gt?: InputMaybe; - maxSize_gte?: InputMaybe; - maxSize_in?: InputMaybe>; - maxSize_isNull?: InputMaybe; - maxSize_lt?: InputMaybe; - maxSize_lte?: InputMaybe; - maxSize_not_eq?: InputMaybe; - maxSize_not_in?: InputMaybe>; - priceImpactAmount_eq?: InputMaybe; - priceImpactAmount_gt?: InputMaybe; - priceImpactAmount_gte?: InputMaybe; - priceImpactAmount_in?: InputMaybe>; - priceImpactAmount_isNull?: InputMaybe; - priceImpactAmount_lt?: InputMaybe; - priceImpactAmount_lte?: InputMaybe; - priceImpactAmount_not_eq?: InputMaybe; - priceImpactAmount_not_in?: InputMaybe>; - priceImpactDiffUsd_eq?: InputMaybe; - priceImpactDiffUsd_gt?: InputMaybe; - priceImpactDiffUsd_gte?: InputMaybe; - priceImpactDiffUsd_in?: InputMaybe>; - priceImpactDiffUsd_isNull?: InputMaybe; - priceImpactDiffUsd_lt?: InputMaybe; - priceImpactDiffUsd_lte?: InputMaybe; - priceImpactDiffUsd_not_eq?: InputMaybe; - priceImpactDiffUsd_not_in?: InputMaybe>; - priceImpactUsd_eq?: InputMaybe; - priceImpactUsd_gt?: InputMaybe; - priceImpactUsd_gte?: InputMaybe; - priceImpactUsd_in?: InputMaybe>; - priceImpactUsd_isNull?: InputMaybe; - priceImpactUsd_lt?: InputMaybe; - priceImpactUsd_lte?: InputMaybe; - priceImpactUsd_not_eq?: InputMaybe; - priceImpactUsd_not_in?: InputMaybe>; - proportionalPendingImpactUsd_eq?: InputMaybe; - proportionalPendingImpactUsd_gt?: InputMaybe; - proportionalPendingImpactUsd_gte?: InputMaybe; - proportionalPendingImpactUsd_in?: InputMaybe>; - proportionalPendingImpactUsd_isNull?: InputMaybe; - proportionalPendingImpactUsd_lt?: InputMaybe; - proportionalPendingImpactUsd_lte?: InputMaybe; - proportionalPendingImpactUsd_not_eq?: InputMaybe; - proportionalPendingImpactUsd_not_in?: InputMaybe>; - sizeDeltaUsd_eq?: InputMaybe; - sizeDeltaUsd_gt?: InputMaybe; - sizeDeltaUsd_gte?: InputMaybe; - sizeDeltaUsd_in?: InputMaybe>; - sizeDeltaUsd_isNull?: InputMaybe; - sizeDeltaUsd_lt?: InputMaybe; - sizeDeltaUsd_lte?: InputMaybe; - sizeDeltaUsd_not_eq?: InputMaybe; - sizeDeltaUsd_not_in?: InputMaybe>; - sizeInUsd_eq?: InputMaybe; - sizeInUsd_gt?: InputMaybe; - sizeInUsd_gte?: InputMaybe; - sizeInUsd_in?: InputMaybe>; - sizeInUsd_isNull?: InputMaybe; - sizeInUsd_lt?: InputMaybe; - sizeInUsd_lte?: InputMaybe; - sizeInUsd_not_eq?: InputMaybe; - sizeInUsd_not_in?: InputMaybe>; - timestamp_eq?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_isNull?: InputMaybe; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not_eq?: InputMaybe; - timestamp_not_in?: InputMaybe>; - totalImpactUsd_eq?: InputMaybe; - totalImpactUsd_gt?: InputMaybe; - totalImpactUsd_gte?: InputMaybe; - totalImpactUsd_in?: InputMaybe>; - totalImpactUsd_isNull?: InputMaybe; - totalImpactUsd_lt?: InputMaybe; - totalImpactUsd_lte?: InputMaybe; - totalImpactUsd_not_eq?: InputMaybe; - totalImpactUsd_not_in?: InputMaybe>; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + basePnlUsd_eq?: InputMaybe; + basePnlUsd_gt?: InputMaybe; + basePnlUsd_gte?: InputMaybe; + basePnlUsd_in?: InputMaybe>; + basePnlUsd_isNull?: InputMaybe; + basePnlUsd_lt?: InputMaybe; + basePnlUsd_lte?: InputMaybe; + basePnlUsd_not_eq?: InputMaybe; + basePnlUsd_not_in?: InputMaybe>; + block_eq?: InputMaybe; + block_gt?: InputMaybe; + block_gte?: InputMaybe; + block_in?: InputMaybe>; + block_isNull?: InputMaybe; + block_lt?: InputMaybe; + block_lte?: InputMaybe; + block_not_eq?: InputMaybe; + block_not_in?: InputMaybe>; + collateralAmount_eq?: InputMaybe; + collateralAmount_gt?: InputMaybe; + collateralAmount_gte?: InputMaybe; + collateralAmount_in?: InputMaybe>; + collateralAmount_isNull?: InputMaybe; + collateralAmount_lt?: InputMaybe; + collateralAmount_lte?: InputMaybe; + collateralAmount_not_eq?: InputMaybe; + collateralAmount_not_in?: InputMaybe>; + collateralDeltaAmount_eq?: InputMaybe; + collateralDeltaAmount_gt?: InputMaybe; + collateralDeltaAmount_gte?: InputMaybe; + collateralDeltaAmount_in?: InputMaybe>; + collateralDeltaAmount_isNull?: InputMaybe; + collateralDeltaAmount_lt?: InputMaybe; + collateralDeltaAmount_lte?: InputMaybe; + collateralDeltaAmount_not_eq?: InputMaybe; + collateralDeltaAmount_not_in?: InputMaybe>; + collateralTokenPriceMin_eq?: InputMaybe; + collateralTokenPriceMin_gt?: InputMaybe; + collateralTokenPriceMin_gte?: InputMaybe; + collateralTokenPriceMin_in?: InputMaybe>; + collateralTokenPriceMin_isNull?: InputMaybe; + collateralTokenPriceMin_lt?: InputMaybe; + collateralTokenPriceMin_lte?: InputMaybe; + collateralTokenPriceMin_not_eq?: InputMaybe; + collateralTokenPriceMin_not_in?: InputMaybe>; + collateralToken_contains?: InputMaybe; + collateralToken_containsInsensitive?: InputMaybe; + collateralToken_endsWith?: InputMaybe; + collateralToken_eq?: InputMaybe; + collateralToken_gt?: InputMaybe; + collateralToken_gte?: InputMaybe; + collateralToken_in?: InputMaybe>; + collateralToken_isNull?: InputMaybe; + collateralToken_lt?: InputMaybe; + collateralToken_lte?: InputMaybe; + collateralToken_not_contains?: InputMaybe; + collateralToken_not_containsInsensitive?: InputMaybe; + collateralToken_not_endsWith?: InputMaybe; + collateralToken_not_eq?: InputMaybe; + collateralToken_not_in?: InputMaybe>; + collateralToken_not_startsWith?: InputMaybe; + collateralToken_startsWith?: InputMaybe; + executionPrice_eq?: InputMaybe; + executionPrice_gt?: InputMaybe; + executionPrice_gte?: InputMaybe; + executionPrice_in?: InputMaybe>; + executionPrice_isNull?: InputMaybe; + executionPrice_lt?: InputMaybe; + executionPrice_lte?: InputMaybe; + executionPrice_not_eq?: InputMaybe; + executionPrice_not_in?: InputMaybe>; + feesAmount_eq?: InputMaybe; + feesAmount_gt?: InputMaybe; + feesAmount_gte?: InputMaybe; + feesAmount_in?: InputMaybe>; + feesAmount_isNull?: InputMaybe; + feesAmount_lt?: InputMaybe; + feesAmount_lte?: InputMaybe; + feesAmount_not_eq?: InputMaybe; + feesAmount_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isLong_eq?: InputMaybe; + isLong_isNull?: InputMaybe; + isLong_not_eq?: InputMaybe; + isWin_eq?: InputMaybe; + isWin_isNull?: InputMaybe; + isWin_not_eq?: InputMaybe; + market_contains?: InputMaybe; + market_containsInsensitive?: InputMaybe; + market_endsWith?: InputMaybe; + market_eq?: InputMaybe; + market_gt?: InputMaybe; + market_gte?: InputMaybe; + market_in?: InputMaybe>; + market_isNull?: InputMaybe; + market_lt?: InputMaybe; + market_lte?: InputMaybe; + market_not_contains?: InputMaybe; + market_not_containsInsensitive?: InputMaybe; + market_not_endsWith?: InputMaybe; + market_not_eq?: InputMaybe; + market_not_in?: InputMaybe>; + market_not_startsWith?: InputMaybe; + market_startsWith?: InputMaybe; + maxSize_eq?: InputMaybe; + maxSize_gt?: InputMaybe; + maxSize_gte?: InputMaybe; + maxSize_in?: InputMaybe>; + maxSize_isNull?: InputMaybe; + maxSize_lt?: InputMaybe; + maxSize_lte?: InputMaybe; + maxSize_not_eq?: InputMaybe; + maxSize_not_in?: InputMaybe>; + priceImpactAmount_eq?: InputMaybe; + priceImpactAmount_gt?: InputMaybe; + priceImpactAmount_gte?: InputMaybe; + priceImpactAmount_in?: InputMaybe>; + priceImpactAmount_isNull?: InputMaybe; + priceImpactAmount_lt?: InputMaybe; + priceImpactAmount_lte?: InputMaybe; + priceImpactAmount_not_eq?: InputMaybe; + priceImpactAmount_not_in?: InputMaybe>; + priceImpactDiffUsd_eq?: InputMaybe; + priceImpactDiffUsd_gt?: InputMaybe; + priceImpactDiffUsd_gte?: InputMaybe; + priceImpactDiffUsd_in?: InputMaybe>; + priceImpactDiffUsd_isNull?: InputMaybe; + priceImpactDiffUsd_lt?: InputMaybe; + priceImpactDiffUsd_lte?: InputMaybe; + priceImpactDiffUsd_not_eq?: InputMaybe; + priceImpactDiffUsd_not_in?: InputMaybe>; + priceImpactUsd_eq?: InputMaybe; + priceImpactUsd_gt?: InputMaybe; + priceImpactUsd_gte?: InputMaybe; + priceImpactUsd_in?: InputMaybe>; + priceImpactUsd_isNull?: InputMaybe; + priceImpactUsd_lt?: InputMaybe; + priceImpactUsd_lte?: InputMaybe; + priceImpactUsd_not_eq?: InputMaybe; + priceImpactUsd_not_in?: InputMaybe>; + proportionalPendingImpactUsd_eq?: InputMaybe; + proportionalPendingImpactUsd_gt?: InputMaybe; + proportionalPendingImpactUsd_gte?: InputMaybe; + proportionalPendingImpactUsd_in?: InputMaybe>; + proportionalPendingImpactUsd_isNull?: InputMaybe; + proportionalPendingImpactUsd_lt?: InputMaybe; + proportionalPendingImpactUsd_lte?: InputMaybe; + proportionalPendingImpactUsd_not_eq?: InputMaybe; + proportionalPendingImpactUsd_not_in?: InputMaybe>; + sizeDeltaUsd_eq?: InputMaybe; + sizeDeltaUsd_gt?: InputMaybe; + sizeDeltaUsd_gte?: InputMaybe; + sizeDeltaUsd_in?: InputMaybe>; + sizeDeltaUsd_isNull?: InputMaybe; + sizeDeltaUsd_lt?: InputMaybe; + sizeDeltaUsd_lte?: InputMaybe; + sizeDeltaUsd_not_eq?: InputMaybe; + sizeDeltaUsd_not_in?: InputMaybe>; + sizeInUsd_eq?: InputMaybe; + sizeInUsd_gt?: InputMaybe; + sizeInUsd_gte?: InputMaybe; + sizeInUsd_in?: InputMaybe>; + sizeInUsd_isNull?: InputMaybe; + sizeInUsd_lt?: InputMaybe; + sizeInUsd_lte?: InputMaybe; + sizeInUsd_not_eq?: InputMaybe; + sizeInUsd_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + totalImpactUsd_eq?: InputMaybe; + totalImpactUsd_gt?: InputMaybe; + totalImpactUsd_gte?: InputMaybe; + totalImpactUsd_in?: InputMaybe>; + totalImpactUsd_isNull?: InputMaybe; + totalImpactUsd_lt?: InputMaybe; + totalImpactUsd_lte?: InputMaybe; + totalImpactUsd_not_eq?: InputMaybe; + totalImpactUsd_not_in?: InputMaybe>; type_eq?: InputMaybe; type_in?: InputMaybe>; - type_isNull?: InputMaybe; + type_isNull?: InputMaybe; type_not_eq?: InputMaybe; type_not_in?: InputMaybe>; } export interface PositionChangesConnection { - __typename?: "PositionChangesConnection"; + __typename?: 'PositionChangesConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface PositionEdge { - __typename?: "PositionEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PositionEdge'; + cursor: Scalars['String']['output']; node: Position; } export interface PositionFeesEntitiesConnection { - __typename?: "PositionFeesEntitiesConnection"; + __typename?: 'PositionFeesEntitiesConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface PositionFeesEntity { - __typename?: "PositionFeesEntity"; - affiliate: Scalars["String"]["output"]; - affiliateRewardAmount: Scalars["BigInt"]["output"]; - borrowingFeeAmount: Scalars["BigInt"]["output"]; - collateralTokenAddress: Scalars["String"]["output"]; - collateralTokenPriceMax: Scalars["BigInt"]["output"]; - collateralTokenPriceMin: Scalars["BigInt"]["output"]; - eventName: Scalars["String"]["output"]; - feeUsdForPool: Scalars["BigInt"]["output"]; - fundingFeeAmount: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - liquidationFeeAmount?: Maybe; - marketAddress: Scalars["String"]["output"]; - orderKey: Scalars["String"]["output"]; - positionFeeAmount: Scalars["BigInt"]["output"]; - totalRebateAmount: Scalars["BigInt"]["output"]; - totalRebateFactor: Scalars["BigInt"]["output"]; - trader: Scalars["String"]["output"]; - traderDiscountAmount: Scalars["BigInt"]["output"]; + __typename?: 'PositionFeesEntity'; + affiliate: Scalars['String']['output']; + affiliateRewardAmount: Scalars['BigInt']['output']; + borrowingFeeAmount: Scalars['BigInt']['output']; + collateralTokenAddress: Scalars['String']['output']; + collateralTokenPriceMax: Scalars['BigInt']['output']; + collateralTokenPriceMin: Scalars['BigInt']['output']; + eventName: Scalars['String']['output']; + feeUsdForPool: Scalars['BigInt']['output']; + fundingFeeAmount: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + liquidationFeeAmount?: Maybe; + marketAddress: Scalars['String']['output']; + orderKey: Scalars['String']['output']; + positionFeeAmount: Scalars['BigInt']['output']; + totalRebateAmount: Scalars['BigInt']['output']; + totalRebateFactor: Scalars['BigInt']['output']; + trader: Scalars['String']['output']; + traderDiscountAmount: Scalars['BigInt']['output']; transaction: Transaction; type: PositionFeesEntityType; } export interface PositionFeesEntityEdge { - __typename?: "PositionFeesEntityEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PositionFeesEntityEdge'; + cursor: Scalars['String']['output']; node: PositionFeesEntity; } export enum PositionFeesEntityOrderByInput { - affiliateRewardAmount_ASC = "affiliateRewardAmount_ASC", - affiliateRewardAmount_ASC_NULLS_FIRST = "affiliateRewardAmount_ASC_NULLS_FIRST", - affiliateRewardAmount_ASC_NULLS_LAST = "affiliateRewardAmount_ASC_NULLS_LAST", - affiliateRewardAmount_DESC = "affiliateRewardAmount_DESC", - affiliateRewardAmount_DESC_NULLS_FIRST = "affiliateRewardAmount_DESC_NULLS_FIRST", - affiliateRewardAmount_DESC_NULLS_LAST = "affiliateRewardAmount_DESC_NULLS_LAST", - affiliate_ASC = "affiliate_ASC", - affiliate_ASC_NULLS_FIRST = "affiliate_ASC_NULLS_FIRST", - affiliate_ASC_NULLS_LAST = "affiliate_ASC_NULLS_LAST", - affiliate_DESC = "affiliate_DESC", - affiliate_DESC_NULLS_FIRST = "affiliate_DESC_NULLS_FIRST", - affiliate_DESC_NULLS_LAST = "affiliate_DESC_NULLS_LAST", - borrowingFeeAmount_ASC = "borrowingFeeAmount_ASC", - borrowingFeeAmount_ASC_NULLS_FIRST = "borrowingFeeAmount_ASC_NULLS_FIRST", - borrowingFeeAmount_ASC_NULLS_LAST = "borrowingFeeAmount_ASC_NULLS_LAST", - borrowingFeeAmount_DESC = "borrowingFeeAmount_DESC", - borrowingFeeAmount_DESC_NULLS_FIRST = "borrowingFeeAmount_DESC_NULLS_FIRST", - borrowingFeeAmount_DESC_NULLS_LAST = "borrowingFeeAmount_DESC_NULLS_LAST", - collateralTokenAddress_ASC = "collateralTokenAddress_ASC", - collateralTokenAddress_ASC_NULLS_FIRST = "collateralTokenAddress_ASC_NULLS_FIRST", - collateralTokenAddress_ASC_NULLS_LAST = "collateralTokenAddress_ASC_NULLS_LAST", - collateralTokenAddress_DESC = "collateralTokenAddress_DESC", - collateralTokenAddress_DESC_NULLS_FIRST = "collateralTokenAddress_DESC_NULLS_FIRST", - collateralTokenAddress_DESC_NULLS_LAST = "collateralTokenAddress_DESC_NULLS_LAST", - collateralTokenPriceMax_ASC = "collateralTokenPriceMax_ASC", - collateralTokenPriceMax_ASC_NULLS_FIRST = "collateralTokenPriceMax_ASC_NULLS_FIRST", - collateralTokenPriceMax_ASC_NULLS_LAST = "collateralTokenPriceMax_ASC_NULLS_LAST", - collateralTokenPriceMax_DESC = "collateralTokenPriceMax_DESC", - collateralTokenPriceMax_DESC_NULLS_FIRST = "collateralTokenPriceMax_DESC_NULLS_FIRST", - collateralTokenPriceMax_DESC_NULLS_LAST = "collateralTokenPriceMax_DESC_NULLS_LAST", - collateralTokenPriceMin_ASC = "collateralTokenPriceMin_ASC", - collateralTokenPriceMin_ASC_NULLS_FIRST = "collateralTokenPriceMin_ASC_NULLS_FIRST", - collateralTokenPriceMin_ASC_NULLS_LAST = "collateralTokenPriceMin_ASC_NULLS_LAST", - collateralTokenPriceMin_DESC = "collateralTokenPriceMin_DESC", - collateralTokenPriceMin_DESC_NULLS_FIRST = "collateralTokenPriceMin_DESC_NULLS_FIRST", - collateralTokenPriceMin_DESC_NULLS_LAST = "collateralTokenPriceMin_DESC_NULLS_LAST", - eventName_ASC = "eventName_ASC", - eventName_ASC_NULLS_FIRST = "eventName_ASC_NULLS_FIRST", - eventName_ASC_NULLS_LAST = "eventName_ASC_NULLS_LAST", - eventName_DESC = "eventName_DESC", - eventName_DESC_NULLS_FIRST = "eventName_DESC_NULLS_FIRST", - eventName_DESC_NULLS_LAST = "eventName_DESC_NULLS_LAST", - feeUsdForPool_ASC = "feeUsdForPool_ASC", - feeUsdForPool_ASC_NULLS_FIRST = "feeUsdForPool_ASC_NULLS_FIRST", - feeUsdForPool_ASC_NULLS_LAST = "feeUsdForPool_ASC_NULLS_LAST", - feeUsdForPool_DESC = "feeUsdForPool_DESC", - feeUsdForPool_DESC_NULLS_FIRST = "feeUsdForPool_DESC_NULLS_FIRST", - feeUsdForPool_DESC_NULLS_LAST = "feeUsdForPool_DESC_NULLS_LAST", - fundingFeeAmount_ASC = "fundingFeeAmount_ASC", - fundingFeeAmount_ASC_NULLS_FIRST = "fundingFeeAmount_ASC_NULLS_FIRST", - fundingFeeAmount_ASC_NULLS_LAST = "fundingFeeAmount_ASC_NULLS_LAST", - fundingFeeAmount_DESC = "fundingFeeAmount_DESC", - fundingFeeAmount_DESC_NULLS_FIRST = "fundingFeeAmount_DESC_NULLS_FIRST", - fundingFeeAmount_DESC_NULLS_LAST = "fundingFeeAmount_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - liquidationFeeAmount_ASC = "liquidationFeeAmount_ASC", - liquidationFeeAmount_ASC_NULLS_FIRST = "liquidationFeeAmount_ASC_NULLS_FIRST", - liquidationFeeAmount_ASC_NULLS_LAST = "liquidationFeeAmount_ASC_NULLS_LAST", - liquidationFeeAmount_DESC = "liquidationFeeAmount_DESC", - liquidationFeeAmount_DESC_NULLS_FIRST = "liquidationFeeAmount_DESC_NULLS_FIRST", - liquidationFeeAmount_DESC_NULLS_LAST = "liquidationFeeAmount_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - orderKey_ASC = "orderKey_ASC", - orderKey_ASC_NULLS_FIRST = "orderKey_ASC_NULLS_FIRST", - orderKey_ASC_NULLS_LAST = "orderKey_ASC_NULLS_LAST", - orderKey_DESC = "orderKey_DESC", - orderKey_DESC_NULLS_FIRST = "orderKey_DESC_NULLS_FIRST", - orderKey_DESC_NULLS_LAST = "orderKey_DESC_NULLS_LAST", - positionFeeAmount_ASC = "positionFeeAmount_ASC", - positionFeeAmount_ASC_NULLS_FIRST = "positionFeeAmount_ASC_NULLS_FIRST", - positionFeeAmount_ASC_NULLS_LAST = "positionFeeAmount_ASC_NULLS_LAST", - positionFeeAmount_DESC = "positionFeeAmount_DESC", - positionFeeAmount_DESC_NULLS_FIRST = "positionFeeAmount_DESC_NULLS_FIRST", - positionFeeAmount_DESC_NULLS_LAST = "positionFeeAmount_DESC_NULLS_LAST", - totalRebateAmount_ASC = "totalRebateAmount_ASC", - totalRebateAmount_ASC_NULLS_FIRST = "totalRebateAmount_ASC_NULLS_FIRST", - totalRebateAmount_ASC_NULLS_LAST = "totalRebateAmount_ASC_NULLS_LAST", - totalRebateAmount_DESC = "totalRebateAmount_DESC", - totalRebateAmount_DESC_NULLS_FIRST = "totalRebateAmount_DESC_NULLS_FIRST", - totalRebateAmount_DESC_NULLS_LAST = "totalRebateAmount_DESC_NULLS_LAST", - totalRebateFactor_ASC = "totalRebateFactor_ASC", - totalRebateFactor_ASC_NULLS_FIRST = "totalRebateFactor_ASC_NULLS_FIRST", - totalRebateFactor_ASC_NULLS_LAST = "totalRebateFactor_ASC_NULLS_LAST", - totalRebateFactor_DESC = "totalRebateFactor_DESC", - totalRebateFactor_DESC_NULLS_FIRST = "totalRebateFactor_DESC_NULLS_FIRST", - totalRebateFactor_DESC_NULLS_LAST = "totalRebateFactor_DESC_NULLS_LAST", - traderDiscountAmount_ASC = "traderDiscountAmount_ASC", - traderDiscountAmount_ASC_NULLS_FIRST = "traderDiscountAmount_ASC_NULLS_FIRST", - traderDiscountAmount_ASC_NULLS_LAST = "traderDiscountAmount_ASC_NULLS_LAST", - traderDiscountAmount_DESC = "traderDiscountAmount_DESC", - traderDiscountAmount_DESC_NULLS_FIRST = "traderDiscountAmount_DESC_NULLS_FIRST", - traderDiscountAmount_DESC_NULLS_LAST = "traderDiscountAmount_DESC_NULLS_LAST", - trader_ASC = "trader_ASC", - trader_ASC_NULLS_FIRST = "trader_ASC_NULLS_FIRST", - trader_ASC_NULLS_LAST = "trader_ASC_NULLS_LAST", - trader_DESC = "trader_DESC", - trader_DESC_NULLS_FIRST = "trader_DESC_NULLS_FIRST", - trader_DESC_NULLS_LAST = "trader_DESC_NULLS_LAST", - transaction_blockNumber_ASC = "transaction_blockNumber_ASC", - transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", - transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", - transaction_blockNumber_DESC = "transaction_blockNumber_DESC", - transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", - transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", - transaction_chainId_ASC = "transaction_chainId_ASC", - transaction_chainId_ASC_NULLS_FIRST = "transaction_chainId_ASC_NULLS_FIRST", - transaction_chainId_ASC_NULLS_LAST = "transaction_chainId_ASC_NULLS_LAST", - transaction_chainId_DESC = "transaction_chainId_DESC", - transaction_chainId_DESC_NULLS_FIRST = "transaction_chainId_DESC_NULLS_FIRST", - transaction_chainId_DESC_NULLS_LAST = "transaction_chainId_DESC_NULLS_LAST", - transaction_from_ASC = "transaction_from_ASC", - transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", - transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", - transaction_from_DESC = "transaction_from_DESC", - transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", - transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", - transaction_hash_ASC = "transaction_hash_ASC", - transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", - transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", - transaction_hash_DESC = "transaction_hash_DESC", - transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", - transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", - transaction_id_ASC = "transaction_id_ASC", - transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", - transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", - transaction_id_DESC = "transaction_id_DESC", - transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", - transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", - transaction_timestamp_ASC = "transaction_timestamp_ASC", - transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", - transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", - transaction_timestamp_DESC = "transaction_timestamp_DESC", - transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", - transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", - transaction_to_ASC = "transaction_to_ASC", - transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", - transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", - transaction_to_DESC = "transaction_to_DESC", - transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", - transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", - transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", - transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", - transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", - transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", - transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", - transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", - type_ASC = "type_ASC", - type_ASC_NULLS_FIRST = "type_ASC_NULLS_FIRST", - type_ASC_NULLS_LAST = "type_ASC_NULLS_LAST", - type_DESC = "type_DESC", - type_DESC_NULLS_FIRST = "type_DESC_NULLS_FIRST", - type_DESC_NULLS_LAST = "type_DESC_NULLS_LAST", + affiliateRewardAmount_ASC = 'affiliateRewardAmount_ASC', + affiliateRewardAmount_ASC_NULLS_FIRST = 'affiliateRewardAmount_ASC_NULLS_FIRST', + affiliateRewardAmount_ASC_NULLS_LAST = 'affiliateRewardAmount_ASC_NULLS_LAST', + affiliateRewardAmount_DESC = 'affiliateRewardAmount_DESC', + affiliateRewardAmount_DESC_NULLS_FIRST = 'affiliateRewardAmount_DESC_NULLS_FIRST', + affiliateRewardAmount_DESC_NULLS_LAST = 'affiliateRewardAmount_DESC_NULLS_LAST', + affiliate_ASC = 'affiliate_ASC', + affiliate_ASC_NULLS_FIRST = 'affiliate_ASC_NULLS_FIRST', + affiliate_ASC_NULLS_LAST = 'affiliate_ASC_NULLS_LAST', + affiliate_DESC = 'affiliate_DESC', + affiliate_DESC_NULLS_FIRST = 'affiliate_DESC_NULLS_FIRST', + affiliate_DESC_NULLS_LAST = 'affiliate_DESC_NULLS_LAST', + borrowingFeeAmount_ASC = 'borrowingFeeAmount_ASC', + borrowingFeeAmount_ASC_NULLS_FIRST = 'borrowingFeeAmount_ASC_NULLS_FIRST', + borrowingFeeAmount_ASC_NULLS_LAST = 'borrowingFeeAmount_ASC_NULLS_LAST', + borrowingFeeAmount_DESC = 'borrowingFeeAmount_DESC', + borrowingFeeAmount_DESC_NULLS_FIRST = 'borrowingFeeAmount_DESC_NULLS_FIRST', + borrowingFeeAmount_DESC_NULLS_LAST = 'borrowingFeeAmount_DESC_NULLS_LAST', + collateralTokenAddress_ASC = 'collateralTokenAddress_ASC', + collateralTokenAddress_ASC_NULLS_FIRST = 'collateralTokenAddress_ASC_NULLS_FIRST', + collateralTokenAddress_ASC_NULLS_LAST = 'collateralTokenAddress_ASC_NULLS_LAST', + collateralTokenAddress_DESC = 'collateralTokenAddress_DESC', + collateralTokenAddress_DESC_NULLS_FIRST = 'collateralTokenAddress_DESC_NULLS_FIRST', + collateralTokenAddress_DESC_NULLS_LAST = 'collateralTokenAddress_DESC_NULLS_LAST', + collateralTokenPriceMax_ASC = 'collateralTokenPriceMax_ASC', + collateralTokenPriceMax_ASC_NULLS_FIRST = 'collateralTokenPriceMax_ASC_NULLS_FIRST', + collateralTokenPriceMax_ASC_NULLS_LAST = 'collateralTokenPriceMax_ASC_NULLS_LAST', + collateralTokenPriceMax_DESC = 'collateralTokenPriceMax_DESC', + collateralTokenPriceMax_DESC_NULLS_FIRST = 'collateralTokenPriceMax_DESC_NULLS_FIRST', + collateralTokenPriceMax_DESC_NULLS_LAST = 'collateralTokenPriceMax_DESC_NULLS_LAST', + collateralTokenPriceMin_ASC = 'collateralTokenPriceMin_ASC', + collateralTokenPriceMin_ASC_NULLS_FIRST = 'collateralTokenPriceMin_ASC_NULLS_FIRST', + collateralTokenPriceMin_ASC_NULLS_LAST = 'collateralTokenPriceMin_ASC_NULLS_LAST', + collateralTokenPriceMin_DESC = 'collateralTokenPriceMin_DESC', + collateralTokenPriceMin_DESC_NULLS_FIRST = 'collateralTokenPriceMin_DESC_NULLS_FIRST', + collateralTokenPriceMin_DESC_NULLS_LAST = 'collateralTokenPriceMin_DESC_NULLS_LAST', + eventName_ASC = 'eventName_ASC', + eventName_ASC_NULLS_FIRST = 'eventName_ASC_NULLS_FIRST', + eventName_ASC_NULLS_LAST = 'eventName_ASC_NULLS_LAST', + eventName_DESC = 'eventName_DESC', + eventName_DESC_NULLS_FIRST = 'eventName_DESC_NULLS_FIRST', + eventName_DESC_NULLS_LAST = 'eventName_DESC_NULLS_LAST', + feeUsdForPool_ASC = 'feeUsdForPool_ASC', + feeUsdForPool_ASC_NULLS_FIRST = 'feeUsdForPool_ASC_NULLS_FIRST', + feeUsdForPool_ASC_NULLS_LAST = 'feeUsdForPool_ASC_NULLS_LAST', + feeUsdForPool_DESC = 'feeUsdForPool_DESC', + feeUsdForPool_DESC_NULLS_FIRST = 'feeUsdForPool_DESC_NULLS_FIRST', + feeUsdForPool_DESC_NULLS_LAST = 'feeUsdForPool_DESC_NULLS_LAST', + fundingFeeAmount_ASC = 'fundingFeeAmount_ASC', + fundingFeeAmount_ASC_NULLS_FIRST = 'fundingFeeAmount_ASC_NULLS_FIRST', + fundingFeeAmount_ASC_NULLS_LAST = 'fundingFeeAmount_ASC_NULLS_LAST', + fundingFeeAmount_DESC = 'fundingFeeAmount_DESC', + fundingFeeAmount_DESC_NULLS_FIRST = 'fundingFeeAmount_DESC_NULLS_FIRST', + fundingFeeAmount_DESC_NULLS_LAST = 'fundingFeeAmount_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + liquidationFeeAmount_ASC = 'liquidationFeeAmount_ASC', + liquidationFeeAmount_ASC_NULLS_FIRST = 'liquidationFeeAmount_ASC_NULLS_FIRST', + liquidationFeeAmount_ASC_NULLS_LAST = 'liquidationFeeAmount_ASC_NULLS_LAST', + liquidationFeeAmount_DESC = 'liquidationFeeAmount_DESC', + liquidationFeeAmount_DESC_NULLS_FIRST = 'liquidationFeeAmount_DESC_NULLS_FIRST', + liquidationFeeAmount_DESC_NULLS_LAST = 'liquidationFeeAmount_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + orderKey_ASC = 'orderKey_ASC', + orderKey_ASC_NULLS_FIRST = 'orderKey_ASC_NULLS_FIRST', + orderKey_ASC_NULLS_LAST = 'orderKey_ASC_NULLS_LAST', + orderKey_DESC = 'orderKey_DESC', + orderKey_DESC_NULLS_FIRST = 'orderKey_DESC_NULLS_FIRST', + orderKey_DESC_NULLS_LAST = 'orderKey_DESC_NULLS_LAST', + positionFeeAmount_ASC = 'positionFeeAmount_ASC', + positionFeeAmount_ASC_NULLS_FIRST = 'positionFeeAmount_ASC_NULLS_FIRST', + positionFeeAmount_ASC_NULLS_LAST = 'positionFeeAmount_ASC_NULLS_LAST', + positionFeeAmount_DESC = 'positionFeeAmount_DESC', + positionFeeAmount_DESC_NULLS_FIRST = 'positionFeeAmount_DESC_NULLS_FIRST', + positionFeeAmount_DESC_NULLS_LAST = 'positionFeeAmount_DESC_NULLS_LAST', + totalRebateAmount_ASC = 'totalRebateAmount_ASC', + totalRebateAmount_ASC_NULLS_FIRST = 'totalRebateAmount_ASC_NULLS_FIRST', + totalRebateAmount_ASC_NULLS_LAST = 'totalRebateAmount_ASC_NULLS_LAST', + totalRebateAmount_DESC = 'totalRebateAmount_DESC', + totalRebateAmount_DESC_NULLS_FIRST = 'totalRebateAmount_DESC_NULLS_FIRST', + totalRebateAmount_DESC_NULLS_LAST = 'totalRebateAmount_DESC_NULLS_LAST', + totalRebateFactor_ASC = 'totalRebateFactor_ASC', + totalRebateFactor_ASC_NULLS_FIRST = 'totalRebateFactor_ASC_NULLS_FIRST', + totalRebateFactor_ASC_NULLS_LAST = 'totalRebateFactor_ASC_NULLS_LAST', + totalRebateFactor_DESC = 'totalRebateFactor_DESC', + totalRebateFactor_DESC_NULLS_FIRST = 'totalRebateFactor_DESC_NULLS_FIRST', + totalRebateFactor_DESC_NULLS_LAST = 'totalRebateFactor_DESC_NULLS_LAST', + traderDiscountAmount_ASC = 'traderDiscountAmount_ASC', + traderDiscountAmount_ASC_NULLS_FIRST = 'traderDiscountAmount_ASC_NULLS_FIRST', + traderDiscountAmount_ASC_NULLS_LAST = 'traderDiscountAmount_ASC_NULLS_LAST', + traderDiscountAmount_DESC = 'traderDiscountAmount_DESC', + traderDiscountAmount_DESC_NULLS_FIRST = 'traderDiscountAmount_DESC_NULLS_FIRST', + traderDiscountAmount_DESC_NULLS_LAST = 'traderDiscountAmount_DESC_NULLS_LAST', + trader_ASC = 'trader_ASC', + trader_ASC_NULLS_FIRST = 'trader_ASC_NULLS_FIRST', + trader_ASC_NULLS_LAST = 'trader_ASC_NULLS_LAST', + trader_DESC = 'trader_DESC', + trader_DESC_NULLS_FIRST = 'trader_DESC_NULLS_FIRST', + trader_DESC_NULLS_LAST = 'trader_DESC_NULLS_LAST', + transaction_blockNumber_ASC = 'transaction_blockNumber_ASC', + transaction_blockNumber_ASC_NULLS_FIRST = 'transaction_blockNumber_ASC_NULLS_FIRST', + transaction_blockNumber_ASC_NULLS_LAST = 'transaction_blockNumber_ASC_NULLS_LAST', + transaction_blockNumber_DESC = 'transaction_blockNumber_DESC', + transaction_blockNumber_DESC_NULLS_FIRST = 'transaction_blockNumber_DESC_NULLS_FIRST', + transaction_blockNumber_DESC_NULLS_LAST = 'transaction_blockNumber_DESC_NULLS_LAST', + transaction_from_ASC = 'transaction_from_ASC', + transaction_from_ASC_NULLS_FIRST = 'transaction_from_ASC_NULLS_FIRST', + transaction_from_ASC_NULLS_LAST = 'transaction_from_ASC_NULLS_LAST', + transaction_from_DESC = 'transaction_from_DESC', + transaction_from_DESC_NULLS_FIRST = 'transaction_from_DESC_NULLS_FIRST', + transaction_from_DESC_NULLS_LAST = 'transaction_from_DESC_NULLS_LAST', + transaction_hash_ASC = 'transaction_hash_ASC', + transaction_hash_ASC_NULLS_FIRST = 'transaction_hash_ASC_NULLS_FIRST', + transaction_hash_ASC_NULLS_LAST = 'transaction_hash_ASC_NULLS_LAST', + transaction_hash_DESC = 'transaction_hash_DESC', + transaction_hash_DESC_NULLS_FIRST = 'transaction_hash_DESC_NULLS_FIRST', + transaction_hash_DESC_NULLS_LAST = 'transaction_hash_DESC_NULLS_LAST', + transaction_id_ASC = 'transaction_id_ASC', + transaction_id_ASC_NULLS_FIRST = 'transaction_id_ASC_NULLS_FIRST', + transaction_id_ASC_NULLS_LAST = 'transaction_id_ASC_NULLS_LAST', + transaction_id_DESC = 'transaction_id_DESC', + transaction_id_DESC_NULLS_FIRST = 'transaction_id_DESC_NULLS_FIRST', + transaction_id_DESC_NULLS_LAST = 'transaction_id_DESC_NULLS_LAST', + transaction_timestamp_ASC = 'transaction_timestamp_ASC', + transaction_timestamp_ASC_NULLS_FIRST = 'transaction_timestamp_ASC_NULLS_FIRST', + transaction_timestamp_ASC_NULLS_LAST = 'transaction_timestamp_ASC_NULLS_LAST', + transaction_timestamp_DESC = 'transaction_timestamp_DESC', + transaction_timestamp_DESC_NULLS_FIRST = 'transaction_timestamp_DESC_NULLS_FIRST', + transaction_timestamp_DESC_NULLS_LAST = 'transaction_timestamp_DESC_NULLS_LAST', + transaction_to_ASC = 'transaction_to_ASC', + transaction_to_ASC_NULLS_FIRST = 'transaction_to_ASC_NULLS_FIRST', + transaction_to_ASC_NULLS_LAST = 'transaction_to_ASC_NULLS_LAST', + transaction_to_DESC = 'transaction_to_DESC', + transaction_to_DESC_NULLS_FIRST = 'transaction_to_DESC_NULLS_FIRST', + transaction_to_DESC_NULLS_LAST = 'transaction_to_DESC_NULLS_LAST', + transaction_transactionIndex_ASC = 'transaction_transactionIndex_ASC', + transaction_transactionIndex_ASC_NULLS_FIRST = 'transaction_transactionIndex_ASC_NULLS_FIRST', + transaction_transactionIndex_ASC_NULLS_LAST = 'transaction_transactionIndex_ASC_NULLS_LAST', + transaction_transactionIndex_DESC = 'transaction_transactionIndex_DESC', + transaction_transactionIndex_DESC_NULLS_FIRST = 'transaction_transactionIndex_DESC_NULLS_FIRST', + transaction_transactionIndex_DESC_NULLS_LAST = 'transaction_transactionIndex_DESC_NULLS_LAST', + type_ASC = 'type_ASC', + type_ASC_NULLS_FIRST = 'type_ASC_NULLS_FIRST', + type_ASC_NULLS_LAST = 'type_ASC_NULLS_LAST', + type_DESC = 'type_DESC', + type_DESC_NULLS_FIRST = 'type_DESC_NULLS_FIRST', + type_DESC_NULLS_LAST = 'type_DESC_NULLS_LAST' } export enum PositionFeesEntityType { - PositionFeesCollected = "PositionFeesCollected", - PositionFeesInfo = "PositionFeesInfo", + PositionFeesCollected = 'PositionFeesCollected', + PositionFeesInfo = 'PositionFeesInfo' } export interface PositionFeesEntityWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - affiliateRewardAmount_eq?: InputMaybe; - affiliateRewardAmount_gt?: InputMaybe; - affiliateRewardAmount_gte?: InputMaybe; - affiliateRewardAmount_in?: InputMaybe>; - affiliateRewardAmount_isNull?: InputMaybe; - affiliateRewardAmount_lt?: InputMaybe; - affiliateRewardAmount_lte?: InputMaybe; - affiliateRewardAmount_not_eq?: InputMaybe; - affiliateRewardAmount_not_in?: InputMaybe>; - affiliate_contains?: InputMaybe; - affiliate_containsInsensitive?: InputMaybe; - affiliate_endsWith?: InputMaybe; - affiliate_eq?: InputMaybe; - affiliate_gt?: InputMaybe; - affiliate_gte?: InputMaybe; - affiliate_in?: InputMaybe>; - affiliate_isNull?: InputMaybe; - affiliate_lt?: InputMaybe; - affiliate_lte?: InputMaybe; - affiliate_not_contains?: InputMaybe; - affiliate_not_containsInsensitive?: InputMaybe; - affiliate_not_endsWith?: InputMaybe; - affiliate_not_eq?: InputMaybe; - affiliate_not_in?: InputMaybe>; - affiliate_not_startsWith?: InputMaybe; - affiliate_startsWith?: InputMaybe; - borrowingFeeAmount_eq?: InputMaybe; - borrowingFeeAmount_gt?: InputMaybe; - borrowingFeeAmount_gte?: InputMaybe; - borrowingFeeAmount_in?: InputMaybe>; - borrowingFeeAmount_isNull?: InputMaybe; - borrowingFeeAmount_lt?: InputMaybe; - borrowingFeeAmount_lte?: InputMaybe; - borrowingFeeAmount_not_eq?: InputMaybe; - borrowingFeeAmount_not_in?: InputMaybe>; - collateralTokenAddress_contains?: InputMaybe; - collateralTokenAddress_containsInsensitive?: InputMaybe; - collateralTokenAddress_endsWith?: InputMaybe; - collateralTokenAddress_eq?: InputMaybe; - collateralTokenAddress_gt?: InputMaybe; - collateralTokenAddress_gte?: InputMaybe; - collateralTokenAddress_in?: InputMaybe>; - collateralTokenAddress_isNull?: InputMaybe; - collateralTokenAddress_lt?: InputMaybe; - collateralTokenAddress_lte?: InputMaybe; - collateralTokenAddress_not_contains?: InputMaybe; - collateralTokenAddress_not_containsInsensitive?: InputMaybe; - collateralTokenAddress_not_endsWith?: InputMaybe; - collateralTokenAddress_not_eq?: InputMaybe; - collateralTokenAddress_not_in?: InputMaybe>; - collateralTokenAddress_not_startsWith?: InputMaybe; - collateralTokenAddress_startsWith?: InputMaybe; - collateralTokenPriceMax_eq?: InputMaybe; - collateralTokenPriceMax_gt?: InputMaybe; - collateralTokenPriceMax_gte?: InputMaybe; - collateralTokenPriceMax_in?: InputMaybe>; - collateralTokenPriceMax_isNull?: InputMaybe; - collateralTokenPriceMax_lt?: InputMaybe; - collateralTokenPriceMax_lte?: InputMaybe; - collateralTokenPriceMax_not_eq?: InputMaybe; - collateralTokenPriceMax_not_in?: InputMaybe>; - collateralTokenPriceMin_eq?: InputMaybe; - collateralTokenPriceMin_gt?: InputMaybe; - collateralTokenPriceMin_gte?: InputMaybe; - collateralTokenPriceMin_in?: InputMaybe>; - collateralTokenPriceMin_isNull?: InputMaybe; - collateralTokenPriceMin_lt?: InputMaybe; - collateralTokenPriceMin_lte?: InputMaybe; - collateralTokenPriceMin_not_eq?: InputMaybe; - collateralTokenPriceMin_not_in?: InputMaybe>; - eventName_contains?: InputMaybe; - eventName_containsInsensitive?: InputMaybe; - eventName_endsWith?: InputMaybe; - eventName_eq?: InputMaybe; - eventName_gt?: InputMaybe; - eventName_gte?: InputMaybe; - eventName_in?: InputMaybe>; - eventName_isNull?: InputMaybe; - eventName_lt?: InputMaybe; - eventName_lte?: InputMaybe; - eventName_not_contains?: InputMaybe; - eventName_not_containsInsensitive?: InputMaybe; - eventName_not_endsWith?: InputMaybe; - eventName_not_eq?: InputMaybe; - eventName_not_in?: InputMaybe>; - eventName_not_startsWith?: InputMaybe; - eventName_startsWith?: InputMaybe; - feeUsdForPool_eq?: InputMaybe; - feeUsdForPool_gt?: InputMaybe; - feeUsdForPool_gte?: InputMaybe; - feeUsdForPool_in?: InputMaybe>; - feeUsdForPool_isNull?: InputMaybe; - feeUsdForPool_lt?: InputMaybe; - feeUsdForPool_lte?: InputMaybe; - feeUsdForPool_not_eq?: InputMaybe; - feeUsdForPool_not_in?: InputMaybe>; - fundingFeeAmount_eq?: InputMaybe; - fundingFeeAmount_gt?: InputMaybe; - fundingFeeAmount_gte?: InputMaybe; - fundingFeeAmount_in?: InputMaybe>; - fundingFeeAmount_isNull?: InputMaybe; - fundingFeeAmount_lt?: InputMaybe; - fundingFeeAmount_lte?: InputMaybe; - fundingFeeAmount_not_eq?: InputMaybe; - fundingFeeAmount_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - liquidationFeeAmount_eq?: InputMaybe; - liquidationFeeAmount_gt?: InputMaybe; - liquidationFeeAmount_gte?: InputMaybe; - liquidationFeeAmount_in?: InputMaybe>; - liquidationFeeAmount_isNull?: InputMaybe; - liquidationFeeAmount_lt?: InputMaybe; - liquidationFeeAmount_lte?: InputMaybe; - liquidationFeeAmount_not_eq?: InputMaybe; - liquidationFeeAmount_not_in?: InputMaybe>; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - orderKey_contains?: InputMaybe; - orderKey_containsInsensitive?: InputMaybe; - orderKey_endsWith?: InputMaybe; - orderKey_eq?: InputMaybe; - orderKey_gt?: InputMaybe; - orderKey_gte?: InputMaybe; - orderKey_in?: InputMaybe>; - orderKey_isNull?: InputMaybe; - orderKey_lt?: InputMaybe; - orderKey_lte?: InputMaybe; - orderKey_not_contains?: InputMaybe; - orderKey_not_containsInsensitive?: InputMaybe; - orderKey_not_endsWith?: InputMaybe; - orderKey_not_eq?: InputMaybe; - orderKey_not_in?: InputMaybe>; - orderKey_not_startsWith?: InputMaybe; - orderKey_startsWith?: InputMaybe; - positionFeeAmount_eq?: InputMaybe; - positionFeeAmount_gt?: InputMaybe; - positionFeeAmount_gte?: InputMaybe; - positionFeeAmount_in?: InputMaybe>; - positionFeeAmount_isNull?: InputMaybe; - positionFeeAmount_lt?: InputMaybe; - positionFeeAmount_lte?: InputMaybe; - positionFeeAmount_not_eq?: InputMaybe; - positionFeeAmount_not_in?: InputMaybe>; - totalRebateAmount_eq?: InputMaybe; - totalRebateAmount_gt?: InputMaybe; - totalRebateAmount_gte?: InputMaybe; - totalRebateAmount_in?: InputMaybe>; - totalRebateAmount_isNull?: InputMaybe; - totalRebateAmount_lt?: InputMaybe; - totalRebateAmount_lte?: InputMaybe; - totalRebateAmount_not_eq?: InputMaybe; - totalRebateAmount_not_in?: InputMaybe>; - totalRebateFactor_eq?: InputMaybe; - totalRebateFactor_gt?: InputMaybe; - totalRebateFactor_gte?: InputMaybe; - totalRebateFactor_in?: InputMaybe>; - totalRebateFactor_isNull?: InputMaybe; - totalRebateFactor_lt?: InputMaybe; - totalRebateFactor_lte?: InputMaybe; - totalRebateFactor_not_eq?: InputMaybe; - totalRebateFactor_not_in?: InputMaybe>; - traderDiscountAmount_eq?: InputMaybe; - traderDiscountAmount_gt?: InputMaybe; - traderDiscountAmount_gte?: InputMaybe; - traderDiscountAmount_in?: InputMaybe>; - traderDiscountAmount_isNull?: InputMaybe; - traderDiscountAmount_lt?: InputMaybe; - traderDiscountAmount_lte?: InputMaybe; - traderDiscountAmount_not_eq?: InputMaybe; - traderDiscountAmount_not_in?: InputMaybe>; - trader_contains?: InputMaybe; - trader_containsInsensitive?: InputMaybe; - trader_endsWith?: InputMaybe; - trader_eq?: InputMaybe; - trader_gt?: InputMaybe; - trader_gte?: InputMaybe; - trader_in?: InputMaybe>; - trader_isNull?: InputMaybe; - trader_lt?: InputMaybe; - trader_lte?: InputMaybe; - trader_not_contains?: InputMaybe; - trader_not_containsInsensitive?: InputMaybe; - trader_not_endsWith?: InputMaybe; - trader_not_eq?: InputMaybe; - trader_not_in?: InputMaybe>; - trader_not_startsWith?: InputMaybe; - trader_startsWith?: InputMaybe; + affiliateRewardAmount_eq?: InputMaybe; + affiliateRewardAmount_gt?: InputMaybe; + affiliateRewardAmount_gte?: InputMaybe; + affiliateRewardAmount_in?: InputMaybe>; + affiliateRewardAmount_isNull?: InputMaybe; + affiliateRewardAmount_lt?: InputMaybe; + affiliateRewardAmount_lte?: InputMaybe; + affiliateRewardAmount_not_eq?: InputMaybe; + affiliateRewardAmount_not_in?: InputMaybe>; + affiliate_contains?: InputMaybe; + affiliate_containsInsensitive?: InputMaybe; + affiliate_endsWith?: InputMaybe; + affiliate_eq?: InputMaybe; + affiliate_gt?: InputMaybe; + affiliate_gte?: InputMaybe; + affiliate_in?: InputMaybe>; + affiliate_isNull?: InputMaybe; + affiliate_lt?: InputMaybe; + affiliate_lte?: InputMaybe; + affiliate_not_contains?: InputMaybe; + affiliate_not_containsInsensitive?: InputMaybe; + affiliate_not_endsWith?: InputMaybe; + affiliate_not_eq?: InputMaybe; + affiliate_not_in?: InputMaybe>; + affiliate_not_startsWith?: InputMaybe; + affiliate_startsWith?: InputMaybe; + borrowingFeeAmount_eq?: InputMaybe; + borrowingFeeAmount_gt?: InputMaybe; + borrowingFeeAmount_gte?: InputMaybe; + borrowingFeeAmount_in?: InputMaybe>; + borrowingFeeAmount_isNull?: InputMaybe; + borrowingFeeAmount_lt?: InputMaybe; + borrowingFeeAmount_lte?: InputMaybe; + borrowingFeeAmount_not_eq?: InputMaybe; + borrowingFeeAmount_not_in?: InputMaybe>; + collateralTokenAddress_contains?: InputMaybe; + collateralTokenAddress_containsInsensitive?: InputMaybe; + collateralTokenAddress_endsWith?: InputMaybe; + collateralTokenAddress_eq?: InputMaybe; + collateralTokenAddress_gt?: InputMaybe; + collateralTokenAddress_gte?: InputMaybe; + collateralTokenAddress_in?: InputMaybe>; + collateralTokenAddress_isNull?: InputMaybe; + collateralTokenAddress_lt?: InputMaybe; + collateralTokenAddress_lte?: InputMaybe; + collateralTokenAddress_not_contains?: InputMaybe; + collateralTokenAddress_not_containsInsensitive?: InputMaybe; + collateralTokenAddress_not_endsWith?: InputMaybe; + collateralTokenAddress_not_eq?: InputMaybe; + collateralTokenAddress_not_in?: InputMaybe>; + collateralTokenAddress_not_startsWith?: InputMaybe; + collateralTokenAddress_startsWith?: InputMaybe; + collateralTokenPriceMax_eq?: InputMaybe; + collateralTokenPriceMax_gt?: InputMaybe; + collateralTokenPriceMax_gte?: InputMaybe; + collateralTokenPriceMax_in?: InputMaybe>; + collateralTokenPriceMax_isNull?: InputMaybe; + collateralTokenPriceMax_lt?: InputMaybe; + collateralTokenPriceMax_lte?: InputMaybe; + collateralTokenPriceMax_not_eq?: InputMaybe; + collateralTokenPriceMax_not_in?: InputMaybe>; + collateralTokenPriceMin_eq?: InputMaybe; + collateralTokenPriceMin_gt?: InputMaybe; + collateralTokenPriceMin_gte?: InputMaybe; + collateralTokenPriceMin_in?: InputMaybe>; + collateralTokenPriceMin_isNull?: InputMaybe; + collateralTokenPriceMin_lt?: InputMaybe; + collateralTokenPriceMin_lte?: InputMaybe; + collateralTokenPriceMin_not_eq?: InputMaybe; + collateralTokenPriceMin_not_in?: InputMaybe>; + eventName_contains?: InputMaybe; + eventName_containsInsensitive?: InputMaybe; + eventName_endsWith?: InputMaybe; + eventName_eq?: InputMaybe; + eventName_gt?: InputMaybe; + eventName_gte?: InputMaybe; + eventName_in?: InputMaybe>; + eventName_isNull?: InputMaybe; + eventName_lt?: InputMaybe; + eventName_lte?: InputMaybe; + eventName_not_contains?: InputMaybe; + eventName_not_containsInsensitive?: InputMaybe; + eventName_not_endsWith?: InputMaybe; + eventName_not_eq?: InputMaybe; + eventName_not_in?: InputMaybe>; + eventName_not_startsWith?: InputMaybe; + eventName_startsWith?: InputMaybe; + feeUsdForPool_eq?: InputMaybe; + feeUsdForPool_gt?: InputMaybe; + feeUsdForPool_gte?: InputMaybe; + feeUsdForPool_in?: InputMaybe>; + feeUsdForPool_isNull?: InputMaybe; + feeUsdForPool_lt?: InputMaybe; + feeUsdForPool_lte?: InputMaybe; + feeUsdForPool_not_eq?: InputMaybe; + feeUsdForPool_not_in?: InputMaybe>; + fundingFeeAmount_eq?: InputMaybe; + fundingFeeAmount_gt?: InputMaybe; + fundingFeeAmount_gte?: InputMaybe; + fundingFeeAmount_in?: InputMaybe>; + fundingFeeAmount_isNull?: InputMaybe; + fundingFeeAmount_lt?: InputMaybe; + fundingFeeAmount_lte?: InputMaybe; + fundingFeeAmount_not_eq?: InputMaybe; + fundingFeeAmount_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + liquidationFeeAmount_eq?: InputMaybe; + liquidationFeeAmount_gt?: InputMaybe; + liquidationFeeAmount_gte?: InputMaybe; + liquidationFeeAmount_in?: InputMaybe>; + liquidationFeeAmount_isNull?: InputMaybe; + liquidationFeeAmount_lt?: InputMaybe; + liquidationFeeAmount_lte?: InputMaybe; + liquidationFeeAmount_not_eq?: InputMaybe; + liquidationFeeAmount_not_in?: InputMaybe>; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + orderKey_contains?: InputMaybe; + orderKey_containsInsensitive?: InputMaybe; + orderKey_endsWith?: InputMaybe; + orderKey_eq?: InputMaybe; + orderKey_gt?: InputMaybe; + orderKey_gte?: InputMaybe; + orderKey_in?: InputMaybe>; + orderKey_isNull?: InputMaybe; + orderKey_lt?: InputMaybe; + orderKey_lte?: InputMaybe; + orderKey_not_contains?: InputMaybe; + orderKey_not_containsInsensitive?: InputMaybe; + orderKey_not_endsWith?: InputMaybe; + orderKey_not_eq?: InputMaybe; + orderKey_not_in?: InputMaybe>; + orderKey_not_startsWith?: InputMaybe; + orderKey_startsWith?: InputMaybe; + positionFeeAmount_eq?: InputMaybe; + positionFeeAmount_gt?: InputMaybe; + positionFeeAmount_gte?: InputMaybe; + positionFeeAmount_in?: InputMaybe>; + positionFeeAmount_isNull?: InputMaybe; + positionFeeAmount_lt?: InputMaybe; + positionFeeAmount_lte?: InputMaybe; + positionFeeAmount_not_eq?: InputMaybe; + positionFeeAmount_not_in?: InputMaybe>; + totalRebateAmount_eq?: InputMaybe; + totalRebateAmount_gt?: InputMaybe; + totalRebateAmount_gte?: InputMaybe; + totalRebateAmount_in?: InputMaybe>; + totalRebateAmount_isNull?: InputMaybe; + totalRebateAmount_lt?: InputMaybe; + totalRebateAmount_lte?: InputMaybe; + totalRebateAmount_not_eq?: InputMaybe; + totalRebateAmount_not_in?: InputMaybe>; + totalRebateFactor_eq?: InputMaybe; + totalRebateFactor_gt?: InputMaybe; + totalRebateFactor_gte?: InputMaybe; + totalRebateFactor_in?: InputMaybe>; + totalRebateFactor_isNull?: InputMaybe; + totalRebateFactor_lt?: InputMaybe; + totalRebateFactor_lte?: InputMaybe; + totalRebateFactor_not_eq?: InputMaybe; + totalRebateFactor_not_in?: InputMaybe>; + traderDiscountAmount_eq?: InputMaybe; + traderDiscountAmount_gt?: InputMaybe; + traderDiscountAmount_gte?: InputMaybe; + traderDiscountAmount_in?: InputMaybe>; + traderDiscountAmount_isNull?: InputMaybe; + traderDiscountAmount_lt?: InputMaybe; + traderDiscountAmount_lte?: InputMaybe; + traderDiscountAmount_not_eq?: InputMaybe; + traderDiscountAmount_not_in?: InputMaybe>; + trader_contains?: InputMaybe; + trader_containsInsensitive?: InputMaybe; + trader_endsWith?: InputMaybe; + trader_eq?: InputMaybe; + trader_gt?: InputMaybe; + trader_gte?: InputMaybe; + trader_in?: InputMaybe>; + trader_isNull?: InputMaybe; + trader_lt?: InputMaybe; + trader_lte?: InputMaybe; + trader_not_contains?: InputMaybe; + trader_not_containsInsensitive?: InputMaybe; + trader_not_endsWith?: InputMaybe; + trader_not_eq?: InputMaybe; + trader_not_in?: InputMaybe>; + trader_not_startsWith?: InputMaybe; + trader_startsWith?: InputMaybe; transaction?: InputMaybe; - transaction_isNull?: InputMaybe; + transaction_isNull?: InputMaybe; type_eq?: InputMaybe; type_in?: InputMaybe>; - type_isNull?: InputMaybe; + type_isNull?: InputMaybe; type_not_eq?: InputMaybe; type_not_in?: InputMaybe>; } export interface PositionMarketVolumeInfo { - __typename?: "PositionMarketVolumeInfo"; - market: Scalars["String"]["output"]; - volume: Scalars["BigInt"]["output"]; + __typename?: 'PositionMarketVolumeInfo'; + market: Scalars['String']['output']; + volume: Scalars['BigInt']['output']; } export enum PositionOrderByInput { - accountStat_closedCount_ASC = "accountStat_closedCount_ASC", - accountStat_closedCount_ASC_NULLS_FIRST = "accountStat_closedCount_ASC_NULLS_FIRST", - accountStat_closedCount_ASC_NULLS_LAST = "accountStat_closedCount_ASC_NULLS_LAST", - accountStat_closedCount_DESC = "accountStat_closedCount_DESC", - accountStat_closedCount_DESC_NULLS_FIRST = "accountStat_closedCount_DESC_NULLS_FIRST", - accountStat_closedCount_DESC_NULLS_LAST = "accountStat_closedCount_DESC_NULLS_LAST", - accountStat_cumsumCollateral_ASC = "accountStat_cumsumCollateral_ASC", - accountStat_cumsumCollateral_ASC_NULLS_FIRST = "accountStat_cumsumCollateral_ASC_NULLS_FIRST", - accountStat_cumsumCollateral_ASC_NULLS_LAST = "accountStat_cumsumCollateral_ASC_NULLS_LAST", - accountStat_cumsumCollateral_DESC = "accountStat_cumsumCollateral_DESC", - accountStat_cumsumCollateral_DESC_NULLS_FIRST = "accountStat_cumsumCollateral_DESC_NULLS_FIRST", - accountStat_cumsumCollateral_DESC_NULLS_LAST = "accountStat_cumsumCollateral_DESC_NULLS_LAST", - accountStat_cumsumSize_ASC = "accountStat_cumsumSize_ASC", - accountStat_cumsumSize_ASC_NULLS_FIRST = "accountStat_cumsumSize_ASC_NULLS_FIRST", - accountStat_cumsumSize_ASC_NULLS_LAST = "accountStat_cumsumSize_ASC_NULLS_LAST", - accountStat_cumsumSize_DESC = "accountStat_cumsumSize_DESC", - accountStat_cumsumSize_DESC_NULLS_FIRST = "accountStat_cumsumSize_DESC_NULLS_FIRST", - accountStat_cumsumSize_DESC_NULLS_LAST = "accountStat_cumsumSize_DESC_NULLS_LAST", - accountStat_deposits_ASC = "accountStat_deposits_ASC", - accountStat_deposits_ASC_NULLS_FIRST = "accountStat_deposits_ASC_NULLS_FIRST", - accountStat_deposits_ASC_NULLS_LAST = "accountStat_deposits_ASC_NULLS_LAST", - accountStat_deposits_DESC = "accountStat_deposits_DESC", - accountStat_deposits_DESC_NULLS_FIRST = "accountStat_deposits_DESC_NULLS_FIRST", - accountStat_deposits_DESC_NULLS_LAST = "accountStat_deposits_DESC_NULLS_LAST", - accountStat_id_ASC = "accountStat_id_ASC", - accountStat_id_ASC_NULLS_FIRST = "accountStat_id_ASC_NULLS_FIRST", - accountStat_id_ASC_NULLS_LAST = "accountStat_id_ASC_NULLS_LAST", - accountStat_id_DESC = "accountStat_id_DESC", - accountStat_id_DESC_NULLS_FIRST = "accountStat_id_DESC_NULLS_FIRST", - accountStat_id_DESC_NULLS_LAST = "accountStat_id_DESC_NULLS_LAST", - accountStat_losses_ASC = "accountStat_losses_ASC", - accountStat_losses_ASC_NULLS_FIRST = "accountStat_losses_ASC_NULLS_FIRST", - accountStat_losses_ASC_NULLS_LAST = "accountStat_losses_ASC_NULLS_LAST", - accountStat_losses_DESC = "accountStat_losses_DESC", - accountStat_losses_DESC_NULLS_FIRST = "accountStat_losses_DESC_NULLS_FIRST", - accountStat_losses_DESC_NULLS_LAST = "accountStat_losses_DESC_NULLS_LAST", - accountStat_maxCapital_ASC = "accountStat_maxCapital_ASC", - accountStat_maxCapital_ASC_NULLS_FIRST = "accountStat_maxCapital_ASC_NULLS_FIRST", - accountStat_maxCapital_ASC_NULLS_LAST = "accountStat_maxCapital_ASC_NULLS_LAST", - accountStat_maxCapital_DESC = "accountStat_maxCapital_DESC", - accountStat_maxCapital_DESC_NULLS_FIRST = "accountStat_maxCapital_DESC_NULLS_FIRST", - accountStat_maxCapital_DESC_NULLS_LAST = "accountStat_maxCapital_DESC_NULLS_LAST", - accountStat_netCapital_ASC = "accountStat_netCapital_ASC", - accountStat_netCapital_ASC_NULLS_FIRST = "accountStat_netCapital_ASC_NULLS_FIRST", - accountStat_netCapital_ASC_NULLS_LAST = "accountStat_netCapital_ASC_NULLS_LAST", - accountStat_netCapital_DESC = "accountStat_netCapital_DESC", - accountStat_netCapital_DESC_NULLS_FIRST = "accountStat_netCapital_DESC_NULLS_FIRST", - accountStat_netCapital_DESC_NULLS_LAST = "accountStat_netCapital_DESC_NULLS_LAST", - accountStat_realizedFees_ASC = "accountStat_realizedFees_ASC", - accountStat_realizedFees_ASC_NULLS_FIRST = "accountStat_realizedFees_ASC_NULLS_FIRST", - accountStat_realizedFees_ASC_NULLS_LAST = "accountStat_realizedFees_ASC_NULLS_LAST", - accountStat_realizedFees_DESC = "accountStat_realizedFees_DESC", - accountStat_realizedFees_DESC_NULLS_FIRST = "accountStat_realizedFees_DESC_NULLS_FIRST", - accountStat_realizedFees_DESC_NULLS_LAST = "accountStat_realizedFees_DESC_NULLS_LAST", - accountStat_realizedPnl_ASC = "accountStat_realizedPnl_ASC", - accountStat_realizedPnl_ASC_NULLS_FIRST = "accountStat_realizedPnl_ASC_NULLS_FIRST", - accountStat_realizedPnl_ASC_NULLS_LAST = "accountStat_realizedPnl_ASC_NULLS_LAST", - accountStat_realizedPnl_DESC = "accountStat_realizedPnl_DESC", - accountStat_realizedPnl_DESC_NULLS_FIRST = "accountStat_realizedPnl_DESC_NULLS_FIRST", - accountStat_realizedPnl_DESC_NULLS_LAST = "accountStat_realizedPnl_DESC_NULLS_LAST", - accountStat_realizedPriceImpact_ASC = "accountStat_realizedPriceImpact_ASC", - accountStat_realizedPriceImpact_ASC_NULLS_FIRST = "accountStat_realizedPriceImpact_ASC_NULLS_FIRST", - accountStat_realizedPriceImpact_ASC_NULLS_LAST = "accountStat_realizedPriceImpact_ASC_NULLS_LAST", - accountStat_realizedPriceImpact_DESC = "accountStat_realizedPriceImpact_DESC", - accountStat_realizedPriceImpact_DESC_NULLS_FIRST = "accountStat_realizedPriceImpact_DESC_NULLS_FIRST", - accountStat_realizedPriceImpact_DESC_NULLS_LAST = "accountStat_realizedPriceImpact_DESC_NULLS_LAST", - accountStat_sumMaxSize_ASC = "accountStat_sumMaxSize_ASC", - accountStat_sumMaxSize_ASC_NULLS_FIRST = "accountStat_sumMaxSize_ASC_NULLS_FIRST", - accountStat_sumMaxSize_ASC_NULLS_LAST = "accountStat_sumMaxSize_ASC_NULLS_LAST", - accountStat_sumMaxSize_DESC = "accountStat_sumMaxSize_DESC", - accountStat_sumMaxSize_DESC_NULLS_FIRST = "accountStat_sumMaxSize_DESC_NULLS_FIRST", - accountStat_sumMaxSize_DESC_NULLS_LAST = "accountStat_sumMaxSize_DESC_NULLS_LAST", - accountStat_volume_ASC = "accountStat_volume_ASC", - accountStat_volume_ASC_NULLS_FIRST = "accountStat_volume_ASC_NULLS_FIRST", - accountStat_volume_ASC_NULLS_LAST = "accountStat_volume_ASC_NULLS_LAST", - accountStat_volume_DESC = "accountStat_volume_DESC", - accountStat_volume_DESC_NULLS_FIRST = "accountStat_volume_DESC_NULLS_FIRST", - accountStat_volume_DESC_NULLS_LAST = "accountStat_volume_DESC_NULLS_LAST", - accountStat_wins_ASC = "accountStat_wins_ASC", - accountStat_wins_ASC_NULLS_FIRST = "accountStat_wins_ASC_NULLS_FIRST", - accountStat_wins_ASC_NULLS_LAST = "accountStat_wins_ASC_NULLS_LAST", - accountStat_wins_DESC = "accountStat_wins_DESC", - accountStat_wins_DESC_NULLS_FIRST = "accountStat_wins_DESC_NULLS_FIRST", - accountStat_wins_DESC_NULLS_LAST = "accountStat_wins_DESC_NULLS_LAST", - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - collateralAmount_ASC = "collateralAmount_ASC", - collateralAmount_ASC_NULLS_FIRST = "collateralAmount_ASC_NULLS_FIRST", - collateralAmount_ASC_NULLS_LAST = "collateralAmount_ASC_NULLS_LAST", - collateralAmount_DESC = "collateralAmount_DESC", - collateralAmount_DESC_NULLS_FIRST = "collateralAmount_DESC_NULLS_FIRST", - collateralAmount_DESC_NULLS_LAST = "collateralAmount_DESC_NULLS_LAST", - collateralToken_ASC = "collateralToken_ASC", - collateralToken_ASC_NULLS_FIRST = "collateralToken_ASC_NULLS_FIRST", - collateralToken_ASC_NULLS_LAST = "collateralToken_ASC_NULLS_LAST", - collateralToken_DESC = "collateralToken_DESC", - collateralToken_DESC_NULLS_FIRST = "collateralToken_DESC_NULLS_FIRST", - collateralToken_DESC_NULLS_LAST = "collateralToken_DESC_NULLS_LAST", - entryPrice_ASC = "entryPrice_ASC", - entryPrice_ASC_NULLS_FIRST = "entryPrice_ASC_NULLS_FIRST", - entryPrice_ASC_NULLS_LAST = "entryPrice_ASC_NULLS_LAST", - entryPrice_DESC = "entryPrice_DESC", - entryPrice_DESC_NULLS_FIRST = "entryPrice_DESC_NULLS_FIRST", - entryPrice_DESC_NULLS_LAST = "entryPrice_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isLong_ASC = "isLong_ASC", - isLong_ASC_NULLS_FIRST = "isLong_ASC_NULLS_FIRST", - isLong_ASC_NULLS_LAST = "isLong_ASC_NULLS_LAST", - isLong_DESC = "isLong_DESC", - isLong_DESC_NULLS_FIRST = "isLong_DESC_NULLS_FIRST", - isLong_DESC_NULLS_LAST = "isLong_DESC_NULLS_LAST", - isSnapshot_ASC = "isSnapshot_ASC", - isSnapshot_ASC_NULLS_FIRST = "isSnapshot_ASC_NULLS_FIRST", - isSnapshot_ASC_NULLS_LAST = "isSnapshot_ASC_NULLS_LAST", - isSnapshot_DESC = "isSnapshot_DESC", - isSnapshot_DESC_NULLS_FIRST = "isSnapshot_DESC_NULLS_FIRST", - isSnapshot_DESC_NULLS_LAST = "isSnapshot_DESC_NULLS_LAST", - market_ASC = "market_ASC", - market_ASC_NULLS_FIRST = "market_ASC_NULLS_FIRST", - market_ASC_NULLS_LAST = "market_ASC_NULLS_LAST", - market_DESC = "market_DESC", - market_DESC_NULLS_FIRST = "market_DESC_NULLS_FIRST", - market_DESC_NULLS_LAST = "market_DESC_NULLS_LAST", - maxSize_ASC = "maxSize_ASC", - maxSize_ASC_NULLS_FIRST = "maxSize_ASC_NULLS_FIRST", - maxSize_ASC_NULLS_LAST = "maxSize_ASC_NULLS_LAST", - maxSize_DESC = "maxSize_DESC", - maxSize_DESC_NULLS_FIRST = "maxSize_DESC_NULLS_FIRST", - maxSize_DESC_NULLS_LAST = "maxSize_DESC_NULLS_LAST", - openedAt_ASC = "openedAt_ASC", - openedAt_ASC_NULLS_FIRST = "openedAt_ASC_NULLS_FIRST", - openedAt_ASC_NULLS_LAST = "openedAt_ASC_NULLS_LAST", - openedAt_DESC = "openedAt_DESC", - openedAt_DESC_NULLS_FIRST = "openedAt_DESC_NULLS_FIRST", - openedAt_DESC_NULLS_LAST = "openedAt_DESC_NULLS_LAST", - positionKey_ASC = "positionKey_ASC", - positionKey_ASC_NULLS_FIRST = "positionKey_ASC_NULLS_FIRST", - positionKey_ASC_NULLS_LAST = "positionKey_ASC_NULLS_LAST", - positionKey_DESC = "positionKey_DESC", - positionKey_DESC_NULLS_FIRST = "positionKey_DESC_NULLS_FIRST", - positionKey_DESC_NULLS_LAST = "positionKey_DESC_NULLS_LAST", - realizedFees_ASC = "realizedFees_ASC", - realizedFees_ASC_NULLS_FIRST = "realizedFees_ASC_NULLS_FIRST", - realizedFees_ASC_NULLS_LAST = "realizedFees_ASC_NULLS_LAST", - realizedFees_DESC = "realizedFees_DESC", - realizedFees_DESC_NULLS_FIRST = "realizedFees_DESC_NULLS_FIRST", - realizedFees_DESC_NULLS_LAST = "realizedFees_DESC_NULLS_LAST", - realizedPnl_ASC = "realizedPnl_ASC", - realizedPnl_ASC_NULLS_FIRST = "realizedPnl_ASC_NULLS_FIRST", - realizedPnl_ASC_NULLS_LAST = "realizedPnl_ASC_NULLS_LAST", - realizedPnl_DESC = "realizedPnl_DESC", - realizedPnl_DESC_NULLS_FIRST = "realizedPnl_DESC_NULLS_FIRST", - realizedPnl_DESC_NULLS_LAST = "realizedPnl_DESC_NULLS_LAST", - realizedPriceImpact_ASC = "realizedPriceImpact_ASC", - realizedPriceImpact_ASC_NULLS_FIRST = "realizedPriceImpact_ASC_NULLS_FIRST", - realizedPriceImpact_ASC_NULLS_LAST = "realizedPriceImpact_ASC_NULLS_LAST", - realizedPriceImpact_DESC = "realizedPriceImpact_DESC", - realizedPriceImpact_DESC_NULLS_FIRST = "realizedPriceImpact_DESC_NULLS_FIRST", - realizedPriceImpact_DESC_NULLS_LAST = "realizedPriceImpact_DESC_NULLS_LAST", - sizeInTokens_ASC = "sizeInTokens_ASC", - sizeInTokens_ASC_NULLS_FIRST = "sizeInTokens_ASC_NULLS_FIRST", - sizeInTokens_ASC_NULLS_LAST = "sizeInTokens_ASC_NULLS_LAST", - sizeInTokens_DESC = "sizeInTokens_DESC", - sizeInTokens_DESC_NULLS_FIRST = "sizeInTokens_DESC_NULLS_FIRST", - sizeInTokens_DESC_NULLS_LAST = "sizeInTokens_DESC_NULLS_LAST", - sizeInUsd_ASC = "sizeInUsd_ASC", - sizeInUsd_ASC_NULLS_FIRST = "sizeInUsd_ASC_NULLS_FIRST", - sizeInUsd_ASC_NULLS_LAST = "sizeInUsd_ASC_NULLS_LAST", - sizeInUsd_DESC = "sizeInUsd_DESC", - sizeInUsd_DESC_NULLS_FIRST = "sizeInUsd_DESC_NULLS_FIRST", - sizeInUsd_DESC_NULLS_LAST = "sizeInUsd_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", - unrealizedFees_ASC = "unrealizedFees_ASC", - unrealizedFees_ASC_NULLS_FIRST = "unrealizedFees_ASC_NULLS_FIRST", - unrealizedFees_ASC_NULLS_LAST = "unrealizedFees_ASC_NULLS_LAST", - unrealizedFees_DESC = "unrealizedFees_DESC", - unrealizedFees_DESC_NULLS_FIRST = "unrealizedFees_DESC_NULLS_FIRST", - unrealizedFees_DESC_NULLS_LAST = "unrealizedFees_DESC_NULLS_LAST", - unrealizedPnl_ASC = "unrealizedPnl_ASC", - unrealizedPnl_ASC_NULLS_FIRST = "unrealizedPnl_ASC_NULLS_FIRST", - unrealizedPnl_ASC_NULLS_LAST = "unrealizedPnl_ASC_NULLS_LAST", - unrealizedPnl_DESC = "unrealizedPnl_DESC", - unrealizedPnl_DESC_NULLS_FIRST = "unrealizedPnl_DESC_NULLS_FIRST", - unrealizedPnl_DESC_NULLS_LAST = "unrealizedPnl_DESC_NULLS_LAST", - unrealizedPriceImpact_ASC = "unrealizedPriceImpact_ASC", - unrealizedPriceImpact_ASC_NULLS_FIRST = "unrealizedPriceImpact_ASC_NULLS_FIRST", - unrealizedPriceImpact_ASC_NULLS_LAST = "unrealizedPriceImpact_ASC_NULLS_LAST", - unrealizedPriceImpact_DESC = "unrealizedPriceImpact_DESC", - unrealizedPriceImpact_DESC_NULLS_FIRST = "unrealizedPriceImpact_DESC_NULLS_FIRST", - unrealizedPriceImpact_DESC_NULLS_LAST = "unrealizedPriceImpact_DESC_NULLS_LAST", + accountStat_closedCount_ASC = 'accountStat_closedCount_ASC', + accountStat_closedCount_ASC_NULLS_FIRST = 'accountStat_closedCount_ASC_NULLS_FIRST', + accountStat_closedCount_ASC_NULLS_LAST = 'accountStat_closedCount_ASC_NULLS_LAST', + accountStat_closedCount_DESC = 'accountStat_closedCount_DESC', + accountStat_closedCount_DESC_NULLS_FIRST = 'accountStat_closedCount_DESC_NULLS_FIRST', + accountStat_closedCount_DESC_NULLS_LAST = 'accountStat_closedCount_DESC_NULLS_LAST', + accountStat_cumsumCollateral_ASC = 'accountStat_cumsumCollateral_ASC', + accountStat_cumsumCollateral_ASC_NULLS_FIRST = 'accountStat_cumsumCollateral_ASC_NULLS_FIRST', + accountStat_cumsumCollateral_ASC_NULLS_LAST = 'accountStat_cumsumCollateral_ASC_NULLS_LAST', + accountStat_cumsumCollateral_DESC = 'accountStat_cumsumCollateral_DESC', + accountStat_cumsumCollateral_DESC_NULLS_FIRST = 'accountStat_cumsumCollateral_DESC_NULLS_FIRST', + accountStat_cumsumCollateral_DESC_NULLS_LAST = 'accountStat_cumsumCollateral_DESC_NULLS_LAST', + accountStat_cumsumSize_ASC = 'accountStat_cumsumSize_ASC', + accountStat_cumsumSize_ASC_NULLS_FIRST = 'accountStat_cumsumSize_ASC_NULLS_FIRST', + accountStat_cumsumSize_ASC_NULLS_LAST = 'accountStat_cumsumSize_ASC_NULLS_LAST', + accountStat_cumsumSize_DESC = 'accountStat_cumsumSize_DESC', + accountStat_cumsumSize_DESC_NULLS_FIRST = 'accountStat_cumsumSize_DESC_NULLS_FIRST', + accountStat_cumsumSize_DESC_NULLS_LAST = 'accountStat_cumsumSize_DESC_NULLS_LAST', + accountStat_deposits_ASC = 'accountStat_deposits_ASC', + accountStat_deposits_ASC_NULLS_FIRST = 'accountStat_deposits_ASC_NULLS_FIRST', + accountStat_deposits_ASC_NULLS_LAST = 'accountStat_deposits_ASC_NULLS_LAST', + accountStat_deposits_DESC = 'accountStat_deposits_DESC', + accountStat_deposits_DESC_NULLS_FIRST = 'accountStat_deposits_DESC_NULLS_FIRST', + accountStat_deposits_DESC_NULLS_LAST = 'accountStat_deposits_DESC_NULLS_LAST', + accountStat_id_ASC = 'accountStat_id_ASC', + accountStat_id_ASC_NULLS_FIRST = 'accountStat_id_ASC_NULLS_FIRST', + accountStat_id_ASC_NULLS_LAST = 'accountStat_id_ASC_NULLS_LAST', + accountStat_id_DESC = 'accountStat_id_DESC', + accountStat_id_DESC_NULLS_FIRST = 'accountStat_id_DESC_NULLS_FIRST', + accountStat_id_DESC_NULLS_LAST = 'accountStat_id_DESC_NULLS_LAST', + accountStat_losses_ASC = 'accountStat_losses_ASC', + accountStat_losses_ASC_NULLS_FIRST = 'accountStat_losses_ASC_NULLS_FIRST', + accountStat_losses_ASC_NULLS_LAST = 'accountStat_losses_ASC_NULLS_LAST', + accountStat_losses_DESC = 'accountStat_losses_DESC', + accountStat_losses_DESC_NULLS_FIRST = 'accountStat_losses_DESC_NULLS_FIRST', + accountStat_losses_DESC_NULLS_LAST = 'accountStat_losses_DESC_NULLS_LAST', + accountStat_maxCapital_ASC = 'accountStat_maxCapital_ASC', + accountStat_maxCapital_ASC_NULLS_FIRST = 'accountStat_maxCapital_ASC_NULLS_FIRST', + accountStat_maxCapital_ASC_NULLS_LAST = 'accountStat_maxCapital_ASC_NULLS_LAST', + accountStat_maxCapital_DESC = 'accountStat_maxCapital_DESC', + accountStat_maxCapital_DESC_NULLS_FIRST = 'accountStat_maxCapital_DESC_NULLS_FIRST', + accountStat_maxCapital_DESC_NULLS_LAST = 'accountStat_maxCapital_DESC_NULLS_LAST', + accountStat_netCapital_ASC = 'accountStat_netCapital_ASC', + accountStat_netCapital_ASC_NULLS_FIRST = 'accountStat_netCapital_ASC_NULLS_FIRST', + accountStat_netCapital_ASC_NULLS_LAST = 'accountStat_netCapital_ASC_NULLS_LAST', + accountStat_netCapital_DESC = 'accountStat_netCapital_DESC', + accountStat_netCapital_DESC_NULLS_FIRST = 'accountStat_netCapital_DESC_NULLS_FIRST', + accountStat_netCapital_DESC_NULLS_LAST = 'accountStat_netCapital_DESC_NULLS_LAST', + accountStat_realizedFees_ASC = 'accountStat_realizedFees_ASC', + accountStat_realizedFees_ASC_NULLS_FIRST = 'accountStat_realizedFees_ASC_NULLS_FIRST', + accountStat_realizedFees_ASC_NULLS_LAST = 'accountStat_realizedFees_ASC_NULLS_LAST', + accountStat_realizedFees_DESC = 'accountStat_realizedFees_DESC', + accountStat_realizedFees_DESC_NULLS_FIRST = 'accountStat_realizedFees_DESC_NULLS_FIRST', + accountStat_realizedFees_DESC_NULLS_LAST = 'accountStat_realizedFees_DESC_NULLS_LAST', + accountStat_realizedPnl_ASC = 'accountStat_realizedPnl_ASC', + accountStat_realizedPnl_ASC_NULLS_FIRST = 'accountStat_realizedPnl_ASC_NULLS_FIRST', + accountStat_realizedPnl_ASC_NULLS_LAST = 'accountStat_realizedPnl_ASC_NULLS_LAST', + accountStat_realizedPnl_DESC = 'accountStat_realizedPnl_DESC', + accountStat_realizedPnl_DESC_NULLS_FIRST = 'accountStat_realizedPnl_DESC_NULLS_FIRST', + accountStat_realizedPnl_DESC_NULLS_LAST = 'accountStat_realizedPnl_DESC_NULLS_LAST', + accountStat_realizedPriceImpact_ASC = 'accountStat_realizedPriceImpact_ASC', + accountStat_realizedPriceImpact_ASC_NULLS_FIRST = 'accountStat_realizedPriceImpact_ASC_NULLS_FIRST', + accountStat_realizedPriceImpact_ASC_NULLS_LAST = 'accountStat_realizedPriceImpact_ASC_NULLS_LAST', + accountStat_realizedPriceImpact_DESC = 'accountStat_realizedPriceImpact_DESC', + accountStat_realizedPriceImpact_DESC_NULLS_FIRST = 'accountStat_realizedPriceImpact_DESC_NULLS_FIRST', + accountStat_realizedPriceImpact_DESC_NULLS_LAST = 'accountStat_realizedPriceImpact_DESC_NULLS_LAST', + accountStat_sumMaxSize_ASC = 'accountStat_sumMaxSize_ASC', + accountStat_sumMaxSize_ASC_NULLS_FIRST = 'accountStat_sumMaxSize_ASC_NULLS_FIRST', + accountStat_sumMaxSize_ASC_NULLS_LAST = 'accountStat_sumMaxSize_ASC_NULLS_LAST', + accountStat_sumMaxSize_DESC = 'accountStat_sumMaxSize_DESC', + accountStat_sumMaxSize_DESC_NULLS_FIRST = 'accountStat_sumMaxSize_DESC_NULLS_FIRST', + accountStat_sumMaxSize_DESC_NULLS_LAST = 'accountStat_sumMaxSize_DESC_NULLS_LAST', + accountStat_volume_ASC = 'accountStat_volume_ASC', + accountStat_volume_ASC_NULLS_FIRST = 'accountStat_volume_ASC_NULLS_FIRST', + accountStat_volume_ASC_NULLS_LAST = 'accountStat_volume_ASC_NULLS_LAST', + accountStat_volume_DESC = 'accountStat_volume_DESC', + accountStat_volume_DESC_NULLS_FIRST = 'accountStat_volume_DESC_NULLS_FIRST', + accountStat_volume_DESC_NULLS_LAST = 'accountStat_volume_DESC_NULLS_LAST', + accountStat_wins_ASC = 'accountStat_wins_ASC', + accountStat_wins_ASC_NULLS_FIRST = 'accountStat_wins_ASC_NULLS_FIRST', + accountStat_wins_ASC_NULLS_LAST = 'accountStat_wins_ASC_NULLS_LAST', + accountStat_wins_DESC = 'accountStat_wins_DESC', + accountStat_wins_DESC_NULLS_FIRST = 'accountStat_wins_DESC_NULLS_FIRST', + accountStat_wins_DESC_NULLS_LAST = 'accountStat_wins_DESC_NULLS_LAST', + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + collateralAmount_ASC = 'collateralAmount_ASC', + collateralAmount_ASC_NULLS_FIRST = 'collateralAmount_ASC_NULLS_FIRST', + collateralAmount_ASC_NULLS_LAST = 'collateralAmount_ASC_NULLS_LAST', + collateralAmount_DESC = 'collateralAmount_DESC', + collateralAmount_DESC_NULLS_FIRST = 'collateralAmount_DESC_NULLS_FIRST', + collateralAmount_DESC_NULLS_LAST = 'collateralAmount_DESC_NULLS_LAST', + collateralToken_ASC = 'collateralToken_ASC', + collateralToken_ASC_NULLS_FIRST = 'collateralToken_ASC_NULLS_FIRST', + collateralToken_ASC_NULLS_LAST = 'collateralToken_ASC_NULLS_LAST', + collateralToken_DESC = 'collateralToken_DESC', + collateralToken_DESC_NULLS_FIRST = 'collateralToken_DESC_NULLS_FIRST', + collateralToken_DESC_NULLS_LAST = 'collateralToken_DESC_NULLS_LAST', + entryPrice_ASC = 'entryPrice_ASC', + entryPrice_ASC_NULLS_FIRST = 'entryPrice_ASC_NULLS_FIRST', + entryPrice_ASC_NULLS_LAST = 'entryPrice_ASC_NULLS_LAST', + entryPrice_DESC = 'entryPrice_DESC', + entryPrice_DESC_NULLS_FIRST = 'entryPrice_DESC_NULLS_FIRST', + entryPrice_DESC_NULLS_LAST = 'entryPrice_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isLong_ASC = 'isLong_ASC', + isLong_ASC_NULLS_FIRST = 'isLong_ASC_NULLS_FIRST', + isLong_ASC_NULLS_LAST = 'isLong_ASC_NULLS_LAST', + isLong_DESC = 'isLong_DESC', + isLong_DESC_NULLS_FIRST = 'isLong_DESC_NULLS_FIRST', + isLong_DESC_NULLS_LAST = 'isLong_DESC_NULLS_LAST', + isSnapshot_ASC = 'isSnapshot_ASC', + isSnapshot_ASC_NULLS_FIRST = 'isSnapshot_ASC_NULLS_FIRST', + isSnapshot_ASC_NULLS_LAST = 'isSnapshot_ASC_NULLS_LAST', + isSnapshot_DESC = 'isSnapshot_DESC', + isSnapshot_DESC_NULLS_FIRST = 'isSnapshot_DESC_NULLS_FIRST', + isSnapshot_DESC_NULLS_LAST = 'isSnapshot_DESC_NULLS_LAST', + market_ASC = 'market_ASC', + market_ASC_NULLS_FIRST = 'market_ASC_NULLS_FIRST', + market_ASC_NULLS_LAST = 'market_ASC_NULLS_LAST', + market_DESC = 'market_DESC', + market_DESC_NULLS_FIRST = 'market_DESC_NULLS_FIRST', + market_DESC_NULLS_LAST = 'market_DESC_NULLS_LAST', + maxSize_ASC = 'maxSize_ASC', + maxSize_ASC_NULLS_FIRST = 'maxSize_ASC_NULLS_FIRST', + maxSize_ASC_NULLS_LAST = 'maxSize_ASC_NULLS_LAST', + maxSize_DESC = 'maxSize_DESC', + maxSize_DESC_NULLS_FIRST = 'maxSize_DESC_NULLS_FIRST', + maxSize_DESC_NULLS_LAST = 'maxSize_DESC_NULLS_LAST', + openedAt_ASC = 'openedAt_ASC', + openedAt_ASC_NULLS_FIRST = 'openedAt_ASC_NULLS_FIRST', + openedAt_ASC_NULLS_LAST = 'openedAt_ASC_NULLS_LAST', + openedAt_DESC = 'openedAt_DESC', + openedAt_DESC_NULLS_FIRST = 'openedAt_DESC_NULLS_FIRST', + openedAt_DESC_NULLS_LAST = 'openedAt_DESC_NULLS_LAST', + positionKey_ASC = 'positionKey_ASC', + positionKey_ASC_NULLS_FIRST = 'positionKey_ASC_NULLS_FIRST', + positionKey_ASC_NULLS_LAST = 'positionKey_ASC_NULLS_LAST', + positionKey_DESC = 'positionKey_DESC', + positionKey_DESC_NULLS_FIRST = 'positionKey_DESC_NULLS_FIRST', + positionKey_DESC_NULLS_LAST = 'positionKey_DESC_NULLS_LAST', + realizedFees_ASC = 'realizedFees_ASC', + realizedFees_ASC_NULLS_FIRST = 'realizedFees_ASC_NULLS_FIRST', + realizedFees_ASC_NULLS_LAST = 'realizedFees_ASC_NULLS_LAST', + realizedFees_DESC = 'realizedFees_DESC', + realizedFees_DESC_NULLS_FIRST = 'realizedFees_DESC_NULLS_FIRST', + realizedFees_DESC_NULLS_LAST = 'realizedFees_DESC_NULLS_LAST', + realizedPnl_ASC = 'realizedPnl_ASC', + realizedPnl_ASC_NULLS_FIRST = 'realizedPnl_ASC_NULLS_FIRST', + realizedPnl_ASC_NULLS_LAST = 'realizedPnl_ASC_NULLS_LAST', + realizedPnl_DESC = 'realizedPnl_DESC', + realizedPnl_DESC_NULLS_FIRST = 'realizedPnl_DESC_NULLS_FIRST', + realizedPnl_DESC_NULLS_LAST = 'realizedPnl_DESC_NULLS_LAST', + realizedPriceImpact_ASC = 'realizedPriceImpact_ASC', + realizedPriceImpact_ASC_NULLS_FIRST = 'realizedPriceImpact_ASC_NULLS_FIRST', + realizedPriceImpact_ASC_NULLS_LAST = 'realizedPriceImpact_ASC_NULLS_LAST', + realizedPriceImpact_DESC = 'realizedPriceImpact_DESC', + realizedPriceImpact_DESC_NULLS_FIRST = 'realizedPriceImpact_DESC_NULLS_FIRST', + realizedPriceImpact_DESC_NULLS_LAST = 'realizedPriceImpact_DESC_NULLS_LAST', + sizeInTokens_ASC = 'sizeInTokens_ASC', + sizeInTokens_ASC_NULLS_FIRST = 'sizeInTokens_ASC_NULLS_FIRST', + sizeInTokens_ASC_NULLS_LAST = 'sizeInTokens_ASC_NULLS_LAST', + sizeInTokens_DESC = 'sizeInTokens_DESC', + sizeInTokens_DESC_NULLS_FIRST = 'sizeInTokens_DESC_NULLS_FIRST', + sizeInTokens_DESC_NULLS_LAST = 'sizeInTokens_DESC_NULLS_LAST', + sizeInUsd_ASC = 'sizeInUsd_ASC', + sizeInUsd_ASC_NULLS_FIRST = 'sizeInUsd_ASC_NULLS_FIRST', + sizeInUsd_ASC_NULLS_LAST = 'sizeInUsd_ASC_NULLS_LAST', + sizeInUsd_DESC = 'sizeInUsd_DESC', + sizeInUsd_DESC_NULLS_FIRST = 'sizeInUsd_DESC_NULLS_FIRST', + sizeInUsd_DESC_NULLS_LAST = 'sizeInUsd_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST', + unrealizedFees_ASC = 'unrealizedFees_ASC', + unrealizedFees_ASC_NULLS_FIRST = 'unrealizedFees_ASC_NULLS_FIRST', + unrealizedFees_ASC_NULLS_LAST = 'unrealizedFees_ASC_NULLS_LAST', + unrealizedFees_DESC = 'unrealizedFees_DESC', + unrealizedFees_DESC_NULLS_FIRST = 'unrealizedFees_DESC_NULLS_FIRST', + unrealizedFees_DESC_NULLS_LAST = 'unrealizedFees_DESC_NULLS_LAST', + unrealizedPnl_ASC = 'unrealizedPnl_ASC', + unrealizedPnl_ASC_NULLS_FIRST = 'unrealizedPnl_ASC_NULLS_FIRST', + unrealizedPnl_ASC_NULLS_LAST = 'unrealizedPnl_ASC_NULLS_LAST', + unrealizedPnl_DESC = 'unrealizedPnl_DESC', + unrealizedPnl_DESC_NULLS_FIRST = 'unrealizedPnl_DESC_NULLS_FIRST', + unrealizedPnl_DESC_NULLS_LAST = 'unrealizedPnl_DESC_NULLS_LAST', + unrealizedPriceImpact_ASC = 'unrealizedPriceImpact_ASC', + unrealizedPriceImpact_ASC_NULLS_FIRST = 'unrealizedPriceImpact_ASC_NULLS_FIRST', + unrealizedPriceImpact_ASC_NULLS_LAST = 'unrealizedPriceImpact_ASC_NULLS_LAST', + unrealizedPriceImpact_DESC = 'unrealizedPriceImpact_DESC', + unrealizedPriceImpact_DESC_NULLS_FIRST = 'unrealizedPriceImpact_DESC_NULLS_FIRST', + unrealizedPriceImpact_DESC_NULLS_LAST = 'unrealizedPriceImpact_DESC_NULLS_LAST' } export interface PositionTotalCollateralAmount { - __typename?: "PositionTotalCollateralAmount"; - amount: Scalars["BigInt"]["output"]; - token: Scalars["String"]["output"]; + __typename?: 'PositionTotalCollateralAmount'; + amount: Scalars['BigInt']['output']; + token: Scalars['String']['output']; } export interface PositionTotalCollateralAmountWhereInput { - marketAddress?: InputMaybe; + marketAddress?: InputMaybe; } export interface PositionVolumeByAllMarketsWhereInput { - timestamp: Scalars["Float"]["input"]; + timestamp: Scalars['Float']['input']; } export interface PositionVolumeWhereInput { - marketAddress?: InputMaybe; - timestamp: Scalars["Float"]["input"]; + marketAddress?: InputMaybe; + timestamp: Scalars['Float']['input']; } export interface PositionWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; accountStat?: InputMaybe; - accountStat_isNull?: InputMaybe; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - collateralAmount_eq?: InputMaybe; - collateralAmount_gt?: InputMaybe; - collateralAmount_gte?: InputMaybe; - collateralAmount_in?: InputMaybe>; - collateralAmount_isNull?: InputMaybe; - collateralAmount_lt?: InputMaybe; - collateralAmount_lte?: InputMaybe; - collateralAmount_not_eq?: InputMaybe; - collateralAmount_not_in?: InputMaybe>; - collateralToken_contains?: InputMaybe; - collateralToken_containsInsensitive?: InputMaybe; - collateralToken_endsWith?: InputMaybe; - collateralToken_eq?: InputMaybe; - collateralToken_gt?: InputMaybe; - collateralToken_gte?: InputMaybe; - collateralToken_in?: InputMaybe>; - collateralToken_isNull?: InputMaybe; - collateralToken_lt?: InputMaybe; - collateralToken_lte?: InputMaybe; - collateralToken_not_contains?: InputMaybe; - collateralToken_not_containsInsensitive?: InputMaybe; - collateralToken_not_endsWith?: InputMaybe; - collateralToken_not_eq?: InputMaybe; - collateralToken_not_in?: InputMaybe>; - collateralToken_not_startsWith?: InputMaybe; - collateralToken_startsWith?: InputMaybe; - entryPrice_eq?: InputMaybe; - entryPrice_gt?: InputMaybe; - entryPrice_gte?: InputMaybe; - entryPrice_in?: InputMaybe>; - entryPrice_isNull?: InputMaybe; - entryPrice_lt?: InputMaybe; - entryPrice_lte?: InputMaybe; - entryPrice_not_eq?: InputMaybe; - entryPrice_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isLong_eq?: InputMaybe; - isLong_isNull?: InputMaybe; - isLong_not_eq?: InputMaybe; - isSnapshot_eq?: InputMaybe; - isSnapshot_isNull?: InputMaybe; - isSnapshot_not_eq?: InputMaybe; - market_contains?: InputMaybe; - market_containsInsensitive?: InputMaybe; - market_endsWith?: InputMaybe; - market_eq?: InputMaybe; - market_gt?: InputMaybe; - market_gte?: InputMaybe; - market_in?: InputMaybe>; - market_isNull?: InputMaybe; - market_lt?: InputMaybe; - market_lte?: InputMaybe; - market_not_contains?: InputMaybe; - market_not_containsInsensitive?: InputMaybe; - market_not_endsWith?: InputMaybe; - market_not_eq?: InputMaybe; - market_not_in?: InputMaybe>; - market_not_startsWith?: InputMaybe; - market_startsWith?: InputMaybe; - maxSize_eq?: InputMaybe; - maxSize_gt?: InputMaybe; - maxSize_gte?: InputMaybe; - maxSize_in?: InputMaybe>; - maxSize_isNull?: InputMaybe; - maxSize_lt?: InputMaybe; - maxSize_lte?: InputMaybe; - maxSize_not_eq?: InputMaybe; - maxSize_not_in?: InputMaybe>; - openedAt_eq?: InputMaybe; - openedAt_gt?: InputMaybe; - openedAt_gte?: InputMaybe; - openedAt_in?: InputMaybe>; - openedAt_isNull?: InputMaybe; - openedAt_lt?: InputMaybe; - openedAt_lte?: InputMaybe; - openedAt_not_eq?: InputMaybe; - openedAt_not_in?: InputMaybe>; - positionKey_contains?: InputMaybe; - positionKey_containsInsensitive?: InputMaybe; - positionKey_endsWith?: InputMaybe; - positionKey_eq?: InputMaybe; - positionKey_gt?: InputMaybe; - positionKey_gte?: InputMaybe; - positionKey_in?: InputMaybe>; - positionKey_isNull?: InputMaybe; - positionKey_lt?: InputMaybe; - positionKey_lte?: InputMaybe; - positionKey_not_contains?: InputMaybe; - positionKey_not_containsInsensitive?: InputMaybe; - positionKey_not_endsWith?: InputMaybe; - positionKey_not_eq?: InputMaybe; - positionKey_not_in?: InputMaybe>; - positionKey_not_startsWith?: InputMaybe; - positionKey_startsWith?: InputMaybe; - realizedFees_eq?: InputMaybe; - realizedFees_gt?: InputMaybe; - realizedFees_gte?: InputMaybe; - realizedFees_in?: InputMaybe>; - realizedFees_isNull?: InputMaybe; - realizedFees_lt?: InputMaybe; - realizedFees_lte?: InputMaybe; - realizedFees_not_eq?: InputMaybe; - realizedFees_not_in?: InputMaybe>; - realizedPnl_eq?: InputMaybe; - realizedPnl_gt?: InputMaybe; - realizedPnl_gte?: InputMaybe; - realizedPnl_in?: InputMaybe>; - realizedPnl_isNull?: InputMaybe; - realizedPnl_lt?: InputMaybe; - realizedPnl_lte?: InputMaybe; - realizedPnl_not_eq?: InputMaybe; - realizedPnl_not_in?: InputMaybe>; - realizedPriceImpact_eq?: InputMaybe; - realizedPriceImpact_gt?: InputMaybe; - realizedPriceImpact_gte?: InputMaybe; - realizedPriceImpact_in?: InputMaybe>; - realizedPriceImpact_isNull?: InputMaybe; - realizedPriceImpact_lt?: InputMaybe; - realizedPriceImpact_lte?: InputMaybe; - realizedPriceImpact_not_eq?: InputMaybe; - realizedPriceImpact_not_in?: InputMaybe>; - sizeInTokens_eq?: InputMaybe; - sizeInTokens_gt?: InputMaybe; - sizeInTokens_gte?: InputMaybe; - sizeInTokens_in?: InputMaybe>; - sizeInTokens_isNull?: InputMaybe; - sizeInTokens_lt?: InputMaybe; - sizeInTokens_lte?: InputMaybe; - sizeInTokens_not_eq?: InputMaybe; - sizeInTokens_not_in?: InputMaybe>; - sizeInUsd_eq?: InputMaybe; - sizeInUsd_gt?: InputMaybe; - sizeInUsd_gte?: InputMaybe; - sizeInUsd_in?: InputMaybe>; - sizeInUsd_isNull?: InputMaybe; - sizeInUsd_lt?: InputMaybe; - sizeInUsd_lte?: InputMaybe; - sizeInUsd_not_eq?: InputMaybe; - sizeInUsd_not_in?: InputMaybe>; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; - unrealizedFees_eq?: InputMaybe; - unrealizedFees_gt?: InputMaybe; - unrealizedFees_gte?: InputMaybe; - unrealizedFees_in?: InputMaybe>; - unrealizedFees_isNull?: InputMaybe; - unrealizedFees_lt?: InputMaybe; - unrealizedFees_lte?: InputMaybe; - unrealizedFees_not_eq?: InputMaybe; - unrealizedFees_not_in?: InputMaybe>; - unrealizedPnl_eq?: InputMaybe; - unrealizedPnl_gt?: InputMaybe; - unrealizedPnl_gte?: InputMaybe; - unrealizedPnl_in?: InputMaybe>; - unrealizedPnl_isNull?: InputMaybe; - unrealizedPnl_lt?: InputMaybe; - unrealizedPnl_lte?: InputMaybe; - unrealizedPnl_not_eq?: InputMaybe; - unrealizedPnl_not_in?: InputMaybe>; - unrealizedPriceImpact_eq?: InputMaybe; - unrealizedPriceImpact_gt?: InputMaybe; - unrealizedPriceImpact_gte?: InputMaybe; - unrealizedPriceImpact_in?: InputMaybe>; - unrealizedPriceImpact_isNull?: InputMaybe; - unrealizedPriceImpact_lt?: InputMaybe; - unrealizedPriceImpact_lte?: InputMaybe; - unrealizedPriceImpact_not_eq?: InputMaybe; - unrealizedPriceImpact_not_in?: InputMaybe>; + accountStat_isNull?: InputMaybe; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + collateralAmount_eq?: InputMaybe; + collateralAmount_gt?: InputMaybe; + collateralAmount_gte?: InputMaybe; + collateralAmount_in?: InputMaybe>; + collateralAmount_isNull?: InputMaybe; + collateralAmount_lt?: InputMaybe; + collateralAmount_lte?: InputMaybe; + collateralAmount_not_eq?: InputMaybe; + collateralAmount_not_in?: InputMaybe>; + collateralToken_contains?: InputMaybe; + collateralToken_containsInsensitive?: InputMaybe; + collateralToken_endsWith?: InputMaybe; + collateralToken_eq?: InputMaybe; + collateralToken_gt?: InputMaybe; + collateralToken_gte?: InputMaybe; + collateralToken_in?: InputMaybe>; + collateralToken_isNull?: InputMaybe; + collateralToken_lt?: InputMaybe; + collateralToken_lte?: InputMaybe; + collateralToken_not_contains?: InputMaybe; + collateralToken_not_containsInsensitive?: InputMaybe; + collateralToken_not_endsWith?: InputMaybe; + collateralToken_not_eq?: InputMaybe; + collateralToken_not_in?: InputMaybe>; + collateralToken_not_startsWith?: InputMaybe; + collateralToken_startsWith?: InputMaybe; + entryPrice_eq?: InputMaybe; + entryPrice_gt?: InputMaybe; + entryPrice_gte?: InputMaybe; + entryPrice_in?: InputMaybe>; + entryPrice_isNull?: InputMaybe; + entryPrice_lt?: InputMaybe; + entryPrice_lte?: InputMaybe; + entryPrice_not_eq?: InputMaybe; + entryPrice_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isLong_eq?: InputMaybe; + isLong_isNull?: InputMaybe; + isLong_not_eq?: InputMaybe; + isSnapshot_eq?: InputMaybe; + isSnapshot_isNull?: InputMaybe; + isSnapshot_not_eq?: InputMaybe; + market_contains?: InputMaybe; + market_containsInsensitive?: InputMaybe; + market_endsWith?: InputMaybe; + market_eq?: InputMaybe; + market_gt?: InputMaybe; + market_gte?: InputMaybe; + market_in?: InputMaybe>; + market_isNull?: InputMaybe; + market_lt?: InputMaybe; + market_lte?: InputMaybe; + market_not_contains?: InputMaybe; + market_not_containsInsensitive?: InputMaybe; + market_not_endsWith?: InputMaybe; + market_not_eq?: InputMaybe; + market_not_in?: InputMaybe>; + market_not_startsWith?: InputMaybe; + market_startsWith?: InputMaybe; + maxSize_eq?: InputMaybe; + maxSize_gt?: InputMaybe; + maxSize_gte?: InputMaybe; + maxSize_in?: InputMaybe>; + maxSize_isNull?: InputMaybe; + maxSize_lt?: InputMaybe; + maxSize_lte?: InputMaybe; + maxSize_not_eq?: InputMaybe; + maxSize_not_in?: InputMaybe>; + openedAt_eq?: InputMaybe; + openedAt_gt?: InputMaybe; + openedAt_gte?: InputMaybe; + openedAt_in?: InputMaybe>; + openedAt_isNull?: InputMaybe; + openedAt_lt?: InputMaybe; + openedAt_lte?: InputMaybe; + openedAt_not_eq?: InputMaybe; + openedAt_not_in?: InputMaybe>; + positionKey_contains?: InputMaybe; + positionKey_containsInsensitive?: InputMaybe; + positionKey_endsWith?: InputMaybe; + positionKey_eq?: InputMaybe; + positionKey_gt?: InputMaybe; + positionKey_gte?: InputMaybe; + positionKey_in?: InputMaybe>; + positionKey_isNull?: InputMaybe; + positionKey_lt?: InputMaybe; + positionKey_lte?: InputMaybe; + positionKey_not_contains?: InputMaybe; + positionKey_not_containsInsensitive?: InputMaybe; + positionKey_not_endsWith?: InputMaybe; + positionKey_not_eq?: InputMaybe; + positionKey_not_in?: InputMaybe>; + positionKey_not_startsWith?: InputMaybe; + positionKey_startsWith?: InputMaybe; + realizedFees_eq?: InputMaybe; + realizedFees_gt?: InputMaybe; + realizedFees_gte?: InputMaybe; + realizedFees_in?: InputMaybe>; + realizedFees_isNull?: InputMaybe; + realizedFees_lt?: InputMaybe; + realizedFees_lte?: InputMaybe; + realizedFees_not_eq?: InputMaybe; + realizedFees_not_in?: InputMaybe>; + realizedPnl_eq?: InputMaybe; + realizedPnl_gt?: InputMaybe; + realizedPnl_gte?: InputMaybe; + realizedPnl_in?: InputMaybe>; + realizedPnl_isNull?: InputMaybe; + realizedPnl_lt?: InputMaybe; + realizedPnl_lte?: InputMaybe; + realizedPnl_not_eq?: InputMaybe; + realizedPnl_not_in?: InputMaybe>; + realizedPriceImpact_eq?: InputMaybe; + realizedPriceImpact_gt?: InputMaybe; + realizedPriceImpact_gte?: InputMaybe; + realizedPriceImpact_in?: InputMaybe>; + realizedPriceImpact_isNull?: InputMaybe; + realizedPriceImpact_lt?: InputMaybe; + realizedPriceImpact_lte?: InputMaybe; + realizedPriceImpact_not_eq?: InputMaybe; + realizedPriceImpact_not_in?: InputMaybe>; + sizeInTokens_eq?: InputMaybe; + sizeInTokens_gt?: InputMaybe; + sizeInTokens_gte?: InputMaybe; + sizeInTokens_in?: InputMaybe>; + sizeInTokens_isNull?: InputMaybe; + sizeInTokens_lt?: InputMaybe; + sizeInTokens_lte?: InputMaybe; + sizeInTokens_not_eq?: InputMaybe; + sizeInTokens_not_in?: InputMaybe>; + sizeInUsd_eq?: InputMaybe; + sizeInUsd_gt?: InputMaybe; + sizeInUsd_gte?: InputMaybe; + sizeInUsd_in?: InputMaybe>; + sizeInUsd_isNull?: InputMaybe; + sizeInUsd_lt?: InputMaybe; + sizeInUsd_lte?: InputMaybe; + sizeInUsd_not_eq?: InputMaybe; + sizeInUsd_not_in?: InputMaybe>; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; + unrealizedFees_eq?: InputMaybe; + unrealizedFees_gt?: InputMaybe; + unrealizedFees_gte?: InputMaybe; + unrealizedFees_in?: InputMaybe>; + unrealizedFees_isNull?: InputMaybe; + unrealizedFees_lt?: InputMaybe; + unrealizedFees_lte?: InputMaybe; + unrealizedFees_not_eq?: InputMaybe; + unrealizedFees_not_in?: InputMaybe>; + unrealizedPnl_eq?: InputMaybe; + unrealizedPnl_gt?: InputMaybe; + unrealizedPnl_gte?: InputMaybe; + unrealizedPnl_in?: InputMaybe>; + unrealizedPnl_isNull?: InputMaybe; + unrealizedPnl_lt?: InputMaybe; + unrealizedPnl_lte?: InputMaybe; + unrealizedPnl_not_eq?: InputMaybe; + unrealizedPnl_not_in?: InputMaybe>; + unrealizedPriceImpact_eq?: InputMaybe; + unrealizedPriceImpact_gt?: InputMaybe; + unrealizedPriceImpact_gte?: InputMaybe; + unrealizedPriceImpact_in?: InputMaybe>; + unrealizedPriceImpact_isNull?: InputMaybe; + unrealizedPriceImpact_lt?: InputMaybe; + unrealizedPriceImpact_lte?: InputMaybe; + unrealizedPriceImpact_not_eq?: InputMaybe; + unrealizedPriceImpact_not_in?: InputMaybe>; } export interface PositionsConnection { - __typename?: "PositionsConnection"; + __typename?: 'PositionsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Price { - __typename?: "Price"; - id: Scalars["String"]["output"]; - isSnapshot: Scalars["Boolean"]["output"]; - maxPrice: Scalars["BigInt"]["output"]; - minPrice: Scalars["BigInt"]["output"]; - snapshotTimestamp?: Maybe; - timestamp: Scalars["Int"]["output"]; - token: Scalars["String"]["output"]; + __typename?: 'Price'; + id: Scalars['String']['output']; + isSnapshot: Scalars['Boolean']['output']; + maxPrice: Scalars['BigInt']['output']; + minPrice: Scalars['BigInt']['output']; + snapshotTimestamp?: Maybe; + timestamp: Scalars['Int']['output']; + token: Scalars['String']['output']; type: PriceType; } export interface PriceEdge { - __typename?: "PriceEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'PriceEdge'; + cursor: Scalars['String']['output']; node: Price; } export enum PriceOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - isSnapshot_ASC = "isSnapshot_ASC", - isSnapshot_ASC_NULLS_FIRST = "isSnapshot_ASC_NULLS_FIRST", - isSnapshot_ASC_NULLS_LAST = "isSnapshot_ASC_NULLS_LAST", - isSnapshot_DESC = "isSnapshot_DESC", - isSnapshot_DESC_NULLS_FIRST = "isSnapshot_DESC_NULLS_FIRST", - isSnapshot_DESC_NULLS_LAST = "isSnapshot_DESC_NULLS_LAST", - maxPrice_ASC = "maxPrice_ASC", - maxPrice_ASC_NULLS_FIRST = "maxPrice_ASC_NULLS_FIRST", - maxPrice_ASC_NULLS_LAST = "maxPrice_ASC_NULLS_LAST", - maxPrice_DESC = "maxPrice_DESC", - maxPrice_DESC_NULLS_FIRST = "maxPrice_DESC_NULLS_FIRST", - maxPrice_DESC_NULLS_LAST = "maxPrice_DESC_NULLS_LAST", - minPrice_ASC = "minPrice_ASC", - minPrice_ASC_NULLS_FIRST = "minPrice_ASC_NULLS_FIRST", - minPrice_ASC_NULLS_LAST = "minPrice_ASC_NULLS_LAST", - minPrice_DESC = "minPrice_DESC", - minPrice_DESC_NULLS_FIRST = "minPrice_DESC_NULLS_FIRST", - minPrice_DESC_NULLS_LAST = "minPrice_DESC_NULLS_LAST", - snapshotTimestamp_ASC = "snapshotTimestamp_ASC", - snapshotTimestamp_ASC_NULLS_FIRST = "snapshotTimestamp_ASC_NULLS_FIRST", - snapshotTimestamp_ASC_NULLS_LAST = "snapshotTimestamp_ASC_NULLS_LAST", - snapshotTimestamp_DESC = "snapshotTimestamp_DESC", - snapshotTimestamp_DESC_NULLS_FIRST = "snapshotTimestamp_DESC_NULLS_FIRST", - snapshotTimestamp_DESC_NULLS_LAST = "snapshotTimestamp_DESC_NULLS_LAST", - timestamp_ASC = "timestamp_ASC", - timestamp_ASC_NULLS_FIRST = "timestamp_ASC_NULLS_FIRST", - timestamp_ASC_NULLS_LAST = "timestamp_ASC_NULLS_LAST", - timestamp_DESC = "timestamp_DESC", - timestamp_DESC_NULLS_FIRST = "timestamp_DESC_NULLS_FIRST", - timestamp_DESC_NULLS_LAST = "timestamp_DESC_NULLS_LAST", - token_ASC = "token_ASC", - token_ASC_NULLS_FIRST = "token_ASC_NULLS_FIRST", - token_ASC_NULLS_LAST = "token_ASC_NULLS_LAST", - token_DESC = "token_DESC", - token_DESC_NULLS_FIRST = "token_DESC_NULLS_FIRST", - token_DESC_NULLS_LAST = "token_DESC_NULLS_LAST", - type_ASC = "type_ASC", - type_ASC_NULLS_FIRST = "type_ASC_NULLS_FIRST", - type_ASC_NULLS_LAST = "type_ASC_NULLS_LAST", - type_DESC = "type_DESC", - type_DESC_NULLS_FIRST = "type_DESC_NULLS_FIRST", - type_DESC_NULLS_LAST = "type_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + isSnapshot_ASC = 'isSnapshot_ASC', + isSnapshot_ASC_NULLS_FIRST = 'isSnapshot_ASC_NULLS_FIRST', + isSnapshot_ASC_NULLS_LAST = 'isSnapshot_ASC_NULLS_LAST', + isSnapshot_DESC = 'isSnapshot_DESC', + isSnapshot_DESC_NULLS_FIRST = 'isSnapshot_DESC_NULLS_FIRST', + isSnapshot_DESC_NULLS_LAST = 'isSnapshot_DESC_NULLS_LAST', + maxPrice_ASC = 'maxPrice_ASC', + maxPrice_ASC_NULLS_FIRST = 'maxPrice_ASC_NULLS_FIRST', + maxPrice_ASC_NULLS_LAST = 'maxPrice_ASC_NULLS_LAST', + maxPrice_DESC = 'maxPrice_DESC', + maxPrice_DESC_NULLS_FIRST = 'maxPrice_DESC_NULLS_FIRST', + maxPrice_DESC_NULLS_LAST = 'maxPrice_DESC_NULLS_LAST', + minPrice_ASC = 'minPrice_ASC', + minPrice_ASC_NULLS_FIRST = 'minPrice_ASC_NULLS_FIRST', + minPrice_ASC_NULLS_LAST = 'minPrice_ASC_NULLS_LAST', + minPrice_DESC = 'minPrice_DESC', + minPrice_DESC_NULLS_FIRST = 'minPrice_DESC_NULLS_FIRST', + minPrice_DESC_NULLS_LAST = 'minPrice_DESC_NULLS_LAST', + snapshotTimestamp_ASC = 'snapshotTimestamp_ASC', + snapshotTimestamp_ASC_NULLS_FIRST = 'snapshotTimestamp_ASC_NULLS_FIRST', + snapshotTimestamp_ASC_NULLS_LAST = 'snapshotTimestamp_ASC_NULLS_LAST', + snapshotTimestamp_DESC = 'snapshotTimestamp_DESC', + snapshotTimestamp_DESC_NULLS_FIRST = 'snapshotTimestamp_DESC_NULLS_FIRST', + snapshotTimestamp_DESC_NULLS_LAST = 'snapshotTimestamp_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + token_ASC = 'token_ASC', + token_ASC_NULLS_FIRST = 'token_ASC_NULLS_FIRST', + token_ASC_NULLS_LAST = 'token_ASC_NULLS_LAST', + token_DESC = 'token_DESC', + token_DESC_NULLS_FIRST = 'token_DESC_NULLS_FIRST', + token_DESC_NULLS_LAST = 'token_DESC_NULLS_LAST', + type_ASC = 'type_ASC', + type_ASC_NULLS_FIRST = 'type_ASC_NULLS_FIRST', + type_ASC_NULLS_LAST = 'type_ASC_NULLS_LAST', + type_DESC = 'type_DESC', + type_DESC_NULLS_FIRST = 'type_DESC_NULLS_FIRST', + type_DESC_NULLS_LAST = 'type_DESC_NULLS_LAST' } export enum PriceType { - glv = "glv", - gm = "gm", - onchainFeed = "onchainFeed", - v2 = "v2", + glv = 'glv', + gm = 'gm', + onchainFeed = 'onchainFeed', + v2 = 'v2' } export interface PriceWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - isSnapshot_eq?: InputMaybe; - isSnapshot_isNull?: InputMaybe; - isSnapshot_not_eq?: InputMaybe; - maxPrice_eq?: InputMaybe; - maxPrice_gt?: InputMaybe; - maxPrice_gte?: InputMaybe; - maxPrice_in?: InputMaybe>; - maxPrice_isNull?: InputMaybe; - maxPrice_lt?: InputMaybe; - maxPrice_lte?: InputMaybe; - maxPrice_not_eq?: InputMaybe; - maxPrice_not_in?: InputMaybe>; - minPrice_eq?: InputMaybe; - minPrice_gt?: InputMaybe; - minPrice_gte?: InputMaybe; - minPrice_in?: InputMaybe>; - minPrice_isNull?: InputMaybe; - minPrice_lt?: InputMaybe; - minPrice_lte?: InputMaybe; - minPrice_not_eq?: InputMaybe; - minPrice_not_in?: InputMaybe>; - snapshotTimestamp_eq?: InputMaybe; - snapshotTimestamp_gt?: InputMaybe; - snapshotTimestamp_gte?: InputMaybe; - snapshotTimestamp_in?: InputMaybe>; - snapshotTimestamp_isNull?: InputMaybe; - snapshotTimestamp_lt?: InputMaybe; - snapshotTimestamp_lte?: InputMaybe; - snapshotTimestamp_not_eq?: InputMaybe; - snapshotTimestamp_not_in?: InputMaybe>; - timestamp_eq?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_isNull?: InputMaybe; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not_eq?: InputMaybe; - timestamp_not_in?: InputMaybe>; - token_contains?: InputMaybe; - token_containsInsensitive?: InputMaybe; - token_endsWith?: InputMaybe; - token_eq?: InputMaybe; - token_gt?: InputMaybe; - token_gte?: InputMaybe; - token_in?: InputMaybe>; - token_isNull?: InputMaybe; - token_lt?: InputMaybe; - token_lte?: InputMaybe; - token_not_contains?: InputMaybe; - token_not_containsInsensitive?: InputMaybe; - token_not_endsWith?: InputMaybe; - token_not_eq?: InputMaybe; - token_not_in?: InputMaybe>; - token_not_startsWith?: InputMaybe; - token_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + isSnapshot_eq?: InputMaybe; + isSnapshot_isNull?: InputMaybe; + isSnapshot_not_eq?: InputMaybe; + maxPrice_eq?: InputMaybe; + maxPrice_gt?: InputMaybe; + maxPrice_gte?: InputMaybe; + maxPrice_in?: InputMaybe>; + maxPrice_isNull?: InputMaybe; + maxPrice_lt?: InputMaybe; + maxPrice_lte?: InputMaybe; + maxPrice_not_eq?: InputMaybe; + maxPrice_not_in?: InputMaybe>; + minPrice_eq?: InputMaybe; + minPrice_gt?: InputMaybe; + minPrice_gte?: InputMaybe; + minPrice_in?: InputMaybe>; + minPrice_isNull?: InputMaybe; + minPrice_lt?: InputMaybe; + minPrice_lte?: InputMaybe; + minPrice_not_eq?: InputMaybe; + minPrice_not_in?: InputMaybe>; + snapshotTimestamp_eq?: InputMaybe; + snapshotTimestamp_gt?: InputMaybe; + snapshotTimestamp_gte?: InputMaybe; + snapshotTimestamp_in?: InputMaybe>; + snapshotTimestamp_isNull?: InputMaybe; + snapshotTimestamp_lt?: InputMaybe; + snapshotTimestamp_lte?: InputMaybe; + snapshotTimestamp_not_eq?: InputMaybe; + snapshotTimestamp_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token_contains?: InputMaybe; + token_containsInsensitive?: InputMaybe; + token_endsWith?: InputMaybe; + token_eq?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_isNull?: InputMaybe; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_containsInsensitive?: InputMaybe; + token_not_endsWith?: InputMaybe; + token_not_eq?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_startsWith?: InputMaybe; + token_startsWith?: InputMaybe; type_eq?: InputMaybe; type_in?: InputMaybe>; - type_isNull?: InputMaybe; + type_isNull?: InputMaybe; type_not_eq?: InputMaybe; type_not_in?: InputMaybe>; } export interface PricesConnection { - __typename?: "PricesConnection"; + __typename?: 'PricesConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface ProcessorStatus { - __typename?: "ProcessorStatus"; - id: Scalars["String"]["output"]; - lastParsedBlockNumber: Scalars["Int"]["output"]; - lastParsedBlockTimestamp: Scalars["Int"]["output"]; - lastProcessorCallTimestamp: Scalars["Int"]["output"]; + __typename?: 'ProcessorStatus'; + id: Scalars['String']['output']; + lastParsedBlockNumber: Scalars['Int']['output']; + lastParsedBlockTimestamp: Scalars['Int']['output']; + lastProcessorCallTimestamp: Scalars['Int']['output']; } export interface ProcessorStatusEdge { - __typename?: "ProcessorStatusEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'ProcessorStatusEdge'; + cursor: Scalars['String']['output']; node: ProcessorStatus; } export enum ProcessorStatusOrderByInput { - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - lastParsedBlockNumber_ASC = "lastParsedBlockNumber_ASC", - lastParsedBlockNumber_ASC_NULLS_FIRST = "lastParsedBlockNumber_ASC_NULLS_FIRST", - lastParsedBlockNumber_ASC_NULLS_LAST = "lastParsedBlockNumber_ASC_NULLS_LAST", - lastParsedBlockNumber_DESC = "lastParsedBlockNumber_DESC", - lastParsedBlockNumber_DESC_NULLS_FIRST = "lastParsedBlockNumber_DESC_NULLS_FIRST", - lastParsedBlockNumber_DESC_NULLS_LAST = "lastParsedBlockNumber_DESC_NULLS_LAST", - lastParsedBlockTimestamp_ASC = "lastParsedBlockTimestamp_ASC", - lastParsedBlockTimestamp_ASC_NULLS_FIRST = "lastParsedBlockTimestamp_ASC_NULLS_FIRST", - lastParsedBlockTimestamp_ASC_NULLS_LAST = "lastParsedBlockTimestamp_ASC_NULLS_LAST", - lastParsedBlockTimestamp_DESC = "lastParsedBlockTimestamp_DESC", - lastParsedBlockTimestamp_DESC_NULLS_FIRST = "lastParsedBlockTimestamp_DESC_NULLS_FIRST", - lastParsedBlockTimestamp_DESC_NULLS_LAST = "lastParsedBlockTimestamp_DESC_NULLS_LAST", - lastProcessorCallTimestamp_ASC = "lastProcessorCallTimestamp_ASC", - lastProcessorCallTimestamp_ASC_NULLS_FIRST = "lastProcessorCallTimestamp_ASC_NULLS_FIRST", - lastProcessorCallTimestamp_ASC_NULLS_LAST = "lastProcessorCallTimestamp_ASC_NULLS_LAST", - lastProcessorCallTimestamp_DESC = "lastProcessorCallTimestamp_DESC", - lastProcessorCallTimestamp_DESC_NULLS_FIRST = "lastProcessorCallTimestamp_DESC_NULLS_FIRST", - lastProcessorCallTimestamp_DESC_NULLS_LAST = "lastProcessorCallTimestamp_DESC_NULLS_LAST", + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + lastParsedBlockNumber_ASC = 'lastParsedBlockNumber_ASC', + lastParsedBlockNumber_ASC_NULLS_FIRST = 'lastParsedBlockNumber_ASC_NULLS_FIRST', + lastParsedBlockNumber_ASC_NULLS_LAST = 'lastParsedBlockNumber_ASC_NULLS_LAST', + lastParsedBlockNumber_DESC = 'lastParsedBlockNumber_DESC', + lastParsedBlockNumber_DESC_NULLS_FIRST = 'lastParsedBlockNumber_DESC_NULLS_FIRST', + lastParsedBlockNumber_DESC_NULLS_LAST = 'lastParsedBlockNumber_DESC_NULLS_LAST', + lastParsedBlockTimestamp_ASC = 'lastParsedBlockTimestamp_ASC', + lastParsedBlockTimestamp_ASC_NULLS_FIRST = 'lastParsedBlockTimestamp_ASC_NULLS_FIRST', + lastParsedBlockTimestamp_ASC_NULLS_LAST = 'lastParsedBlockTimestamp_ASC_NULLS_LAST', + lastParsedBlockTimestamp_DESC = 'lastParsedBlockTimestamp_DESC', + lastParsedBlockTimestamp_DESC_NULLS_FIRST = 'lastParsedBlockTimestamp_DESC_NULLS_FIRST', + lastParsedBlockTimestamp_DESC_NULLS_LAST = 'lastParsedBlockTimestamp_DESC_NULLS_LAST', + lastProcessorCallTimestamp_ASC = 'lastProcessorCallTimestamp_ASC', + lastProcessorCallTimestamp_ASC_NULLS_FIRST = 'lastProcessorCallTimestamp_ASC_NULLS_FIRST', + lastProcessorCallTimestamp_ASC_NULLS_LAST = 'lastProcessorCallTimestamp_ASC_NULLS_LAST', + lastProcessorCallTimestamp_DESC = 'lastProcessorCallTimestamp_DESC', + lastProcessorCallTimestamp_DESC_NULLS_FIRST = 'lastProcessorCallTimestamp_DESC_NULLS_FIRST', + lastProcessorCallTimestamp_DESC_NULLS_LAST = 'lastProcessorCallTimestamp_DESC_NULLS_LAST' } export interface ProcessorStatusWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - lastParsedBlockNumber_eq?: InputMaybe; - lastParsedBlockNumber_gt?: InputMaybe; - lastParsedBlockNumber_gte?: InputMaybe; - lastParsedBlockNumber_in?: InputMaybe>; - lastParsedBlockNumber_isNull?: InputMaybe; - lastParsedBlockNumber_lt?: InputMaybe; - lastParsedBlockNumber_lte?: InputMaybe; - lastParsedBlockNumber_not_eq?: InputMaybe; - lastParsedBlockNumber_not_in?: InputMaybe>; - lastParsedBlockTimestamp_eq?: InputMaybe; - lastParsedBlockTimestamp_gt?: InputMaybe; - lastParsedBlockTimestamp_gte?: InputMaybe; - lastParsedBlockTimestamp_in?: InputMaybe>; - lastParsedBlockTimestamp_isNull?: InputMaybe; - lastParsedBlockTimestamp_lt?: InputMaybe; - lastParsedBlockTimestamp_lte?: InputMaybe; - lastParsedBlockTimestamp_not_eq?: InputMaybe; - lastParsedBlockTimestamp_not_in?: InputMaybe>; - lastProcessorCallTimestamp_eq?: InputMaybe; - lastProcessorCallTimestamp_gt?: InputMaybe; - lastProcessorCallTimestamp_gte?: InputMaybe; - lastProcessorCallTimestamp_in?: InputMaybe>; - lastProcessorCallTimestamp_isNull?: InputMaybe; - lastProcessorCallTimestamp_lt?: InputMaybe; - lastProcessorCallTimestamp_lte?: InputMaybe; - lastProcessorCallTimestamp_not_eq?: InputMaybe; - lastProcessorCallTimestamp_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + lastParsedBlockNumber_eq?: InputMaybe; + lastParsedBlockNumber_gt?: InputMaybe; + lastParsedBlockNumber_gte?: InputMaybe; + lastParsedBlockNumber_in?: InputMaybe>; + lastParsedBlockNumber_isNull?: InputMaybe; + lastParsedBlockNumber_lt?: InputMaybe; + lastParsedBlockNumber_lte?: InputMaybe; + lastParsedBlockNumber_not_eq?: InputMaybe; + lastParsedBlockNumber_not_in?: InputMaybe>; + lastParsedBlockTimestamp_eq?: InputMaybe; + lastParsedBlockTimestamp_gt?: InputMaybe; + lastParsedBlockTimestamp_gte?: InputMaybe; + lastParsedBlockTimestamp_in?: InputMaybe>; + lastParsedBlockTimestamp_isNull?: InputMaybe; + lastParsedBlockTimestamp_lt?: InputMaybe; + lastParsedBlockTimestamp_lte?: InputMaybe; + lastParsedBlockTimestamp_not_eq?: InputMaybe; + lastParsedBlockTimestamp_not_in?: InputMaybe>; + lastProcessorCallTimestamp_eq?: InputMaybe; + lastProcessorCallTimestamp_gt?: InputMaybe; + lastProcessorCallTimestamp_gte?: InputMaybe; + lastProcessorCallTimestamp_in?: InputMaybe>; + lastProcessorCallTimestamp_isNull?: InputMaybe; + lastProcessorCallTimestamp_lt?: InputMaybe; + lastProcessorCallTimestamp_lte?: InputMaybe; + lastProcessorCallTimestamp_not_eq?: InputMaybe; + lastProcessorCallTimestamp_not_in?: InputMaybe>; } export interface ProcessorStatusesConnection { - __typename?: "ProcessorStatusesConnection"; + __typename?: 'ProcessorStatusesConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Query { - __typename?: "Query"; + __typename?: 'Query'; accountPnlHistoryStats: Array; accountPnlSummaryStats: Array; accountStatById?: Maybe; @@ -7343,7 +7245,7 @@ export interface Query { positions: Array; positionsConnection: PositionsConnection; positionsVolume: Array; - positionsVolume24hByMarket: Scalars["BigInt"]["output"]; + positionsVolume24hByMarket: Scalars['BigInt']['output']; priceById?: Maybe; prices: Array; pricesConnection: PricesConnection; @@ -7354,7 +7256,7 @@ export interface Query { swapInfoById?: Maybe; swapInfos: Array; swapInfosConnection: SwapInfosConnection; - totalPositionChanges: Scalars["Float"]["output"]; + totalPositionChanges: Scalars['Float']['output']; tradeActionById?: Maybe; tradeActions: Array; tradeActionsConnection: TradeActionsConnection; @@ -7363,1884 +7265,1959 @@ export interface Query { transactionsConnection: TransactionsConnection; } + export interface QueryaccountPnlHistoryStatsArgs { - account: Scalars["String"]["input"]; - from?: InputMaybe; + account: Scalars['String']['input']; + from?: InputMaybe; } + export interface QueryaccountPnlSummaryStatsArgs { - account: Scalars["String"]["input"]; + account: Scalars['String']['input']; } + export interface QueryaccountStatByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryaccountStatsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryaccountStatsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryannualizedPerformanceArgs { where?: InputMaybe; } + export interface QueryaprSnapshotByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryaprSnapshotsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryaprSnapshotsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryborrowingRateSnapshotByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryborrowingRateSnapshotsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryborrowingRateSnapshotsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryclaimActionByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryclaimActionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryclaimActionsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryclaimRefByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryclaimRefsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryclaimRefsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryclaimableCollateralByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryclaimableCollateralGroupByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryclaimableCollateralGroupsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryclaimableCollateralGroupsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryclaimableCollateralsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryclaimableCollateralsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryclaimableFundingFeeInfoByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryclaimableFundingFeeInfosArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryclaimableFundingFeeInfosConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerycollectedFeesInfoByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerycollectedFeesInfosArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerycollectedFeesInfosConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerycumulativePnlByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerycumulativePnlsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerycumulativePnlsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerycumulativePoolValueByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerycumulativePoolValuesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerycumulativePoolValuesConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerydistributionByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerydistributionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerydistributionsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryglvByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryglvsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryglvsAprByPeriodArgs { where?: InputMaybe; } + export interface QueryglvsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryglvsPnlAprByPeriodArgs { where?: InputMaybe; } + export interface QuerymarketByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerymarketInfoByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerymarketInfosArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerymarketInfosConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerymarketsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerymarketsAprByPeriodArgs { where?: InputMaybe; } + export interface QuerymarketsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerymarketsPnlAprByPeriodArgs { where?: InputMaybe; } + export interface QuerymultichainFundingArgs { where?: InputMaybe; } + export interface QuerymultichainFundingReceiveEventByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerymultichainFundingReceiveEventsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerymultichainFundingReceiveEventsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerymultichainFundingSendEventByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerymultichainFundingSendEventsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerymultichainFundingSendEventsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerymultichainMetadataArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerymultichainMetadataByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerymultichainMetadataConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryonChainSettingByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryonChainSettingsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryonChainSettingsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryorderByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryordersArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryordersConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryperformanceSnapshotsArgs { where?: InputMaybe; } + export interface QueryperiodAccountStatsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; where?: InputMaybe; } + export interface QueryplatformStatsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryplatformStatsByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryplatformStatsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerypnlAprSnapshotByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerypnlAprSnapshotsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerypnlAprSnapshotsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerypositionByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerypositionChangeByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerypositionChangesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerypositionChangesConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerypositionFeesEntitiesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerypositionFeesEntitiesConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerypositionFeesEntityByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerypositionTotalCollateralAmountArgs { where?: InputMaybe; } + export interface QuerypositionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerypositionsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerypositionsVolumeArgs { where?: InputMaybe; } + export interface QuerypositionsVolume24hByMarketArgs { where?: InputMaybe; } + export interface QuerypriceByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerypricesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerypricesConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryprocessorStatusByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryprocessorStatusesArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryprocessorStatusesConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QueryswapInfoByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QueryswapInfosArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QueryswapInfosConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerytradeActionByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerytradeActionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerytradeActionsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } + export interface QuerytransactionByIdArgs { - id: Scalars["String"]["input"]; + id: Scalars['String']['input']; } + export interface QuerytransactionsArgs { - limit?: InputMaybe; - offset?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe>; where?: InputMaybe; } + export interface QuerytransactionsConnectionArgs { - after?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + first?: InputMaybe; orderBy: Array; where?: InputMaybe; } export interface SquidStatus { - __typename?: "SquidStatus"; - finalizedHeight: Scalars["Float"]["output"]; - height: Scalars["Float"]["output"]; + __typename?: 'SquidStatus'; + finalizedHeight: Scalars['Float']['output']; + height: Scalars['Float']['output']; } export interface SwapInfo { - __typename?: "SwapInfo"; - amountIn: Scalars["BigInt"]["output"]; - amountInAfterFees: Scalars["BigInt"]["output"]; - amountOut: Scalars["BigInt"]["output"]; - id: Scalars["String"]["output"]; - marketAddress: Scalars["String"]["output"]; - orderKey: Scalars["String"]["output"]; - priceImpactUsd: Scalars["BigInt"]["output"]; - receiver: Scalars["String"]["output"]; - tokenInAddress: Scalars["String"]["output"]; - tokenInPrice: Scalars["BigInt"]["output"]; - tokenOutAddress: Scalars["String"]["output"]; - tokenOutPrice: Scalars["BigInt"]["output"]; + __typename?: 'SwapInfo'; + amountIn: Scalars['BigInt']['output']; + amountInAfterFees: Scalars['BigInt']['output']; + amountOut: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + marketAddress: Scalars['String']['output']; + orderKey: Scalars['String']['output']; + priceImpactUsd: Scalars['BigInt']['output']; + receiver: Scalars['String']['output']; + tokenInAddress: Scalars['String']['output']; + tokenInPrice: Scalars['BigInt']['output']; + tokenOutAddress: Scalars['String']['output']; + tokenOutPrice: Scalars['BigInt']['output']; transaction: Transaction; } export interface SwapInfoEdge { - __typename?: "SwapInfoEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'SwapInfoEdge'; + cursor: Scalars['String']['output']; node: SwapInfo; } export enum SwapInfoOrderByInput { - amountInAfterFees_ASC = "amountInAfterFees_ASC", - amountInAfterFees_ASC_NULLS_FIRST = "amountInAfterFees_ASC_NULLS_FIRST", - amountInAfterFees_ASC_NULLS_LAST = "amountInAfterFees_ASC_NULLS_LAST", - amountInAfterFees_DESC = "amountInAfterFees_DESC", - amountInAfterFees_DESC_NULLS_FIRST = "amountInAfterFees_DESC_NULLS_FIRST", - amountInAfterFees_DESC_NULLS_LAST = "amountInAfterFees_DESC_NULLS_LAST", - amountIn_ASC = "amountIn_ASC", - amountIn_ASC_NULLS_FIRST = "amountIn_ASC_NULLS_FIRST", - amountIn_ASC_NULLS_LAST = "amountIn_ASC_NULLS_LAST", - amountIn_DESC = "amountIn_DESC", - amountIn_DESC_NULLS_FIRST = "amountIn_DESC_NULLS_FIRST", - amountIn_DESC_NULLS_LAST = "amountIn_DESC_NULLS_LAST", - amountOut_ASC = "amountOut_ASC", - amountOut_ASC_NULLS_FIRST = "amountOut_ASC_NULLS_FIRST", - amountOut_ASC_NULLS_LAST = "amountOut_ASC_NULLS_LAST", - amountOut_DESC = "amountOut_DESC", - amountOut_DESC_NULLS_FIRST = "amountOut_DESC_NULLS_FIRST", - amountOut_DESC_NULLS_LAST = "amountOut_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - orderKey_ASC = "orderKey_ASC", - orderKey_ASC_NULLS_FIRST = "orderKey_ASC_NULLS_FIRST", - orderKey_ASC_NULLS_LAST = "orderKey_ASC_NULLS_LAST", - orderKey_DESC = "orderKey_DESC", - orderKey_DESC_NULLS_FIRST = "orderKey_DESC_NULLS_FIRST", - orderKey_DESC_NULLS_LAST = "orderKey_DESC_NULLS_LAST", - priceImpactUsd_ASC = "priceImpactUsd_ASC", - priceImpactUsd_ASC_NULLS_FIRST = "priceImpactUsd_ASC_NULLS_FIRST", - priceImpactUsd_ASC_NULLS_LAST = "priceImpactUsd_ASC_NULLS_LAST", - priceImpactUsd_DESC = "priceImpactUsd_DESC", - priceImpactUsd_DESC_NULLS_FIRST = "priceImpactUsd_DESC_NULLS_FIRST", - priceImpactUsd_DESC_NULLS_LAST = "priceImpactUsd_DESC_NULLS_LAST", - receiver_ASC = "receiver_ASC", - receiver_ASC_NULLS_FIRST = "receiver_ASC_NULLS_FIRST", - receiver_ASC_NULLS_LAST = "receiver_ASC_NULLS_LAST", - receiver_DESC = "receiver_DESC", - receiver_DESC_NULLS_FIRST = "receiver_DESC_NULLS_FIRST", - receiver_DESC_NULLS_LAST = "receiver_DESC_NULLS_LAST", - tokenInAddress_ASC = "tokenInAddress_ASC", - tokenInAddress_ASC_NULLS_FIRST = "tokenInAddress_ASC_NULLS_FIRST", - tokenInAddress_ASC_NULLS_LAST = "tokenInAddress_ASC_NULLS_LAST", - tokenInAddress_DESC = "tokenInAddress_DESC", - tokenInAddress_DESC_NULLS_FIRST = "tokenInAddress_DESC_NULLS_FIRST", - tokenInAddress_DESC_NULLS_LAST = "tokenInAddress_DESC_NULLS_LAST", - tokenInPrice_ASC = "tokenInPrice_ASC", - tokenInPrice_ASC_NULLS_FIRST = "tokenInPrice_ASC_NULLS_FIRST", - tokenInPrice_ASC_NULLS_LAST = "tokenInPrice_ASC_NULLS_LAST", - tokenInPrice_DESC = "tokenInPrice_DESC", - tokenInPrice_DESC_NULLS_FIRST = "tokenInPrice_DESC_NULLS_FIRST", - tokenInPrice_DESC_NULLS_LAST = "tokenInPrice_DESC_NULLS_LAST", - tokenOutAddress_ASC = "tokenOutAddress_ASC", - tokenOutAddress_ASC_NULLS_FIRST = "tokenOutAddress_ASC_NULLS_FIRST", - tokenOutAddress_ASC_NULLS_LAST = "tokenOutAddress_ASC_NULLS_LAST", - tokenOutAddress_DESC = "tokenOutAddress_DESC", - tokenOutAddress_DESC_NULLS_FIRST = "tokenOutAddress_DESC_NULLS_FIRST", - tokenOutAddress_DESC_NULLS_LAST = "tokenOutAddress_DESC_NULLS_LAST", - tokenOutPrice_ASC = "tokenOutPrice_ASC", - tokenOutPrice_ASC_NULLS_FIRST = "tokenOutPrice_ASC_NULLS_FIRST", - tokenOutPrice_ASC_NULLS_LAST = "tokenOutPrice_ASC_NULLS_LAST", - tokenOutPrice_DESC = "tokenOutPrice_DESC", - tokenOutPrice_DESC_NULLS_FIRST = "tokenOutPrice_DESC_NULLS_FIRST", - tokenOutPrice_DESC_NULLS_LAST = "tokenOutPrice_DESC_NULLS_LAST", - transaction_blockNumber_ASC = "transaction_blockNumber_ASC", - transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", - transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", - transaction_blockNumber_DESC = "transaction_blockNumber_DESC", - transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", - transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", - transaction_chainId_ASC = "transaction_chainId_ASC", - transaction_chainId_ASC_NULLS_FIRST = "transaction_chainId_ASC_NULLS_FIRST", - transaction_chainId_ASC_NULLS_LAST = "transaction_chainId_ASC_NULLS_LAST", - transaction_chainId_DESC = "transaction_chainId_DESC", - transaction_chainId_DESC_NULLS_FIRST = "transaction_chainId_DESC_NULLS_FIRST", - transaction_chainId_DESC_NULLS_LAST = "transaction_chainId_DESC_NULLS_LAST", - transaction_from_ASC = "transaction_from_ASC", - transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", - transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", - transaction_from_DESC = "transaction_from_DESC", - transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", - transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", - transaction_hash_ASC = "transaction_hash_ASC", - transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", - transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", - transaction_hash_DESC = "transaction_hash_DESC", - transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", - transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", - transaction_id_ASC = "transaction_id_ASC", - transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", - transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", - transaction_id_DESC = "transaction_id_DESC", - transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", - transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", - transaction_timestamp_ASC = "transaction_timestamp_ASC", - transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", - transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", - transaction_timestamp_DESC = "transaction_timestamp_DESC", - transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", - transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", - transaction_to_ASC = "transaction_to_ASC", - transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", - transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", - transaction_to_DESC = "transaction_to_DESC", - transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", - transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", - transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", - transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", - transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", - transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", - transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", - transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", + amountInAfterFees_ASC = 'amountInAfterFees_ASC', + amountInAfterFees_ASC_NULLS_FIRST = 'amountInAfterFees_ASC_NULLS_FIRST', + amountInAfterFees_ASC_NULLS_LAST = 'amountInAfterFees_ASC_NULLS_LAST', + amountInAfterFees_DESC = 'amountInAfterFees_DESC', + amountInAfterFees_DESC_NULLS_FIRST = 'amountInAfterFees_DESC_NULLS_FIRST', + amountInAfterFees_DESC_NULLS_LAST = 'amountInAfterFees_DESC_NULLS_LAST', + amountIn_ASC = 'amountIn_ASC', + amountIn_ASC_NULLS_FIRST = 'amountIn_ASC_NULLS_FIRST', + amountIn_ASC_NULLS_LAST = 'amountIn_ASC_NULLS_LAST', + amountIn_DESC = 'amountIn_DESC', + amountIn_DESC_NULLS_FIRST = 'amountIn_DESC_NULLS_FIRST', + amountIn_DESC_NULLS_LAST = 'amountIn_DESC_NULLS_LAST', + amountOut_ASC = 'amountOut_ASC', + amountOut_ASC_NULLS_FIRST = 'amountOut_ASC_NULLS_FIRST', + amountOut_ASC_NULLS_LAST = 'amountOut_ASC_NULLS_LAST', + amountOut_DESC = 'amountOut_DESC', + amountOut_DESC_NULLS_FIRST = 'amountOut_DESC_NULLS_FIRST', + amountOut_DESC_NULLS_LAST = 'amountOut_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + orderKey_ASC = 'orderKey_ASC', + orderKey_ASC_NULLS_FIRST = 'orderKey_ASC_NULLS_FIRST', + orderKey_ASC_NULLS_LAST = 'orderKey_ASC_NULLS_LAST', + orderKey_DESC = 'orderKey_DESC', + orderKey_DESC_NULLS_FIRST = 'orderKey_DESC_NULLS_FIRST', + orderKey_DESC_NULLS_LAST = 'orderKey_DESC_NULLS_LAST', + priceImpactUsd_ASC = 'priceImpactUsd_ASC', + priceImpactUsd_ASC_NULLS_FIRST = 'priceImpactUsd_ASC_NULLS_FIRST', + priceImpactUsd_ASC_NULLS_LAST = 'priceImpactUsd_ASC_NULLS_LAST', + priceImpactUsd_DESC = 'priceImpactUsd_DESC', + priceImpactUsd_DESC_NULLS_FIRST = 'priceImpactUsd_DESC_NULLS_FIRST', + priceImpactUsd_DESC_NULLS_LAST = 'priceImpactUsd_DESC_NULLS_LAST', + receiver_ASC = 'receiver_ASC', + receiver_ASC_NULLS_FIRST = 'receiver_ASC_NULLS_FIRST', + receiver_ASC_NULLS_LAST = 'receiver_ASC_NULLS_LAST', + receiver_DESC = 'receiver_DESC', + receiver_DESC_NULLS_FIRST = 'receiver_DESC_NULLS_FIRST', + receiver_DESC_NULLS_LAST = 'receiver_DESC_NULLS_LAST', + tokenInAddress_ASC = 'tokenInAddress_ASC', + tokenInAddress_ASC_NULLS_FIRST = 'tokenInAddress_ASC_NULLS_FIRST', + tokenInAddress_ASC_NULLS_LAST = 'tokenInAddress_ASC_NULLS_LAST', + tokenInAddress_DESC = 'tokenInAddress_DESC', + tokenInAddress_DESC_NULLS_FIRST = 'tokenInAddress_DESC_NULLS_FIRST', + tokenInAddress_DESC_NULLS_LAST = 'tokenInAddress_DESC_NULLS_LAST', + tokenInPrice_ASC = 'tokenInPrice_ASC', + tokenInPrice_ASC_NULLS_FIRST = 'tokenInPrice_ASC_NULLS_FIRST', + tokenInPrice_ASC_NULLS_LAST = 'tokenInPrice_ASC_NULLS_LAST', + tokenInPrice_DESC = 'tokenInPrice_DESC', + tokenInPrice_DESC_NULLS_FIRST = 'tokenInPrice_DESC_NULLS_FIRST', + tokenInPrice_DESC_NULLS_LAST = 'tokenInPrice_DESC_NULLS_LAST', + tokenOutAddress_ASC = 'tokenOutAddress_ASC', + tokenOutAddress_ASC_NULLS_FIRST = 'tokenOutAddress_ASC_NULLS_FIRST', + tokenOutAddress_ASC_NULLS_LAST = 'tokenOutAddress_ASC_NULLS_LAST', + tokenOutAddress_DESC = 'tokenOutAddress_DESC', + tokenOutAddress_DESC_NULLS_FIRST = 'tokenOutAddress_DESC_NULLS_FIRST', + tokenOutAddress_DESC_NULLS_LAST = 'tokenOutAddress_DESC_NULLS_LAST', + tokenOutPrice_ASC = 'tokenOutPrice_ASC', + tokenOutPrice_ASC_NULLS_FIRST = 'tokenOutPrice_ASC_NULLS_FIRST', + tokenOutPrice_ASC_NULLS_LAST = 'tokenOutPrice_ASC_NULLS_LAST', + tokenOutPrice_DESC = 'tokenOutPrice_DESC', + tokenOutPrice_DESC_NULLS_FIRST = 'tokenOutPrice_DESC_NULLS_FIRST', + tokenOutPrice_DESC_NULLS_LAST = 'tokenOutPrice_DESC_NULLS_LAST', + transaction_blockNumber_ASC = 'transaction_blockNumber_ASC', + transaction_blockNumber_ASC_NULLS_FIRST = 'transaction_blockNumber_ASC_NULLS_FIRST', + transaction_blockNumber_ASC_NULLS_LAST = 'transaction_blockNumber_ASC_NULLS_LAST', + transaction_blockNumber_DESC = 'transaction_blockNumber_DESC', + transaction_blockNumber_DESC_NULLS_FIRST = 'transaction_blockNumber_DESC_NULLS_FIRST', + transaction_blockNumber_DESC_NULLS_LAST = 'transaction_blockNumber_DESC_NULLS_LAST', + transaction_from_ASC = 'transaction_from_ASC', + transaction_from_ASC_NULLS_FIRST = 'transaction_from_ASC_NULLS_FIRST', + transaction_from_ASC_NULLS_LAST = 'transaction_from_ASC_NULLS_LAST', + transaction_from_DESC = 'transaction_from_DESC', + transaction_from_DESC_NULLS_FIRST = 'transaction_from_DESC_NULLS_FIRST', + transaction_from_DESC_NULLS_LAST = 'transaction_from_DESC_NULLS_LAST', + transaction_hash_ASC = 'transaction_hash_ASC', + transaction_hash_ASC_NULLS_FIRST = 'transaction_hash_ASC_NULLS_FIRST', + transaction_hash_ASC_NULLS_LAST = 'transaction_hash_ASC_NULLS_LAST', + transaction_hash_DESC = 'transaction_hash_DESC', + transaction_hash_DESC_NULLS_FIRST = 'transaction_hash_DESC_NULLS_FIRST', + transaction_hash_DESC_NULLS_LAST = 'transaction_hash_DESC_NULLS_LAST', + transaction_id_ASC = 'transaction_id_ASC', + transaction_id_ASC_NULLS_FIRST = 'transaction_id_ASC_NULLS_FIRST', + transaction_id_ASC_NULLS_LAST = 'transaction_id_ASC_NULLS_LAST', + transaction_id_DESC = 'transaction_id_DESC', + transaction_id_DESC_NULLS_FIRST = 'transaction_id_DESC_NULLS_FIRST', + transaction_id_DESC_NULLS_LAST = 'transaction_id_DESC_NULLS_LAST', + transaction_timestamp_ASC = 'transaction_timestamp_ASC', + transaction_timestamp_ASC_NULLS_FIRST = 'transaction_timestamp_ASC_NULLS_FIRST', + transaction_timestamp_ASC_NULLS_LAST = 'transaction_timestamp_ASC_NULLS_LAST', + transaction_timestamp_DESC = 'transaction_timestamp_DESC', + transaction_timestamp_DESC_NULLS_FIRST = 'transaction_timestamp_DESC_NULLS_FIRST', + transaction_timestamp_DESC_NULLS_LAST = 'transaction_timestamp_DESC_NULLS_LAST', + transaction_to_ASC = 'transaction_to_ASC', + transaction_to_ASC_NULLS_FIRST = 'transaction_to_ASC_NULLS_FIRST', + transaction_to_ASC_NULLS_LAST = 'transaction_to_ASC_NULLS_LAST', + transaction_to_DESC = 'transaction_to_DESC', + transaction_to_DESC_NULLS_FIRST = 'transaction_to_DESC_NULLS_FIRST', + transaction_to_DESC_NULLS_LAST = 'transaction_to_DESC_NULLS_LAST', + transaction_transactionIndex_ASC = 'transaction_transactionIndex_ASC', + transaction_transactionIndex_ASC_NULLS_FIRST = 'transaction_transactionIndex_ASC_NULLS_FIRST', + transaction_transactionIndex_ASC_NULLS_LAST = 'transaction_transactionIndex_ASC_NULLS_LAST', + transaction_transactionIndex_DESC = 'transaction_transactionIndex_DESC', + transaction_transactionIndex_DESC_NULLS_FIRST = 'transaction_transactionIndex_DESC_NULLS_FIRST', + transaction_transactionIndex_DESC_NULLS_LAST = 'transaction_transactionIndex_DESC_NULLS_LAST' } export interface SwapInfoWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - amountInAfterFees_eq?: InputMaybe; - amountInAfterFees_gt?: InputMaybe; - amountInAfterFees_gte?: InputMaybe; - amountInAfterFees_in?: InputMaybe>; - amountInAfterFees_isNull?: InputMaybe; - amountInAfterFees_lt?: InputMaybe; - amountInAfterFees_lte?: InputMaybe; - amountInAfterFees_not_eq?: InputMaybe; - amountInAfterFees_not_in?: InputMaybe>; - amountIn_eq?: InputMaybe; - amountIn_gt?: InputMaybe; - amountIn_gte?: InputMaybe; - amountIn_in?: InputMaybe>; - amountIn_isNull?: InputMaybe; - amountIn_lt?: InputMaybe; - amountIn_lte?: InputMaybe; - amountIn_not_eq?: InputMaybe; - amountIn_not_in?: InputMaybe>; - amountOut_eq?: InputMaybe; - amountOut_gt?: InputMaybe; - amountOut_gte?: InputMaybe; - amountOut_in?: InputMaybe>; - amountOut_isNull?: InputMaybe; - amountOut_lt?: InputMaybe; - amountOut_lte?: InputMaybe; - amountOut_not_eq?: InputMaybe; - amountOut_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - orderKey_contains?: InputMaybe; - orderKey_containsInsensitive?: InputMaybe; - orderKey_endsWith?: InputMaybe; - orderKey_eq?: InputMaybe; - orderKey_gt?: InputMaybe; - orderKey_gte?: InputMaybe; - orderKey_in?: InputMaybe>; - orderKey_isNull?: InputMaybe; - orderKey_lt?: InputMaybe; - orderKey_lte?: InputMaybe; - orderKey_not_contains?: InputMaybe; - orderKey_not_containsInsensitive?: InputMaybe; - orderKey_not_endsWith?: InputMaybe; - orderKey_not_eq?: InputMaybe; - orderKey_not_in?: InputMaybe>; - orderKey_not_startsWith?: InputMaybe; - orderKey_startsWith?: InputMaybe; - priceImpactUsd_eq?: InputMaybe; - priceImpactUsd_gt?: InputMaybe; - priceImpactUsd_gte?: InputMaybe; - priceImpactUsd_in?: InputMaybe>; - priceImpactUsd_isNull?: InputMaybe; - priceImpactUsd_lt?: InputMaybe; - priceImpactUsd_lte?: InputMaybe; - priceImpactUsd_not_eq?: InputMaybe; - priceImpactUsd_not_in?: InputMaybe>; - receiver_contains?: InputMaybe; - receiver_containsInsensitive?: InputMaybe; - receiver_endsWith?: InputMaybe; - receiver_eq?: InputMaybe; - receiver_gt?: InputMaybe; - receiver_gte?: InputMaybe; - receiver_in?: InputMaybe>; - receiver_isNull?: InputMaybe; - receiver_lt?: InputMaybe; - receiver_lte?: InputMaybe; - receiver_not_contains?: InputMaybe; - receiver_not_containsInsensitive?: InputMaybe; - receiver_not_endsWith?: InputMaybe; - receiver_not_eq?: InputMaybe; - receiver_not_in?: InputMaybe>; - receiver_not_startsWith?: InputMaybe; - receiver_startsWith?: InputMaybe; - tokenInAddress_contains?: InputMaybe; - tokenInAddress_containsInsensitive?: InputMaybe; - tokenInAddress_endsWith?: InputMaybe; - tokenInAddress_eq?: InputMaybe; - tokenInAddress_gt?: InputMaybe; - tokenInAddress_gte?: InputMaybe; - tokenInAddress_in?: InputMaybe>; - tokenInAddress_isNull?: InputMaybe; - tokenInAddress_lt?: InputMaybe; - tokenInAddress_lte?: InputMaybe; - tokenInAddress_not_contains?: InputMaybe; - tokenInAddress_not_containsInsensitive?: InputMaybe; - tokenInAddress_not_endsWith?: InputMaybe; - tokenInAddress_not_eq?: InputMaybe; - tokenInAddress_not_in?: InputMaybe>; - tokenInAddress_not_startsWith?: InputMaybe; - tokenInAddress_startsWith?: InputMaybe; - tokenInPrice_eq?: InputMaybe; - tokenInPrice_gt?: InputMaybe; - tokenInPrice_gte?: InputMaybe; - tokenInPrice_in?: InputMaybe>; - tokenInPrice_isNull?: InputMaybe; - tokenInPrice_lt?: InputMaybe; - tokenInPrice_lte?: InputMaybe; - tokenInPrice_not_eq?: InputMaybe; - tokenInPrice_not_in?: InputMaybe>; - tokenOutAddress_contains?: InputMaybe; - tokenOutAddress_containsInsensitive?: InputMaybe; - tokenOutAddress_endsWith?: InputMaybe; - tokenOutAddress_eq?: InputMaybe; - tokenOutAddress_gt?: InputMaybe; - tokenOutAddress_gte?: InputMaybe; - tokenOutAddress_in?: InputMaybe>; - tokenOutAddress_isNull?: InputMaybe; - tokenOutAddress_lt?: InputMaybe; - tokenOutAddress_lte?: InputMaybe; - tokenOutAddress_not_contains?: InputMaybe; - tokenOutAddress_not_containsInsensitive?: InputMaybe; - tokenOutAddress_not_endsWith?: InputMaybe; - tokenOutAddress_not_eq?: InputMaybe; - tokenOutAddress_not_in?: InputMaybe>; - tokenOutAddress_not_startsWith?: InputMaybe; - tokenOutAddress_startsWith?: InputMaybe; - tokenOutPrice_eq?: InputMaybe; - tokenOutPrice_gt?: InputMaybe; - tokenOutPrice_gte?: InputMaybe; - tokenOutPrice_in?: InputMaybe>; - tokenOutPrice_isNull?: InputMaybe; - tokenOutPrice_lt?: InputMaybe; - tokenOutPrice_lte?: InputMaybe; - tokenOutPrice_not_eq?: InputMaybe; - tokenOutPrice_not_in?: InputMaybe>; + amountInAfterFees_eq?: InputMaybe; + amountInAfterFees_gt?: InputMaybe; + amountInAfterFees_gte?: InputMaybe; + amountInAfterFees_in?: InputMaybe>; + amountInAfterFees_isNull?: InputMaybe; + amountInAfterFees_lt?: InputMaybe; + amountInAfterFees_lte?: InputMaybe; + amountInAfterFees_not_eq?: InputMaybe; + amountInAfterFees_not_in?: InputMaybe>; + amountIn_eq?: InputMaybe; + amountIn_gt?: InputMaybe; + amountIn_gte?: InputMaybe; + amountIn_in?: InputMaybe>; + amountIn_isNull?: InputMaybe; + amountIn_lt?: InputMaybe; + amountIn_lte?: InputMaybe; + amountIn_not_eq?: InputMaybe; + amountIn_not_in?: InputMaybe>; + amountOut_eq?: InputMaybe; + amountOut_gt?: InputMaybe; + amountOut_gte?: InputMaybe; + amountOut_in?: InputMaybe>; + amountOut_isNull?: InputMaybe; + amountOut_lt?: InputMaybe; + amountOut_lte?: InputMaybe; + amountOut_not_eq?: InputMaybe; + amountOut_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + orderKey_contains?: InputMaybe; + orderKey_containsInsensitive?: InputMaybe; + orderKey_endsWith?: InputMaybe; + orderKey_eq?: InputMaybe; + orderKey_gt?: InputMaybe; + orderKey_gte?: InputMaybe; + orderKey_in?: InputMaybe>; + orderKey_isNull?: InputMaybe; + orderKey_lt?: InputMaybe; + orderKey_lte?: InputMaybe; + orderKey_not_contains?: InputMaybe; + orderKey_not_containsInsensitive?: InputMaybe; + orderKey_not_endsWith?: InputMaybe; + orderKey_not_eq?: InputMaybe; + orderKey_not_in?: InputMaybe>; + orderKey_not_startsWith?: InputMaybe; + orderKey_startsWith?: InputMaybe; + priceImpactUsd_eq?: InputMaybe; + priceImpactUsd_gt?: InputMaybe; + priceImpactUsd_gte?: InputMaybe; + priceImpactUsd_in?: InputMaybe>; + priceImpactUsd_isNull?: InputMaybe; + priceImpactUsd_lt?: InputMaybe; + priceImpactUsd_lte?: InputMaybe; + priceImpactUsd_not_eq?: InputMaybe; + priceImpactUsd_not_in?: InputMaybe>; + receiver_contains?: InputMaybe; + receiver_containsInsensitive?: InputMaybe; + receiver_endsWith?: InputMaybe; + receiver_eq?: InputMaybe; + receiver_gt?: InputMaybe; + receiver_gte?: InputMaybe; + receiver_in?: InputMaybe>; + receiver_isNull?: InputMaybe; + receiver_lt?: InputMaybe; + receiver_lte?: InputMaybe; + receiver_not_contains?: InputMaybe; + receiver_not_containsInsensitive?: InputMaybe; + receiver_not_endsWith?: InputMaybe; + receiver_not_eq?: InputMaybe; + receiver_not_in?: InputMaybe>; + receiver_not_startsWith?: InputMaybe; + receiver_startsWith?: InputMaybe; + tokenInAddress_contains?: InputMaybe; + tokenInAddress_containsInsensitive?: InputMaybe; + tokenInAddress_endsWith?: InputMaybe; + tokenInAddress_eq?: InputMaybe; + tokenInAddress_gt?: InputMaybe; + tokenInAddress_gte?: InputMaybe; + tokenInAddress_in?: InputMaybe>; + tokenInAddress_isNull?: InputMaybe; + tokenInAddress_lt?: InputMaybe; + tokenInAddress_lte?: InputMaybe; + tokenInAddress_not_contains?: InputMaybe; + tokenInAddress_not_containsInsensitive?: InputMaybe; + tokenInAddress_not_endsWith?: InputMaybe; + tokenInAddress_not_eq?: InputMaybe; + tokenInAddress_not_in?: InputMaybe>; + tokenInAddress_not_startsWith?: InputMaybe; + tokenInAddress_startsWith?: InputMaybe; + tokenInPrice_eq?: InputMaybe; + tokenInPrice_gt?: InputMaybe; + tokenInPrice_gte?: InputMaybe; + tokenInPrice_in?: InputMaybe>; + tokenInPrice_isNull?: InputMaybe; + tokenInPrice_lt?: InputMaybe; + tokenInPrice_lte?: InputMaybe; + tokenInPrice_not_eq?: InputMaybe; + tokenInPrice_not_in?: InputMaybe>; + tokenOutAddress_contains?: InputMaybe; + tokenOutAddress_containsInsensitive?: InputMaybe; + tokenOutAddress_endsWith?: InputMaybe; + tokenOutAddress_eq?: InputMaybe; + tokenOutAddress_gt?: InputMaybe; + tokenOutAddress_gte?: InputMaybe; + tokenOutAddress_in?: InputMaybe>; + tokenOutAddress_isNull?: InputMaybe; + tokenOutAddress_lt?: InputMaybe; + tokenOutAddress_lte?: InputMaybe; + tokenOutAddress_not_contains?: InputMaybe; + tokenOutAddress_not_containsInsensitive?: InputMaybe; + tokenOutAddress_not_endsWith?: InputMaybe; + tokenOutAddress_not_eq?: InputMaybe; + tokenOutAddress_not_in?: InputMaybe>; + tokenOutAddress_not_startsWith?: InputMaybe; + tokenOutAddress_startsWith?: InputMaybe; + tokenOutPrice_eq?: InputMaybe; + tokenOutPrice_gt?: InputMaybe; + tokenOutPrice_gte?: InputMaybe; + tokenOutPrice_in?: InputMaybe>; + tokenOutPrice_isNull?: InputMaybe; + tokenOutPrice_lt?: InputMaybe; + tokenOutPrice_lte?: InputMaybe; + tokenOutPrice_not_eq?: InputMaybe; + tokenOutPrice_not_in?: InputMaybe>; transaction?: InputMaybe; - transaction_isNull?: InputMaybe; + transaction_isNull?: InputMaybe; } export interface SwapInfosConnection { - __typename?: "SwapInfosConnection"; + __typename?: 'SwapInfosConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface TradeAction { - __typename?: "TradeAction"; - acceptablePrice?: Maybe; - account: Scalars["String"]["output"]; - basePnlUsd?: Maybe; - borrowingFeeAmount?: Maybe; - collateralTokenPriceMax?: Maybe; - collateralTokenPriceMin?: Maybe; - contractTriggerPrice?: Maybe; - eventName: Scalars["String"]["output"]; - executionAmountOut?: Maybe; - executionPrice?: Maybe; - fundingFeeAmount?: Maybe; - id: Scalars["String"]["output"]; - indexTokenPriceMax?: Maybe; - indexTokenPriceMin?: Maybe; - initialCollateralDeltaAmount: Scalars["BigInt"]["output"]; - initialCollateralTokenAddress: Scalars["String"]["output"]; - isLong?: Maybe; - liquidationFeeAmount?: Maybe; - marketAddress?: Maybe; - minOutputAmount?: Maybe; - numberOfParts?: Maybe; - orderKey: Scalars["String"]["output"]; - orderType: Scalars["Int"]["output"]; - pnlUsd?: Maybe; - positionFeeAmount?: Maybe; - priceImpactAmount?: Maybe; - priceImpactDiffUsd?: Maybe; - priceImpactUsd?: Maybe; - proportionalPendingImpactUsd?: Maybe; - reason?: Maybe; - reasonBytes?: Maybe; - shouldUnwrapNativeToken?: Maybe; - sizeDeltaUsd?: Maybe; - srcChainId?: Maybe; - swapPath: Array; - timestamp: Scalars["Int"]["output"]; - totalImpactUsd?: Maybe; + __typename?: 'TradeAction'; + acceptablePrice?: Maybe; + account: Scalars['String']['output']; + basePnlUsd?: Maybe; + borrowingFeeAmount?: Maybe; + collateralTokenPriceMax?: Maybe; + collateralTokenPriceMin?: Maybe; + contractTriggerPrice?: Maybe; + eventName: Scalars['String']['output']; + executionAmountOut?: Maybe; + executionPrice?: Maybe; + fundingFeeAmount?: Maybe; + id: Scalars['String']['output']; + indexTokenPriceMax?: Maybe; + indexTokenPriceMin?: Maybe; + initialCollateralDeltaAmount: Scalars['BigInt']['output']; + initialCollateralTokenAddress: Scalars['String']['output']; + isLong?: Maybe; + liquidationFeeAmount?: Maybe; + marketAddress?: Maybe; + minOutputAmount?: Maybe; + numberOfParts?: Maybe; + orderKey: Scalars['String']['output']; + orderType: Scalars['Int']['output']; + pnlUsd?: Maybe; + positionFeeAmount?: Maybe; + priceImpactAmount?: Maybe; + priceImpactDiffUsd?: Maybe; + priceImpactUsd?: Maybe; + proportionalPendingImpactUsd?: Maybe; + reason?: Maybe; + reasonBytes?: Maybe; + shouldUnwrapNativeToken?: Maybe; + sizeDeltaUsd?: Maybe; + srcChainId?: Maybe; + swapPath: Array; + timestamp: Scalars['Int']['output']; + totalImpactUsd?: Maybe; transaction: Transaction; - triggerPrice?: Maybe; - twapGroupId?: Maybe; - uiFeeReceiver: Scalars["String"]["output"]; + triggerPrice?: Maybe; + twapGroupId?: Maybe; + uiFeeReceiver: Scalars['String']['output']; } export interface TradeActionEdge { - __typename?: "TradeActionEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'TradeActionEdge'; + cursor: Scalars['String']['output']; node: TradeAction; } export enum TradeActionOrderByInput { - acceptablePrice_ASC = "acceptablePrice_ASC", - acceptablePrice_ASC_NULLS_FIRST = "acceptablePrice_ASC_NULLS_FIRST", - acceptablePrice_ASC_NULLS_LAST = "acceptablePrice_ASC_NULLS_LAST", - acceptablePrice_DESC = "acceptablePrice_DESC", - acceptablePrice_DESC_NULLS_FIRST = "acceptablePrice_DESC_NULLS_FIRST", - acceptablePrice_DESC_NULLS_LAST = "acceptablePrice_DESC_NULLS_LAST", - account_ASC = "account_ASC", - account_ASC_NULLS_FIRST = "account_ASC_NULLS_FIRST", - account_ASC_NULLS_LAST = "account_ASC_NULLS_LAST", - account_DESC = "account_DESC", - account_DESC_NULLS_FIRST = "account_DESC_NULLS_FIRST", - account_DESC_NULLS_LAST = "account_DESC_NULLS_LAST", - basePnlUsd_ASC = "basePnlUsd_ASC", - basePnlUsd_ASC_NULLS_FIRST = "basePnlUsd_ASC_NULLS_FIRST", - basePnlUsd_ASC_NULLS_LAST = "basePnlUsd_ASC_NULLS_LAST", - basePnlUsd_DESC = "basePnlUsd_DESC", - basePnlUsd_DESC_NULLS_FIRST = "basePnlUsd_DESC_NULLS_FIRST", - basePnlUsd_DESC_NULLS_LAST = "basePnlUsd_DESC_NULLS_LAST", - borrowingFeeAmount_ASC = "borrowingFeeAmount_ASC", - borrowingFeeAmount_ASC_NULLS_FIRST = "borrowingFeeAmount_ASC_NULLS_FIRST", - borrowingFeeAmount_ASC_NULLS_LAST = "borrowingFeeAmount_ASC_NULLS_LAST", - borrowingFeeAmount_DESC = "borrowingFeeAmount_DESC", - borrowingFeeAmount_DESC_NULLS_FIRST = "borrowingFeeAmount_DESC_NULLS_FIRST", - borrowingFeeAmount_DESC_NULLS_LAST = "borrowingFeeAmount_DESC_NULLS_LAST", - collateralTokenPriceMax_ASC = "collateralTokenPriceMax_ASC", - collateralTokenPriceMax_ASC_NULLS_FIRST = "collateralTokenPriceMax_ASC_NULLS_FIRST", - collateralTokenPriceMax_ASC_NULLS_LAST = "collateralTokenPriceMax_ASC_NULLS_LAST", - collateralTokenPriceMax_DESC = "collateralTokenPriceMax_DESC", - collateralTokenPriceMax_DESC_NULLS_FIRST = "collateralTokenPriceMax_DESC_NULLS_FIRST", - collateralTokenPriceMax_DESC_NULLS_LAST = "collateralTokenPriceMax_DESC_NULLS_LAST", - collateralTokenPriceMin_ASC = "collateralTokenPriceMin_ASC", - collateralTokenPriceMin_ASC_NULLS_FIRST = "collateralTokenPriceMin_ASC_NULLS_FIRST", - collateralTokenPriceMin_ASC_NULLS_LAST = "collateralTokenPriceMin_ASC_NULLS_LAST", - collateralTokenPriceMin_DESC = "collateralTokenPriceMin_DESC", - collateralTokenPriceMin_DESC_NULLS_FIRST = "collateralTokenPriceMin_DESC_NULLS_FIRST", - collateralTokenPriceMin_DESC_NULLS_LAST = "collateralTokenPriceMin_DESC_NULLS_LAST", - contractTriggerPrice_ASC = "contractTriggerPrice_ASC", - contractTriggerPrice_ASC_NULLS_FIRST = "contractTriggerPrice_ASC_NULLS_FIRST", - contractTriggerPrice_ASC_NULLS_LAST = "contractTriggerPrice_ASC_NULLS_LAST", - contractTriggerPrice_DESC = "contractTriggerPrice_DESC", - contractTriggerPrice_DESC_NULLS_FIRST = "contractTriggerPrice_DESC_NULLS_FIRST", - contractTriggerPrice_DESC_NULLS_LAST = "contractTriggerPrice_DESC_NULLS_LAST", - eventName_ASC = "eventName_ASC", - eventName_ASC_NULLS_FIRST = "eventName_ASC_NULLS_FIRST", - eventName_ASC_NULLS_LAST = "eventName_ASC_NULLS_LAST", - eventName_DESC = "eventName_DESC", - eventName_DESC_NULLS_FIRST = "eventName_DESC_NULLS_FIRST", - eventName_DESC_NULLS_LAST = "eventName_DESC_NULLS_LAST", - executionAmountOut_ASC = "executionAmountOut_ASC", - executionAmountOut_ASC_NULLS_FIRST = "executionAmountOut_ASC_NULLS_FIRST", - executionAmountOut_ASC_NULLS_LAST = "executionAmountOut_ASC_NULLS_LAST", - executionAmountOut_DESC = "executionAmountOut_DESC", - executionAmountOut_DESC_NULLS_FIRST = "executionAmountOut_DESC_NULLS_FIRST", - executionAmountOut_DESC_NULLS_LAST = "executionAmountOut_DESC_NULLS_LAST", - executionPrice_ASC = "executionPrice_ASC", - executionPrice_ASC_NULLS_FIRST = "executionPrice_ASC_NULLS_FIRST", - executionPrice_ASC_NULLS_LAST = "executionPrice_ASC_NULLS_LAST", - executionPrice_DESC = "executionPrice_DESC", - executionPrice_DESC_NULLS_FIRST = "executionPrice_DESC_NULLS_FIRST", - executionPrice_DESC_NULLS_LAST = "executionPrice_DESC_NULLS_LAST", - fundingFeeAmount_ASC = "fundingFeeAmount_ASC", - fundingFeeAmount_ASC_NULLS_FIRST = "fundingFeeAmount_ASC_NULLS_FIRST", - fundingFeeAmount_ASC_NULLS_LAST = "fundingFeeAmount_ASC_NULLS_LAST", - fundingFeeAmount_DESC = "fundingFeeAmount_DESC", - fundingFeeAmount_DESC_NULLS_FIRST = "fundingFeeAmount_DESC_NULLS_FIRST", - fundingFeeAmount_DESC_NULLS_LAST = "fundingFeeAmount_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - indexTokenPriceMax_ASC = "indexTokenPriceMax_ASC", - indexTokenPriceMax_ASC_NULLS_FIRST = "indexTokenPriceMax_ASC_NULLS_FIRST", - indexTokenPriceMax_ASC_NULLS_LAST = "indexTokenPriceMax_ASC_NULLS_LAST", - indexTokenPriceMax_DESC = "indexTokenPriceMax_DESC", - indexTokenPriceMax_DESC_NULLS_FIRST = "indexTokenPriceMax_DESC_NULLS_FIRST", - indexTokenPriceMax_DESC_NULLS_LAST = "indexTokenPriceMax_DESC_NULLS_LAST", - indexTokenPriceMin_ASC = "indexTokenPriceMin_ASC", - indexTokenPriceMin_ASC_NULLS_FIRST = "indexTokenPriceMin_ASC_NULLS_FIRST", - indexTokenPriceMin_ASC_NULLS_LAST = "indexTokenPriceMin_ASC_NULLS_LAST", - indexTokenPriceMin_DESC = "indexTokenPriceMin_DESC", - indexTokenPriceMin_DESC_NULLS_FIRST = "indexTokenPriceMin_DESC_NULLS_FIRST", - indexTokenPriceMin_DESC_NULLS_LAST = "indexTokenPriceMin_DESC_NULLS_LAST", - initialCollateralDeltaAmount_ASC = "initialCollateralDeltaAmount_ASC", - initialCollateralDeltaAmount_ASC_NULLS_FIRST = "initialCollateralDeltaAmount_ASC_NULLS_FIRST", - initialCollateralDeltaAmount_ASC_NULLS_LAST = "initialCollateralDeltaAmount_ASC_NULLS_LAST", - initialCollateralDeltaAmount_DESC = "initialCollateralDeltaAmount_DESC", - initialCollateralDeltaAmount_DESC_NULLS_FIRST = "initialCollateralDeltaAmount_DESC_NULLS_FIRST", - initialCollateralDeltaAmount_DESC_NULLS_LAST = "initialCollateralDeltaAmount_DESC_NULLS_LAST", - initialCollateralTokenAddress_ASC = "initialCollateralTokenAddress_ASC", - initialCollateralTokenAddress_ASC_NULLS_FIRST = "initialCollateralTokenAddress_ASC_NULLS_FIRST", - initialCollateralTokenAddress_ASC_NULLS_LAST = "initialCollateralTokenAddress_ASC_NULLS_LAST", - initialCollateralTokenAddress_DESC = "initialCollateralTokenAddress_DESC", - initialCollateralTokenAddress_DESC_NULLS_FIRST = "initialCollateralTokenAddress_DESC_NULLS_FIRST", - initialCollateralTokenAddress_DESC_NULLS_LAST = "initialCollateralTokenAddress_DESC_NULLS_LAST", - isLong_ASC = "isLong_ASC", - isLong_ASC_NULLS_FIRST = "isLong_ASC_NULLS_FIRST", - isLong_ASC_NULLS_LAST = "isLong_ASC_NULLS_LAST", - isLong_DESC = "isLong_DESC", - isLong_DESC_NULLS_FIRST = "isLong_DESC_NULLS_FIRST", - isLong_DESC_NULLS_LAST = "isLong_DESC_NULLS_LAST", - liquidationFeeAmount_ASC = "liquidationFeeAmount_ASC", - liquidationFeeAmount_ASC_NULLS_FIRST = "liquidationFeeAmount_ASC_NULLS_FIRST", - liquidationFeeAmount_ASC_NULLS_LAST = "liquidationFeeAmount_ASC_NULLS_LAST", - liquidationFeeAmount_DESC = "liquidationFeeAmount_DESC", - liquidationFeeAmount_DESC_NULLS_FIRST = "liquidationFeeAmount_DESC_NULLS_FIRST", - liquidationFeeAmount_DESC_NULLS_LAST = "liquidationFeeAmount_DESC_NULLS_LAST", - marketAddress_ASC = "marketAddress_ASC", - marketAddress_ASC_NULLS_FIRST = "marketAddress_ASC_NULLS_FIRST", - marketAddress_ASC_NULLS_LAST = "marketAddress_ASC_NULLS_LAST", - marketAddress_DESC = "marketAddress_DESC", - marketAddress_DESC_NULLS_FIRST = "marketAddress_DESC_NULLS_FIRST", - marketAddress_DESC_NULLS_LAST = "marketAddress_DESC_NULLS_LAST", - minOutputAmount_ASC = "minOutputAmount_ASC", - minOutputAmount_ASC_NULLS_FIRST = "minOutputAmount_ASC_NULLS_FIRST", - minOutputAmount_ASC_NULLS_LAST = "minOutputAmount_ASC_NULLS_LAST", - minOutputAmount_DESC = "minOutputAmount_DESC", - minOutputAmount_DESC_NULLS_FIRST = "minOutputAmount_DESC_NULLS_FIRST", - minOutputAmount_DESC_NULLS_LAST = "minOutputAmount_DESC_NULLS_LAST", - numberOfParts_ASC = "numberOfParts_ASC", - numberOfParts_ASC_NULLS_FIRST = "numberOfParts_ASC_NULLS_FIRST", - numberOfParts_ASC_NULLS_LAST = "numberOfParts_ASC_NULLS_LAST", - numberOfParts_DESC = "numberOfParts_DESC", - numberOfParts_DESC_NULLS_FIRST = "numberOfParts_DESC_NULLS_FIRST", - numberOfParts_DESC_NULLS_LAST = "numberOfParts_DESC_NULLS_LAST", - orderKey_ASC = "orderKey_ASC", - orderKey_ASC_NULLS_FIRST = "orderKey_ASC_NULLS_FIRST", - orderKey_ASC_NULLS_LAST = "orderKey_ASC_NULLS_LAST", - orderKey_DESC = "orderKey_DESC", - orderKey_DESC_NULLS_FIRST = "orderKey_DESC_NULLS_FIRST", - orderKey_DESC_NULLS_LAST = "orderKey_DESC_NULLS_LAST", - orderType_ASC = "orderType_ASC", - orderType_ASC_NULLS_FIRST = "orderType_ASC_NULLS_FIRST", - orderType_ASC_NULLS_LAST = "orderType_ASC_NULLS_LAST", - orderType_DESC = "orderType_DESC", - orderType_DESC_NULLS_FIRST = "orderType_DESC_NULLS_FIRST", - orderType_DESC_NULLS_LAST = "orderType_DESC_NULLS_LAST", - pnlUsd_ASC = "pnlUsd_ASC", - pnlUsd_ASC_NULLS_FIRST = "pnlUsd_ASC_NULLS_FIRST", - pnlUsd_ASC_NULLS_LAST = "pnlUsd_ASC_NULLS_LAST", - pnlUsd_DESC = "pnlUsd_DESC", - pnlUsd_DESC_NULLS_FIRST = "pnlUsd_DESC_NULLS_FIRST", - pnlUsd_DESC_NULLS_LAST = "pnlUsd_DESC_NULLS_LAST", - positionFeeAmount_ASC = "positionFeeAmount_ASC", - positionFeeAmount_ASC_NULLS_FIRST = "positionFeeAmount_ASC_NULLS_FIRST", - positionFeeAmount_ASC_NULLS_LAST = "positionFeeAmount_ASC_NULLS_LAST", - positionFeeAmount_DESC = "positionFeeAmount_DESC", - positionFeeAmount_DESC_NULLS_FIRST = "positionFeeAmount_DESC_NULLS_FIRST", - positionFeeAmount_DESC_NULLS_LAST = "positionFeeAmount_DESC_NULLS_LAST", - priceImpactAmount_ASC = "priceImpactAmount_ASC", - priceImpactAmount_ASC_NULLS_FIRST = "priceImpactAmount_ASC_NULLS_FIRST", - priceImpactAmount_ASC_NULLS_LAST = "priceImpactAmount_ASC_NULLS_LAST", - priceImpactAmount_DESC = "priceImpactAmount_DESC", - priceImpactAmount_DESC_NULLS_FIRST = "priceImpactAmount_DESC_NULLS_FIRST", - priceImpactAmount_DESC_NULLS_LAST = "priceImpactAmount_DESC_NULLS_LAST", - priceImpactDiffUsd_ASC = "priceImpactDiffUsd_ASC", - priceImpactDiffUsd_ASC_NULLS_FIRST = "priceImpactDiffUsd_ASC_NULLS_FIRST", - priceImpactDiffUsd_ASC_NULLS_LAST = "priceImpactDiffUsd_ASC_NULLS_LAST", - priceImpactDiffUsd_DESC = "priceImpactDiffUsd_DESC", - priceImpactDiffUsd_DESC_NULLS_FIRST = "priceImpactDiffUsd_DESC_NULLS_FIRST", - priceImpactDiffUsd_DESC_NULLS_LAST = "priceImpactDiffUsd_DESC_NULLS_LAST", - priceImpactUsd_ASC = "priceImpactUsd_ASC", - priceImpactUsd_ASC_NULLS_FIRST = "priceImpactUsd_ASC_NULLS_FIRST", - priceImpactUsd_ASC_NULLS_LAST = "priceImpactUsd_ASC_NULLS_LAST", - priceImpactUsd_DESC = "priceImpactUsd_DESC", - priceImpactUsd_DESC_NULLS_FIRST = "priceImpactUsd_DESC_NULLS_FIRST", - priceImpactUsd_DESC_NULLS_LAST = "priceImpactUsd_DESC_NULLS_LAST", - proportionalPendingImpactUsd_ASC = "proportionalPendingImpactUsd_ASC", - proportionalPendingImpactUsd_ASC_NULLS_FIRST = "proportionalPendingImpactUsd_ASC_NULLS_FIRST", - proportionalPendingImpactUsd_ASC_NULLS_LAST = "proportionalPendingImpactUsd_ASC_NULLS_LAST", - proportionalPendingImpactUsd_DESC = "proportionalPendingImpactUsd_DESC", - proportionalPendingImpactUsd_DESC_NULLS_FIRST = "proportionalPendingImpactUsd_DESC_NULLS_FIRST", - proportionalPendingImpactUsd_DESC_NULLS_LAST = "proportionalPendingImpactUsd_DESC_NULLS_LAST", - reasonBytes_ASC = "reasonBytes_ASC", - reasonBytes_ASC_NULLS_FIRST = "reasonBytes_ASC_NULLS_FIRST", - reasonBytes_ASC_NULLS_LAST = "reasonBytes_ASC_NULLS_LAST", - reasonBytes_DESC = "reasonBytes_DESC", - reasonBytes_DESC_NULLS_FIRST = "reasonBytes_DESC_NULLS_FIRST", - reasonBytes_DESC_NULLS_LAST = "reasonBytes_DESC_NULLS_LAST", - reason_ASC = "reason_ASC", - reason_ASC_NULLS_FIRST = "reason_ASC_NULLS_FIRST", - reason_ASC_NULLS_LAST = "reason_ASC_NULLS_LAST", - reason_DESC = "reason_DESC", - reason_DESC_NULLS_FIRST = "reason_DESC_NULLS_FIRST", - reason_DESC_NULLS_LAST = "reason_DESC_NULLS_LAST", - shouldUnwrapNativeToken_ASC = "shouldUnwrapNativeToken_ASC", - shouldUnwrapNativeToken_ASC_NULLS_FIRST = "shouldUnwrapNativeToken_ASC_NULLS_FIRST", - shouldUnwrapNativeToken_ASC_NULLS_LAST = "shouldUnwrapNativeToken_ASC_NULLS_LAST", - shouldUnwrapNativeToken_DESC = "shouldUnwrapNativeToken_DESC", - shouldUnwrapNativeToken_DESC_NULLS_FIRST = "shouldUnwrapNativeToken_DESC_NULLS_FIRST", - shouldUnwrapNativeToken_DESC_NULLS_LAST = "shouldUnwrapNativeToken_DESC_NULLS_LAST", - sizeDeltaUsd_ASC = "sizeDeltaUsd_ASC", - sizeDeltaUsd_ASC_NULLS_FIRST = "sizeDeltaUsd_ASC_NULLS_FIRST", - sizeDeltaUsd_ASC_NULLS_LAST = "sizeDeltaUsd_ASC_NULLS_LAST", - sizeDeltaUsd_DESC = "sizeDeltaUsd_DESC", - sizeDeltaUsd_DESC_NULLS_FIRST = "sizeDeltaUsd_DESC_NULLS_FIRST", - sizeDeltaUsd_DESC_NULLS_LAST = "sizeDeltaUsd_DESC_NULLS_LAST", - srcChainId_ASC = "srcChainId_ASC", - srcChainId_ASC_NULLS_FIRST = "srcChainId_ASC_NULLS_FIRST", - srcChainId_ASC_NULLS_LAST = "srcChainId_ASC_NULLS_LAST", - srcChainId_DESC = "srcChainId_DESC", - srcChainId_DESC_NULLS_FIRST = "srcChainId_DESC_NULLS_FIRST", - srcChainId_DESC_NULLS_LAST = "srcChainId_DESC_NULLS_LAST", - timestamp_ASC = "timestamp_ASC", - timestamp_ASC_NULLS_FIRST = "timestamp_ASC_NULLS_FIRST", - timestamp_ASC_NULLS_LAST = "timestamp_ASC_NULLS_LAST", - timestamp_DESC = "timestamp_DESC", - timestamp_DESC_NULLS_FIRST = "timestamp_DESC_NULLS_FIRST", - timestamp_DESC_NULLS_LAST = "timestamp_DESC_NULLS_LAST", - totalImpactUsd_ASC = "totalImpactUsd_ASC", - totalImpactUsd_ASC_NULLS_FIRST = "totalImpactUsd_ASC_NULLS_FIRST", - totalImpactUsd_ASC_NULLS_LAST = "totalImpactUsd_ASC_NULLS_LAST", - totalImpactUsd_DESC = "totalImpactUsd_DESC", - totalImpactUsd_DESC_NULLS_FIRST = "totalImpactUsd_DESC_NULLS_FIRST", - totalImpactUsd_DESC_NULLS_LAST = "totalImpactUsd_DESC_NULLS_LAST", - transaction_blockNumber_ASC = "transaction_blockNumber_ASC", - transaction_blockNumber_ASC_NULLS_FIRST = "transaction_blockNumber_ASC_NULLS_FIRST", - transaction_blockNumber_ASC_NULLS_LAST = "transaction_blockNumber_ASC_NULLS_LAST", - transaction_blockNumber_DESC = "transaction_blockNumber_DESC", - transaction_blockNumber_DESC_NULLS_FIRST = "transaction_blockNumber_DESC_NULLS_FIRST", - transaction_blockNumber_DESC_NULLS_LAST = "transaction_blockNumber_DESC_NULLS_LAST", - transaction_chainId_ASC = "transaction_chainId_ASC", - transaction_chainId_ASC_NULLS_FIRST = "transaction_chainId_ASC_NULLS_FIRST", - transaction_chainId_ASC_NULLS_LAST = "transaction_chainId_ASC_NULLS_LAST", - transaction_chainId_DESC = "transaction_chainId_DESC", - transaction_chainId_DESC_NULLS_FIRST = "transaction_chainId_DESC_NULLS_FIRST", - transaction_chainId_DESC_NULLS_LAST = "transaction_chainId_DESC_NULLS_LAST", - transaction_from_ASC = "transaction_from_ASC", - transaction_from_ASC_NULLS_FIRST = "transaction_from_ASC_NULLS_FIRST", - transaction_from_ASC_NULLS_LAST = "transaction_from_ASC_NULLS_LAST", - transaction_from_DESC = "transaction_from_DESC", - transaction_from_DESC_NULLS_FIRST = "transaction_from_DESC_NULLS_FIRST", - transaction_from_DESC_NULLS_LAST = "transaction_from_DESC_NULLS_LAST", - transaction_hash_ASC = "transaction_hash_ASC", - transaction_hash_ASC_NULLS_FIRST = "transaction_hash_ASC_NULLS_FIRST", - transaction_hash_ASC_NULLS_LAST = "transaction_hash_ASC_NULLS_LAST", - transaction_hash_DESC = "transaction_hash_DESC", - transaction_hash_DESC_NULLS_FIRST = "transaction_hash_DESC_NULLS_FIRST", - transaction_hash_DESC_NULLS_LAST = "transaction_hash_DESC_NULLS_LAST", - transaction_id_ASC = "transaction_id_ASC", - transaction_id_ASC_NULLS_FIRST = "transaction_id_ASC_NULLS_FIRST", - transaction_id_ASC_NULLS_LAST = "transaction_id_ASC_NULLS_LAST", - transaction_id_DESC = "transaction_id_DESC", - transaction_id_DESC_NULLS_FIRST = "transaction_id_DESC_NULLS_FIRST", - transaction_id_DESC_NULLS_LAST = "transaction_id_DESC_NULLS_LAST", - transaction_timestamp_ASC = "transaction_timestamp_ASC", - transaction_timestamp_ASC_NULLS_FIRST = "transaction_timestamp_ASC_NULLS_FIRST", - transaction_timestamp_ASC_NULLS_LAST = "transaction_timestamp_ASC_NULLS_LAST", - transaction_timestamp_DESC = "transaction_timestamp_DESC", - transaction_timestamp_DESC_NULLS_FIRST = "transaction_timestamp_DESC_NULLS_FIRST", - transaction_timestamp_DESC_NULLS_LAST = "transaction_timestamp_DESC_NULLS_LAST", - transaction_to_ASC = "transaction_to_ASC", - transaction_to_ASC_NULLS_FIRST = "transaction_to_ASC_NULLS_FIRST", - transaction_to_ASC_NULLS_LAST = "transaction_to_ASC_NULLS_LAST", - transaction_to_DESC = "transaction_to_DESC", - transaction_to_DESC_NULLS_FIRST = "transaction_to_DESC_NULLS_FIRST", - transaction_to_DESC_NULLS_LAST = "transaction_to_DESC_NULLS_LAST", - transaction_transactionIndex_ASC = "transaction_transactionIndex_ASC", - transaction_transactionIndex_ASC_NULLS_FIRST = "transaction_transactionIndex_ASC_NULLS_FIRST", - transaction_transactionIndex_ASC_NULLS_LAST = "transaction_transactionIndex_ASC_NULLS_LAST", - transaction_transactionIndex_DESC = "transaction_transactionIndex_DESC", - transaction_transactionIndex_DESC_NULLS_FIRST = "transaction_transactionIndex_DESC_NULLS_FIRST", - transaction_transactionIndex_DESC_NULLS_LAST = "transaction_transactionIndex_DESC_NULLS_LAST", - triggerPrice_ASC = "triggerPrice_ASC", - triggerPrice_ASC_NULLS_FIRST = "triggerPrice_ASC_NULLS_FIRST", - triggerPrice_ASC_NULLS_LAST = "triggerPrice_ASC_NULLS_LAST", - triggerPrice_DESC = "triggerPrice_DESC", - triggerPrice_DESC_NULLS_FIRST = "triggerPrice_DESC_NULLS_FIRST", - triggerPrice_DESC_NULLS_LAST = "triggerPrice_DESC_NULLS_LAST", - twapGroupId_ASC = "twapGroupId_ASC", - twapGroupId_ASC_NULLS_FIRST = "twapGroupId_ASC_NULLS_FIRST", - twapGroupId_ASC_NULLS_LAST = "twapGroupId_ASC_NULLS_LAST", - twapGroupId_DESC = "twapGroupId_DESC", - twapGroupId_DESC_NULLS_FIRST = "twapGroupId_DESC_NULLS_FIRST", - twapGroupId_DESC_NULLS_LAST = "twapGroupId_DESC_NULLS_LAST", - uiFeeReceiver_ASC = "uiFeeReceiver_ASC", - uiFeeReceiver_ASC_NULLS_FIRST = "uiFeeReceiver_ASC_NULLS_FIRST", - uiFeeReceiver_ASC_NULLS_LAST = "uiFeeReceiver_ASC_NULLS_LAST", - uiFeeReceiver_DESC = "uiFeeReceiver_DESC", - uiFeeReceiver_DESC_NULLS_FIRST = "uiFeeReceiver_DESC_NULLS_FIRST", - uiFeeReceiver_DESC_NULLS_LAST = "uiFeeReceiver_DESC_NULLS_LAST", + acceptablePrice_ASC = 'acceptablePrice_ASC', + acceptablePrice_ASC_NULLS_FIRST = 'acceptablePrice_ASC_NULLS_FIRST', + acceptablePrice_ASC_NULLS_LAST = 'acceptablePrice_ASC_NULLS_LAST', + acceptablePrice_DESC = 'acceptablePrice_DESC', + acceptablePrice_DESC_NULLS_FIRST = 'acceptablePrice_DESC_NULLS_FIRST', + acceptablePrice_DESC_NULLS_LAST = 'acceptablePrice_DESC_NULLS_LAST', + account_ASC = 'account_ASC', + account_ASC_NULLS_FIRST = 'account_ASC_NULLS_FIRST', + account_ASC_NULLS_LAST = 'account_ASC_NULLS_LAST', + account_DESC = 'account_DESC', + account_DESC_NULLS_FIRST = 'account_DESC_NULLS_FIRST', + account_DESC_NULLS_LAST = 'account_DESC_NULLS_LAST', + basePnlUsd_ASC = 'basePnlUsd_ASC', + basePnlUsd_ASC_NULLS_FIRST = 'basePnlUsd_ASC_NULLS_FIRST', + basePnlUsd_ASC_NULLS_LAST = 'basePnlUsd_ASC_NULLS_LAST', + basePnlUsd_DESC = 'basePnlUsd_DESC', + basePnlUsd_DESC_NULLS_FIRST = 'basePnlUsd_DESC_NULLS_FIRST', + basePnlUsd_DESC_NULLS_LAST = 'basePnlUsd_DESC_NULLS_LAST', + borrowingFeeAmount_ASC = 'borrowingFeeAmount_ASC', + borrowingFeeAmount_ASC_NULLS_FIRST = 'borrowingFeeAmount_ASC_NULLS_FIRST', + borrowingFeeAmount_ASC_NULLS_LAST = 'borrowingFeeAmount_ASC_NULLS_LAST', + borrowingFeeAmount_DESC = 'borrowingFeeAmount_DESC', + borrowingFeeAmount_DESC_NULLS_FIRST = 'borrowingFeeAmount_DESC_NULLS_FIRST', + borrowingFeeAmount_DESC_NULLS_LAST = 'borrowingFeeAmount_DESC_NULLS_LAST', + collateralTokenPriceMax_ASC = 'collateralTokenPriceMax_ASC', + collateralTokenPriceMax_ASC_NULLS_FIRST = 'collateralTokenPriceMax_ASC_NULLS_FIRST', + collateralTokenPriceMax_ASC_NULLS_LAST = 'collateralTokenPriceMax_ASC_NULLS_LAST', + collateralTokenPriceMax_DESC = 'collateralTokenPriceMax_DESC', + collateralTokenPriceMax_DESC_NULLS_FIRST = 'collateralTokenPriceMax_DESC_NULLS_FIRST', + collateralTokenPriceMax_DESC_NULLS_LAST = 'collateralTokenPriceMax_DESC_NULLS_LAST', + collateralTokenPriceMin_ASC = 'collateralTokenPriceMin_ASC', + collateralTokenPriceMin_ASC_NULLS_FIRST = 'collateralTokenPriceMin_ASC_NULLS_FIRST', + collateralTokenPriceMin_ASC_NULLS_LAST = 'collateralTokenPriceMin_ASC_NULLS_LAST', + collateralTokenPriceMin_DESC = 'collateralTokenPriceMin_DESC', + collateralTokenPriceMin_DESC_NULLS_FIRST = 'collateralTokenPriceMin_DESC_NULLS_FIRST', + collateralTokenPriceMin_DESC_NULLS_LAST = 'collateralTokenPriceMin_DESC_NULLS_LAST', + contractTriggerPrice_ASC = 'contractTriggerPrice_ASC', + contractTriggerPrice_ASC_NULLS_FIRST = 'contractTriggerPrice_ASC_NULLS_FIRST', + contractTriggerPrice_ASC_NULLS_LAST = 'contractTriggerPrice_ASC_NULLS_LAST', + contractTriggerPrice_DESC = 'contractTriggerPrice_DESC', + contractTriggerPrice_DESC_NULLS_FIRST = 'contractTriggerPrice_DESC_NULLS_FIRST', + contractTriggerPrice_DESC_NULLS_LAST = 'contractTriggerPrice_DESC_NULLS_LAST', + eventName_ASC = 'eventName_ASC', + eventName_ASC_NULLS_FIRST = 'eventName_ASC_NULLS_FIRST', + eventName_ASC_NULLS_LAST = 'eventName_ASC_NULLS_LAST', + eventName_DESC = 'eventName_DESC', + eventName_DESC_NULLS_FIRST = 'eventName_DESC_NULLS_FIRST', + eventName_DESC_NULLS_LAST = 'eventName_DESC_NULLS_LAST', + executionAmountOut_ASC = 'executionAmountOut_ASC', + executionAmountOut_ASC_NULLS_FIRST = 'executionAmountOut_ASC_NULLS_FIRST', + executionAmountOut_ASC_NULLS_LAST = 'executionAmountOut_ASC_NULLS_LAST', + executionAmountOut_DESC = 'executionAmountOut_DESC', + executionAmountOut_DESC_NULLS_FIRST = 'executionAmountOut_DESC_NULLS_FIRST', + executionAmountOut_DESC_NULLS_LAST = 'executionAmountOut_DESC_NULLS_LAST', + executionPrice_ASC = 'executionPrice_ASC', + executionPrice_ASC_NULLS_FIRST = 'executionPrice_ASC_NULLS_FIRST', + executionPrice_ASC_NULLS_LAST = 'executionPrice_ASC_NULLS_LAST', + executionPrice_DESC = 'executionPrice_DESC', + executionPrice_DESC_NULLS_FIRST = 'executionPrice_DESC_NULLS_FIRST', + executionPrice_DESC_NULLS_LAST = 'executionPrice_DESC_NULLS_LAST', + fundingFeeAmount_ASC = 'fundingFeeAmount_ASC', + fundingFeeAmount_ASC_NULLS_FIRST = 'fundingFeeAmount_ASC_NULLS_FIRST', + fundingFeeAmount_ASC_NULLS_LAST = 'fundingFeeAmount_ASC_NULLS_LAST', + fundingFeeAmount_DESC = 'fundingFeeAmount_DESC', + fundingFeeAmount_DESC_NULLS_FIRST = 'fundingFeeAmount_DESC_NULLS_FIRST', + fundingFeeAmount_DESC_NULLS_LAST = 'fundingFeeAmount_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + indexTokenPriceMax_ASC = 'indexTokenPriceMax_ASC', + indexTokenPriceMax_ASC_NULLS_FIRST = 'indexTokenPriceMax_ASC_NULLS_FIRST', + indexTokenPriceMax_ASC_NULLS_LAST = 'indexTokenPriceMax_ASC_NULLS_LAST', + indexTokenPriceMax_DESC = 'indexTokenPriceMax_DESC', + indexTokenPriceMax_DESC_NULLS_FIRST = 'indexTokenPriceMax_DESC_NULLS_FIRST', + indexTokenPriceMax_DESC_NULLS_LAST = 'indexTokenPriceMax_DESC_NULLS_LAST', + indexTokenPriceMin_ASC = 'indexTokenPriceMin_ASC', + indexTokenPriceMin_ASC_NULLS_FIRST = 'indexTokenPriceMin_ASC_NULLS_FIRST', + indexTokenPriceMin_ASC_NULLS_LAST = 'indexTokenPriceMin_ASC_NULLS_LAST', + indexTokenPriceMin_DESC = 'indexTokenPriceMin_DESC', + indexTokenPriceMin_DESC_NULLS_FIRST = 'indexTokenPriceMin_DESC_NULLS_FIRST', + indexTokenPriceMin_DESC_NULLS_LAST = 'indexTokenPriceMin_DESC_NULLS_LAST', + initialCollateralDeltaAmount_ASC = 'initialCollateralDeltaAmount_ASC', + initialCollateralDeltaAmount_ASC_NULLS_FIRST = 'initialCollateralDeltaAmount_ASC_NULLS_FIRST', + initialCollateralDeltaAmount_ASC_NULLS_LAST = 'initialCollateralDeltaAmount_ASC_NULLS_LAST', + initialCollateralDeltaAmount_DESC = 'initialCollateralDeltaAmount_DESC', + initialCollateralDeltaAmount_DESC_NULLS_FIRST = 'initialCollateralDeltaAmount_DESC_NULLS_FIRST', + initialCollateralDeltaAmount_DESC_NULLS_LAST = 'initialCollateralDeltaAmount_DESC_NULLS_LAST', + initialCollateralTokenAddress_ASC = 'initialCollateralTokenAddress_ASC', + initialCollateralTokenAddress_ASC_NULLS_FIRST = 'initialCollateralTokenAddress_ASC_NULLS_FIRST', + initialCollateralTokenAddress_ASC_NULLS_LAST = 'initialCollateralTokenAddress_ASC_NULLS_LAST', + initialCollateralTokenAddress_DESC = 'initialCollateralTokenAddress_DESC', + initialCollateralTokenAddress_DESC_NULLS_FIRST = 'initialCollateralTokenAddress_DESC_NULLS_FIRST', + initialCollateralTokenAddress_DESC_NULLS_LAST = 'initialCollateralTokenAddress_DESC_NULLS_LAST', + isLong_ASC = 'isLong_ASC', + isLong_ASC_NULLS_FIRST = 'isLong_ASC_NULLS_FIRST', + isLong_ASC_NULLS_LAST = 'isLong_ASC_NULLS_LAST', + isLong_DESC = 'isLong_DESC', + isLong_DESC_NULLS_FIRST = 'isLong_DESC_NULLS_FIRST', + isLong_DESC_NULLS_LAST = 'isLong_DESC_NULLS_LAST', + liquidationFeeAmount_ASC = 'liquidationFeeAmount_ASC', + liquidationFeeAmount_ASC_NULLS_FIRST = 'liquidationFeeAmount_ASC_NULLS_FIRST', + liquidationFeeAmount_ASC_NULLS_LAST = 'liquidationFeeAmount_ASC_NULLS_LAST', + liquidationFeeAmount_DESC = 'liquidationFeeAmount_DESC', + liquidationFeeAmount_DESC_NULLS_FIRST = 'liquidationFeeAmount_DESC_NULLS_FIRST', + liquidationFeeAmount_DESC_NULLS_LAST = 'liquidationFeeAmount_DESC_NULLS_LAST', + marketAddress_ASC = 'marketAddress_ASC', + marketAddress_ASC_NULLS_FIRST = 'marketAddress_ASC_NULLS_FIRST', + marketAddress_ASC_NULLS_LAST = 'marketAddress_ASC_NULLS_LAST', + marketAddress_DESC = 'marketAddress_DESC', + marketAddress_DESC_NULLS_FIRST = 'marketAddress_DESC_NULLS_FIRST', + marketAddress_DESC_NULLS_LAST = 'marketAddress_DESC_NULLS_LAST', + minOutputAmount_ASC = 'minOutputAmount_ASC', + minOutputAmount_ASC_NULLS_FIRST = 'minOutputAmount_ASC_NULLS_FIRST', + minOutputAmount_ASC_NULLS_LAST = 'minOutputAmount_ASC_NULLS_LAST', + minOutputAmount_DESC = 'minOutputAmount_DESC', + minOutputAmount_DESC_NULLS_FIRST = 'minOutputAmount_DESC_NULLS_FIRST', + minOutputAmount_DESC_NULLS_LAST = 'minOutputAmount_DESC_NULLS_LAST', + numberOfParts_ASC = 'numberOfParts_ASC', + numberOfParts_ASC_NULLS_FIRST = 'numberOfParts_ASC_NULLS_FIRST', + numberOfParts_ASC_NULLS_LAST = 'numberOfParts_ASC_NULLS_LAST', + numberOfParts_DESC = 'numberOfParts_DESC', + numberOfParts_DESC_NULLS_FIRST = 'numberOfParts_DESC_NULLS_FIRST', + numberOfParts_DESC_NULLS_LAST = 'numberOfParts_DESC_NULLS_LAST', + orderKey_ASC = 'orderKey_ASC', + orderKey_ASC_NULLS_FIRST = 'orderKey_ASC_NULLS_FIRST', + orderKey_ASC_NULLS_LAST = 'orderKey_ASC_NULLS_LAST', + orderKey_DESC = 'orderKey_DESC', + orderKey_DESC_NULLS_FIRST = 'orderKey_DESC_NULLS_FIRST', + orderKey_DESC_NULLS_LAST = 'orderKey_DESC_NULLS_LAST', + orderType_ASC = 'orderType_ASC', + orderType_ASC_NULLS_FIRST = 'orderType_ASC_NULLS_FIRST', + orderType_ASC_NULLS_LAST = 'orderType_ASC_NULLS_LAST', + orderType_DESC = 'orderType_DESC', + orderType_DESC_NULLS_FIRST = 'orderType_DESC_NULLS_FIRST', + orderType_DESC_NULLS_LAST = 'orderType_DESC_NULLS_LAST', + pnlUsd_ASC = 'pnlUsd_ASC', + pnlUsd_ASC_NULLS_FIRST = 'pnlUsd_ASC_NULLS_FIRST', + pnlUsd_ASC_NULLS_LAST = 'pnlUsd_ASC_NULLS_LAST', + pnlUsd_DESC = 'pnlUsd_DESC', + pnlUsd_DESC_NULLS_FIRST = 'pnlUsd_DESC_NULLS_FIRST', + pnlUsd_DESC_NULLS_LAST = 'pnlUsd_DESC_NULLS_LAST', + positionFeeAmount_ASC = 'positionFeeAmount_ASC', + positionFeeAmount_ASC_NULLS_FIRST = 'positionFeeAmount_ASC_NULLS_FIRST', + positionFeeAmount_ASC_NULLS_LAST = 'positionFeeAmount_ASC_NULLS_LAST', + positionFeeAmount_DESC = 'positionFeeAmount_DESC', + positionFeeAmount_DESC_NULLS_FIRST = 'positionFeeAmount_DESC_NULLS_FIRST', + positionFeeAmount_DESC_NULLS_LAST = 'positionFeeAmount_DESC_NULLS_LAST', + priceImpactAmount_ASC = 'priceImpactAmount_ASC', + priceImpactAmount_ASC_NULLS_FIRST = 'priceImpactAmount_ASC_NULLS_FIRST', + priceImpactAmount_ASC_NULLS_LAST = 'priceImpactAmount_ASC_NULLS_LAST', + priceImpactAmount_DESC = 'priceImpactAmount_DESC', + priceImpactAmount_DESC_NULLS_FIRST = 'priceImpactAmount_DESC_NULLS_FIRST', + priceImpactAmount_DESC_NULLS_LAST = 'priceImpactAmount_DESC_NULLS_LAST', + priceImpactDiffUsd_ASC = 'priceImpactDiffUsd_ASC', + priceImpactDiffUsd_ASC_NULLS_FIRST = 'priceImpactDiffUsd_ASC_NULLS_FIRST', + priceImpactDiffUsd_ASC_NULLS_LAST = 'priceImpactDiffUsd_ASC_NULLS_LAST', + priceImpactDiffUsd_DESC = 'priceImpactDiffUsd_DESC', + priceImpactDiffUsd_DESC_NULLS_FIRST = 'priceImpactDiffUsd_DESC_NULLS_FIRST', + priceImpactDiffUsd_DESC_NULLS_LAST = 'priceImpactDiffUsd_DESC_NULLS_LAST', + priceImpactUsd_ASC = 'priceImpactUsd_ASC', + priceImpactUsd_ASC_NULLS_FIRST = 'priceImpactUsd_ASC_NULLS_FIRST', + priceImpactUsd_ASC_NULLS_LAST = 'priceImpactUsd_ASC_NULLS_LAST', + priceImpactUsd_DESC = 'priceImpactUsd_DESC', + priceImpactUsd_DESC_NULLS_FIRST = 'priceImpactUsd_DESC_NULLS_FIRST', + priceImpactUsd_DESC_NULLS_LAST = 'priceImpactUsd_DESC_NULLS_LAST', + proportionalPendingImpactUsd_ASC = 'proportionalPendingImpactUsd_ASC', + proportionalPendingImpactUsd_ASC_NULLS_FIRST = 'proportionalPendingImpactUsd_ASC_NULLS_FIRST', + proportionalPendingImpactUsd_ASC_NULLS_LAST = 'proportionalPendingImpactUsd_ASC_NULLS_LAST', + proportionalPendingImpactUsd_DESC = 'proportionalPendingImpactUsd_DESC', + proportionalPendingImpactUsd_DESC_NULLS_FIRST = 'proportionalPendingImpactUsd_DESC_NULLS_FIRST', + proportionalPendingImpactUsd_DESC_NULLS_LAST = 'proportionalPendingImpactUsd_DESC_NULLS_LAST', + reasonBytes_ASC = 'reasonBytes_ASC', + reasonBytes_ASC_NULLS_FIRST = 'reasonBytes_ASC_NULLS_FIRST', + reasonBytes_ASC_NULLS_LAST = 'reasonBytes_ASC_NULLS_LAST', + reasonBytes_DESC = 'reasonBytes_DESC', + reasonBytes_DESC_NULLS_FIRST = 'reasonBytes_DESC_NULLS_FIRST', + reasonBytes_DESC_NULLS_LAST = 'reasonBytes_DESC_NULLS_LAST', + reason_ASC = 'reason_ASC', + reason_ASC_NULLS_FIRST = 'reason_ASC_NULLS_FIRST', + reason_ASC_NULLS_LAST = 'reason_ASC_NULLS_LAST', + reason_DESC = 'reason_DESC', + reason_DESC_NULLS_FIRST = 'reason_DESC_NULLS_FIRST', + reason_DESC_NULLS_LAST = 'reason_DESC_NULLS_LAST', + shouldUnwrapNativeToken_ASC = 'shouldUnwrapNativeToken_ASC', + shouldUnwrapNativeToken_ASC_NULLS_FIRST = 'shouldUnwrapNativeToken_ASC_NULLS_FIRST', + shouldUnwrapNativeToken_ASC_NULLS_LAST = 'shouldUnwrapNativeToken_ASC_NULLS_LAST', + shouldUnwrapNativeToken_DESC = 'shouldUnwrapNativeToken_DESC', + shouldUnwrapNativeToken_DESC_NULLS_FIRST = 'shouldUnwrapNativeToken_DESC_NULLS_FIRST', + shouldUnwrapNativeToken_DESC_NULLS_LAST = 'shouldUnwrapNativeToken_DESC_NULLS_LAST', + sizeDeltaUsd_ASC = 'sizeDeltaUsd_ASC', + sizeDeltaUsd_ASC_NULLS_FIRST = 'sizeDeltaUsd_ASC_NULLS_FIRST', + sizeDeltaUsd_ASC_NULLS_LAST = 'sizeDeltaUsd_ASC_NULLS_LAST', + sizeDeltaUsd_DESC = 'sizeDeltaUsd_DESC', + sizeDeltaUsd_DESC_NULLS_FIRST = 'sizeDeltaUsd_DESC_NULLS_FIRST', + sizeDeltaUsd_DESC_NULLS_LAST = 'sizeDeltaUsd_DESC_NULLS_LAST', + srcChainId_ASC = 'srcChainId_ASC', + srcChainId_ASC_NULLS_FIRST = 'srcChainId_ASC_NULLS_FIRST', + srcChainId_ASC_NULLS_LAST = 'srcChainId_ASC_NULLS_LAST', + srcChainId_DESC = 'srcChainId_DESC', + srcChainId_DESC_NULLS_FIRST = 'srcChainId_DESC_NULLS_FIRST', + srcChainId_DESC_NULLS_LAST = 'srcChainId_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + totalImpactUsd_ASC = 'totalImpactUsd_ASC', + totalImpactUsd_ASC_NULLS_FIRST = 'totalImpactUsd_ASC_NULLS_FIRST', + totalImpactUsd_ASC_NULLS_LAST = 'totalImpactUsd_ASC_NULLS_LAST', + totalImpactUsd_DESC = 'totalImpactUsd_DESC', + totalImpactUsd_DESC_NULLS_FIRST = 'totalImpactUsd_DESC_NULLS_FIRST', + totalImpactUsd_DESC_NULLS_LAST = 'totalImpactUsd_DESC_NULLS_LAST', + transaction_blockNumber_ASC = 'transaction_blockNumber_ASC', + transaction_blockNumber_ASC_NULLS_FIRST = 'transaction_blockNumber_ASC_NULLS_FIRST', + transaction_blockNumber_ASC_NULLS_LAST = 'transaction_blockNumber_ASC_NULLS_LAST', + transaction_blockNumber_DESC = 'transaction_blockNumber_DESC', + transaction_blockNumber_DESC_NULLS_FIRST = 'transaction_blockNumber_DESC_NULLS_FIRST', + transaction_blockNumber_DESC_NULLS_LAST = 'transaction_blockNumber_DESC_NULLS_LAST', + transaction_from_ASC = 'transaction_from_ASC', + transaction_from_ASC_NULLS_FIRST = 'transaction_from_ASC_NULLS_FIRST', + transaction_from_ASC_NULLS_LAST = 'transaction_from_ASC_NULLS_LAST', + transaction_from_DESC = 'transaction_from_DESC', + transaction_from_DESC_NULLS_FIRST = 'transaction_from_DESC_NULLS_FIRST', + transaction_from_DESC_NULLS_LAST = 'transaction_from_DESC_NULLS_LAST', + transaction_hash_ASC = 'transaction_hash_ASC', + transaction_hash_ASC_NULLS_FIRST = 'transaction_hash_ASC_NULLS_FIRST', + transaction_hash_ASC_NULLS_LAST = 'transaction_hash_ASC_NULLS_LAST', + transaction_hash_DESC = 'transaction_hash_DESC', + transaction_hash_DESC_NULLS_FIRST = 'transaction_hash_DESC_NULLS_FIRST', + transaction_hash_DESC_NULLS_LAST = 'transaction_hash_DESC_NULLS_LAST', + transaction_id_ASC = 'transaction_id_ASC', + transaction_id_ASC_NULLS_FIRST = 'transaction_id_ASC_NULLS_FIRST', + transaction_id_ASC_NULLS_LAST = 'transaction_id_ASC_NULLS_LAST', + transaction_id_DESC = 'transaction_id_DESC', + transaction_id_DESC_NULLS_FIRST = 'transaction_id_DESC_NULLS_FIRST', + transaction_id_DESC_NULLS_LAST = 'transaction_id_DESC_NULLS_LAST', + transaction_timestamp_ASC = 'transaction_timestamp_ASC', + transaction_timestamp_ASC_NULLS_FIRST = 'transaction_timestamp_ASC_NULLS_FIRST', + transaction_timestamp_ASC_NULLS_LAST = 'transaction_timestamp_ASC_NULLS_LAST', + transaction_timestamp_DESC = 'transaction_timestamp_DESC', + transaction_timestamp_DESC_NULLS_FIRST = 'transaction_timestamp_DESC_NULLS_FIRST', + transaction_timestamp_DESC_NULLS_LAST = 'transaction_timestamp_DESC_NULLS_LAST', + transaction_to_ASC = 'transaction_to_ASC', + transaction_to_ASC_NULLS_FIRST = 'transaction_to_ASC_NULLS_FIRST', + transaction_to_ASC_NULLS_LAST = 'transaction_to_ASC_NULLS_LAST', + transaction_to_DESC = 'transaction_to_DESC', + transaction_to_DESC_NULLS_FIRST = 'transaction_to_DESC_NULLS_FIRST', + transaction_to_DESC_NULLS_LAST = 'transaction_to_DESC_NULLS_LAST', + transaction_transactionIndex_ASC = 'transaction_transactionIndex_ASC', + transaction_transactionIndex_ASC_NULLS_FIRST = 'transaction_transactionIndex_ASC_NULLS_FIRST', + transaction_transactionIndex_ASC_NULLS_LAST = 'transaction_transactionIndex_ASC_NULLS_LAST', + transaction_transactionIndex_DESC = 'transaction_transactionIndex_DESC', + transaction_transactionIndex_DESC_NULLS_FIRST = 'transaction_transactionIndex_DESC_NULLS_FIRST', + transaction_transactionIndex_DESC_NULLS_LAST = 'transaction_transactionIndex_DESC_NULLS_LAST', + triggerPrice_ASC = 'triggerPrice_ASC', + triggerPrice_ASC_NULLS_FIRST = 'triggerPrice_ASC_NULLS_FIRST', + triggerPrice_ASC_NULLS_LAST = 'triggerPrice_ASC_NULLS_LAST', + triggerPrice_DESC = 'triggerPrice_DESC', + triggerPrice_DESC_NULLS_FIRST = 'triggerPrice_DESC_NULLS_FIRST', + triggerPrice_DESC_NULLS_LAST = 'triggerPrice_DESC_NULLS_LAST', + twapGroupId_ASC = 'twapGroupId_ASC', + twapGroupId_ASC_NULLS_FIRST = 'twapGroupId_ASC_NULLS_FIRST', + twapGroupId_ASC_NULLS_LAST = 'twapGroupId_ASC_NULLS_LAST', + twapGroupId_DESC = 'twapGroupId_DESC', + twapGroupId_DESC_NULLS_FIRST = 'twapGroupId_DESC_NULLS_FIRST', + twapGroupId_DESC_NULLS_LAST = 'twapGroupId_DESC_NULLS_LAST', + uiFeeReceiver_ASC = 'uiFeeReceiver_ASC', + uiFeeReceiver_ASC_NULLS_FIRST = 'uiFeeReceiver_ASC_NULLS_FIRST', + uiFeeReceiver_ASC_NULLS_LAST = 'uiFeeReceiver_ASC_NULLS_LAST', + uiFeeReceiver_DESC = 'uiFeeReceiver_DESC', + uiFeeReceiver_DESC_NULLS_FIRST = 'uiFeeReceiver_DESC_NULLS_FIRST', + uiFeeReceiver_DESC_NULLS_LAST = 'uiFeeReceiver_DESC_NULLS_LAST' } export interface TradeActionWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - acceptablePrice_eq?: InputMaybe; - acceptablePrice_gt?: InputMaybe; - acceptablePrice_gte?: InputMaybe; - acceptablePrice_in?: InputMaybe>; - acceptablePrice_isNull?: InputMaybe; - acceptablePrice_lt?: InputMaybe; - acceptablePrice_lte?: InputMaybe; - acceptablePrice_not_eq?: InputMaybe; - acceptablePrice_not_in?: InputMaybe>; - account_contains?: InputMaybe; - account_containsInsensitive?: InputMaybe; - account_endsWith?: InputMaybe; - account_eq?: InputMaybe; - account_gt?: InputMaybe; - account_gte?: InputMaybe; - account_in?: InputMaybe>; - account_isNull?: InputMaybe; - account_lt?: InputMaybe; - account_lte?: InputMaybe; - account_not_contains?: InputMaybe; - account_not_containsInsensitive?: InputMaybe; - account_not_endsWith?: InputMaybe; - account_not_eq?: InputMaybe; - account_not_in?: InputMaybe>; - account_not_startsWith?: InputMaybe; - account_startsWith?: InputMaybe; - basePnlUsd_eq?: InputMaybe; - basePnlUsd_gt?: InputMaybe; - basePnlUsd_gte?: InputMaybe; - basePnlUsd_in?: InputMaybe>; - basePnlUsd_isNull?: InputMaybe; - basePnlUsd_lt?: InputMaybe; - basePnlUsd_lte?: InputMaybe; - basePnlUsd_not_eq?: InputMaybe; - basePnlUsd_not_in?: InputMaybe>; - borrowingFeeAmount_eq?: InputMaybe; - borrowingFeeAmount_gt?: InputMaybe; - borrowingFeeAmount_gte?: InputMaybe; - borrowingFeeAmount_in?: InputMaybe>; - borrowingFeeAmount_isNull?: InputMaybe; - borrowingFeeAmount_lt?: InputMaybe; - borrowingFeeAmount_lte?: InputMaybe; - borrowingFeeAmount_not_eq?: InputMaybe; - borrowingFeeAmount_not_in?: InputMaybe>; - collateralTokenPriceMax_eq?: InputMaybe; - collateralTokenPriceMax_gt?: InputMaybe; - collateralTokenPriceMax_gte?: InputMaybe; - collateralTokenPriceMax_in?: InputMaybe>; - collateralTokenPriceMax_isNull?: InputMaybe; - collateralTokenPriceMax_lt?: InputMaybe; - collateralTokenPriceMax_lte?: InputMaybe; - collateralTokenPriceMax_not_eq?: InputMaybe; - collateralTokenPriceMax_not_in?: InputMaybe>; - collateralTokenPriceMin_eq?: InputMaybe; - collateralTokenPriceMin_gt?: InputMaybe; - collateralTokenPriceMin_gte?: InputMaybe; - collateralTokenPriceMin_in?: InputMaybe>; - collateralTokenPriceMin_isNull?: InputMaybe; - collateralTokenPriceMin_lt?: InputMaybe; - collateralTokenPriceMin_lte?: InputMaybe; - collateralTokenPriceMin_not_eq?: InputMaybe; - collateralTokenPriceMin_not_in?: InputMaybe>; - contractTriggerPrice_eq?: InputMaybe; - contractTriggerPrice_gt?: InputMaybe; - contractTriggerPrice_gte?: InputMaybe; - contractTriggerPrice_in?: InputMaybe>; - contractTriggerPrice_isNull?: InputMaybe; - contractTriggerPrice_lt?: InputMaybe; - contractTriggerPrice_lte?: InputMaybe; - contractTriggerPrice_not_eq?: InputMaybe; - contractTriggerPrice_not_in?: InputMaybe>; - eventName_contains?: InputMaybe; - eventName_containsInsensitive?: InputMaybe; - eventName_endsWith?: InputMaybe; - eventName_eq?: InputMaybe; - eventName_gt?: InputMaybe; - eventName_gte?: InputMaybe; - eventName_in?: InputMaybe>; - eventName_isNull?: InputMaybe; - eventName_lt?: InputMaybe; - eventName_lte?: InputMaybe; - eventName_not_contains?: InputMaybe; - eventName_not_containsInsensitive?: InputMaybe; - eventName_not_endsWith?: InputMaybe; - eventName_not_eq?: InputMaybe; - eventName_not_in?: InputMaybe>; - eventName_not_startsWith?: InputMaybe; - eventName_startsWith?: InputMaybe; - executionAmountOut_eq?: InputMaybe; - executionAmountOut_gt?: InputMaybe; - executionAmountOut_gte?: InputMaybe; - executionAmountOut_in?: InputMaybe>; - executionAmountOut_isNull?: InputMaybe; - executionAmountOut_lt?: InputMaybe; - executionAmountOut_lte?: InputMaybe; - executionAmountOut_not_eq?: InputMaybe; - executionAmountOut_not_in?: InputMaybe>; - executionPrice_eq?: InputMaybe; - executionPrice_gt?: InputMaybe; - executionPrice_gte?: InputMaybe; - executionPrice_in?: InputMaybe>; - executionPrice_isNull?: InputMaybe; - executionPrice_lt?: InputMaybe; - executionPrice_lte?: InputMaybe; - executionPrice_not_eq?: InputMaybe; - executionPrice_not_in?: InputMaybe>; - fundingFeeAmount_eq?: InputMaybe; - fundingFeeAmount_gt?: InputMaybe; - fundingFeeAmount_gte?: InputMaybe; - fundingFeeAmount_in?: InputMaybe>; - fundingFeeAmount_isNull?: InputMaybe; - fundingFeeAmount_lt?: InputMaybe; - fundingFeeAmount_lte?: InputMaybe; - fundingFeeAmount_not_eq?: InputMaybe; - fundingFeeAmount_not_in?: InputMaybe>; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - indexTokenPriceMax_eq?: InputMaybe; - indexTokenPriceMax_gt?: InputMaybe; - indexTokenPriceMax_gte?: InputMaybe; - indexTokenPriceMax_in?: InputMaybe>; - indexTokenPriceMax_isNull?: InputMaybe; - indexTokenPriceMax_lt?: InputMaybe; - indexTokenPriceMax_lte?: InputMaybe; - indexTokenPriceMax_not_eq?: InputMaybe; - indexTokenPriceMax_not_in?: InputMaybe>; - indexTokenPriceMin_eq?: InputMaybe; - indexTokenPriceMin_gt?: InputMaybe; - indexTokenPriceMin_gte?: InputMaybe; - indexTokenPriceMin_in?: InputMaybe>; - indexTokenPriceMin_isNull?: InputMaybe; - indexTokenPriceMin_lt?: InputMaybe; - indexTokenPriceMin_lte?: InputMaybe; - indexTokenPriceMin_not_eq?: InputMaybe; - indexTokenPriceMin_not_in?: InputMaybe>; - initialCollateralDeltaAmount_eq?: InputMaybe; - initialCollateralDeltaAmount_gt?: InputMaybe; - initialCollateralDeltaAmount_gte?: InputMaybe; - initialCollateralDeltaAmount_in?: InputMaybe>; - initialCollateralDeltaAmount_isNull?: InputMaybe; - initialCollateralDeltaAmount_lt?: InputMaybe; - initialCollateralDeltaAmount_lte?: InputMaybe; - initialCollateralDeltaAmount_not_eq?: InputMaybe; - initialCollateralDeltaAmount_not_in?: InputMaybe>; - initialCollateralTokenAddress_contains?: InputMaybe; - initialCollateralTokenAddress_containsInsensitive?: InputMaybe; - initialCollateralTokenAddress_endsWith?: InputMaybe; - initialCollateralTokenAddress_eq?: InputMaybe; - initialCollateralTokenAddress_gt?: InputMaybe; - initialCollateralTokenAddress_gte?: InputMaybe; - initialCollateralTokenAddress_in?: InputMaybe>; - initialCollateralTokenAddress_isNull?: InputMaybe; - initialCollateralTokenAddress_lt?: InputMaybe; - initialCollateralTokenAddress_lte?: InputMaybe; - initialCollateralTokenAddress_not_contains?: InputMaybe; - initialCollateralTokenAddress_not_containsInsensitive?: InputMaybe; - initialCollateralTokenAddress_not_endsWith?: InputMaybe; - initialCollateralTokenAddress_not_eq?: InputMaybe; - initialCollateralTokenAddress_not_in?: InputMaybe>; - initialCollateralTokenAddress_not_startsWith?: InputMaybe; - initialCollateralTokenAddress_startsWith?: InputMaybe; - isLong_eq?: InputMaybe; - isLong_isNull?: InputMaybe; - isLong_not_eq?: InputMaybe; - liquidationFeeAmount_eq?: InputMaybe; - liquidationFeeAmount_gt?: InputMaybe; - liquidationFeeAmount_gte?: InputMaybe; - liquidationFeeAmount_in?: InputMaybe>; - liquidationFeeAmount_isNull?: InputMaybe; - liquidationFeeAmount_lt?: InputMaybe; - liquidationFeeAmount_lte?: InputMaybe; - liquidationFeeAmount_not_eq?: InputMaybe; - liquidationFeeAmount_not_in?: InputMaybe>; - marketAddress_contains?: InputMaybe; - marketAddress_containsInsensitive?: InputMaybe; - marketAddress_endsWith?: InputMaybe; - marketAddress_eq?: InputMaybe; - marketAddress_gt?: InputMaybe; - marketAddress_gte?: InputMaybe; - marketAddress_in?: InputMaybe>; - marketAddress_isNull?: InputMaybe; - marketAddress_lt?: InputMaybe; - marketAddress_lte?: InputMaybe; - marketAddress_not_contains?: InputMaybe; - marketAddress_not_containsInsensitive?: InputMaybe; - marketAddress_not_endsWith?: InputMaybe; - marketAddress_not_eq?: InputMaybe; - marketAddress_not_in?: InputMaybe>; - marketAddress_not_startsWith?: InputMaybe; - marketAddress_startsWith?: InputMaybe; - minOutputAmount_eq?: InputMaybe; - minOutputAmount_gt?: InputMaybe; - minOutputAmount_gte?: InputMaybe; - minOutputAmount_in?: InputMaybe>; - minOutputAmount_isNull?: InputMaybe; - minOutputAmount_lt?: InputMaybe; - minOutputAmount_lte?: InputMaybe; - minOutputAmount_not_eq?: InputMaybe; - minOutputAmount_not_in?: InputMaybe>; - numberOfParts_eq?: InputMaybe; - numberOfParts_gt?: InputMaybe; - numberOfParts_gte?: InputMaybe; - numberOfParts_in?: InputMaybe>; - numberOfParts_isNull?: InputMaybe; - numberOfParts_lt?: InputMaybe; - numberOfParts_lte?: InputMaybe; - numberOfParts_not_eq?: InputMaybe; - numberOfParts_not_in?: InputMaybe>; - orderKey_contains?: InputMaybe; - orderKey_containsInsensitive?: InputMaybe; - orderKey_endsWith?: InputMaybe; - orderKey_eq?: InputMaybe; - orderKey_gt?: InputMaybe; - orderKey_gte?: InputMaybe; - orderKey_in?: InputMaybe>; - orderKey_isNull?: InputMaybe; - orderKey_lt?: InputMaybe; - orderKey_lte?: InputMaybe; - orderKey_not_contains?: InputMaybe; - orderKey_not_containsInsensitive?: InputMaybe; - orderKey_not_endsWith?: InputMaybe; - orderKey_not_eq?: InputMaybe; - orderKey_not_in?: InputMaybe>; - orderKey_not_startsWith?: InputMaybe; - orderKey_startsWith?: InputMaybe; - orderType_eq?: InputMaybe; - orderType_gt?: InputMaybe; - orderType_gte?: InputMaybe; - orderType_in?: InputMaybe>; - orderType_isNull?: InputMaybe; - orderType_lt?: InputMaybe; - orderType_lte?: InputMaybe; - orderType_not_eq?: InputMaybe; - orderType_not_in?: InputMaybe>; - pnlUsd_eq?: InputMaybe; - pnlUsd_gt?: InputMaybe; - pnlUsd_gte?: InputMaybe; - pnlUsd_in?: InputMaybe>; - pnlUsd_isNull?: InputMaybe; - pnlUsd_lt?: InputMaybe; - pnlUsd_lte?: InputMaybe; - pnlUsd_not_eq?: InputMaybe; - pnlUsd_not_in?: InputMaybe>; - positionFeeAmount_eq?: InputMaybe; - positionFeeAmount_gt?: InputMaybe; - positionFeeAmount_gte?: InputMaybe; - positionFeeAmount_in?: InputMaybe>; - positionFeeAmount_isNull?: InputMaybe; - positionFeeAmount_lt?: InputMaybe; - positionFeeAmount_lte?: InputMaybe; - positionFeeAmount_not_eq?: InputMaybe; - positionFeeAmount_not_in?: InputMaybe>; - priceImpactAmount_eq?: InputMaybe; - priceImpactAmount_gt?: InputMaybe; - priceImpactAmount_gte?: InputMaybe; - priceImpactAmount_in?: InputMaybe>; - priceImpactAmount_isNull?: InputMaybe; - priceImpactAmount_lt?: InputMaybe; - priceImpactAmount_lte?: InputMaybe; - priceImpactAmount_not_eq?: InputMaybe; - priceImpactAmount_not_in?: InputMaybe>; - priceImpactDiffUsd_eq?: InputMaybe; - priceImpactDiffUsd_gt?: InputMaybe; - priceImpactDiffUsd_gte?: InputMaybe; - priceImpactDiffUsd_in?: InputMaybe>; - priceImpactDiffUsd_isNull?: InputMaybe; - priceImpactDiffUsd_lt?: InputMaybe; - priceImpactDiffUsd_lte?: InputMaybe; - priceImpactDiffUsd_not_eq?: InputMaybe; - priceImpactDiffUsd_not_in?: InputMaybe>; - priceImpactUsd_eq?: InputMaybe; - priceImpactUsd_gt?: InputMaybe; - priceImpactUsd_gte?: InputMaybe; - priceImpactUsd_in?: InputMaybe>; - priceImpactUsd_isNull?: InputMaybe; - priceImpactUsd_lt?: InputMaybe; - priceImpactUsd_lte?: InputMaybe; - priceImpactUsd_not_eq?: InputMaybe; - priceImpactUsd_not_in?: InputMaybe>; - proportionalPendingImpactUsd_eq?: InputMaybe; - proportionalPendingImpactUsd_gt?: InputMaybe; - proportionalPendingImpactUsd_gte?: InputMaybe; - proportionalPendingImpactUsd_in?: InputMaybe>; - proportionalPendingImpactUsd_isNull?: InputMaybe; - proportionalPendingImpactUsd_lt?: InputMaybe; - proportionalPendingImpactUsd_lte?: InputMaybe; - proportionalPendingImpactUsd_not_eq?: InputMaybe; - proportionalPendingImpactUsd_not_in?: InputMaybe>; - reasonBytes_contains?: InputMaybe; - reasonBytes_containsInsensitive?: InputMaybe; - reasonBytes_endsWith?: InputMaybe; - reasonBytes_eq?: InputMaybe; - reasonBytes_gt?: InputMaybe; - reasonBytes_gte?: InputMaybe; - reasonBytes_in?: InputMaybe>; - reasonBytes_isNull?: InputMaybe; - reasonBytes_lt?: InputMaybe; - reasonBytes_lte?: InputMaybe; - reasonBytes_not_contains?: InputMaybe; - reasonBytes_not_containsInsensitive?: InputMaybe; - reasonBytes_not_endsWith?: InputMaybe; - reasonBytes_not_eq?: InputMaybe; - reasonBytes_not_in?: InputMaybe>; - reasonBytes_not_startsWith?: InputMaybe; - reasonBytes_startsWith?: InputMaybe; - reason_contains?: InputMaybe; - reason_containsInsensitive?: InputMaybe; - reason_endsWith?: InputMaybe; - reason_eq?: InputMaybe; - reason_gt?: InputMaybe; - reason_gte?: InputMaybe; - reason_in?: InputMaybe>; - reason_isNull?: InputMaybe; - reason_lt?: InputMaybe; - reason_lte?: InputMaybe; - reason_not_contains?: InputMaybe; - reason_not_containsInsensitive?: InputMaybe; - reason_not_endsWith?: InputMaybe; - reason_not_eq?: InputMaybe; - reason_not_in?: InputMaybe>; - reason_not_startsWith?: InputMaybe; - reason_startsWith?: InputMaybe; - shouldUnwrapNativeToken_eq?: InputMaybe; - shouldUnwrapNativeToken_isNull?: InputMaybe; - shouldUnwrapNativeToken_not_eq?: InputMaybe; - sizeDeltaUsd_eq?: InputMaybe; - sizeDeltaUsd_gt?: InputMaybe; - sizeDeltaUsd_gte?: InputMaybe; - sizeDeltaUsd_in?: InputMaybe>; - sizeDeltaUsd_isNull?: InputMaybe; - sizeDeltaUsd_lt?: InputMaybe; - sizeDeltaUsd_lte?: InputMaybe; - sizeDeltaUsd_not_eq?: InputMaybe; - sizeDeltaUsd_not_in?: InputMaybe>; - srcChainId_eq?: InputMaybe; - srcChainId_gt?: InputMaybe; - srcChainId_gte?: InputMaybe; - srcChainId_in?: InputMaybe>; - srcChainId_isNull?: InputMaybe; - srcChainId_lt?: InputMaybe; - srcChainId_lte?: InputMaybe; - srcChainId_not_eq?: InputMaybe; - srcChainId_not_in?: InputMaybe>; - swapPath_containsAll?: InputMaybe>; - swapPath_containsAny?: InputMaybe>; - swapPath_containsNone?: InputMaybe>; - swapPath_isNull?: InputMaybe; - timestamp_eq?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_isNull?: InputMaybe; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not_eq?: InputMaybe; - timestamp_not_in?: InputMaybe>; - totalImpactUsd_eq?: InputMaybe; - totalImpactUsd_gt?: InputMaybe; - totalImpactUsd_gte?: InputMaybe; - totalImpactUsd_in?: InputMaybe>; - totalImpactUsd_isNull?: InputMaybe; - totalImpactUsd_lt?: InputMaybe; - totalImpactUsd_lte?: InputMaybe; - totalImpactUsd_not_eq?: InputMaybe; - totalImpactUsd_not_in?: InputMaybe>; + acceptablePrice_eq?: InputMaybe; + acceptablePrice_gt?: InputMaybe; + acceptablePrice_gte?: InputMaybe; + acceptablePrice_in?: InputMaybe>; + acceptablePrice_isNull?: InputMaybe; + acceptablePrice_lt?: InputMaybe; + acceptablePrice_lte?: InputMaybe; + acceptablePrice_not_eq?: InputMaybe; + acceptablePrice_not_in?: InputMaybe>; + account_contains?: InputMaybe; + account_containsInsensitive?: InputMaybe; + account_endsWith?: InputMaybe; + account_eq?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_isNull?: InputMaybe; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_containsInsensitive?: InputMaybe; + account_not_endsWith?: InputMaybe; + account_not_eq?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_startsWith?: InputMaybe; + account_startsWith?: InputMaybe; + basePnlUsd_eq?: InputMaybe; + basePnlUsd_gt?: InputMaybe; + basePnlUsd_gte?: InputMaybe; + basePnlUsd_in?: InputMaybe>; + basePnlUsd_isNull?: InputMaybe; + basePnlUsd_lt?: InputMaybe; + basePnlUsd_lte?: InputMaybe; + basePnlUsd_not_eq?: InputMaybe; + basePnlUsd_not_in?: InputMaybe>; + borrowingFeeAmount_eq?: InputMaybe; + borrowingFeeAmount_gt?: InputMaybe; + borrowingFeeAmount_gte?: InputMaybe; + borrowingFeeAmount_in?: InputMaybe>; + borrowingFeeAmount_isNull?: InputMaybe; + borrowingFeeAmount_lt?: InputMaybe; + borrowingFeeAmount_lte?: InputMaybe; + borrowingFeeAmount_not_eq?: InputMaybe; + borrowingFeeAmount_not_in?: InputMaybe>; + collateralTokenPriceMax_eq?: InputMaybe; + collateralTokenPriceMax_gt?: InputMaybe; + collateralTokenPriceMax_gte?: InputMaybe; + collateralTokenPriceMax_in?: InputMaybe>; + collateralTokenPriceMax_isNull?: InputMaybe; + collateralTokenPriceMax_lt?: InputMaybe; + collateralTokenPriceMax_lte?: InputMaybe; + collateralTokenPriceMax_not_eq?: InputMaybe; + collateralTokenPriceMax_not_in?: InputMaybe>; + collateralTokenPriceMin_eq?: InputMaybe; + collateralTokenPriceMin_gt?: InputMaybe; + collateralTokenPriceMin_gte?: InputMaybe; + collateralTokenPriceMin_in?: InputMaybe>; + collateralTokenPriceMin_isNull?: InputMaybe; + collateralTokenPriceMin_lt?: InputMaybe; + collateralTokenPriceMin_lte?: InputMaybe; + collateralTokenPriceMin_not_eq?: InputMaybe; + collateralTokenPriceMin_not_in?: InputMaybe>; + contractTriggerPrice_eq?: InputMaybe; + contractTriggerPrice_gt?: InputMaybe; + contractTriggerPrice_gte?: InputMaybe; + contractTriggerPrice_in?: InputMaybe>; + contractTriggerPrice_isNull?: InputMaybe; + contractTriggerPrice_lt?: InputMaybe; + contractTriggerPrice_lte?: InputMaybe; + contractTriggerPrice_not_eq?: InputMaybe; + contractTriggerPrice_not_in?: InputMaybe>; + eventName_contains?: InputMaybe; + eventName_containsInsensitive?: InputMaybe; + eventName_endsWith?: InputMaybe; + eventName_eq?: InputMaybe; + eventName_gt?: InputMaybe; + eventName_gte?: InputMaybe; + eventName_in?: InputMaybe>; + eventName_isNull?: InputMaybe; + eventName_lt?: InputMaybe; + eventName_lte?: InputMaybe; + eventName_not_contains?: InputMaybe; + eventName_not_containsInsensitive?: InputMaybe; + eventName_not_endsWith?: InputMaybe; + eventName_not_eq?: InputMaybe; + eventName_not_in?: InputMaybe>; + eventName_not_startsWith?: InputMaybe; + eventName_startsWith?: InputMaybe; + executionAmountOut_eq?: InputMaybe; + executionAmountOut_gt?: InputMaybe; + executionAmountOut_gte?: InputMaybe; + executionAmountOut_in?: InputMaybe>; + executionAmountOut_isNull?: InputMaybe; + executionAmountOut_lt?: InputMaybe; + executionAmountOut_lte?: InputMaybe; + executionAmountOut_not_eq?: InputMaybe; + executionAmountOut_not_in?: InputMaybe>; + executionPrice_eq?: InputMaybe; + executionPrice_gt?: InputMaybe; + executionPrice_gte?: InputMaybe; + executionPrice_in?: InputMaybe>; + executionPrice_isNull?: InputMaybe; + executionPrice_lt?: InputMaybe; + executionPrice_lte?: InputMaybe; + executionPrice_not_eq?: InputMaybe; + executionPrice_not_in?: InputMaybe>; + fundingFeeAmount_eq?: InputMaybe; + fundingFeeAmount_gt?: InputMaybe; + fundingFeeAmount_gte?: InputMaybe; + fundingFeeAmount_in?: InputMaybe>; + fundingFeeAmount_isNull?: InputMaybe; + fundingFeeAmount_lt?: InputMaybe; + fundingFeeAmount_lte?: InputMaybe; + fundingFeeAmount_not_eq?: InputMaybe; + fundingFeeAmount_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + indexTokenPriceMax_eq?: InputMaybe; + indexTokenPriceMax_gt?: InputMaybe; + indexTokenPriceMax_gte?: InputMaybe; + indexTokenPriceMax_in?: InputMaybe>; + indexTokenPriceMax_isNull?: InputMaybe; + indexTokenPriceMax_lt?: InputMaybe; + indexTokenPriceMax_lte?: InputMaybe; + indexTokenPriceMax_not_eq?: InputMaybe; + indexTokenPriceMax_not_in?: InputMaybe>; + indexTokenPriceMin_eq?: InputMaybe; + indexTokenPriceMin_gt?: InputMaybe; + indexTokenPriceMin_gte?: InputMaybe; + indexTokenPriceMin_in?: InputMaybe>; + indexTokenPriceMin_isNull?: InputMaybe; + indexTokenPriceMin_lt?: InputMaybe; + indexTokenPriceMin_lte?: InputMaybe; + indexTokenPriceMin_not_eq?: InputMaybe; + indexTokenPriceMin_not_in?: InputMaybe>; + initialCollateralDeltaAmount_eq?: InputMaybe; + initialCollateralDeltaAmount_gt?: InputMaybe; + initialCollateralDeltaAmount_gte?: InputMaybe; + initialCollateralDeltaAmount_in?: InputMaybe>; + initialCollateralDeltaAmount_isNull?: InputMaybe; + initialCollateralDeltaAmount_lt?: InputMaybe; + initialCollateralDeltaAmount_lte?: InputMaybe; + initialCollateralDeltaAmount_not_eq?: InputMaybe; + initialCollateralDeltaAmount_not_in?: InputMaybe>; + initialCollateralTokenAddress_contains?: InputMaybe; + initialCollateralTokenAddress_containsInsensitive?: InputMaybe; + initialCollateralTokenAddress_endsWith?: InputMaybe; + initialCollateralTokenAddress_eq?: InputMaybe; + initialCollateralTokenAddress_gt?: InputMaybe; + initialCollateralTokenAddress_gte?: InputMaybe; + initialCollateralTokenAddress_in?: InputMaybe>; + initialCollateralTokenAddress_isNull?: InputMaybe; + initialCollateralTokenAddress_lt?: InputMaybe; + initialCollateralTokenAddress_lte?: InputMaybe; + initialCollateralTokenAddress_not_contains?: InputMaybe; + initialCollateralTokenAddress_not_containsInsensitive?: InputMaybe; + initialCollateralTokenAddress_not_endsWith?: InputMaybe; + initialCollateralTokenAddress_not_eq?: InputMaybe; + initialCollateralTokenAddress_not_in?: InputMaybe>; + initialCollateralTokenAddress_not_startsWith?: InputMaybe; + initialCollateralTokenAddress_startsWith?: InputMaybe; + isLong_eq?: InputMaybe; + isLong_isNull?: InputMaybe; + isLong_not_eq?: InputMaybe; + liquidationFeeAmount_eq?: InputMaybe; + liquidationFeeAmount_gt?: InputMaybe; + liquidationFeeAmount_gte?: InputMaybe; + liquidationFeeAmount_in?: InputMaybe>; + liquidationFeeAmount_isNull?: InputMaybe; + liquidationFeeAmount_lt?: InputMaybe; + liquidationFeeAmount_lte?: InputMaybe; + liquidationFeeAmount_not_eq?: InputMaybe; + liquidationFeeAmount_not_in?: InputMaybe>; + marketAddress_contains?: InputMaybe; + marketAddress_containsInsensitive?: InputMaybe; + marketAddress_endsWith?: InputMaybe; + marketAddress_eq?: InputMaybe; + marketAddress_gt?: InputMaybe; + marketAddress_gte?: InputMaybe; + marketAddress_in?: InputMaybe>; + marketAddress_isNull?: InputMaybe; + marketAddress_lt?: InputMaybe; + marketAddress_lte?: InputMaybe; + marketAddress_not_contains?: InputMaybe; + marketAddress_not_containsInsensitive?: InputMaybe; + marketAddress_not_endsWith?: InputMaybe; + marketAddress_not_eq?: InputMaybe; + marketAddress_not_in?: InputMaybe>; + marketAddress_not_startsWith?: InputMaybe; + marketAddress_startsWith?: InputMaybe; + minOutputAmount_eq?: InputMaybe; + minOutputAmount_gt?: InputMaybe; + minOutputAmount_gte?: InputMaybe; + minOutputAmount_in?: InputMaybe>; + minOutputAmount_isNull?: InputMaybe; + minOutputAmount_lt?: InputMaybe; + minOutputAmount_lte?: InputMaybe; + minOutputAmount_not_eq?: InputMaybe; + minOutputAmount_not_in?: InputMaybe>; + numberOfParts_eq?: InputMaybe; + numberOfParts_gt?: InputMaybe; + numberOfParts_gte?: InputMaybe; + numberOfParts_in?: InputMaybe>; + numberOfParts_isNull?: InputMaybe; + numberOfParts_lt?: InputMaybe; + numberOfParts_lte?: InputMaybe; + numberOfParts_not_eq?: InputMaybe; + numberOfParts_not_in?: InputMaybe>; + orderKey_contains?: InputMaybe; + orderKey_containsInsensitive?: InputMaybe; + orderKey_endsWith?: InputMaybe; + orderKey_eq?: InputMaybe; + orderKey_gt?: InputMaybe; + orderKey_gte?: InputMaybe; + orderKey_in?: InputMaybe>; + orderKey_isNull?: InputMaybe; + orderKey_lt?: InputMaybe; + orderKey_lte?: InputMaybe; + orderKey_not_contains?: InputMaybe; + orderKey_not_containsInsensitive?: InputMaybe; + orderKey_not_endsWith?: InputMaybe; + orderKey_not_eq?: InputMaybe; + orderKey_not_in?: InputMaybe>; + orderKey_not_startsWith?: InputMaybe; + orderKey_startsWith?: InputMaybe; + orderType_eq?: InputMaybe; + orderType_gt?: InputMaybe; + orderType_gte?: InputMaybe; + orderType_in?: InputMaybe>; + orderType_isNull?: InputMaybe; + orderType_lt?: InputMaybe; + orderType_lte?: InputMaybe; + orderType_not_eq?: InputMaybe; + orderType_not_in?: InputMaybe>; + pnlUsd_eq?: InputMaybe; + pnlUsd_gt?: InputMaybe; + pnlUsd_gte?: InputMaybe; + pnlUsd_in?: InputMaybe>; + pnlUsd_isNull?: InputMaybe; + pnlUsd_lt?: InputMaybe; + pnlUsd_lte?: InputMaybe; + pnlUsd_not_eq?: InputMaybe; + pnlUsd_not_in?: InputMaybe>; + positionFeeAmount_eq?: InputMaybe; + positionFeeAmount_gt?: InputMaybe; + positionFeeAmount_gte?: InputMaybe; + positionFeeAmount_in?: InputMaybe>; + positionFeeAmount_isNull?: InputMaybe; + positionFeeAmount_lt?: InputMaybe; + positionFeeAmount_lte?: InputMaybe; + positionFeeAmount_not_eq?: InputMaybe; + positionFeeAmount_not_in?: InputMaybe>; + priceImpactAmount_eq?: InputMaybe; + priceImpactAmount_gt?: InputMaybe; + priceImpactAmount_gte?: InputMaybe; + priceImpactAmount_in?: InputMaybe>; + priceImpactAmount_isNull?: InputMaybe; + priceImpactAmount_lt?: InputMaybe; + priceImpactAmount_lte?: InputMaybe; + priceImpactAmount_not_eq?: InputMaybe; + priceImpactAmount_not_in?: InputMaybe>; + priceImpactDiffUsd_eq?: InputMaybe; + priceImpactDiffUsd_gt?: InputMaybe; + priceImpactDiffUsd_gte?: InputMaybe; + priceImpactDiffUsd_in?: InputMaybe>; + priceImpactDiffUsd_isNull?: InputMaybe; + priceImpactDiffUsd_lt?: InputMaybe; + priceImpactDiffUsd_lte?: InputMaybe; + priceImpactDiffUsd_not_eq?: InputMaybe; + priceImpactDiffUsd_not_in?: InputMaybe>; + priceImpactUsd_eq?: InputMaybe; + priceImpactUsd_gt?: InputMaybe; + priceImpactUsd_gte?: InputMaybe; + priceImpactUsd_in?: InputMaybe>; + priceImpactUsd_isNull?: InputMaybe; + priceImpactUsd_lt?: InputMaybe; + priceImpactUsd_lte?: InputMaybe; + priceImpactUsd_not_eq?: InputMaybe; + priceImpactUsd_not_in?: InputMaybe>; + proportionalPendingImpactUsd_eq?: InputMaybe; + proportionalPendingImpactUsd_gt?: InputMaybe; + proportionalPendingImpactUsd_gte?: InputMaybe; + proportionalPendingImpactUsd_in?: InputMaybe>; + proportionalPendingImpactUsd_isNull?: InputMaybe; + proportionalPendingImpactUsd_lt?: InputMaybe; + proportionalPendingImpactUsd_lte?: InputMaybe; + proportionalPendingImpactUsd_not_eq?: InputMaybe; + proportionalPendingImpactUsd_not_in?: InputMaybe>; + reasonBytes_contains?: InputMaybe; + reasonBytes_containsInsensitive?: InputMaybe; + reasonBytes_endsWith?: InputMaybe; + reasonBytes_eq?: InputMaybe; + reasonBytes_gt?: InputMaybe; + reasonBytes_gte?: InputMaybe; + reasonBytes_in?: InputMaybe>; + reasonBytes_isNull?: InputMaybe; + reasonBytes_lt?: InputMaybe; + reasonBytes_lte?: InputMaybe; + reasonBytes_not_contains?: InputMaybe; + reasonBytes_not_containsInsensitive?: InputMaybe; + reasonBytes_not_endsWith?: InputMaybe; + reasonBytes_not_eq?: InputMaybe; + reasonBytes_not_in?: InputMaybe>; + reasonBytes_not_startsWith?: InputMaybe; + reasonBytes_startsWith?: InputMaybe; + reason_contains?: InputMaybe; + reason_containsInsensitive?: InputMaybe; + reason_endsWith?: InputMaybe; + reason_eq?: InputMaybe; + reason_gt?: InputMaybe; + reason_gte?: InputMaybe; + reason_in?: InputMaybe>; + reason_isNull?: InputMaybe; + reason_lt?: InputMaybe; + reason_lte?: InputMaybe; + reason_not_contains?: InputMaybe; + reason_not_containsInsensitive?: InputMaybe; + reason_not_endsWith?: InputMaybe; + reason_not_eq?: InputMaybe; + reason_not_in?: InputMaybe>; + reason_not_startsWith?: InputMaybe; + reason_startsWith?: InputMaybe; + shouldUnwrapNativeToken_eq?: InputMaybe; + shouldUnwrapNativeToken_isNull?: InputMaybe; + shouldUnwrapNativeToken_not_eq?: InputMaybe; + sizeDeltaUsd_eq?: InputMaybe; + sizeDeltaUsd_gt?: InputMaybe; + sizeDeltaUsd_gte?: InputMaybe; + sizeDeltaUsd_in?: InputMaybe>; + sizeDeltaUsd_isNull?: InputMaybe; + sizeDeltaUsd_lt?: InputMaybe; + sizeDeltaUsd_lte?: InputMaybe; + sizeDeltaUsd_not_eq?: InputMaybe; + sizeDeltaUsd_not_in?: InputMaybe>; + srcChainId_eq?: InputMaybe; + srcChainId_gt?: InputMaybe; + srcChainId_gte?: InputMaybe; + srcChainId_in?: InputMaybe>; + srcChainId_isNull?: InputMaybe; + srcChainId_lt?: InputMaybe; + srcChainId_lte?: InputMaybe; + srcChainId_not_eq?: InputMaybe; + srcChainId_not_in?: InputMaybe>; + swapPath_containsAll?: InputMaybe>; + swapPath_containsAny?: InputMaybe>; + swapPath_containsNone?: InputMaybe>; + swapPath_isNull?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + totalImpactUsd_eq?: InputMaybe; + totalImpactUsd_gt?: InputMaybe; + totalImpactUsd_gte?: InputMaybe; + totalImpactUsd_in?: InputMaybe>; + totalImpactUsd_isNull?: InputMaybe; + totalImpactUsd_lt?: InputMaybe; + totalImpactUsd_lte?: InputMaybe; + totalImpactUsd_not_eq?: InputMaybe; + totalImpactUsd_not_in?: InputMaybe>; transaction?: InputMaybe; - transaction_isNull?: InputMaybe; - triggerPrice_eq?: InputMaybe; - triggerPrice_gt?: InputMaybe; - triggerPrice_gte?: InputMaybe; - triggerPrice_in?: InputMaybe>; - triggerPrice_isNull?: InputMaybe; - triggerPrice_lt?: InputMaybe; - triggerPrice_lte?: InputMaybe; - triggerPrice_not_eq?: InputMaybe; - triggerPrice_not_in?: InputMaybe>; - twapGroupId_contains?: InputMaybe; - twapGroupId_containsInsensitive?: InputMaybe; - twapGroupId_endsWith?: InputMaybe; - twapGroupId_eq?: InputMaybe; - twapGroupId_gt?: InputMaybe; - twapGroupId_gte?: InputMaybe; - twapGroupId_in?: InputMaybe>; - twapGroupId_isNull?: InputMaybe; - twapGroupId_lt?: InputMaybe; - twapGroupId_lte?: InputMaybe; - twapGroupId_not_contains?: InputMaybe; - twapGroupId_not_containsInsensitive?: InputMaybe; - twapGroupId_not_endsWith?: InputMaybe; - twapGroupId_not_eq?: InputMaybe; - twapGroupId_not_in?: InputMaybe>; - twapGroupId_not_startsWith?: InputMaybe; - twapGroupId_startsWith?: InputMaybe; - uiFeeReceiver_contains?: InputMaybe; - uiFeeReceiver_containsInsensitive?: InputMaybe; - uiFeeReceiver_endsWith?: InputMaybe; - uiFeeReceiver_eq?: InputMaybe; - uiFeeReceiver_gt?: InputMaybe; - uiFeeReceiver_gte?: InputMaybe; - uiFeeReceiver_in?: InputMaybe>; - uiFeeReceiver_isNull?: InputMaybe; - uiFeeReceiver_lt?: InputMaybe; - uiFeeReceiver_lte?: InputMaybe; - uiFeeReceiver_not_contains?: InputMaybe; - uiFeeReceiver_not_containsInsensitive?: InputMaybe; - uiFeeReceiver_not_endsWith?: InputMaybe; - uiFeeReceiver_not_eq?: InputMaybe; - uiFeeReceiver_not_in?: InputMaybe>; - uiFeeReceiver_not_startsWith?: InputMaybe; - uiFeeReceiver_startsWith?: InputMaybe; + transaction_isNull?: InputMaybe; + triggerPrice_eq?: InputMaybe; + triggerPrice_gt?: InputMaybe; + triggerPrice_gte?: InputMaybe; + triggerPrice_in?: InputMaybe>; + triggerPrice_isNull?: InputMaybe; + triggerPrice_lt?: InputMaybe; + triggerPrice_lte?: InputMaybe; + triggerPrice_not_eq?: InputMaybe; + triggerPrice_not_in?: InputMaybe>; + twapGroupId_contains?: InputMaybe; + twapGroupId_containsInsensitive?: InputMaybe; + twapGroupId_endsWith?: InputMaybe; + twapGroupId_eq?: InputMaybe; + twapGroupId_gt?: InputMaybe; + twapGroupId_gte?: InputMaybe; + twapGroupId_in?: InputMaybe>; + twapGroupId_isNull?: InputMaybe; + twapGroupId_lt?: InputMaybe; + twapGroupId_lte?: InputMaybe; + twapGroupId_not_contains?: InputMaybe; + twapGroupId_not_containsInsensitive?: InputMaybe; + twapGroupId_not_endsWith?: InputMaybe; + twapGroupId_not_eq?: InputMaybe; + twapGroupId_not_in?: InputMaybe>; + twapGroupId_not_startsWith?: InputMaybe; + twapGroupId_startsWith?: InputMaybe; + uiFeeReceiver_contains?: InputMaybe; + uiFeeReceiver_containsInsensitive?: InputMaybe; + uiFeeReceiver_endsWith?: InputMaybe; + uiFeeReceiver_eq?: InputMaybe; + uiFeeReceiver_gt?: InputMaybe; + uiFeeReceiver_gte?: InputMaybe; + uiFeeReceiver_in?: InputMaybe>; + uiFeeReceiver_isNull?: InputMaybe; + uiFeeReceiver_lt?: InputMaybe; + uiFeeReceiver_lte?: InputMaybe; + uiFeeReceiver_not_contains?: InputMaybe; + uiFeeReceiver_not_containsInsensitive?: InputMaybe; + uiFeeReceiver_not_endsWith?: InputMaybe; + uiFeeReceiver_not_eq?: InputMaybe; + uiFeeReceiver_not_in?: InputMaybe>; + uiFeeReceiver_not_startsWith?: InputMaybe; + uiFeeReceiver_startsWith?: InputMaybe; } export interface TradeActionsConnection { - __typename?: "TradeActionsConnection"; + __typename?: 'TradeActionsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface Transaction { - __typename?: "Transaction"; - blockNumber: Scalars["Int"]["output"]; - chainId: Scalars["Int"]["output"]; - from: Scalars["String"]["output"]; - hash: Scalars["String"]["output"]; - id: Scalars["String"]["output"]; - timestamp: Scalars["Int"]["output"]; - to: Scalars["String"]["output"]; - transactionIndex: Scalars["Int"]["output"]; + __typename?: 'Transaction'; + blockNumber: Scalars['Int']['output']; + from: Scalars['String']['output']; + hash: Scalars['String']['output']; + id: Scalars['String']['output']; + timestamp: Scalars['Int']['output']; + to: Scalars['String']['output']; + transactionIndex: Scalars['Int']['output']; } export interface TransactionEdge { - __typename?: "TransactionEdge"; - cursor: Scalars["String"]["output"]; + __typename?: 'TransactionEdge'; + cursor: Scalars['String']['output']; node: Transaction; } export enum TransactionOrderByInput { - blockNumber_ASC = "blockNumber_ASC", - blockNumber_ASC_NULLS_FIRST = "blockNumber_ASC_NULLS_FIRST", - blockNumber_ASC_NULLS_LAST = "blockNumber_ASC_NULLS_LAST", - blockNumber_DESC = "blockNumber_DESC", - blockNumber_DESC_NULLS_FIRST = "blockNumber_DESC_NULLS_FIRST", - blockNumber_DESC_NULLS_LAST = "blockNumber_DESC_NULLS_LAST", - chainId_ASC = "chainId_ASC", - chainId_ASC_NULLS_FIRST = "chainId_ASC_NULLS_FIRST", - chainId_ASC_NULLS_LAST = "chainId_ASC_NULLS_LAST", - chainId_DESC = "chainId_DESC", - chainId_DESC_NULLS_FIRST = "chainId_DESC_NULLS_FIRST", - chainId_DESC_NULLS_LAST = "chainId_DESC_NULLS_LAST", - from_ASC = "from_ASC", - from_ASC_NULLS_FIRST = "from_ASC_NULLS_FIRST", - from_ASC_NULLS_LAST = "from_ASC_NULLS_LAST", - from_DESC = "from_DESC", - from_DESC_NULLS_FIRST = "from_DESC_NULLS_FIRST", - from_DESC_NULLS_LAST = "from_DESC_NULLS_LAST", - hash_ASC = "hash_ASC", - hash_ASC_NULLS_FIRST = "hash_ASC_NULLS_FIRST", - hash_ASC_NULLS_LAST = "hash_ASC_NULLS_LAST", - hash_DESC = "hash_DESC", - hash_DESC_NULLS_FIRST = "hash_DESC_NULLS_FIRST", - hash_DESC_NULLS_LAST = "hash_DESC_NULLS_LAST", - id_ASC = "id_ASC", - id_ASC_NULLS_FIRST = "id_ASC_NULLS_FIRST", - id_ASC_NULLS_LAST = "id_ASC_NULLS_LAST", - id_DESC = "id_DESC", - id_DESC_NULLS_FIRST = "id_DESC_NULLS_FIRST", - id_DESC_NULLS_LAST = "id_DESC_NULLS_LAST", - timestamp_ASC = "timestamp_ASC", - timestamp_ASC_NULLS_FIRST = "timestamp_ASC_NULLS_FIRST", - timestamp_ASC_NULLS_LAST = "timestamp_ASC_NULLS_LAST", - timestamp_DESC = "timestamp_DESC", - timestamp_DESC_NULLS_FIRST = "timestamp_DESC_NULLS_FIRST", - timestamp_DESC_NULLS_LAST = "timestamp_DESC_NULLS_LAST", - to_ASC = "to_ASC", - to_ASC_NULLS_FIRST = "to_ASC_NULLS_FIRST", - to_ASC_NULLS_LAST = "to_ASC_NULLS_LAST", - to_DESC = "to_DESC", - to_DESC_NULLS_FIRST = "to_DESC_NULLS_FIRST", - to_DESC_NULLS_LAST = "to_DESC_NULLS_LAST", - transactionIndex_ASC = "transactionIndex_ASC", - transactionIndex_ASC_NULLS_FIRST = "transactionIndex_ASC_NULLS_FIRST", - transactionIndex_ASC_NULLS_LAST = "transactionIndex_ASC_NULLS_LAST", - transactionIndex_DESC = "transactionIndex_DESC", - transactionIndex_DESC_NULLS_FIRST = "transactionIndex_DESC_NULLS_FIRST", - transactionIndex_DESC_NULLS_LAST = "transactionIndex_DESC_NULLS_LAST", + blockNumber_ASC = 'blockNumber_ASC', + blockNumber_ASC_NULLS_FIRST = 'blockNumber_ASC_NULLS_FIRST', + blockNumber_ASC_NULLS_LAST = 'blockNumber_ASC_NULLS_LAST', + blockNumber_DESC = 'blockNumber_DESC', + blockNumber_DESC_NULLS_FIRST = 'blockNumber_DESC_NULLS_FIRST', + blockNumber_DESC_NULLS_LAST = 'blockNumber_DESC_NULLS_LAST', + from_ASC = 'from_ASC', + from_ASC_NULLS_FIRST = 'from_ASC_NULLS_FIRST', + from_ASC_NULLS_LAST = 'from_ASC_NULLS_LAST', + from_DESC = 'from_DESC', + from_DESC_NULLS_FIRST = 'from_DESC_NULLS_FIRST', + from_DESC_NULLS_LAST = 'from_DESC_NULLS_LAST', + hash_ASC = 'hash_ASC', + hash_ASC_NULLS_FIRST = 'hash_ASC_NULLS_FIRST', + hash_ASC_NULLS_LAST = 'hash_ASC_NULLS_LAST', + hash_DESC = 'hash_DESC', + hash_DESC_NULLS_FIRST = 'hash_DESC_NULLS_FIRST', + hash_DESC_NULLS_LAST = 'hash_DESC_NULLS_LAST', + id_ASC = 'id_ASC', + id_ASC_NULLS_FIRST = 'id_ASC_NULLS_FIRST', + id_ASC_NULLS_LAST = 'id_ASC_NULLS_LAST', + id_DESC = 'id_DESC', + id_DESC_NULLS_FIRST = 'id_DESC_NULLS_FIRST', + id_DESC_NULLS_LAST = 'id_DESC_NULLS_LAST', + timestamp_ASC = 'timestamp_ASC', + timestamp_ASC_NULLS_FIRST = 'timestamp_ASC_NULLS_FIRST', + timestamp_ASC_NULLS_LAST = 'timestamp_ASC_NULLS_LAST', + timestamp_DESC = 'timestamp_DESC', + timestamp_DESC_NULLS_FIRST = 'timestamp_DESC_NULLS_FIRST', + timestamp_DESC_NULLS_LAST = 'timestamp_DESC_NULLS_LAST', + to_ASC = 'to_ASC', + to_ASC_NULLS_FIRST = 'to_ASC_NULLS_FIRST', + to_ASC_NULLS_LAST = 'to_ASC_NULLS_LAST', + to_DESC = 'to_DESC', + to_DESC_NULLS_FIRST = 'to_DESC_NULLS_FIRST', + to_DESC_NULLS_LAST = 'to_DESC_NULLS_LAST', + transactionIndex_ASC = 'transactionIndex_ASC', + transactionIndex_ASC_NULLS_FIRST = 'transactionIndex_ASC_NULLS_FIRST', + transactionIndex_ASC_NULLS_LAST = 'transactionIndex_ASC_NULLS_LAST', + transactionIndex_DESC = 'transactionIndex_DESC', + transactionIndex_DESC_NULLS_FIRST = 'transactionIndex_DESC_NULLS_FIRST', + transactionIndex_DESC_NULLS_LAST = 'transactionIndex_DESC_NULLS_LAST' } export interface TransactionWhereInput { AND?: InputMaybe>; OR?: InputMaybe>; - blockNumber_eq?: InputMaybe; - blockNumber_gt?: InputMaybe; - blockNumber_gte?: InputMaybe; - blockNumber_in?: InputMaybe>; - blockNumber_isNull?: InputMaybe; - blockNumber_lt?: InputMaybe; - blockNumber_lte?: InputMaybe; - blockNumber_not_eq?: InputMaybe; - blockNumber_not_in?: InputMaybe>; - chainId_eq?: InputMaybe; - chainId_gt?: InputMaybe; - chainId_gte?: InputMaybe; - chainId_in?: InputMaybe>; - chainId_isNull?: InputMaybe; - chainId_lt?: InputMaybe; - chainId_lte?: InputMaybe; - chainId_not_eq?: InputMaybe; - chainId_not_in?: InputMaybe>; - from_contains?: InputMaybe; - from_containsInsensitive?: InputMaybe; - from_endsWith?: InputMaybe; - from_eq?: InputMaybe; - from_gt?: InputMaybe; - from_gte?: InputMaybe; - from_in?: InputMaybe>; - from_isNull?: InputMaybe; - from_lt?: InputMaybe; - from_lte?: InputMaybe; - from_not_contains?: InputMaybe; - from_not_containsInsensitive?: InputMaybe; - from_not_endsWith?: InputMaybe; - from_not_eq?: InputMaybe; - from_not_in?: InputMaybe>; - from_not_startsWith?: InputMaybe; - from_startsWith?: InputMaybe; - hash_contains?: InputMaybe; - hash_containsInsensitive?: InputMaybe; - hash_endsWith?: InputMaybe; - hash_eq?: InputMaybe; - hash_gt?: InputMaybe; - hash_gte?: InputMaybe; - hash_in?: InputMaybe>; - hash_isNull?: InputMaybe; - hash_lt?: InputMaybe; - hash_lte?: InputMaybe; - hash_not_contains?: InputMaybe; - hash_not_containsInsensitive?: InputMaybe; - hash_not_endsWith?: InputMaybe; - hash_not_eq?: InputMaybe; - hash_not_in?: InputMaybe>; - hash_not_startsWith?: InputMaybe; - hash_startsWith?: InputMaybe; - id_contains?: InputMaybe; - id_containsInsensitive?: InputMaybe; - id_endsWith?: InputMaybe; - id_eq?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_isNull?: InputMaybe; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_containsInsensitive?: InputMaybe; - id_not_endsWith?: InputMaybe; - id_not_eq?: InputMaybe; - id_not_in?: InputMaybe>; - id_not_startsWith?: InputMaybe; - id_startsWith?: InputMaybe; - timestamp_eq?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_isNull?: InputMaybe; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not_eq?: InputMaybe; - timestamp_not_in?: InputMaybe>; - to_contains?: InputMaybe; - to_containsInsensitive?: InputMaybe; - to_endsWith?: InputMaybe; - to_eq?: InputMaybe; - to_gt?: InputMaybe; - to_gte?: InputMaybe; - to_in?: InputMaybe>; - to_isNull?: InputMaybe; - to_lt?: InputMaybe; - to_lte?: InputMaybe; - to_not_contains?: InputMaybe; - to_not_containsInsensitive?: InputMaybe; - to_not_endsWith?: InputMaybe; - to_not_eq?: InputMaybe; - to_not_in?: InputMaybe>; - to_not_startsWith?: InputMaybe; - to_startsWith?: InputMaybe; - transactionIndex_eq?: InputMaybe; - transactionIndex_gt?: InputMaybe; - transactionIndex_gte?: InputMaybe; - transactionIndex_in?: InputMaybe>; - transactionIndex_isNull?: InputMaybe; - transactionIndex_lt?: InputMaybe; - transactionIndex_lte?: InputMaybe; - transactionIndex_not_eq?: InputMaybe; - transactionIndex_not_in?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + from_contains?: InputMaybe; + from_containsInsensitive?: InputMaybe; + from_endsWith?: InputMaybe; + from_eq?: InputMaybe; + from_gt?: InputMaybe; + from_gte?: InputMaybe; + from_in?: InputMaybe>; + from_isNull?: InputMaybe; + from_lt?: InputMaybe; + from_lte?: InputMaybe; + from_not_contains?: InputMaybe; + from_not_containsInsensitive?: InputMaybe; + from_not_endsWith?: InputMaybe; + from_not_eq?: InputMaybe; + from_not_in?: InputMaybe>; + from_not_startsWith?: InputMaybe; + from_startsWith?: InputMaybe; + hash_contains?: InputMaybe; + hash_containsInsensitive?: InputMaybe; + hash_endsWith?: InputMaybe; + hash_eq?: InputMaybe; + hash_gt?: InputMaybe; + hash_gte?: InputMaybe; + hash_in?: InputMaybe>; + hash_isNull?: InputMaybe; + hash_lt?: InputMaybe; + hash_lte?: InputMaybe; + hash_not_contains?: InputMaybe; + hash_not_containsInsensitive?: InputMaybe; + hash_not_endsWith?: InputMaybe; + hash_not_eq?: InputMaybe; + hash_not_in?: InputMaybe>; + hash_not_startsWith?: InputMaybe; + hash_startsWith?: InputMaybe; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + to_contains?: InputMaybe; + to_containsInsensitive?: InputMaybe; + to_endsWith?: InputMaybe; + to_eq?: InputMaybe; + to_gt?: InputMaybe; + to_gte?: InputMaybe; + to_in?: InputMaybe>; + to_isNull?: InputMaybe; + to_lt?: InputMaybe; + to_lte?: InputMaybe; + to_not_contains?: InputMaybe; + to_not_containsInsensitive?: InputMaybe; + to_not_endsWith?: InputMaybe; + to_not_eq?: InputMaybe; + to_not_in?: InputMaybe>; + to_not_startsWith?: InputMaybe; + to_startsWith?: InputMaybe; + transactionIndex_eq?: InputMaybe; + transactionIndex_gt?: InputMaybe; + transactionIndex_gte?: InputMaybe; + transactionIndex_in?: InputMaybe>; + transactionIndex_isNull?: InputMaybe; + transactionIndex_lt?: InputMaybe; + transactionIndex_lte?: InputMaybe; + transactionIndex_not_eq?: InputMaybe; + transactionIndex_not_in?: InputMaybe>; } export interface TransactionsConnection { - __typename?: "TransactionsConnection"; + __typename?: 'TransactionsConnection'; edges: Array; pageInfo: PageInfo; - totalCount: Scalars["Int"]["output"]; + totalCount: Scalars['Int']['output']; } export interface WhereInput { - from?: InputMaybe; - id_eq?: InputMaybe; - maxCapital_gte?: InputMaybe; - to?: InputMaybe; + from?: InputMaybe; + id_eq?: InputMaybe; + maxCapital_gte?: InputMaybe; + to?: InputMaybe; } diff --git a/sdk/src/types/tokens.ts b/sdk/src/types/tokens.ts index c2ff9f2de1..71dc8ae388 100644 --- a/sdk/src/types/tokens.ts +++ b/sdk/src/types/tokens.ts @@ -135,6 +135,9 @@ export type TokenData = Token & { prices: TokenPrices; walletBalance?: bigint; gmxAccountBalance?: bigint; + /** + * In source chain decimals, use `getMappedTokenId` to get the decimals + */ sourceChainBalance?: bigint; balanceType?: TokenBalanceType; /** diff --git a/sdk/src/types/trade.ts b/sdk/src/types/trade.ts index ab35b46a24..0c7a82ede4 100644 --- a/sdk/src/types/trade.ts +++ b/sdk/src/types/trade.ts @@ -348,6 +348,7 @@ export type GmSwapFees = { swapPriceImpact?: FeeItem; uiFee?: FeeItem; shiftFee?: FeeItem; + logicalNetworkFee?: FeeItem; }; export type TradeSearchParams = { diff --git a/sdk/src/utils/fees/estimateOraclePriceCount.ts b/sdk/src/utils/fees/estimateOraclePriceCount.ts index 3dc385e79b..7a16e60bc0 100644 --- a/sdk/src/utils/fees/estimateOraclePriceCount.ts +++ b/sdk/src/utils/fees/estimateOraclePriceCount.ts @@ -1,5 +1,5 @@ // @see https://github.com/gmx-io/gmx-synthetics/blob/6ed9be061d8fcc0dc7bc5d34dee3bf091408a1bf/contracts/gas/GasUtils.sol#L218-L234 -export function estimateDepositOraclePriceCount(swapsCount: number): bigint { +export function estimateDepositOraclePriceCount(swapsCount: number | bigint): bigint { return 3n + BigInt(swapsCount); } diff --git a/sdk/src/utils/fees/executionFee.ts b/sdk/src/utils/fees/executionFee.ts index 19421461e0..9835adcbdf 100644 --- a/sdk/src/utils/fees/executionFee.ts +++ b/sdk/src/utils/fees/executionFee.ts @@ -237,15 +237,12 @@ export function estimateExecuteSwapOrderGasLimit( export function estimateExecuteDepositGasLimit( gasLimits: GasLimitsConfig, deposit: { - // We do not use this yet - longTokenSwapsCount?: number; - // We do not use this yet - shortTokenSwapsCount?: number; + swapsCount?: number | bigint; callbackGasLimit?: bigint; } ) { const gasPerSwap = gasLimits.singleSwap; - const swapsCount = BigInt((deposit.longTokenSwapsCount ?? 0) + (deposit.shortTokenSwapsCount ?? 0)); + const swapsCount = BigInt(deposit.swapsCount ?? 0); const gasForSwaps = swapsCount * gasPerSwap; return gasLimits.depositToken + (deposit.callbackGasLimit ?? 0n) + gasForSwaps; @@ -256,11 +253,11 @@ export function estimateExecuteGlvDepositGasLimit( { marketsCount, isMarketTokenDeposit, + swapsCount, }: { isMarketTokenDeposit: boolean; marketsCount: bigint; - initialLongTokenAmount: bigint; - initialShortTokenAmount: bigint; + swapsCount: bigint; } ) { const gasPerGlvPerMarket = gasLimits.glvPerMarketGasLimit; @@ -272,7 +269,10 @@ export function estimateExecuteGlvDepositGasLimit( return gasLimit; } - return gasLimit + gasLimits.depositToken; + const gasPerSwap = gasLimits.singleSwap; + const gasForSwaps = swapsCount * gasPerSwap; + + return gasLimit + gasLimits.depositToken + gasForSwaps; } export function estimateExecuteGlvWithdrawalGasLimit( diff --git a/sdk/src/utils/markets.ts b/sdk/src/utils/markets.ts index 6ec7a07961..f56bc13df0 100644 --- a/sdk/src/utils/markets.ts +++ b/sdk/src/utils/markets.ts @@ -1,4 +1,5 @@ import { BASIS_POINTS_DIVISOR } from "configs/factors"; +import { MarketConfig } from "configs/markets"; import { getTokenVisualMultiplier, NATIVE_TOKEN_ADDRESS } from "configs/tokens"; import { ContractMarketPrices, Market, MarketInfo } from "types/markets"; import { Token, TokenPrices, TokensData } from "types/tokens"; @@ -145,6 +146,12 @@ export function getOppositeCollateral(marketInfo: MarketInfo, tokenAddress: stri return undefined; } +export function getOppositeCollateralFromConfig(marketConfig: MarketConfig, tokenAddress: string) { + return marketConfig.shortTokenAddress === tokenAddress + ? marketConfig.longTokenAddress + : marketConfig.shortTokenAddress; +} + export function getAvailableUsdLiquidityForCollateral(marketInfo: MarketInfo, isLong: boolean) { const poolUsd = getPoolUsdWithoutPnl(marketInfo, isLong, "minPrice"); diff --git a/sdk/src/utils/swap/buildSwapStrategy.ts b/sdk/src/utils/swap/buildSwapStrategy.ts index a4172b33ad..237f88e498 100644 --- a/sdk/src/utils/swap/buildSwapStrategy.ts +++ b/sdk/src/utils/swap/buildSwapStrategy.ts @@ -152,14 +152,16 @@ export function buildReverseSwapStrategy({ chainId, externalSwapQuoteParams, swapOptimizationOrder, + isAtomicSwap, }: { chainId: number; amountOut: bigint; tokenIn: TokenData; tokenOut: TokenData; marketsInfoData: MarketsInfoData | undefined; - externalSwapQuoteParams: ExternalSwapQuoteParams; + externalSwapQuoteParams: ExternalSwapQuoteParams | undefined; swapOptimizationOrder: SwapOptimizationOrderArray | undefined; + isAtomicSwap?: boolean; }): SwapStrategyForSwapOrders { const priceIn = getMidPrice(tokenIn.prices); const priceOut = getMidPrice(tokenOut.prices); @@ -190,7 +192,7 @@ export function buildReverseSwapStrategy({ fromTokenAddress: tokenIn.address, toTokenAddress: tokenOut.address, marketsInfoData, - isExpressFeeSwap: false, + isExpressFeeSwap: isAtomicSwap, }); const approximateSwapPathStats = findSwapPath(approximateUsdIn, { order: swapOptimizationOrder }); @@ -241,7 +243,7 @@ export function buildReverseSwapStrategy({ return Boolean(swapPathStats); }); - if (suitableSwapPath) { + if (suitableSwapPath && externalSwapQuoteParams) { const approximateExternalSwapQuoteForCombinedSwap = getExternalSwapQuoteByPath({ amountIn: approximateAmountIn, externalSwapPath: suitableSwapPath, diff --git a/sdk/yarn.lock b/sdk/yarn.lock index 9c2441efdf..1d7023e82f 100644 --- a/sdk/yarn.lock +++ b/sdk/yarn.lock @@ -5520,7 +5520,7 @@ __metadata: "viem@patch:viem@npm:2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341::locator=%40gmx-io%2Fsdk%40workspace%3A.": version: 2.37.1 - resolution: "viem@patch:viem@npm%3A2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=410eea&locator=%40gmx-io%2Fsdk%40workspace%3A." + resolution: "viem@patch:viem@npm%3A2.37.1#../.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=aa32ba&locator=%40gmx-io%2Fsdk%40workspace%3A." dependencies: "@noble/curves": 1.9.1 "@noble/hashes": 1.8.0 @@ -5535,7 +5535,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 7f0c63f1f263c9af7bc437aa0a99503985733bb779578462c5c225098637fa0735abab219f9c0b6cbac593c977c4fd1f735f80536ab7d47cec60f6e25c124df4 + checksum: d6e24123d5ccab32ccfad86f35d5800876e677992ba5c7a8cf29110cab7653aa5a45a583b6d44e6a5451278f8307630f25eb4c6a8bda07c6f41dc96c3b4aec20 languageName: node linkType: hard diff --git a/src/App/MainRoutes.tsx b/src/App/MainRoutes.tsx index dd7d994301..2ed21d94cd 100644 --- a/src/App/MainRoutes.tsx +++ b/src/App/MainRoutes.tsx @@ -4,7 +4,6 @@ import { Redirect, Route, Switch, useLocation } from "react-router-dom"; import type { Address } from "viem"; import { isDevelopment } from "config/env"; -import { PoolsDetailsContextProvider } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { SyntheticsStateContextProvider } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; import { useChainId } from "lib/chains"; import { AccountDashboard } from "pages/AccountDashboard/AccountDashboard"; @@ -105,9 +104,9 @@ export function MainRoutes({ openSettings }: { openSettings: () => void }) { - - - + {/* */} + + {/* */} diff --git a/src/components/GmSwap/GmFees/GmFees.tsx b/src/components/GmSwap/GmFees/GmFees.tsx index a8f7a7b0f3..eab9c74e7d 100644 --- a/src/components/GmSwap/GmFees/GmFees.tsx +++ b/src/components/GmSwap/GmFees/GmFees.tsx @@ -11,6 +11,8 @@ import StatsTooltipRow from "components/StatsTooltip/StatsTooltipRow"; import { SyntheticsInfoRow } from "components/SyntheticsInfoRow"; import Tooltip from "components/Tooltip/Tooltip"; +import SpinnerIcon from "img/ic_spinner.svg?react"; + import { Operation } from "../GmSwapBox/types"; import "./GmFees.scss"; @@ -21,6 +23,7 @@ type Props = { uiFee?: FeeItem; shiftFee?: FeeItem; operation: Operation; + isLoading?: boolean; }; export function GmFees(p: Props) { @@ -203,5 +206,10 @@ export function GmFees(p: Props) { totalFeesUsd, ]); - return Price Impact / Fees} value={value} />; + return ( + Price Impact / Fees} + value={p.isLoading ? : value} + /> + ); } diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 1ea01295f3..3a4962de20 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -7,10 +7,23 @@ import uniqBy from "lodash/uniqBy"; import { useCallback, useEffect, useMemo, useState } from "react"; import { useAccount } from "wagmi"; +import { SettlementChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; -import { isSourceChain } from "config/multichain"; +import { getMappedTokenId, isSourceChain } from "config/multichain"; +import { + selectPoolsDetailsGlvOrMarketAddress, + selectPoolsDetailsMarketTokenData, + usePoolsDetailsFirstTokenAddress, + usePoolsDetailsFirstTokenInputValue, + usePoolsDetailsFocusedInput, + usePoolsDetailsMarketOrGlvTokenInputValue, + usePoolsDetailsPaySource, + usePoolsDetailsSecondTokenAddress, + usePoolsDetailsSecondTokenInputValue, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; import { useTokensData } from "context/SyntheticsStateContext/hooks/globalsHooks"; +import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectGlvAndMarketsInfoData, selectMarketsInfoData, @@ -18,7 +31,18 @@ import { import { useSelector } from "context/SyntheticsStateContext/utils"; import { useGasLimits, useGasPrice } from "domain/synthetics/fees"; import useUiFeeFactorRequest from "domain/synthetics/fees/utils/useUiFeeFactor"; -import { useMarketTokensData } from "domain/synthetics/markets"; +import { + RawCreateDepositParams, + RawCreateGlvDepositParams, + RawCreateGlvWithdrawalParams, + RawCreateWithdrawalParams, + useMarketTokensData, +} from "domain/synthetics/markets"; +import { estimatePureLpActionExecutionFee } from "domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee"; +import { estimateSourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; +import { estimateSourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; +import { estimateSourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; +import { estimateSourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; import { isGlvInfo } from "domain/synthetics/markets/glv"; import { getAvailableUsdLiquidityForCollateral, @@ -33,8 +57,12 @@ import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; import { useChainId } from "lib/chains"; import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "lib/numbers"; import { getByKey } from "lib/objects"; +import { usePrevious } from "lib/usePrevious"; +import { useThrottledAsync } from "lib/useThrottledAsync"; import { switchNetwork } from "lib/wallets"; +import { MARKETS } from "sdk/configs/markets"; import { getNativeToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; +import { WithdrawalAmounts } from "sdk/types/trade"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; @@ -52,23 +80,26 @@ import { GmSwapWarningsRow } from "../GmSwapWarningsRow"; import { Mode, Operation } from "../types"; import { useGmWarningState } from "../useGmWarningState"; import { InfoRows } from "./InfoRows"; +import { selectPoolsDetailsParams } from "./lpTxn/useParams"; +import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts"; import { TokenInputState } from "./types"; -import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; -import { useGmDepositWithdrawalBoxState } from "./useGmDepositWithdrawalBoxState"; import { useGmSwapSubmitState } from "./useGmSwapSubmitState"; import { useUpdateInputAmounts } from "./useUpdateInputAmounts"; import { useUpdateTokens } from "./useUpdateTokens"; export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const { - selectedGlvOrMarketAddress, + // selectedGlvOrMarketAddress, operation, mode, onSelectGlvOrMarket, selectedMarketForGlv, onSelectedMarketForGlv, } = p; + const selectedGlvOrMarketAddress = useSelector(selectPoolsDetailsGlvOrMarketAddress); + const marketToken = useSelector(selectPoolsDetailsMarketTokenData); + // const [, setSettlementChainId] = useGmxAccountSettlementChainId(); const { shouldDisableValidationForTesting } = useSettings(); const { chainId, srcChainId } = useChainId(); const [isMarketForGlvSelectedManually, setIsMarketForGlvSelectedManually] = useState(false); @@ -96,6 +127,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { account, selectedGlvOrMarketAddress ); + // #endregion // #region Selectors @@ -110,22 +142,13 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const rawTradeTokensData = useTokensData(); // #region State - const { - focusedInput, - setFocusedInput, - paySource, - setPaySource, - firstTokenAddress, - setFirstTokenAddress, - secondTokenAddress, - setSecondTokenAddress, - firstTokenInputValue, - setFirstTokenInputValue, - secondTokenInputValue, - setSecondTokenInputValue, - marketOrGlvTokenInputValue, - setMarketOrGlvTokenInputValue, - } = useGmDepositWithdrawalBoxState(operation, mode, selectedGlvOrMarketAddress); + const [focusedInput, setFocusedInput] = usePoolsDetailsFocusedInput(); + const [paySource, setPaySource] = usePoolsDetailsPaySource(); + const [firstTokenAddress, setFirstTokenAddress] = usePoolsDetailsFirstTokenAddress(); + const [secondTokenAddress, setSecondTokenAddress] = usePoolsDetailsSecondTokenAddress(); + const [firstTokenInputValue, setFirstTokenInputValue] = usePoolsDetailsFirstTokenInputValue(); + const [secondTokenInputValue, setSecondTokenInputValue] = usePoolsDetailsSecondTokenInputValue(); + const [marketOrGlvTokenInputValue, setMarketOrGlvTokenInputValue] = usePoolsDetailsMarketOrGlvTokenInputValue(); // #endregion // #region Derived state @@ -235,7 +258,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { inputs.push({ address: firstTokenAddress, isMarketToken: firstToken?.symbol === "GM", - value: firstTokenInputValue, + value: firstTokenInputValue || "", setValue: setFirstTokenInputValue, amount: firstTokenAmount, usd: firstTokenUsd, @@ -245,7 +268,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { if (isPair && secondTokenAddress) { inputs.push({ address: secondTokenAddress, - value: secondTokenInputValue, + value: secondTokenInputValue || "", isMarketToken: false, setValue: setSecondTokenInputValue, amount: secondTokenAmount, @@ -286,7 +309,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { * When buy/sell GM - marketToken is GM token, glvToken is undefined * When buy/sell GLV - marketToken is corresponding GM token, glvToken is selected GLV token */ - const { marketTokenAmount, marketToken, glvToken, glvTokenAmount } = useMemo(() => { + const { marketTokenAmount, glvToken, glvTokenAmount } = useMemo(() => { const marketToken = getTokenData(marketTokensData, marketInfo?.marketTokenAddress); const marketTokenAmount = glvInfo ? fromMarketTokenInputState?.amount ?? 0n @@ -364,10 +387,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }); }, [tradeTokensData, tokenOptions]); - // useEffect(() => { - // console.log({ availableTokensData, tokenOptions }); - // }, [availableTokensData, tokenOptions]); - const { longCollateralLiquidityUsd, shortCollateralLiquidityUsd } = useMemo(() => { if (!marketInfo) { return {}; @@ -381,26 +400,204 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const isMarketTokenDeposit = Boolean(fromMarketTokenInputState); - const amounts = useDepositWithdrawalAmounts({ - chainId, - isDeposit, - marketInfo, - marketToken, - glvToken, - glvTokenAmount, - longTokenInputState, - shortTokenInputState, - marketTokenAmount, - uiFeeFactor, - focusedInput, - isWithdrawal, - marketTokensData, - isMarketTokenDeposit, - glvInfo, - isPair, - }); + const amounts = useSelector(selectDepositWithdrawalAmounts); + + const globalExpressParams = useSelector(selectExpressGlobalParams); + + const tokenAddress = + longTokenInputState?.amount !== undefined && longTokenInputState?.amount > 0n + ? longTokenInputState?.address + : shortTokenInputState?.address; + const tokenAmount = + longTokenInputState?.amount !== undefined && longTokenInputState?.amount > 0n + ? longTokenInputState?.amount + : shortTokenInputState?.amount; + + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + + const params = useSelector(selectPoolsDetailsParams); + + // paySource !== usePrevious(paySource) || operation !== usePrevious(operation) + const prevPaySource = usePrevious(paySource); + const prevOperation = usePrevious(operation); + const prevIsPair = usePrevious(isPair); + const forceRecalculate = prevPaySource !== paySource || prevOperation !== operation || prevIsPair !== isPair; + + // if (forceRecalculate) { + // console.log({ forceRecalculate }); + // } - const { fees, executionFee } = useDepositWithdrawalFees({ + const technicalFeesAsyncResult = useThrottledAsync( + async (p) => { + if (p.params.paySource === "gmxAccount" || p.params.paySource === "settlementChain") { + if (!p.params.globalExpressParams) { + return undefined; + } + if (p.params.operation === Operation.Deposit) { + if (p.params.isGlv) { + const castedParams = p.params.params as RawCreateGlvDepositParams; + return estimatePureLpActionExecutionFee({ + action: { + operation: Operation.Deposit, + isGlv: true, + marketsCount: BigInt(p.params.glvInfo!.markets.length), + swapsCount: BigInt( + castedParams.addresses.longTokenSwapPath.length + castedParams.addresses.shortTokenSwapPath.length + ), + isMarketTokenDeposit: castedParams.isMarketTokenDeposit, + }, + chainId: p.params.chainId, + globalExpressParams: p.params.globalExpressParams, + }); + } else { + const castedParams = p.params.params as RawCreateDepositParams; + return estimatePureLpActionExecutionFee({ + action: { + operation: Operation.Deposit, + isGlv: false, + swapsCount: BigInt( + castedParams.addresses.longTokenSwapPath.length + castedParams.addresses.shortTokenSwapPath.length + ), + }, + chainId: p.params.chainId, + globalExpressParams: p.params.globalExpressParams, + }); + } + } else if (p.params.operation === Operation.Withdrawal) { + if (p.params.isGlv) { + const castedParams = p.params.params as RawCreateGlvWithdrawalParams; + return estimatePureLpActionExecutionFee({ + action: { + operation: Operation.Withdrawal, + isGlv: true, + marketsCount: BigInt(p.params.glvInfo!.markets.length), + swapsCount: BigInt( + castedParams.addresses.longTokenSwapPath.length + castedParams.addresses.shortTokenSwapPath.length + ), + }, + chainId: p.params.chainId, + globalExpressParams: p.params.globalExpressParams, + }); + } + const castedParams = p.params.params as RawCreateWithdrawalParams; + return estimatePureLpActionExecutionFee({ + action: { + operation: Operation.Withdrawal, + isGlv: false, + swapsCount: BigInt( + castedParams.addresses.longTokenSwapPath.length + castedParams.addresses.shortTokenSwapPath.length + ), + }, + chainId: p.params.chainId, + globalExpressParams: p.params.globalExpressParams, + }); + } + } else if (p.params.paySource === "sourceChain") { + if (p.params.tokenAddress === undefined || p.params.tokenAmount === undefined) { + // throw new Error("Token address or token amount is not defined"); + return undefined; + } + if (p.params.operation === Operation.Deposit) { + if (p.params.isGlv) { + const castedParams = p.params.params as RawCreateGlvDepositParams; + return await estimateSourceChainGlvDepositFees({ + chainId: p.params.chainId as SettlementChainId, + srcChainId: p.params.srcChainId as SourceChainId, + params: castedParams, + tokenAddress: p.params.tokenAddress, + tokenAmount: p.params.tokenAmount, + globalExpressParams: p.params.globalExpressParams, + glvMarketCount: BigInt(p.params.glvInfo!.markets.length), + }); + } else { + const castedParams = p.params.params as RawCreateDepositParams; + return await estimateSourceChainDepositFees({ + chainId: p.params.chainId as SettlementChainId, + srcChainId: p.params.srcChainId as SourceChainId, + params: castedParams, + tokenAddress: p.params.tokenAddress, + tokenAmount: p.params.tokenAmount, + globalExpressParams: p.params.globalExpressParams, + }); + } + } else if (p.params.operation === Operation.Withdrawal) { + if (p.params.isGlv) { + const castedParams = p.params.params as RawCreateGlvWithdrawalParams; + const glvWithdrawalAmounts = p.params.amounts as WithdrawalAmounts; + const outputLongTokenAddress = + glvWithdrawalAmounts.longTokenSwapPathStats?.tokenOutAddress ?? glvInfo!.longTokenAddress; + const outputShortTokenAddress = + glvWithdrawalAmounts.shortTokenSwapPathStats?.tokenOutAddress ?? glvInfo!.shortTokenAddress; + + return await estimateSourceChainGlvWithdrawalFees({ + chainId: p.params.chainId as SettlementChainId, + srcChainId: p.params.srcChainId as SourceChainId, + params: castedParams, + tokenAddress: castedParams.addresses.glv, + tokenAmount: p.params.marketTokenAmount, + globalExpressParams: p.params.globalExpressParams, + marketsCount: BigInt(p.params.glvInfo!.markets.length), + outputLongTokenAddress, + outputShortTokenAddress, + }); + } else { + const castedParams = p.params.params as RawCreateWithdrawalParams; + if (!p.params.amounts) { + // throw new Error("Amounts are not defined"); + return undefined; + } + + const gmWithdrawalAmounts = p.params.amounts as WithdrawalAmounts; + + const outputLongTokenAddress = + gmWithdrawalAmounts.longTokenSwapPathStats?.tokenOutAddress ?? + MARKETS[p.params.chainId][p.params.params.addresses.market].longTokenAddress; + const outputShortTokenAddress = + gmWithdrawalAmounts.shortTokenSwapPathStats?.tokenOutAddress ?? + MARKETS[p.params.chainId][p.params.params.addresses.market].shortTokenAddress; + + return await estimateSourceChainWithdrawalFees({ + chainId: p.params.chainId as SettlementChainId, + srcChainId: p.params.srcChainId as SourceChainId, + params: castedParams, + tokenAddress: p.params.params.addresses.market, + tokenAmount: p.params.marketTokenAmount, + globalExpressParams: p.params.globalExpressParams, + outputLongTokenAddress, + outputShortTokenAddress, + }); + } + } + } + }, + { + params: + globalExpressParams && params + ? { + chainId, + globalExpressParams, + params, + isGlv, + glvInfo, + paySource, + srcChainId, + tokenAddress, + marketTokenAmount, + tokenAmount, + operation, + amounts, + } + : undefined, + withLoading: true, + forceRecalculate, + } + ); + + // useEffect(() => { + // console.log(technicalFeesAsyncResult); + // }, [technicalFeesAsyncResult]); + + const { logicalFees } = useDepositWithdrawalFees({ amounts, chainId, gasLimits, @@ -409,44 +606,44 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { tokensData: tradeTokensData, glvInfo, isMarketTokenDeposit, + technicalFees: technicalFeesAsyncResult.data, + srcChainId, }); const { shouldShowWarning, shouldShowWarningForExecutionFee, shouldShowWarningForPosition } = useGmWarningState({ - executionFee, - fees, + logicalFees, }); const submitState = useGmSwapSubmitState({ routerAddress, - amounts, - executionFee, - fees, - isDeposit, - marketInfo, - glvInfo, - marketToken: marketToken!, - operation, - glvToken, + // amounts, + logicalFees, + technicalFees: technicalFeesAsyncResult.data, + // isDeposit, + // marketInfo, + // glvInfo, + // operation, + // glvToken, shouldDisableValidation: shouldDisableValidationForTesting, tokensData: tradeTokensData, - longTokenAddress: longTokenInputState?.address, - shortTokenAddress: shortTokenInputState?.address, + // longTokenAddress: longTokenInputState?.address, + // shortTokenAddress: shortTokenInputState?.address, longTokenLiquidityUsd: longCollateralLiquidityUsd, shortTokenLiquidityUsd: shortCollateralLiquidityUsd, - marketTokensData, - selectedMarketForGlv, - selectedMarketInfoForGlv: getByKey(marketsInfoData, selectedMarketForGlv), - isMarketTokenDeposit: isMarketTokenDeposit, + // marketTokensData, + // selectedMarketForGlv, + // selectedMarketInfoForGlv: getByKey(marketsInfoData, selectedMarketForGlv), + // isMarketTokenDeposit: isMarketTokenDeposit, marketsInfoData, glvAndMarketsInfoData, - paySource, - isPair, + // paySource: paySource || "settlementChain", + // isPair, }); const firstTokenMaxDetails = useMaxAvailableAmount({ fromToken: firstToken, fromTokenAmount: firstTokenAmount ?? 0n, - fromTokenInputValue: firstTokenInputValue, + fromTokenInputValue: firstTokenInputValue || "", nativeToken: nativeToken, minResidualAmount: undefined, isLoading: false, @@ -515,22 +712,34 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { } let balance; + let decimals; if (paySource === "gmxAccount") { balance = firstToken.gmxAccountBalance; + decimals = firstToken.decimals; } else if (paySource === "sourceChain") { balance = firstToken.sourceChainBalance; + + decimals = getMappedTokenId( + chainId as SettlementChainId, + firstToken.address, + srcChainId as SourceChainId + )?.decimals; + if (!decimals) { + return undefined; + } } else { balance = firstToken.walletBalance; + decimals = firstToken.decimals; } if (balance === undefined) { return undefined; } - return formatBalanceAmount(balance, firstToken.decimals, undefined, { + return formatBalanceAmount(balance, decimals, undefined, { isStable: firstToken.isStable, }); - }, [firstToken, paySource]); + }, [firstToken, paySource, chainId, srcChainId]); // #region Callbacks const onFocusedCollateralInputChange = useCallback( @@ -722,7 +931,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isDeposit, glvInfo, selectedMarketForGlv, - fees, + fees: logicalFees, uiFeeFactor, focusedInput, marketTokenAmount, @@ -884,7 +1093,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { chainId={chainId} label={isWithdrawal ? t`Pay` : t`Receive`} srcChainId={srcChainId} - paySource={paySource} + paySource={paySource || "settlementChain"} onSelectTokenAddress={async (newChainId) => { if (newChainId === 0) { setPaySource("gmxAccount"); @@ -935,7 +1144,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) {
{submitButton}
- + ); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx index f64f1c598f..b447a8508f 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx @@ -1,23 +1,26 @@ -import { t } from "@lingui/macro"; +import { t, Trans } from "@lingui/macro"; import { useState } from "react"; -import { ExecutionFee } from "domain/synthetics/fees"; import { GmSwapFees } from "domain/synthetics/trade"; +import { formatDeltaUsd } from "lib/numbers"; import { ExpandableRow } from "components/ExpandableRow"; import { GmFees } from "components/GmSwap/GmFees/GmFees"; -import { NetworkFeeRow } from "components/NetworkFeeRow/NetworkFeeRow"; +import { SyntheticsInfoRow } from "components/SyntheticsInfoRow"; + +import SpinnerIcon from "img/ic_spinner.svg?react"; import { Operation } from "../types"; export function InfoRows({ isDeposit, fees, - executionFee, + + isLoading, }: { isDeposit: boolean; fees: GmSwapFees | undefined; - executionFee: ExecutionFee | undefined; + isLoading?: boolean; }) { const [isExecutionDetailsOpen, setIsExecutionDetailsOpen] = useState(false); @@ -33,6 +36,7 @@ export function InfoRows({ swapFee={fees?.swapFee} swapPriceImpact={fees?.swapPriceImpact} uiFee={fees?.uiFee} + isLoading={isLoading} /> - + Network Fee} + value={ + isLoading ? ( + + ) : ( + formatDeltaUsd(fees?.logicalNetworkFee?.deltaUsd) + ) + } + /> ); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index 51fcfbaf0e..48a2e2b092 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -1,32 +1,45 @@ import { t } from "@lingui/macro"; import chunk from "lodash/chunk"; import { useCallback, useMemo } from "react"; -import { Hex, bytesToHex, hexToBytes, numberToHex, zeroAddress } from "viem"; +import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; import { SettlementChainId } from "config/chains"; import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; +import { + selectPoolsDetailsGlvInfo, + selectPoolsDetailsGlvOrMarketAddress, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketTokenData, + selectPoolsDetailsShortTokenAddress, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; -import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectBlockTimestampData, selectChainId, selectSrcChainId, } from "context/SyntheticsStateContext/selectors/globalSelectors"; -import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; import { TransferRequests } from "domain/multichain/types"; -import { CreateDepositParamsStruct, CreateGlvDepositParamsStruct, createDepositTxn } from "domain/synthetics/markets"; +import { + CreateDepositParams, + createDepositTxn, + CreateGlvDepositParams, + RawCreateDepositParams, + RawCreateGlvDepositParams, +} from "domain/synthetics/markets"; import { createGlvDepositTxn } from "domain/synthetics/markets/createGlvDepositTxn"; import { createMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; import { createMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; import { createSourceChainDepositTxn } from "domain/synthetics/markets/createSourceChainDepositTxn"; import { createSourceChainGlvDepositTxn } from "domain/synthetics/markets/createSourceChainGlvDepositTxn"; -import { convertToTokenAmount, getMidPrice, getTokenData } from "domain/tokens"; +import { SourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; +import { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; import { helperToast } from "lib/helperToast"; import { initGLVSwapMetricData, @@ -41,7 +54,8 @@ import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmC import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { convertTokenAddress } from "sdk/configs/tokens"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { ExecutionFee } from "sdk/types/fees"; import { nowInSeconds } from "sdk/utils/time"; import { applySlippageToMinOut } from "sdk/utils/trade"; @@ -49,11 +63,7 @@ import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainDepositExpressTxnParams } from "./useMultichainDepositExpressTxnParams"; export const useDepositTransactions = ({ - marketInfo, - marketToken, - longTokenAddress = marketInfo?.longTokenAddress, longTokenAmount, - shortTokenAddress = marketInfo?.shortTokenAddress, shortTokenAmount, glvTokenAmount, glvTokenUsd, @@ -61,10 +71,9 @@ export const useDepositTransactions = ({ marketTokenUsd, shouldDisableValidation, tokensData, - executionFee, + technicalFees, selectedMarketForGlv, selectedMarketInfoForGlv, - glvInfo, isMarketTokenDeposit, isFirstBuy, paySource, @@ -77,10 +86,15 @@ export const useDepositTransactions = ({ const { setPendingDeposit } = useSyntheticsEvents(); const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); - const globalExpressParams = useSelector(selectExpressGlobalParams); + // const globalExpressParams = useSelector(selectExpressGlobalParams); - const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; - const executionFeeTokenAmount = executionFee?.feeTokenAmount; + // const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; + const marketTokenAddress = useSelector(selectPoolsDetailsGlvOrMarketAddress); + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); + const marketInfo = useSelector(selectPoolsDetailsMarketInfo); + const marketToken = useSelector(selectPoolsDetailsMarketTokenData); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); const shouldUnwrapNativeToken = (longTokenAddress === zeroAddress && longTokenAmount !== undefined && longTokenAmount > 0n) || @@ -116,12 +130,12 @@ export const useDepositTransactions = ({ ]); }, [chainId, initialLongTokenAddress, initialShortTokenAddress, isGlv, longTokenAmount, shortTokenAmount]); - const gmParams = useMemo((): CreateDepositParamsStruct | undefined => { + const rawGmParams = useMemo((): RawCreateDepositParams | undefined => { if ( !account || !marketTokenAddress || marketTokenAmount === undefined || - executionFeeTokenAmount === undefined || + // executionFeeTokenAmount === undefined || isGlv || !initialLongTokenAddress || !initialShortTokenAddress @@ -138,12 +152,17 @@ export const useDepositTransactions = ({ return undefined; } + const multichainTokenConfig = getMultichainTokenId(chainId, marketTokenAddress); + if (!multichainTokenConfig) { + return undefined; + } + const actionHash = CodecUiHelper.encodeMultichainActionData({ actionType: MultichainActionType.BridgeOut, actionData: { deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), desChainId: chainId, - provider: getMultichainTokenId(chainId, marketTokenAddress)!.stargate, + provider: multichainTokenConfig.stargate, providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), minAmountOut: minMarketTokens, secondaryProvider: zeroAddress, @@ -157,7 +176,7 @@ export const useDepositTransactions = ({ dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; } - const params: CreateDepositParamsStruct = { + const params: RawCreateDepositParams = { addresses: { receiver: account, callbackContract: zeroAddress, @@ -170,7 +189,6 @@ export const useDepositTransactions = ({ }, minMarketTokens, shouldUnwrapNativeToken: false, - executionFee: executionFeeTokenAmount, callbackGasLimit: 0n, dataList, }; @@ -179,7 +197,7 @@ export const useDepositTransactions = ({ }, [ account, chainId, - executionFeeTokenAmount, + // executionFeeTokenAmount, initialLongTokenAddress, initialShortTokenAddress, isGlv, @@ -189,12 +207,12 @@ export const useDepositTransactions = ({ srcChainId, ]); - const glvParams = useMemo((): CreateGlvDepositParamsStruct | undefined => { + const rawGlvParams = useMemo((): RawCreateGlvDepositParams | undefined => { if ( !account || !marketInfo || marketTokenAmount === undefined || - executionFeeTokenAmount === undefined || + // executionFeeTokenAmount === undefined || !isGlv || glvTokenAmount === undefined || !initialLongTokenAddress || @@ -236,7 +254,7 @@ export const useDepositTransactions = ({ dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; } - const params: CreateGlvDepositParamsStruct = { + const params: RawCreateGlvDepositParams = { addresses: { glv: glvInfo!.glvTokenAddress, market: selectedMarketForGlv!, @@ -249,7 +267,6 @@ export const useDepositTransactions = ({ shortTokenSwapPath: [], }, minGlvTokens, - executionFee: executionFeeTokenAmount, callbackGasLimit: 0n, shouldUnwrapNativeToken, isMarketTokenDeposit: Boolean(isMarketTokenDeposit), @@ -260,7 +277,7 @@ export const useDepositTransactions = ({ }, [ account, chainId, - executionFeeTokenAmount, + // executionFeeTokenAmount, glvInfo, glvTokenAmount, initialLongTokenAddress, @@ -275,6 +292,43 @@ export const useDepositTransactions = ({ srcChainId, ]); + const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; + const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; + + const gmParams = useMemo((): CreateDepositParams | undefined => { + if (!rawGmParams || !technicalFees) { + // console.log("no gm params becayse no", { rawGmParams, technicalFees }); + + return undefined; + } + + const executionFee = + paySource === "sourceChain" + ? (technicalFees as SourceChainDepositFees).executionFee + : (technicalFees as ExecutionFee).feeTokenAmount; + + return { + ...rawGmParams, + executionFee, + }; + }, [rawGmParams, technicalFees, paySource]); + + const glvParams = useMemo((): CreateGlvDepositParams | undefined => { + if (!rawGlvParams || !technicalFees) { + return undefined; + } + + const executionFee = + paySource === "sourceChain" + ? (technicalFees as SourceChainGlvDepositFees).executionFee + : (technicalFees as ExecutionFee).feeTokenAmount; + + return { + ...rawGlvParams, + executionFee, + }; + }, [paySource, rawGlvParams, technicalFees]); + const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ transferRequests, paySource, @@ -290,7 +344,8 @@ export const useDepositTransactions = ({ shortTokenAddress, selectedMarketForGlv, isDeposit: true, - executionFee, + executionFeeTokenAmount: glvParams?.executionFee, + executionFeeTokenDecimals: getWrappedToken(chainId)!.decimals, glvAddress: glvInfo!.glvTokenAddress, glvToken: glvInfo!.glvToken, longTokenAmount, @@ -309,7 +364,8 @@ export const useDepositTransactions = ({ shortTokenAddress, marketToken, isDeposit: true, - executionFee, + executionFeeTokenAmount: gmParams?.executionFee, + executionFeeTokenDecimals: getWrappedToken(chainId)!.decimals, marketInfo, longTokenAmount, shortTokenAmount, @@ -319,10 +375,11 @@ export const useDepositTransactions = ({ }); }, [ chainId, - executionFee, glvInfo, + glvParams?.executionFee, glvTokenAmount, glvTokenUsd, + gmParams?.executionFee, isFirstBuy, isGlv, longTokenAddress, @@ -343,7 +400,7 @@ export const useDepositTransactions = ({ sendOrderSubmittedMetric(metricData.metricId); - if (!executionFee || !tokensData || !account || !signer || !gmParams) { + if (!tokensData || !account || !signer || !rawGmParams) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); return Promise.resolve(); @@ -358,20 +415,22 @@ export const useDepositTransactions = ({ throw new Error("Pay source sourceChain does not support both long and short token deposits"); } + if (!technicalFees) { + throw new Error("Technical fees are not set"); + } + const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; promise = createSourceChainDepositTxn({ chainId: chainId as SettlementChainId, - globalExpressParams: globalExpressParams!, srcChainId: srcChainId!, signer, transferRequests, - params: gmParams!, - account, + params: rawGmParams!, tokenAddress, tokenAmount, - executionFee: executionFee.feeTokenAmount, + fees: technicalFees as SourceChainDepositFees, }); } else if (paySource === "gmxAccount") { promise = createMultichainDepositTxn({ @@ -389,8 +448,8 @@ export const useDepositTransactions = ({ blockTimestampData, longTokenAmount: longTokenAmount ?? 0n, shortTokenAmount: shortTokenAmount ?? 0n, - executionFee: executionFee.feeTokenAmount, - executionGasLimit: executionFee.gasLimit, + executionFee: (technicalFees as ExecutionFee).feeTokenAmount, + executionGasLimit: (technicalFees as ExecutionFee).gasLimit, skipSimulation: shouldDisableValidation, tokensData, metricId: metricData.metricId, @@ -408,47 +467,32 @@ export const useDepositTransactions = ({ .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); }, [ + getDepositMetricData, + tokensData, account, - blockTimestampData, + signer, + rawGmParams, chainId, - executionFee, - getDepositMetricData, - globalExpressParams, - gmParams, - longTokenAddress, - longTokenAmount, - multichainDepositExpressTxnParams, paySource, - setPendingDeposit, - setPendingTxns, - shortTokenAddress, + longTokenAmount, shortTokenAmount, - shouldDisableValidation, - signer, + longTokenAddress, + shortTokenAddress, srcChainId, - tokensData, transferRequests, + multichainDepositExpressTxnParams, + gmParams, + blockTimestampData, + technicalFees, + shouldDisableValidation, + setPendingTxns, + setPendingDeposit, ] ); // TODO MLTCH make it pretty - const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; - const wrappedTokenAddress = longTokenAmount! > 0n ? initialLongTokenAddress! : initialShortTokenAddress!; - const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; - - const tokenData = getTokenData(tokensData, tokenAddress); - - const selectFindSwapPath = useMemo( - () => - makeSelectFindSwapPath( - wrappedTokenAddress, - executionFee?.feeToken.address - ? convertTokenAddress(chainId, executionFee.feeToken.address, "wrapped") - : undefined - ), - [chainId, executionFee?.feeToken.address, wrappedTokenAddress] - ); - const findSwapPath = useSelector(selectFindSwapPath); + // const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; + // const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; const onCreateGlvDeposit = useCallback( async function onCreateGlvDeposit() { @@ -458,13 +502,11 @@ export const useDepositTransactions = ({ if ( !account || - !executionFee || - !marketToken || !marketInfo || marketTokenAmount === undefined || !tokensData || !signer || - (isGlv && !glvParams) + (isGlv && !rawGlvParams) ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -479,31 +521,19 @@ export const useDepositTransactions = ({ throw new Error("Pay source sourceChain does not support both long and short token deposits"); } - if (!tokenData) { - throw new Error("Price not found"); + if (!technicalFees) { + throw new Error("Technical fees are not set"); } - const feeSwapPathStats = findSwapPath(executionFee.feeUsd); - const feeSwapPath = feeSwapPathStats?.swapPath ?? []; - - const feeAmount = - (convertToTokenAmount(executionFee.feeUsd, tokenData.decimals, getMidPrice(tokenData.prices))! * 11n) / 10n; - promise = createSourceChainGlvDepositTxn({ chainId: chainId as SettlementChainId, srcChainId: srcChainId!, signer, transferRequests, - params: glvParams!, - account, + params: rawGlvParams!, tokenAddress, tokenAmount, - globalExpressParams: globalExpressParams!, - relayFeePayload: { - feeToken: wrappedTokenAddress, - feeAmount, - feeSwapPath, - }, + fees: technicalFees as SourceChainGlvDepositFees, }); } else if (paySource === "gmxAccount") { const expressTxnParams = await multichainDepositExpressTxnParams.promise; @@ -529,8 +559,8 @@ export const useDepositTransactions = ({ longTokenAmount: longTokenAmount ?? 0n, shortTokenAmount: shortTokenAmount ?? 0n, marketTokenAmount: marketTokenAmount ?? 0n, - executionFee: executionFee.feeTokenAmount, - executionGasLimit: executionFee.gasLimit, + executionFee: (technicalFees as ExecutionFee).feeTokenAmount, + executionGasLimit: (technicalFees as ExecutionFee).gasLimit, skipSimulation: shouldDisableValidation, tokensData, blockTimestampData, @@ -547,35 +577,31 @@ export const useDepositTransactions = ({ .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); }, [ - account, - blockTimestampData, - chainId, - executionFee, - findSwapPath, getDepositMetricData, - globalExpressParams, - glvParams, - isGlv, - longTokenAddress, - longTokenAmount, + account, marketInfo, - marketToken, marketTokenAmount, - multichainDepositExpressTxnParams.promise, + tokensData, + signer, + isGlv, + rawGlvParams, + chainId, paySource, - setPendingDeposit, - setPendingTxns, - shortTokenAddress, + longTokenAmount, shortTokenAmount, - shouldDisableValidation, - signer, + technicalFees, srcChainId, + transferRequests, tokenAddress, tokenAmount, - tokenData, - tokensData, - transferRequests, - wrappedTokenAddress, + multichainDepositExpressTxnParams.promise, + glvParams, + longTokenAddress, + shortTokenAddress, + shouldDisableValidation, + blockTimestampData, + setPendingTxns, + setPendingDeposit, ] ); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx index 51bff1b0c9..77479c652f 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx @@ -1,8 +1,12 @@ import { useCallback, useState } from "react"; -import { ExecutionFee } from "domain/synthetics/fees"; -import { GlvInfo, MarketInfo } from "domain/synthetics/markets"; -import { TokenData, TokensData } from "domain/synthetics/tokens"; +import type { ExecutionFee } from "domain/synthetics/fees"; +import type { MarketInfo } from "domain/synthetics/markets"; +import type { SourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; +import type { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; +import { SourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; +import { SourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; +import type { TokensData } from "domain/synthetics/tokens"; import { Operation } from "../../types"; import type { GmPaySource } from "../types"; @@ -10,12 +14,7 @@ import { useDepositTransactions } from "./useDepositTransactions"; import { useWithdrawalTransactions } from "./useWithdrawalTransactions"; export interface UseLpTransactionProps { - marketInfo?: MarketInfo; - glvInfo?: GlvInfo; - marketToken: TokenData | undefined; operation: Operation; - longTokenAddress: string | undefined; - shortTokenAddress: string | undefined; marketTokenAmount: bigint | undefined; marketTokenUsd: bigint | undefined; @@ -30,7 +29,13 @@ export interface UseLpTransactionProps { shouldDisableValidation?: boolean; tokensData: TokensData | undefined; - executionFee: ExecutionFee | undefined; + technicalFees: + | ExecutionFee + | SourceChainGlvDepositFees + | SourceChainDepositFees + | SourceChainWithdrawalFees + | SourceChainGlvWithdrawalFees + | undefined; selectedMarketForGlv?: string; selectedMarketInfoForGlv?: MarketInfo; isMarketTokenDeposit?: boolean; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx index 4eb243213c..2c28a1c700 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx @@ -1,6 +1,6 @@ import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { TransferRequests } from "domain/multichain/types"; -import type { CreateDepositParamsStruct, CreateGlvDepositParamsStruct } from "domain/synthetics/markets"; +import type { CreateDepositParams, CreateGlvDepositParams } from "domain/synthetics/markets"; import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; import { buildAndSignMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; import { useChainId } from "lib/chains"; @@ -18,15 +18,15 @@ export function useMultichainDepositExpressTxnParams({ }: { transferRequests: TransferRequests; paySource: GmPaySource; - gmParams: CreateDepositParamsStruct | undefined; - glvParams: CreateGlvDepositParamsStruct | undefined; + gmParams: CreateDepositParams | undefined; + glvParams: CreateGlvDepositParams | undefined; }) { const { chainId, srcChainId } = useChainId(); const { signer } = useWallet(); const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ isGmxAccount: paySource === "gmxAccount", - enabled: paySource === "gmxAccount", + enabled: paySource === "gmxAccount" && Boolean(glvParams || gmParams), executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { if ((!gmParams && !glvParams) || !signer) { diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx index 5436b5a9c9..3d71ad206d 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx @@ -1,6 +1,6 @@ import { useArbitraryRelayParamsAndPayload } from "domain/multichain/arbitraryRelayParams"; import { TransferRequests } from "domain/multichain/types"; -import type { CreateGlvWithdrawalParamsStruct, CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; +import type { CreateGlvWithdrawalParams, CreateWithdrawalParams } from "domain/synthetics/markets"; import { buildAndSignMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; import { buildAndSignMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; import { useChainId } from "lib/chains"; @@ -16,20 +16,26 @@ export function useMultichainWithdrawalExpressTxnParams({ gmParams, glvParams, }: { - transferRequests: TransferRequests; + transferRequests: TransferRequests | undefined; paySource: GmPaySource; - gmParams: CreateWithdrawalParamsStruct | undefined; - glvParams: CreateGlvWithdrawalParamsStruct | undefined; + gmParams: CreateWithdrawalParams | undefined; + glvParams: CreateGlvWithdrawalParams | undefined; }) { const { chainId, srcChainId } = useChainId(); const { signer } = useWallet(); + const enabled = + paySource === "gmxAccount" && + Boolean(glvParams || gmParams) && + transferRequests !== undefined && + signer !== undefined; + const multichainWithdrawalExpressTxnParams = useArbitraryRelayParamsAndPayload({ isGmxAccount: paySource === "gmxAccount", - enabled: paySource === "gmxAccount", + enabled, executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - if ((!gmParams && !glvParams) || !signer) { + if (!enabled) { throw new Error("Invalid params"); } diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx new file mode 100644 index 0000000000..f96d46ce70 --- /dev/null +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx @@ -0,0 +1,424 @@ +import chunk from "lodash/chunk"; +import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; + +import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; +import { + CHAIN_ID_TO_ENDPOINT_ID, + getLayerZeroEndpointId, + getMultichainTokenId, + getStargatePoolAddress, +} from "config/multichain"; +import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; +import { + selectPoolsDetailsFirstTokenAddress, + selectPoolsDetailsFlags, + selectPoolsDetailsGlvTokenAddress, + selectPoolsDetailsGlvOrMarketAddress, + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsLongTokenAmount, + selectPoolsDetailsMarketOrGlvTokenAmount, + selectPoolsDetailsPaySource, + selectPoolsDetailsSecondTokenAddress, + selectPoolsDetailsSelectedMarketForGlv, + selectPoolsDetailsShortTokenAddress, + selectPoolsDetailsShortTokenAmount, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { + selectGlvAndMarketsInfoData, + selectMarketsInfoData, + selectChainId, + selectAccount, + selectSrcChainId, +} from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { createSelector } from "context/SyntheticsStateContext/utils"; +import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { + RawCreateDepositParams, + RawCreateGlvDepositParams, + RawCreateGlvWithdrawalParams, + RawCreateWithdrawalParams, +} from "domain/synthetics/markets/types"; +import { ERC20Address } from "domain/tokens"; +import { EMPTY_ARRAY, getByKey } from "lib/objects"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { MARKETS } from "sdk/configs/markets"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { WithdrawalAmounts } from "sdk/types/trade"; +import { nowInSeconds } from "sdk/utils/time"; +import { applySlippageToMinOut } from "sdk/utils/trade/trade"; + +import { selectDepositWithdrawalAmounts } from "../selectDepositWithdrawalAmounts"; + +export const selectPoolsDetailsParams = createSelector((q) => { + const account = q(selectAccount); + + // Early return if no account + if (!account) { + return undefined; + } + + const chainId = q(selectChainId); + const srcChainId = q(selectSrcChainId); + + const paySource = q(selectPoolsDetailsPaySource); + // If paySource is sourceChain but no srcChainId, abort early + if (paySource === "sourceChain" && srcChainId === undefined) { + return undefined; + } + + const glvTokenAddress = q(selectPoolsDetailsGlvTokenAddress); + + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + const longTokenAmount = q(selectPoolsDetailsLongTokenAmount); + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + const shortTokenAmount = q(selectPoolsDetailsShortTokenAmount); + + const glvAndMarketsInfoData = q(selectGlvAndMarketsInfoData); + const marketsInfoData = q(selectMarketsInfoData); + + const marketOrGlvTokenAddress = q(selectPoolsDetailsGlvOrMarketAddress); + const selectedMarketForGlv = q(selectPoolsDetailsSelectedMarketForGlv); + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const { isPair, isDeposit, isWithdrawal } = q(selectPoolsDetailsFlags); + const isMarketTokenDeposit = q(selectPoolsDetailsIsMarketTokenDeposit); + + const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); + + const amounts = q(selectDepositWithdrawalAmounts); + + /** + * When buy/sell GM - marketInfo is GM market, glvInfo is undefined + * When buy/sell GLV - marketInfo is corresponding GM market, glvInfo is selected GLV + */ + const glvOrMarketInfo = glvTokenAddress ? getByKey(glvAndMarketsInfoData, glvTokenAddress) : undefined; + const isGlv = glvOrMarketInfo && isGlvInfo(glvOrMarketInfo); + + // If we have a GLV but no selected market, this is a weird state + if (isGlv && !selectedMarketForGlv) { + return undefined; + } + + const marketInfo = isGlv + ? selectedMarketForGlv + ? marketsInfoData?.[selectedMarketForGlv] + : undefined + : glvOrMarketInfo; + + const glvInfo = isGlv ? glvOrMarketInfo : undefined; + + // const marketToken = useMemo(() => { + // return getTokenData(marketsInfoData, marketInfo?.marketTokenAddress); + // }, [marketInfo, marketsInfoData]); + + // const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; + + // const shouldUnwrapNativeToken = + // (longTokenInputState?.address === zeroAddress && + // longTokenInputState?.amount !== undefined && + // longTokenInputState?.amount > 0n) || + // (shortTokenInputState?.address === zeroAddress && + // shortTokenInputState?.amount !== undefined && + // shortTokenInputState?.amount > 0n); + + const wrappedTokenAddress = getWrappedToken(chainId); + + const shouldUnwrapNativeToken = + paySource === "settlementChain" + ? (longTokenAmount > 0n && longTokenAddress === wrappedTokenAddress.address) || + (shortTokenAmount > 0n && shortTokenAddress === wrappedTokenAddress.address) + ? true + : false + : false; + + if (isDeposit && !isGlv) { + // Raw GM Deposit Params + if (!marketOrGlvTokenAddress || marketOrGlvTokenAmount === undefined) { + return undefined; + } + + const minMarketTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketOrGlvTokenAmount); + + let dataList: string[] = EMPTY_ARRAY; + + if (paySource === "sourceChain") { + if (!srcChainId) { + throw new Error("Source chain ID is required"); + } + + const multichainTokenConfig = getMultichainTokenId(chainId, marketOrGlvTokenAddress); + + if (!multichainTokenConfig) { + throw new Error("Multichain token config not found"); + } + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + provider: multichainTokenConfig.stargate, + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), + minAmountOut: minMarketTokens, + secondaryProvider: zeroAddress, + secondaryProviderData: zeroAddress, + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + return { + addresses: { + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + market: marketOrGlvTokenAddress!, + initialLongToken: MARKETS[chainId][marketOrGlvTokenAddress!].longTokenAddress as ERC20Address, + initialShortToken: MARKETS[chainId][marketOrGlvTokenAddress!].shortTokenAddress as ERC20Address, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minMarketTokens, + shouldUnwrapNativeToken: false, + callbackGasLimit: 0n, + dataList, + } satisfies RawCreateDepositParams; + } + + if (isDeposit && isGlv) { + // Raw GLV Deposit Params + if (!marketInfo || !glvTokenAddress || marketOrGlvTokenAmount === undefined) { + return undefined; + } + + const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketOrGlvTokenAmount); + + let dataList: string[] = EMPTY_ARRAY; + if (paySource === "sourceChain") { + if (!srcChainId) { + throw new Error("Source chain ID is required"); + } + + const tokenId = getMultichainTokenId(chainId, glvTokenAddress); + + if (!tokenId) { + throw new Error("Token ID not found"); + } + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + minAmountOut: minGlvTokens, + provider: tokenId.stargate, + providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), + secondaryProvider: zeroAddress, + secondaryProviderData: zeroAddress, + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + return { + addresses: { + glv: glvInfo!.glvTokenAddress, + market: selectedMarketForGlv!, + receiver: glvInfo!.glvToken.totalSupply === 0n ? numberToHex(1, { size: 20 }) : account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + initialLongToken: isMarketTokenDeposit + ? zeroAddress + : (MARKETS[chainId][marketOrGlvTokenAddress!].longTokenAddress as ERC20Address), + initialShortToken: isMarketTokenDeposit + ? zeroAddress + : (MARKETS[chainId][marketOrGlvTokenAddress!].shortTokenAddress as ERC20Address), + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minGlvTokens, + callbackGasLimit: 0n, + shouldUnwrapNativeToken, + isMarketTokenDeposit: Boolean(isMarketTokenDeposit), + dataList, + } satisfies RawCreateGlvDepositParams; + } + + if (isWithdrawal && !isGlv) { + // Raw GM Withdrawal Params + if (!longTokenAddress || !shortTokenAddress) { + return undefined; + } + + const longOftProvider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, longTokenAddress, "native")); + const shortOftProvider = getStargatePoolAddress(chainId, convertTokenAddress(chainId, shortTokenAddress, "native")); + let dataList: string[] = EMPTY_ARRAY; + + if (paySource === "sourceChain") { + if (!srcChainId) { + throw new Error("Source chain ID is required"); + } + + const provider = longOftProvider ?? shortOftProvider; + + if (!provider) { + throw new Error("Provider not found"); + } + + const secondaryProvider = provider === shortOftProvider ? undefined : shortTokenAddress; + + const dstEid = getLayerZeroEndpointId(srcChainId); + if (!dstEid) { + throw new Error("Destination endpoint ID not found"); + } + + const providerData = numberToHex(dstEid, { size: 32 }); + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + provider: provider, + providerData: providerData, + // TODO MLTCH apply some slippage + minAmountOut: 0n, + // TODO MLTCH put secondary provider and data + secondaryProvider: secondaryProvider ?? zeroAddress, + secondaryProviderData: secondaryProvider ? providerData : "0x", + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + let shouldUnwrapNativeTokenForGm = false; + if (paySource === "settlementChain") { + shouldUnwrapNativeTokenForGm = + longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; + } + + return { + addresses: { + market: marketOrGlvTokenAddress!, + receiver: account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + longTokenSwapPath: (amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath ?? [], + shortTokenSwapPath: (amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath ?? [], + }, + // TODO MLTCH: do not forget to apply slippage here + // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minLongTokenAmount: 0n, + // TODO MLTCH: do not forget to apply slippage + // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + minShortTokenAmount: 0n, + shouldUnwrapNativeToken: shouldUnwrapNativeTokenForGm, + callbackGasLimit: 0n, + dataList, + } satisfies RawCreateWithdrawalParams; + } + + if (isWithdrawal && isGlv) { + // Raw GLV Withdrawal Params + if (!firstTokenAddress || !secondTokenAddress) { + return undefined; + } + + const { glvTokenAddress: glvTokenAddress, glvToken } = glvInfo!; + + let dataList: string[] = EMPTY_ARRAY; + if (paySource === "sourceChain") { + if (!srcChainId) { + throw new Error("Source chain ID is required"); + } + + const firstOftProvider = getStargatePoolAddress( + chainId, + convertTokenAddress(chainId, firstTokenAddress, "native") + ); + const secondOftProvider = getStargatePoolAddress( + chainId, + convertTokenAddress(chainId, secondTokenAddress, "native") + ); + + const provider = isPair ? firstOftProvider : secondOftProvider; + + if (!provider) { + throw new Error("Provider not found"); + } + + const secondaryProvider = isPair ? secondOftProvider : undefined; + + const dstEid = getLayerZeroEndpointId(srcChainId); + + if (!dstEid) { + throw new Error("Destination endpoint ID not found"); + } + + const providerData = numberToHex(dstEid, { size: 32 }); + + const actionHash = CodecUiHelper.encodeMultichainActionData({ + actionType: MultichainActionType.BridgeOut, + actionData: { + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + desChainId: chainId, + provider: provider, + providerData: providerData, + // TODO MLTCH apply some slippage + minAmountOut: 0n, + secondaryProvider: secondaryProvider ?? zeroAddress, + secondaryProviderData: secondaryProvider ? providerData : "0x", + secondaryMinAmountOut: 0n, + }, + }); + const bytes = hexToBytes(actionHash as Hex); + + const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); + + dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; + } + + let shouldUnwrapNativeTokenForGlv = false; + if (paySource === "settlementChain") { + shouldUnwrapNativeTokenForGlv = + firstTokenAddress === zeroAddress || secondTokenAddress === zeroAddress ? true : false; + } + + return { + addresses: { + glv: glvTokenAddress!, + market: selectedMarketForGlv!, + receiver: glvToken.totalSupply === 0n ? numberToHex(1, { size: 20 }) : account, + callbackContract: zeroAddress, + uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, + longTokenSwapPath: (amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath ?? [], + shortTokenSwapPath: (amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath ?? [], + }, + // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), + minLongTokenAmount: 0n, + // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), + minShortTokenAmount: 0n, + callbackGasLimit: 0n, + shouldUnwrapNativeToken: shouldUnwrapNativeTokenForGlv, + dataList, + } satisfies RawCreateGlvWithdrawalParams; + } + + return undefined; +}); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index cd8fbb40ac..2d8a2d46f6 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -6,6 +6,13 @@ import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; import { getLayerZeroEndpointId, getStargatePoolAddress, isSettlementChain } from "config/multichain"; import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; +import { + selectPoolsDetailsGlvInfo, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketTokenData, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { selectPoolsDetailsShortTokenAddress } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectBlockTimestampData } from "context/SyntheticsStateContext/selectors/globalSelectors"; @@ -14,15 +21,19 @@ import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domai import { getTransferRequests } from "domain/multichain/getTransferRequests"; import { TransferRequests } from "domain/multichain/types"; import { - CreateGlvWithdrawalParamsStruct, - CreateWithdrawalParamsStruct, + CreateGlvWithdrawalParams, + CreateWithdrawalParams, createWithdrawalTxn, + RawCreateGlvWithdrawalParams, + RawCreateWithdrawalParams, } from "domain/synthetics/markets"; import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; import { createMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; import { createMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; import { createSourceChainGlvWithdrawalTxn } from "domain/synthetics/markets/createSourceChainGlvWithdrawalTxn"; import { createSourceChainWithdrawalTxn } from "domain/synthetics/markets/createSourceChainWithdrawalTxn"; +import { SourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; +import { SourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; import { useChainId } from "lib/chains"; import { helperToast } from "lib/helperToast"; import { @@ -36,17 +47,18 @@ import { EMPTY_ARRAY } from "lib/objects"; import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { convertTokenAddress } from "sdk/configs/tokens"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { ExecutionFee } from "sdk/types/fees"; import { nowInSeconds } from "sdk/utils/time"; import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainWithdrawalExpressTxnParams } from "./useMultichainWithdrawalExpressTxnParams"; export const useWithdrawalTransactions = ({ - glvInfo, + // glvInfo, selectedMarketForGlv, - longTokenAddress, - shortTokenAddress, + // longTokenAddress, + // shortTokenAddress, longTokenAmount, longTokenSwapPath, shortTokenSwapPath, @@ -57,11 +69,11 @@ export const useWithdrawalTransactions = ({ glvTokenUsd, isFirstBuy, paySource, - executionFee, + technicalFees, selectedMarketInfoForGlv, - marketToken, + // marketToken, tokensData, - marketInfo, + // marketInfo, shouldDisableValidation, }: UseLpTransactionProps) => { const { chainId, srcChainId } = useChainId(); @@ -70,12 +82,19 @@ export const useWithdrawalTransactions = ({ const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); const globalExpressParams = useSelector(selectExpressGlobalParams); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; - const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; + // const marketTokenAddress = useSelector(selectmarkettokenaddress); + const marketInfo = useSelector(selectPoolsDetailsMarketInfo); + const marketToken = useSelector(selectPoolsDetailsMarketTokenData); + const marketTokenAddress = marketToken?.address; const glvTokenAddress = glvInfo?.glvTokenAddress; const glvTokenTotalSupply = glvInfo?.glvToken.totalSupply; - const executionFeeTokenAmount = executionFee?.feeTokenAmount; + // const executionFeeTokenAmount = (technicalFees as SourceChainWithdrawalFees)?.executionFee; + const executionFeeTokenDecimals = getWrappedToken(chainId)!.decimals; // const initialLongTokenAddress = longTokenAddress // ? convertTokenAddress(chainId, longTokenAddress, "wrapped") // : undefined; @@ -88,8 +107,11 @@ export const useWithdrawalTransactions = ({ // ) // : undefined; - const transferRequests = useMemo((): TransferRequests => { + const transferRequests = useMemo((): TransferRequests | undefined => { if (isGlv) { + if (!glvTokenAddress) { + return undefined; + } return getTransferRequests([ { to: getContract(chainId, "GlvVault"), @@ -99,6 +121,10 @@ export const useWithdrawalTransactions = ({ ]); } + if (!marketTokenAddress) { + return undefined; + } + return getTransferRequests([ { to: getContract(chainId, "WithdrawalVault"), @@ -171,12 +197,12 @@ export const useWithdrawalTransactions = ({ // fromStargateAddress: shortOftProvider, // }); - const gmParams = useMemo((): CreateWithdrawalParamsStruct | undefined => { + const rawGmParams = useMemo((): RawCreateWithdrawalParams | undefined => { if ( !account || !marketTokenAddress || marketTokenAmount === undefined || - executionFeeTokenAmount === undefined || + // executionFeeTokenAmount === undefined || isGlv ) { return undefined; @@ -186,7 +212,7 @@ export const useWithdrawalTransactions = ({ let dataList: string[] = EMPTY_ARRAY; - let executionFee = executionFeeTokenAmount; + // let executionFee = executionFeeTokenAmount; if (paySource === "sourceChain") { if (!srcChainId) { @@ -235,7 +261,7 @@ export const useWithdrawalTransactions = ({ shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; } - const params: CreateWithdrawalParamsStruct = { + const params: RawCreateWithdrawalParams = { addresses: { market: marketTokenAddress, receiver: account, @@ -251,7 +277,6 @@ export const useWithdrawalTransactions = ({ // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), minShortTokenAmount: 0n, shouldUnwrapNativeToken, - executionFee, callbackGasLimit: 0n, dataList, }; @@ -260,7 +285,6 @@ export const useWithdrawalTransactions = ({ }, [ account, chainId, - executionFeeTokenAmount, isGlv, longOftProvider, longTokenAddress, @@ -274,8 +298,8 @@ export const useWithdrawalTransactions = ({ srcChainId, ]); - const glvParams = useMemo((): CreateGlvWithdrawalParamsStruct | undefined => { - if (!account || executionFeeTokenAmount === undefined || !isGlv || glvTokenAmount === undefined) { + const rawGlvParams = useMemo((): RawCreateGlvWithdrawalParams | undefined => { + if (!account || !isGlv || glvTokenAmount === undefined) { return undefined; } @@ -327,7 +351,7 @@ export const useWithdrawalTransactions = ({ shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; } - const params: CreateGlvWithdrawalParamsStruct = { + const params: RawCreateGlvWithdrawalParams = { addresses: { glv: glvTokenAddress!, market: selectedMarketForGlv!, @@ -341,7 +365,6 @@ export const useWithdrawalTransactions = ({ minLongTokenAmount: 0n, // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), minShortTokenAmount: 0n, - executionFee: executionFeeTokenAmount, callbackGasLimit: 0n, shouldUnwrapNativeToken, dataList, @@ -351,7 +374,6 @@ export const useWithdrawalTransactions = ({ }, [ account, chainId, - executionFeeTokenAmount, glvTokenAddress, glvTokenAmount, glvTokenTotalSupply, @@ -367,6 +389,40 @@ export const useWithdrawalTransactions = ({ srcChainId, ]); + const gmParams = useMemo((): CreateWithdrawalParams | undefined => { + if (!rawGmParams || !technicalFees) { + // console.log("no gm params becayse no", { rawGmParams, technicalFees }); + + return undefined; + } + + const executionFee = + paySource === "sourceChain" + ? (technicalFees as SourceChainWithdrawalFees).executionFee + : (technicalFees as ExecutionFee).feeTokenAmount; + + return { + ...rawGmParams, + executionFee, + }; + }, [rawGmParams, technicalFees, paySource]); + + const glvParams = useMemo((): CreateGlvWithdrawalParams | undefined => { + if (!rawGlvParams || !technicalFees) { + return undefined; + } + + const executionFee = + paySource === "sourceChain" + ? (technicalFees as SourceChainGlvWithdrawalFees).executionFee + : (technicalFees as ExecutionFee).feeTokenAmount; + + return { + ...rawGlvParams, + executionFee, + }; + }, [paySource, rawGlvParams, technicalFees]); + const multichainWithdrawalExpressTxnParams = useMultichainWithdrawalExpressTxnParams({ transferRequests, paySource, @@ -383,7 +439,8 @@ export const useWithdrawalTransactions = ({ shortTokenAddress, selectedMarketForGlv, isDeposit: false, - executionFee, + executionFeeTokenAmount: glvParams?.executionFee, + executionFeeTokenDecimals, glvAddress: glvInfo.glvTokenAddress, glvToken: glvInfo.glvToken, longTokenAmount, @@ -400,7 +457,9 @@ export const useWithdrawalTransactions = ({ shortTokenAddress, marketToken, isDeposit: false, - executionFee, + + executionFeeTokenAmount: gmParams?.executionFee, + executionFeeTokenDecimals, marketInfo, longTokenAmount, shortTokenAmount, @@ -412,7 +471,9 @@ export const useWithdrawalTransactions = ({ return metricData; }, [ chainId, - executionFee, + glvParams?.executionFee, + gmParams?.executionFee, + executionFeeTokenDecimals, glvInfo, glvTokenAmount, glvTokenUsd, @@ -437,9 +498,9 @@ export const useWithdrawalTransactions = ({ !account || !marketInfo || !marketToken || - !executionFee || longTokenAmount === undefined || shortTokenAmount === undefined || + !transferRequests || !tokensData || !signer || !glvParams @@ -460,10 +521,10 @@ export const useWithdrawalTransactions = ({ chainId, srcChainId, signer, - globalExpressParams, transferRequests, params: glvParams, tokenAmount: glvTokenAmount!, + fees: technicalFees as SourceChainGlvWithdrawalFees, }); } else if (paySource === "gmxAccount") { const expressTxnParams = await multichainWithdrawalExpressTxnParams.promise; @@ -484,7 +545,7 @@ export const useWithdrawalTransactions = ({ chainId, signer, params: glvParams, - executionGasLimit: executionFee.gasLimit, + executionGasLimit: (technicalFees as ExecutionFee).gasLimit, tokensData, setPendingTxns, setPendingWithdrawal, @@ -504,18 +565,18 @@ export const useWithdrawalTransactions = ({ account, marketInfo, marketToken, - executionFee, longTokenAmount, shortTokenAmount, tokensData, signer, + glvParams, paySource, chainId, srcChainId, globalExpressParams, transferRequests, - glvParams, glvTokenAmount, + technicalFees, multichainWithdrawalExpressTxnParams.promise, setPendingTxns, setPendingWithdrawal, @@ -531,9 +592,9 @@ export const useWithdrawalTransactions = ({ !account || !marketInfo || !marketToken || - !executionFee || longTokenAmount === undefined || shortTokenAmount === undefined || + !transferRequests || !tokensData || !signer || !gmParams @@ -546,7 +607,7 @@ export const useWithdrawalTransactions = ({ let promise: Promise; if (paySource === "sourceChain") { - if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams) { + if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams || !technicalFees || !rawGmParams) { throw new Error("An error occurred"); } @@ -555,10 +616,9 @@ export const useWithdrawalTransactions = ({ chainId, srcChainId, signer, - globalExpressParams, - // executionFee: executionFee.feeTokenAmount, + fees: technicalFees as SourceChainWithdrawalFees, transferRequests, - params: gmParams, + params: rawGmParams!, tokenAmount: marketTokenAmount!, }); } else if (paySource === "gmxAccount") { @@ -580,7 +640,7 @@ export const useWithdrawalTransactions = ({ chainId, signer, marketTokenAmount: marketTokenAmount!, - executionGasLimit: executionFee.gasLimit, + executionGasLimit: (technicalFees as ExecutionFee).gasLimit, params: gmParams, tokensData, skipSimulation: shouldDisableValidation, @@ -601,17 +661,18 @@ export const useWithdrawalTransactions = ({ account, marketInfo, marketToken, - executionFee, longTokenAmount, shortTokenAmount, tokensData, signer, + gmParams, paySource, chainId, srcChainId, globalExpressParams, + technicalFees, + rawGmParams, transferRequests, - gmParams, marketTokenAmount, multichainWithdrawalExpressTxnParams.promise, shouldDisableValidation, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts new file mode 100644 index 0000000000..55d7263475 --- /dev/null +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts @@ -0,0 +1,148 @@ +import { + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAmount, + selectPoolsDetailsMarketOrGlvTokenAmount, + selectPoolsDetailsShortTokenAmount, + selectPoolsDetailsWithdrawalFindSwapPath, + selectPoolsDetailsWithdrawalReceiveTokenAddress, + selectPoolsDetailsFirstTokenAddress, + selectPoolsDetailsFirstTokenAmount, + selectPoolsDetailsFlags, + selectPoolsDetailsFocusedInput, + selectPoolsDetailsGlvInfo, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketTokenData, + selectPoolsDetailsMarketTokensData, + selectPoolsDetailsSecondTokenAddress, + selectPoolsDetailsSecondTokenAmount, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { selectUiFeeFactor } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { createSelector } from "context/SyntheticsStateContext/utils"; +import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; +import { getWithdrawalAmounts } from "domain/synthetics/trade/utils/withdrawal"; +import { DepositAmounts, WithdrawalAmounts } from "sdk/types/trade"; +import { bigMath } from "sdk/utils/bigmath"; + +export const selectDepositWithdrawalAmounts = createSelector((q): DepositAmounts | WithdrawalAmounts | undefined => { + const uiFeeFactor = q(selectUiFeeFactor); + + const { isDeposit, isWithdrawal } = q(selectPoolsDetailsFlags); + const glvInfo = q(selectPoolsDetailsGlvInfo); + const glvToken = glvInfo?.glvToken; + const marketInfo = q(selectPoolsDetailsMarketInfo); + const marketTokensData = q(selectPoolsDetailsMarketTokensData); + const marketToken = q(selectPoolsDetailsMarketTokenData); + const focusedInput = q(selectPoolsDetailsFocusedInput); + + const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); + + const longTokenAmount = q(selectPoolsDetailsLongTokenAmount); + const shortTokenAmount = q(selectPoolsDetailsShortTokenAmount); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); + const isMarketTokenDeposit = q(selectPoolsDetailsIsMarketTokenDeposit); + + const receiveTokenAddress = q(selectPoolsDetailsWithdrawalReceiveTokenAddress); + const withdrawalFindSwapPath = q(selectPoolsDetailsWithdrawalFindSwapPath); + + if (!marketInfo || !marketToken || !marketTokensData) { + return undefined; + } + + let marketTokenAmount = 0n; + if (isDeposit && isMarketTokenDeposit) { + if (firstTokenAddress !== undefined && firstTokenAddress === marketInfo.marketTokenAddress) { + marketTokenAmount += firstTokenAmount; + } + if (secondTokenAddress !== undefined && secondTokenAddress === marketInfo.marketTokenAddress) { + marketTokenAmount += secondTokenAmount; + } + } else { + marketTokenAmount = marketOrGlvTokenAmount; + } + + let glvTokenAmount = 0n; + if (glvInfo) { + glvTokenAmount = marketOrGlvTokenAmount; + } + + if (isDeposit) { + // adjust for same collateral + if (marketInfo.isSameCollaterals) { + if (longTokenAmount > 0n && shortTokenAmount > 0n) { + throw new Error("Weird state"); + } + + const positiveAmount = bigMath.max(longTokenAmount, shortTokenAmount); + + const adjustedLongTokenAmount = positiveAmount / 2n; + const adjustedShortTokenAmount = positiveAmount - adjustedLongTokenAmount; + + return getDepositAmounts({ + marketInfo, + marketToken, + longToken: marketInfo.longToken, + shortToken: marketInfo.shortToken, + longTokenAmount: adjustedLongTokenAmount, + shortTokenAmount: adjustedShortTokenAmount, + marketTokenAmount, + glvTokenAmount, + // TODO MLTCH check it + includeLongToken: adjustedLongTokenAmount > 0n, + includeShortToken: adjustedShortTokenAmount > 0n, + uiFeeFactor, + strategy: focusedInput === "market" ? "byMarketToken" : "byCollaterals", + isMarketTokenDeposit, + glvInfo, + glvToken: glvToken!, + }); + } + + return getDepositAmounts({ + marketInfo, + marketToken, + longToken: marketInfo.longToken, + shortToken: marketInfo.shortToken, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, + glvTokenAmount, + // TODO MLTCH check it + includeLongToken: longTokenAmount > 0n, + includeShortToken: shortTokenAmount > 0n, + uiFeeFactor, + strategy: focusedInput === "market" ? "byMarketToken" : "byCollaterals", + isMarketTokenDeposit, + glvInfo, + glvToken: glvToken!, + }); + } else if (isWithdrawal) { + let strategy; + if (focusedInput === "market") { + strategy = "byMarketToken"; + } else if (focusedInput === "longCollateral") { + strategy = "byLongCollateral"; + } else { + strategy = "byShortCollateral"; + } + + return getWithdrawalAmounts({ + marketInfo, + marketToken, + marketTokenAmount, + longTokenAmount, + shortTokenAmount, + strategy, + uiFeeFactor, + glvInfo, + glvTokenAmount, + glvToken, + findSwapPath: withdrawalFindSwapPath, + wrappedReceiveTokenAddress: receiveTokenAddress, + }); + } + + return undefined; +}); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts index 24cec23414..0232c3addf 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts @@ -11,3 +11,8 @@ export type TokenInputState = { * GM or GLV pay source */ export type GmPaySource = "settlementChain" | "gmxAccount" | "sourceChain"; + +/** + * Focused input types for GM deposit/withdrawal box + */ +export type FocusedInput = "market" | "longCollateral" | "shortCollateral"; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx deleted file mode 100644 index 7933619860..0000000000 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalAmounts.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import { useMemo } from "react"; - -import { ContractsChainId } from "config/chains"; -import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; -import { useSelector } from "context/SyntheticsStateContext/utils"; -import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; -import { TokenData, TokensData } from "domain/synthetics/tokens"; -import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; -import { getWithdrawalAmounts } from "domain/synthetics/trade/utils/withdrawal"; -import { convertTokenAddress } from "sdk/configs/tokens"; -import { DepositAmounts, WithdrawalAmounts } from "sdk/types/trade"; - -import { TokenInputState } from "./types"; - -export function useDepositWithdrawalAmounts({ - chainId, - isDeposit, - isPair, - isWithdrawal, - marketInfo, - marketToken, - longTokenInputState, - shortTokenInputState, - marketTokenAmount, - uiFeeFactor, - focusedInput, - marketTokensData, - glvTokenAmount, - glvToken, - isMarketTokenDeposit, - glvInfo, -}: { - chainId: ContractsChainId; - isDeposit: boolean; - isPair: boolean; - isWithdrawal: boolean; - marketInfo: MarketInfo | undefined; - marketToken: TokenData | undefined; - longTokenInputState: TokenInputState | undefined; - shortTokenInputState: TokenInputState | undefined; - marketTokenAmount: bigint; - glvTokenAmount: bigint; - uiFeeFactor: bigint; - focusedInput: string; - glvToken: TokenData | undefined; - marketTokensData: TokensData | undefined; - isMarketTokenDeposit: boolean; - glvInfo: GlvInfo | undefined; -}): DepositAmounts | WithdrawalAmounts | undefined { - const halfOfLong = longTokenInputState?.amount !== undefined ? longTokenInputState.amount / 2n : undefined; - - const hasLongTokenInputState = longTokenInputState !== undefined; - - const receiveTokenAddress = - !isDeposit && !isPair ? longTokenInputState?.address ?? shortTokenInputState?.address : undefined; - const wrappedReceiveTokenAddress = receiveTokenAddress - ? convertTokenAddress(chainId, receiveTokenAddress, "wrapped") - : undefined; - - const selectFindSwap = useMemo(() => { - if (!hasLongTokenInputState) { - // long to short swap - return makeSelectFindSwapPath(marketInfo?.longToken.address, marketInfo?.shortToken.address); - } - - return makeSelectFindSwapPath(marketInfo?.shortToken.address, marketInfo?.longToken.address); - }, [hasLongTokenInputState, marketInfo?.longToken.address, marketInfo?.shortToken.address]); - const findSwapPath = useSelector(selectFindSwap); - - const amounts = useMemo(() => { - if (isDeposit) { - if (!marketInfo || !marketToken || !marketTokensData) { - return undefined; - } - - let longTokenAmount; - let shortTokenAmount; - - if (glvInfo) { - longTokenAmount = (glvInfo.isSameCollaterals ? halfOfLong : longTokenInputState?.amount) || 0n; - shortTokenAmount = - (glvInfo.isSameCollaterals - ? longTokenInputState?.amount !== undefined - ? longTokenInputState.amount - longTokenAmount - : undefined - : shortTokenInputState?.amount) || 0n; - } else { - longTokenAmount = (marketInfo.isSameCollaterals ? halfOfLong : longTokenInputState?.amount) || 0n; - shortTokenAmount = - (marketInfo.isSameCollaterals - ? longTokenInputState?.amount !== undefined - ? longTokenInputState.amount - longTokenAmount - : undefined - : shortTokenInputState?.amount) || 0n; - } - - return getDepositAmounts({ - marketInfo, - marketToken, - longToken: marketInfo.longToken, - shortToken: marketInfo.shortToken, - longTokenAmount, - shortTokenAmount, - marketTokenAmount, - glvTokenAmount, - includeLongToken: Boolean(longTokenInputState?.address), - includeShortToken: Boolean(shortTokenInputState?.address), - uiFeeFactor, - strategy: focusedInput === "market" ? "byMarketToken" : "byCollaterals", - isMarketTokenDeposit, - glvInfo, - glvToken: glvToken!, - }); - } else if (isWithdrawal) { - if (!marketInfo || !marketToken || !marketTokensData) { - return undefined; - } - - let strategy; - if (focusedInput === "market") { - strategy = "byMarketToken"; - } else if (focusedInput === "longCollateral") { - strategy = "byLongCollateral"; - } else { - strategy = "byShortCollateral"; - } - - const longTokenAmount = marketInfo.isSameCollaterals ? halfOfLong ?? 0n : longTokenInputState?.amount ?? 0n; - const shortTokenAmount = - (marketInfo.isSameCollaterals - ? longTokenInputState?.amount !== undefined - ? longTokenInputState?.amount - longTokenAmount - : 0n - : shortTokenInputState?.amount) ?? 0n; - - return getWithdrawalAmounts({ - marketInfo, - marketToken, - marketTokenAmount, - longTokenAmount, - shortTokenAmount, - strategy, - uiFeeFactor, - glvInfo, - glvTokenAmount, - glvToken, - findSwapPath, - wrappedReceiveTokenAddress, - }); - } - }, [ - isDeposit, - isWithdrawal, - marketInfo, - marketToken, - marketTokensData, - glvInfo, - marketTokenAmount, - glvTokenAmount, - longTokenInputState?.address, - longTokenInputState?.amount, - shortTokenInputState?.address, - shortTokenInputState?.amount, - uiFeeFactor, - focusedInput, - isMarketTokenDeposit, - glvToken, - halfOfLong, - findSwapPath, - wrappedReceiveTokenAddress, - ]); - - return amounts; -} diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx index 241877e27b..fbeea2267a 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees.tsx @@ -1,25 +1,15 @@ import { useMemo } from "react"; -import { - estimateDepositOraclePriceCount, - estimateExecuteDepositGasLimit, - estimateExecuteGlvDepositGasLimit, - estimateExecuteGlvWithdrawalGasLimit, - estimateExecuteWithdrawalGasLimit, - estimateGlvDepositOraclePriceCount, - estimateGlvWithdrawalOraclePriceCount, - estimateWithdrawalOraclePriceCount, - getFeeItem, - getTotalFeeItem, - type FeeItem, - type GasLimitsConfig, -} from "domain/synthetics/fees"; +import { useGasMultichainUsd, useNativeTokenMultichainUsd } from "domain/multichain/useMultichainQuoteFeeUsd"; +import { ExecutionFee, getFeeItem, getTotalFeeItem, type FeeItem, type GasLimitsConfig } from "domain/synthetics/fees"; import { GlvInfo } from "domain/synthetics/markets"; -import { TokensData } from "domain/synthetics/tokens"; -import { GmSwapFees, WithdrawalAmounts } from "domain/synthetics/trade"; -import { getExecutionFee } from "sdk/utils/fees/executionFee"; - -import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; +import { SourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; +import { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; +import { SourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; +import { convertToUsd, getMidPrice, TokensData } from "domain/synthetics/tokens"; +import { DepositAmounts, GmSwapFees, WithdrawalAmounts } from "domain/synthetics/trade"; +import { ContractsChainId, SourceChainId } from "sdk/configs/chains"; +import { getWrappedToken } from "sdk/configs/tokens"; export const useDepositWithdrawalFees = ({ amounts, @@ -28,21 +18,44 @@ export const useDepositWithdrawalFees = ({ gasPrice, isDeposit, tokensData, - glvInfo, - isMarketTokenDeposit, + // glvInfo, + // isMarketTokenDeposit, + technicalFees, + srcChainId, }: { - amounts: ReturnType; - chainId: number; + amounts: DepositAmounts | WithdrawalAmounts | undefined; + chainId: ContractsChainId; gasLimits: GasLimitsConfig | undefined; gasPrice: bigint | undefined; isDeposit: boolean; tokensData: TokensData | undefined; glvInfo: GlvInfo | undefined; isMarketTokenDeposit: boolean; -}) => { + technicalFees: + | ExecutionFee + | SourceChainGlvDepositFees + | SourceChainDepositFees + | SourceChainWithdrawalFees + | undefined; + srcChainId: SourceChainId | undefined; +}): { logicalFees?: GmSwapFees } => { + const txnEstimatedNativeFeeUsd = useNativeTokenMultichainUsd({ + sourceChainTokenAmount: + technicalFees && "txnEstimatedNativeFee" in technicalFees ? technicalFees.txnEstimatedNativeFee : undefined, + sourceChainId: srcChainId, + targetChainId: chainId, + }); + + const txnEstimatedGasUsd = useGasMultichainUsd({ + sourceChainGas: + technicalFees && "txnEstimatedGasLimit" in technicalFees ? technicalFees.txnEstimatedGasLimit : undefined, + sourceChainId: srcChainId, + targetChainId: chainId, + }); + return useMemo(() => { - if (!gasLimits || gasPrice === undefined || !tokensData || !amounts) { - return {}; + if (!gasLimits || gasPrice === undefined || !tokensData || !amounts || !technicalFees) { + return { logicalFees: undefined }; } const basisUsd = isDeposit @@ -55,56 +68,38 @@ export const useDepositWithdrawalFees = ({ shouldRoundUp: true, }); - const totalFees = getTotalFeeItem([swapFee, uiFee].filter(Boolean) as FeeItem[]); - const fees: GmSwapFees = { - swapFee, + const logicalNetworkFee = getFeeItem( + "feeTokenAmount" in technicalFees + ? convertToUsd( + technicalFees.feeTokenAmount * -1n, + getWrappedToken(chainId).decimals, + getMidPrice(tokensData[getWrappedToken(chainId).address].prices) + )! + : (technicalFees.relayFeeUsd + (txnEstimatedNativeFeeUsd ?? 0n) + (txnEstimatedGasUsd ?? 0n)) * -1n, + basisUsd + )!; + // TODO ADD stargate protocol fees + const logicalProtocolFee = getTotalFeeItem([swapFee, uiFee, swapPriceImpact].filter(Boolean) as FeeItem[]); + + const logicalFees: GmSwapFees = { + totalFees: logicalProtocolFee, swapPriceImpact, - totalFees, - uiFee, + logicalNetworkFee, + swapFee, }; - let gasLimit; - let oraclePriceCount; - - const glvMarketsCount = BigInt(glvInfo?.markets?.length ?? 0); - const swapPathCount = BigInt( - ((amounts as WithdrawalAmounts)?.longTokenSwapPathStats?.swapPath.length ?? 0) + - ((amounts as WithdrawalAmounts)?.shortTokenSwapPathStats?.swapPath.length ?? 0) - ); - - if (glvInfo) { - gasLimit = isDeposit - ? estimateExecuteGlvDepositGasLimit(gasLimits, { - marketsCount: glvMarketsCount, - initialLongTokenAmount: amounts.longTokenAmount, - initialShortTokenAmount: amounts.shortTokenAmount, - isMarketTokenDeposit, - }) - : estimateExecuteGlvWithdrawalGasLimit(gasLimits, { - marketsCount: glvMarketsCount, - swapsCount: swapPathCount, - }); - - oraclePriceCount = isDeposit - ? estimateGlvDepositOraclePriceCount(glvMarketsCount) - : estimateGlvWithdrawalOraclePriceCount(glvMarketsCount, swapPathCount); - } else { - gasLimit = isDeposit - ? estimateExecuteDepositGasLimit(gasLimits, {}) - : estimateExecuteWithdrawalGasLimit(gasLimits, { - swapsCount: swapPathCount, - }); - - oraclePriceCount = isDeposit - ? estimateDepositOraclePriceCount(0) - : estimateWithdrawalOraclePriceCount(swapPathCount); - } - - const executionFee = getExecutionFee(chainId, gasLimits, tokensData, gasLimit, gasPrice, oraclePriceCount); - return { - fees, - executionFee, + logicalFees, }; - }, [amounts, chainId, gasLimits, gasPrice, isDeposit, tokensData, glvInfo, isMarketTokenDeposit]); + }, [ + amounts, + chainId, + gasLimits, + gasPrice, + isDeposit, + technicalFees, + tokensData, + txnEstimatedGasUsd, + txnEstimatedNativeFeeUsd, + ]); }; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx deleted file mode 100644 index 3971debff5..0000000000 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmDepositWithdrawalBoxState.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { useEffect, useState } from "react"; - -import type { SourceChainId } from "config/chains"; -import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; -import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; -import { useSelector } from "context/SyntheticsStateContext/utils"; -import { useLocalStorageSerializeKey } from "lib/localStorage"; -import { useSafeState } from "lib/useSafeState"; - -import { Mode, Operation } from "../types"; -import { useDepositWithdrawalSetFirstTokenAddress } from "../useDepositWithdrawalSetFirstTokenAddress"; -import type { GmPaySource } from "./types"; - -function isValidPaySource(paySource: string | undefined): paySource is GmPaySource { - return ( - (paySource as GmPaySource) === "settlementChain" || - (paySource as GmPaySource) === "sourceChain" || - (paySource as GmPaySource) === "gmxAccount" - ); -} - -function fallbackPaySource({ - operation, - mode, - paySource, - srcChainId, -}: { - operation: Operation; - mode: Mode; - paySource: GmPaySource | undefined; - srcChainId: SourceChainId | undefined; -}) { - if (!isValidPaySource(paySource)) { - return "gmxAccount"; - } else if (paySource === "sourceChain" && srcChainId === undefined) { - return "settlementChain"; - } else if (paySource === "settlementChain" && srcChainId !== undefined) { - return "sourceChain"; - } else if (operation === Operation.Deposit && paySource === "sourceChain" && mode === Mode.Pair) { - return "gmxAccount"; - } - - return paySource; -} - -export function useGmDepositWithdrawalBoxState(operation: Operation, mode: Mode, marketAddress: string | undefined) { - const isDeposit = operation === Operation.Deposit; - - const chainId = useSelector(selectChainId); - const srcChainId = useSelector(selectSrcChainId); - - const [focusedInput, setFocusedInput] = useState<"longCollateral" | "shortCollateral" | "market">("market"); - - let [rawPaySource, setPaySource] = useLocalStorageSerializeKey( - [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "paySource"], - "settlementChain" - ); - - let paySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); - - useEffect( - function fallbackSourceChainPaySource() { - const newPaySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); - if (newPaySource !== rawPaySource) { - setPaySource(newPaySource); - } - }, - [mode, operation, rawPaySource, setPaySource, srcChainId] - ); - - let [isSendBackToSourceChain, setIsSendBackToSourceChain] = useLocalStorageSerializeKey( - [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "isSendBackToSourceChain"], - false - ); - - if (isSendBackToSourceChain === undefined) { - isSendBackToSourceChain = false; - } - - const [firstTokenAddress, setFirstTokenAddress] = useDepositWithdrawalSetFirstTokenAddress(isDeposit, marketAddress); - const [secondTokenAddress, setSecondTokenAddress] = useLocalStorageSerializeKey( - [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, marketAddress, "second"], - undefined - ); - const [firstTokenInputValue, setFirstTokenInputValue] = useSafeState(""); - const [secondTokenInputValue, setSecondTokenInputValue] = useSafeState(""); - const [marketOrGlvTokenInputValue, setMarketOrGlvTokenInputValue] = useSafeState(""); - - return { - focusedInput, - setFocusedInput, - - paySource, - setPaySource, - - isSendBackToSourceChain, - setIsSendBackToSourceChain, - - firstTokenAddress, - setFirstTokenAddress, - - secondTokenAddress, - setSecondTokenAddress, - - firstTokenInputValue, - setFirstTokenInputValue, - - secondTokenInputValue, - setSecondTokenInputValue, - - marketOrGlvTokenInputValue, - setMarketOrGlvTokenInputValue, - }; -} diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 934ead0cac..99941af069 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -1,58 +1,69 @@ import { t } from "@lingui/macro"; import { useConnectModal } from "@rainbow-me/rainbowkit"; -import { useCallback, useEffect, useMemo, useState } from "react"; - -import { getContract } from "config/contracts"; -import { selectChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { useCallback, useMemo } from "react"; + +import { + selectPoolsDetailsFirstTokenAddress, + selectPoolsDetailsFlags, + selectPoolsDetailsGlvInfo, + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketTokenData, + selectPoolsDetailsMarketTokensData, + selectPoolsDetailsOperation, + selectPoolsDetailsPaySource, + selectPoolsDetailsSecondTokenAddress, + selectPoolsDetailsSelectedMarketForGlv, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; -import { ExecutionFee } from "domain/synthetics/fees"; -import { GlvAndGmMarketsInfoData, GlvInfo, MarketInfo, MarketsInfoData } from "domain/synthetics/markets"; -import { getTokenData, TokenData, TokensData } from "domain/synthetics/tokens"; +import type { ExecutionFee } from "domain/synthetics/fees"; +import type { GlvAndGmMarketsInfoData, MarketsInfoData } from "domain/synthetics/markets"; +import type { SourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; +import type { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; +import { getTokenData, TokensData } from "domain/synthetics/tokens"; import { getCommonError, getGmSwapError } from "domain/synthetics/trade/utils/validation"; -import { approveTokens } from "domain/tokens"; import { useHasOutdatedUi } from "lib/useHasOutdatedUi"; -import { userAnalytics } from "lib/userAnalytics"; -import { TokenApproveClickEvent, TokenApproveResultEvent } from "lib/userAnalytics/types"; import useWallet from "lib/wallets/useWallet"; -import { WithdrawalAmounts } from "sdk/types/trade"; +import { GmSwapFees, WithdrawalAmounts } from "sdk/types/trade"; import SpinnerIcon from "img/ic_spinner.svg?react"; -import { getGmSwapBoxApproveTokenSymbol } from "../getGmSwapBoxApproveToken"; import { Operation } from "../types"; import { useLpTransactions } from "./lpTxn/useLpTransactions"; -import type { GmPaySource } from "./types"; -import { useDepositWithdrawalAmounts } from "./useDepositWithdrawalAmounts"; -import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; +import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts"; import { useTokensToApprove } from "./useTokensToApprove"; interface Props { - amounts: ReturnType; - fees: ReturnType["fees"]; - isDeposit: boolean; + // amounts: DepositAmounts | WithdrawalAmounts | undefined; + // isDeposit: boolean; routerAddress: string; - marketInfo?: MarketInfo; - glvInfo?: GlvInfo; - marketToken: TokenData; - operation: Operation; - longTokenAddress: string | undefined; - shortTokenAddress: string | undefined; - glvToken: TokenData | undefined; + // marketInfo?: MarketInfo; + // glvInfo?: GlvInfo; + // marketToken: TokenData; + // operation: Operation; + // longTokenAddress: string | undefined; + // shortTokenAddress: string | undefined; + // glvToken: TokenData | undefined; longTokenLiquidityUsd?: bigint | undefined; shortTokenLiquidityUsd?: bigint | undefined; shouldDisableValidation?: boolean; tokensData: TokensData | undefined; - marketTokensData?: TokensData; - executionFee: ExecutionFee | undefined; - selectedMarketForGlv?: string; - isMarketTokenDeposit?: boolean; + // marketTokensData?: TokensData; + technicalFees: ExecutionFee | SourceChainGlvDepositFees | SourceChainDepositFees | undefined; + logicalFees: GmSwapFees | undefined; + // selectedMarketForGlv?: string; + // isMarketTokenDeposit?: boolean; marketsInfoData?: MarketsInfoData; glvAndMarketsInfoData: GlvAndGmMarketsInfoData; - selectedMarketInfoForGlv?: MarketInfo; - paySource: GmPaySource; - isPair: boolean; + // selectedMarketInfoForGlv?: MarketInfo; + // paySource: GmPaySource; + // isPair: boolean; + // needTokenApprove: boolean; + // isApproving: boolean; + // handleApprove: () => void; } const processingTextMap = { @@ -72,36 +83,48 @@ type SubmitButtonState = { }; export const useGmSwapSubmitState = ({ - isDeposit, + // isDeposit, routerAddress, - amounts, - fees, - marketInfo, - marketToken, - longTokenAddress, - shortTokenAddress, - operation, - glvToken, + // amounts, + logicalFees, + technicalFees, + // marketInfo, + // longTokenAddress, + // shortTokenAddress, + // operation, + // glvToken, longTokenLiquidityUsd, shortTokenLiquidityUsd, shouldDisableValidation, tokensData, - marketTokensData, - executionFee, - selectedMarketForGlv, - selectedMarketInfoForGlv, - glvInfo, - isMarketTokenDeposit, - glvAndMarketsInfoData, - paySource, - isPair, + // marketTokensData, + // selectedMarketForGlv, + // selectedMarketInfoForGlv, + // glvInfo, + // isMarketTokenDeposit, + // paySource, + // isPair, }: Props): SubmitButtonState => { + const { isDeposit, isPair } = useSelector(selectPoolsDetailsFlags); + const operation = useSelector(selectPoolsDetailsOperation); + const paySource = useSelector(selectPoolsDetailsPaySource); + const isMarketTokenDeposit = useSelector(selectPoolsDetailsIsMarketTokenDeposit); + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); + const glvToken = glvInfo?.glvToken; + const marketTokensData = useSelector(selectPoolsDetailsMarketTokensData); + const marketToken = useSelector(selectPoolsDetailsMarketTokenData); + const selectedMarketForGlv = useSelector(selectPoolsDetailsSelectedMarketForGlv); + const longTokenAddress = useSelector(selectPoolsDetailsFirstTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsSecondTokenAddress); + const marketInfo = useSelector(selectPoolsDetailsMarketInfo); + const amounts = useSelector(selectDepositWithdrawalAmounts); const chainId = useSelector(selectChainId); + const srcChainId = useSelector(selectSrcChainId); const hasOutdatedUi = useHasOutdatedUi(); const { openConnectModal } = useConnectModal(); - const { account, signer } = useWallet(); + const { account } = useWallet(); const { glvTokenAmount = 0n, @@ -117,23 +140,23 @@ export const useGmSwapSubmitState = ({ const isFirstBuy = Object.values(marketTokensData ?? {}).every((marketToken) => marketToken.balance === 0n); const { isSubmitting, onSubmit } = useLpTransactions({ - marketInfo, - marketToken, + // marketInfo, + // marketToken, operation, - longTokenAddress, + // longTokenAddress, longTokenAmount, - shortTokenAddress, + // shortTokenAddress, shortTokenAmount, marketTokenAmount, glvTokenAmount, glvTokenUsd, shouldDisableValidation, tokensData, - executionFee, + technicalFees, selectedMarketForGlv, - glvInfo, + // glvInfo, isMarketTokenDeposit, - selectedMarketInfoForGlv, + // selectedMarketInfoForGlv, marketTokenUsd, isFirstBuy, paySource, @@ -155,7 +178,7 @@ export const useGmSwapSubmitState = ({ isDeposit, marketInfo, glvInfo, - marketToken, + // marketToken, longToken: getTokenData(tokensData, longTokenAddress), shortToken: getTokenData(tokensData, shortTokenAddress), glvToken, @@ -169,17 +192,20 @@ export const useGmSwapSubmitState = ({ shortTokenUsd, longTokenLiquidityUsd: longTokenLiquidityUsd, shortTokenLiquidityUsd: shortTokenLiquidityUsd, - fees, - priceImpactUsd: fees?.swapPriceImpact?.deltaUsd, + fees: logicalFees, + priceImpactUsd: logicalFees?.swapPriceImpact?.deltaUsd, marketTokensData, isMarketTokenDeposit, paySource, isPair, + chainId, + srcChainId, + marketToken: marketToken, }); const error = commonError || swapError; - const { tokensToApprove, isAllowanceLoading, isAllowanceLoaded } = useTokensToApprove({ + const { approve, isAllowanceLoaded, isAllowanceLoading, tokensToApproveSymbols, isApproving } = useTokensToApprove({ routerAddress, glvInfo, operation, @@ -194,14 +220,6 @@ export const useGmSwapSubmitState = ({ isMarketTokenDeposit, }); - const [isApproving, setIsApproving] = useState(false); - - useEffect(() => { - if (!tokensToApprove.length && isApproving) { - setIsApproving(false); - } - }, [isApproving, tokensToApprove]); - return useMemo((): SubmitButtonState => { if (!account) { return { @@ -217,70 +235,36 @@ export const useGmSwapSubmitState = ({ }; } + // console.log("error", error); if (error) { return { text: error, disabled: !shouldDisableValidation, onSubmit: onSubmit, - tokensToApprove, isAllowanceLoaded, isAllowanceLoading, errorDescription: swapErrorDescription, }; } - if (isApproving && tokensToApprove.length) { - const tokenSymbol = getGmSwapBoxApproveTokenSymbol(tokensToApprove[0], tokensData, glvAndMarketsInfoData); + if (isApproving && tokensToApproveSymbols.length) { + // const tokenSymbol = getGmSwapBoxApproveTokenSymbol(tokensToApprove[0], tokensData, glvAndMarketsInfoData); return { text: ( <> - {t`Allow ${tokenSymbol} to be spent`} + {t`Allow ${tokensToApproveSymbols[0]} to be spent`} ), disabled: true, }; } - if (isAllowanceLoaded && tokensToApprove.length > 0) { - const onApprove = () => { - const tokenAddress = tokensToApprove[0]; - - if (!chainId || isApproving || !tokenAddress) return; - - userAnalytics.pushEvent({ - event: "TokenApproveAction", - data: { - action: "ApproveClick", - }, - }); - - approveTokens({ - setIsApproving, - signer, - tokenAddress, - spender: getContract(chainId, "SyntheticsRouter"), - pendingTxns: [], - setPendingTxns: () => null, - infoTokens: {}, - chainId, - approveAmount: undefined, - onApproveFail: () => { - userAnalytics.pushEvent({ - event: "TokenApproveAction", - data: { - action: "ApproveFail", - }, - }); - }, - permitParams: undefined, - }); - }; - - const tokenSymbol = getGmSwapBoxApproveTokenSymbol(tokensToApprove[0], tokensData, glvAndMarketsInfoData); + if (isAllowanceLoaded && tokensToApproveSymbols.length > 0) { + const onApprove = approve; return { - text: t`Allow ${tokenSymbol} to be spent`, + text: t`Allow ${tokensToApproveSymbols[0]} to be spent`, onSubmit: onApprove, }; } @@ -303,7 +287,7 @@ export const useGmSwapSubmitState = ({ isAllowanceLoading, error, isApproving, - tokensToApprove, + tokensToApproveSymbols, isAllowanceLoaded, glvInfo, isSubmitting, @@ -312,10 +296,7 @@ export const useGmSwapSubmitState = ({ onConnectAccount, shouldDisableValidation, swapErrorDescription, - chainId, - tokensData, - glvAndMarketsInfoData, - signer, + approve, operation, ]); }; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx index d32440835d..30572026ae 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx @@ -1,10 +1,35 @@ +import { t } from "@lingui/macro"; +import noop from "lodash/noop"; import uniq from "lodash/uniq"; -import { useMemo } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; +import { zeroAddress } from "viem"; -import { selectChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { SourceChainId } from "config/chains"; +import { getMappedTokenId } from "config/multichain"; +import { useGmxAccountSettlementChainId } from "context/GmxAccountContext/hooks"; +import { + selectPoolsDetailsFirstTokenAddress, + selectPoolsDetailsFirstTokenAmount, + selectPoolsDetailsPaySource, + selectPoolsDetailsSecondTokenAddress, + selectPoolsDetailsSecondTokenAmount, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { useMultichainApprovalsActiveListener } from "context/SyntheticsEvents/useMultichainEvents"; +import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { GlvInfo } from "domain/synthetics/markets"; import { getNeedTokenApprove, TokenData, useTokensAllowanceData } from "domain/synthetics/tokens"; +import { approveTokens } from "domain/tokens"; +import { helperToast } from "lib/helperToast"; +import { adjustForDecimals } from "lib/numbers"; +import { EMPTY_ARRAY } from "lib/objects"; +import { userAnalytics } from "lib/userAnalytics"; +import { TokenApproveClickEvent, TokenApproveResultEvent } from "lib/userAnalytics/types"; +import { useEthersSigner } from "lib/wallets/useEthersSigner"; +import { getContract } from "sdk/configs/contracts"; +import { getToken } from "sdk/configs/tokens"; + +import { wrapChainAction } from "components/GmxAccountModal/wrapChainAction"; import { Operation } from "../types"; @@ -39,8 +64,108 @@ export const useTokensToApprove = ({ glvTokenAddress, glvTokenAmount, isMarketTokenDeposit, -}: Props) => { +}: Props): { + tokensToApproveSymbols: string[]; + isAllowanceLoading: boolean; + isAllowanceLoaded: boolean; + approve: () => void; + isApproving: boolean; +} => { const chainId = useSelector(selectChainId); + const srcChainId = useSelector(selectSrcChainId); + const [, setSettlementChainId] = useGmxAccountSettlementChainId(); + const paySource = useSelector(selectPoolsDetailsPaySource); + const signer = useEthersSigner(); + + const [isApproving, setIsApproving] = useState(false); + + const firstTokenAddress = useSelector(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = useSelector(selectPoolsDetailsSecondTokenAddress); + const firstTokenAmount = useSelector(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = useSelector(selectPoolsDetailsSecondTokenAmount); + + const firstTokenSourceChainTokenId = + firstTokenAddress !== undefined && srcChainId !== undefined + ? getMappedTokenId(chainId as SourceChainId, firstTokenAddress, srcChainId) + : undefined; + // const secondTokenSourceChainTokenId = + // secondTokenAddress !== undefined && srcChainId !== undefined + // ? getMappedTokenId(chainId as SourceChainId, secondTokenAddress, srcChainId) + // : undefined; + + const multichainSpenderAddress = firstTokenSourceChainTokenId?.stargate; + + useMultichainApprovalsActiveListener(paySource === "sourceChain" ? srcChainId : undefined, "multichain-gm-swap-box"); + + const multichainTokensAllowanceResult = useTokensAllowanceData(paySource === "sourceChain" ? srcChainId : undefined, { + spenderAddress: multichainSpenderAddress, + tokenAddresses: firstTokenSourceChainTokenId ? [firstTokenSourceChainTokenId.address] : [], + skip: srcChainId === undefined, + }); + const multichainTokensAllowanceData = + srcChainId !== undefined ? multichainTokensAllowanceResult.tokensAllowanceData : undefined; + + const firstTokenAmountLD = + firstTokenAmount !== undefined && firstTokenAddress !== undefined && firstTokenSourceChainTokenId !== undefined + ? adjustForDecimals( + firstTokenAmount, + getToken(chainId, firstTokenAddress).decimals, + firstTokenSourceChainTokenId.decimals + ) + : undefined; + const firstTokenSymbol = firstTokenAddress ? getToken(chainId, firstTokenAddress).symbol : undefined; + const multichainNeedTokenApprove = + paySource === "sourceChain" + ? getNeedTokenApprove( + multichainTokensAllowanceData, + firstTokenAddress === zeroAddress ? zeroAddress : firstTokenSourceChainTokenId?.address, + firstTokenAmountLD, + EMPTY_ARRAY + ) + : false; + const multichainTokensToApproveSymbols = useMemo(() => { + return firstTokenSymbol && multichainNeedTokenApprove ? [firstTokenSymbol] : EMPTY_ARRAY; + }, [firstTokenSymbol, multichainNeedTokenApprove]); + + const handleApproveSourceChain = useCallback(async () => { + if (!firstTokenAddress || firstTokenAmountLD === undefined || !multichainSpenderAddress || !srcChainId) { + helperToast.error(t`Approval failed`); + return; + } + + const isNative = firstTokenAddress === zeroAddress; + + if (isNative) { + helperToast.error(t`Native token cannot be approved`); + return; + } + + if (!firstTokenSourceChainTokenId) { + helperToast.error(t`Approval failed`); + return; + } + + await wrapChainAction(srcChainId, setSettlementChainId, async (signer) => { + await approveTokens({ + chainId: srcChainId, + tokenAddress: firstTokenSourceChainTokenId.address, + signer: signer, + spender: multichainSpenderAddress, + onApproveSubmitted: () => setIsApproving(true), + setIsApproving: noop, + permitParams: undefined, + approveAmount: firstTokenAmountLD, + }); + }); + }, [ + firstTokenAddress, + firstTokenAmountLD, + multichainSpenderAddress, + srcChainId, + firstTokenSourceChainTokenId, + setSettlementChainId, + ]); + const payTokenAddresses = useMemo( function getPayTokenAddresses() { if (!marketToken) { @@ -50,11 +175,11 @@ export const useTokensToApprove = ({ const addresses: string[] = []; if (operation === Operation.Deposit) { - if (longTokenAmount !== undefined && longTokenAmount > 0 && longTokenAddress) { - addresses.push(longTokenAddress); + if (firstTokenAmount !== undefined && firstTokenAmount > 0 && firstTokenAddress) { + addresses.push(firstTokenAddress); } - if (shortTokenAmount !== undefined && shortTokenAmount > 0 && shortTokenAddress) { - addresses.push(shortTokenAddress); + if (secondTokenAmount !== undefined && secondTokenAmount > 0 && secondTokenAddress) { + addresses.push(secondTokenAddress); } if (glvInfo && isMarketTokenDeposit) { if (marketTokenAmount !== undefined && marketTokenAmount > 0) { @@ -68,44 +193,64 @@ export const useTokensToApprove = ({ return uniq(addresses); }, [ - operation, marketToken, - longTokenAmount, - longTokenAddress, - shortTokenAmount, - shortTokenAddress, + operation, + firstTokenAmount, + firstTokenAddress, + secondTokenAmount, + secondTokenAddress, glvInfo, - glvTokenAddress, isMarketTokenDeposit, marketTokenAmount, + glvTokenAddress, ] ); const { - tokensAllowanceData, - isLoading: isAllowanceLoading, - isLoaded: isAllowanceLoaded, - } = useTokensAllowanceData(chainId, { + tokensAllowanceData: settlementChainTokensAllowanceData, + isLoading: isSettlementChainAllowanceLoading, + isLoaded: isSettlementChainAllowanceLoaded, + } = useTokensAllowanceData(paySource === "settlementChain" ? chainId : undefined, { spenderAddress: routerAddress, tokenAddresses: payTokenAddresses, + skip: paySource === "settlementChain" ? true : false, }); - const tokensToApprove = useMemo( + const settlementChainTokensToApprove = useMemo( function getTokensToApprove() { + if (paySource !== "settlementChain") { + return EMPTY_ARRAY; + } + const addresses: string[] = []; const shouldApproveMarketToken = getNeedTokenApprove( - tokensAllowanceData, + settlementChainTokensAllowanceData, marketToken?.address, marketTokenAmount, [] ); - const shouldApproveGlvToken = getNeedTokenApprove(tokensAllowanceData, glvTokenAddress, glvTokenAmount, []); + const shouldApproveGlvToken = getNeedTokenApprove( + settlementChainTokensAllowanceData, + glvTokenAddress, + glvTokenAmount, + [] + ); - const shouldApproveLongToken = getNeedTokenApprove(tokensAllowanceData, longTokenAddress, longTokenAmount, []); + const shouldApproveLongToken = getNeedTokenApprove( + settlementChainTokensAllowanceData, + longTokenAddress, + longTokenAmount, + [] + ); - const shouldApproveShortToken = getNeedTokenApprove(tokensAllowanceData, shortTokenAddress, shortTokenAmount, []); + const shouldApproveShortToken = getNeedTokenApprove( + settlementChainTokensAllowanceData, + shortTokenAddress, + shortTokenAmount, + [] + ); if (operation === Operation.Deposit) { if (shouldApproveLongToken && longTokenAddress) { @@ -139,16 +284,96 @@ export const useTokensToApprove = ({ marketToken, marketTokenAmount, operation, + paySource, + settlementChainTokensAllowanceData, shortTokenAddress, shortTokenAmount, - tokensAllowanceData, ] ); + const settlementChainTokensToApproveSymbols = settlementChainTokensToApprove.map( + (tokenAddress) => getToken(chainId, tokenAddress).symbol + ); + + const onApproveSettlementChain = () => { + const tokenAddress = settlementChainTokensToApprove[0]; + + if (!chainId || isApproving || !tokenAddress) return; + + userAnalytics.pushEvent({ + event: "TokenApproveAction", + data: { + action: "ApproveClick", + }, + }); + + approveTokens({ + setIsApproving, + signer, + tokenAddress, + spender: getContract(chainId, "SyntheticsRouter"), + pendingTxns: [], + setPendingTxns: () => null, + infoTokens: {}, + chainId, + approveAmount: undefined, + onApproveFail: () => { + userAnalytics.pushEvent({ + event: "TokenApproveAction", + data: { + action: "ApproveFail", + }, + }); + }, + permitParams: undefined, + }); + }; + + // useEffect(() => { + // if (!multichainNeedTokenApprove && isApproving) { + // setIsApproving(false); + // } + // }, [isApproving, multichainNeedTokenApprove]); + useEffect(() => { + // if (!settlementChainTokensToApprove.length && isApproving) { + // setIsApproving(false); + // } + if (paySource === "settlementChain" && !settlementChainTokensToApprove.length && isApproving) { + setIsApproving(false); + } else if (paySource === "sourceChain" && !multichainTokensToApproveSymbols.length && isApproving) { + setIsApproving(false); + } + }, [isApproving, multichainTokensToApproveSymbols.length, paySource, settlementChainTokensToApprove.length]); + return { - tokensToApprove, - payTokenAddresses, - isAllowanceLoading, - isAllowanceLoaded, + // tokensToApprove, + // payTokenAddresses, + // isAllowanceLoading, + // isAllowanceLoaded, + isApproving, + approve: + paySource === "settlementChain" + ? onApproveSettlementChain + : paySource === "sourceChain" + ? handleApproveSourceChain + : noop, + isAllowanceLoaded: + paySource === "settlementChain" + ? isSettlementChainAllowanceLoaded + : paySource === "sourceChain" + ? multichainTokensAllowanceResult.isLoaded + : false, + isAllowanceLoading: + paySource === "settlementChain" + ? isSettlementChainAllowanceLoading + : paySource === "sourceChain" + ? multichainTokensAllowanceResult.isLoading + : false, + tokensToApproveSymbols: + paySource === "settlementChain" + ? settlementChainTokensToApproveSymbols + : paySource === "sourceChain" + ? multichainTokensToApproveSymbols + : EMPTY_ARRAY, }; }; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx index e27072131d..6d4979446a 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction, useEffect } from "react"; +import { useEffect } from "react"; import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; import { TokenData } from "domain/synthetics/tokens"; @@ -39,12 +39,12 @@ export function useUpdateInputAmounts({ isDeposit: boolean; focusedInput: string; amounts: DepositAmounts | WithdrawalAmounts | undefined; - setMarketOrGlvTokenInputValue: Dispatch>; + setMarketOrGlvTokenInputValue: (value: string) => void; marketTokenAmount: bigint; glvTokenAmount: bigint; isWithdrawal: boolean; - setFirstTokenInputValue: Dispatch>; - setSecondTokenInputValue: Dispatch>; + setFirstTokenInputValue: (value: string) => void; + setSecondTokenInputValue: (value: string) => void; }) { useEffect( function updateInputAmounts() { diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateTokens.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateTokens.tsx index 0f2b826579..a6339f6620 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateTokens.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateTokens.tsx @@ -1,10 +1,12 @@ -import { Dispatch, SetStateAction, useEffect } from "react"; +import { useEffect } from "react"; import { GlvOrMarketInfo } from "domain/synthetics/markets/types"; import { getTokenPoolType } from "domain/synthetics/markets/utils"; import { Token } from "domain/tokens"; import { convertTokenAddress } from "sdk/configs/tokens"; +import { FocusedInput } from "./types"; + export function useUpdateTokens({ chainId, tokenOptions, @@ -22,15 +24,15 @@ export function useUpdateTokens({ chainId: number; tokenOptions: Token[]; firstTokenAddress: string | undefined; - setFirstTokenAddress: Dispatch>; + setFirstTokenAddress: (address: string | undefined) => void; isSingle: boolean; isPair: boolean; secondTokenAddress: string | undefined; marketInfo: GlvOrMarketInfo | undefined; secondTokenAmount: bigint | undefined; - setFocusedInput: Dispatch>; - setSecondTokenAddress: Dispatch>; - setSecondTokenInputValue: Dispatch>; + setFocusedInput: (input: FocusedInput) => void; + setSecondTokenAddress: (address: string | undefined) => void; + setSecondTokenInputValue: (value: string) => void; }) { useEffect( function updateTokens() { diff --git a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx index 2d33ac536f..e6cb99ac62 100644 --- a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx @@ -2,6 +2,7 @@ import { t } from "@lingui/macro"; import { useCallback, useEffect, useMemo, useState } from "react"; import { getContract } from "config/contracts"; +import { usePoolsDetailsFirstTokenAddress } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; import { useTokensData, useUiFeeFactor } from "context/SyntheticsStateContext/hooks/globalsHooks"; import { @@ -33,7 +34,6 @@ import { GmFees } from "../../GmFees/GmFees"; import { GmSwapWarningsRow } from "../GmSwapWarningsRow"; import { SelectedPool } from "../SelectedPool"; import { Operation } from "../types"; -import { useDepositWithdrawalSetFirstTokenAddress } from "../useDepositWithdrawalSetFirstTokenAddress"; import { useGmWarningState } from "../useGmWarningState"; import { useShiftAmounts } from "./useShiftAmounts"; import { useShiftAvailableRelatedMarkets } from "./useShiftAvailableRelatedMarkets"; @@ -115,7 +115,7 @@ export function GmShiftBox({ const { shouldShowWarning, shouldShowWarningForExecutionFee, shouldShowWarningForPosition } = useGmWarningState({ executionFee, - fees, + logicalFees: fees, }); const noAmountSet = amounts?.fromTokenAmount === undefined; @@ -162,7 +162,7 @@ export function GmShiftBox({ useUpdateTokens({ amounts, selectedToken, toToken, focusedInput, setToMarketText, setSelectedMarketText }); const [glvForShiftAddress, setGlvForShiftAddress] = useState(undefined); - const [, setFirstTokenAddressForDeposit] = useDepositWithdrawalSetFirstTokenAddress(true, glvForShiftAddress); + const [, setFirstTokenAddressForDeposit] = usePoolsDetailsFirstTokenAddress(); const handleFormSubmit = useCallback( (event: React.FormEvent) => { diff --git a/src/components/GmSwap/GmSwapBox/useDepositWithdrawalSetFirstTokenAddress.tsx b/src/components/GmSwap/GmSwapBox/useDepositWithdrawalSetFirstTokenAddress.tsx deleted file mode 100644 index af47ff2b93..0000000000 --- a/src/components/GmSwap/GmSwapBox/useDepositWithdrawalSetFirstTokenAddress.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; -import { selectChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; -import { useSelector } from "context/SyntheticsStateContext/utils"; -import { useLocalStorageSerializeKey } from "lib/localStorage"; - -export const useDepositWithdrawalSetFirstTokenAddress = (isDeposit: boolean, marketAddress?: string) => { - const chainId = useSelector(selectChainId); - - return useLocalStorageSerializeKey( - [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, marketAddress, "first"], - undefined - ); -}; diff --git a/src/components/GmSwap/GmSwapBox/useGmWarningState.ts b/src/components/GmSwap/GmSwapBox/useGmWarningState.ts index 841a0b49c8..7961d62e0c 100644 --- a/src/components/GmSwap/GmSwapBox/useGmWarningState.ts +++ b/src/components/GmSwap/GmSwapBox/useGmWarningState.ts @@ -1,17 +1,16 @@ import { getExcessiveExecutionFee } from "config/chains"; import { HIGH_PRICE_IMPACT_BPS, USD_DECIMALS } from "config/factors"; -import { ExecutionFee } from "domain/synthetics/fees"; import { GmSwapFees } from "domain/synthetics/trade"; import { useChainId } from "lib/chains"; import { expandDecimals } from "lib/numbers"; import { bigMath } from "sdk/utils/bigmath"; export function useGmWarningState({ - executionFee, - fees, + // executionFee, + logicalFees: fees, }: { - executionFee: ExecutionFee | undefined; - fees: GmSwapFees | undefined; + // executionFee: ExecutionFee | undefined; + logicalFees: GmSwapFees | undefined; }) { const { chainId } = useChainId(); @@ -20,7 +19,8 @@ export function useGmWarningState({ bigMath.abs(fees?.swapPriceImpact?.bps ?? 0n) >= HIGH_PRICE_IMPACT_BPS; const isHighExecutionFee = Boolean( - executionFee && executionFee?.feeUsd >= expandDecimals(getExcessiveExecutionFee(chainId), USD_DECIMALS) + fees?.logicalNetworkFee?.deltaUsd !== undefined && + fees?.logicalNetworkFee?.deltaUsd >= expandDecimals(getExcessiveExecutionFee(chainId), USD_DECIMALS) ); const shouldShowWarning = isHighExecutionFee || isHighPriceImpact; diff --git a/src/components/GmxAccountModal/DepositView.tsx b/src/components/GmxAccountModal/DepositView.tsx index f86dd7af0b..d4d0338983 100644 --- a/src/components/GmxAccountModal/DepositView.tsx +++ b/src/components/GmxAccountModal/DepositView.tsx @@ -77,7 +77,7 @@ import { ValueTransition } from "components/ValueTransition/ValueTransition"; import ChevronRightIcon from "img/ic_chevron_right.svg?react"; import SpinnerIcon from "img/ic_spinner.svg?react"; -import { useAvailableToTradeAssetMultichain, useMultichainTokensRequest } from "./hooks"; +import { useAvailableToTradeAssetMultichain, useMultichainTradeTokensRequest } from "./hooks"; import { wrapChainAction } from "./wrapChainAction"; const useIsFirstDeposit = () => { @@ -121,7 +121,7 @@ export const DepositView = () => { tokenChainDataArray: multichainTokens, isPriceDataLoading, isBalanceDataLoading, - } = useMultichainTokensRequest(settlementChainId, account); + } = useMultichainTradeTokensRequest(settlementChainId, account); const [isApproving, setIsApproving] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); const [shouldSendCrossChainDepositWhenLoaded, setShouldSendCrossChainDepositWhenLoaded] = useState(false); diff --git a/src/components/GmxAccountModal/SelectAssetToDepositView.tsx b/src/components/GmxAccountModal/SelectAssetToDepositView.tsx index df90cdacc5..c75623f6d2 100644 --- a/src/components/GmxAccountModal/SelectAssetToDepositView.tsx +++ b/src/components/GmxAccountModal/SelectAssetToDepositView.tsx @@ -19,7 +19,7 @@ import { convertToUsd, getMidPrice } from "sdk/utils/tokens"; import { Amount } from "components/Amount/Amount"; import Button from "components/Button/Button"; -import { useMultichainTokensRequest } from "components/GmxAccountModal/hooks"; +import { useMultichainTradeTokensRequest } from "components/GmxAccountModal/hooks"; import SearchInput from "components/SearchInput/SearchInput"; import { ButtonRowScrollFadeContainer } from "components/TableScrollFade/TableScrollFade"; import { VerticalScrollFadeContainer } from "components/TableScrollFade/VerticalScrollFade"; @@ -83,7 +83,7 @@ export const SelectAssetToDepositView = () => { const [selectedNetwork, setSelectedNetwork] = useState("all"); const [searchQuery, setSearchQuery] = useState(""); - const { tokenChainDataArray } = useMultichainTokensRequest(chainId, account); + const { tokenChainDataArray } = useMultichainTradeTokensRequest(chainId, account); const NETWORKS_FILTER = useMemo(() => { const wildCard = { id: "all" as const, name: "All Networks" }; diff --git a/src/components/GmxAccountModal/hooks.ts b/src/components/GmxAccountModal/hooks.ts index 1194c8ffe5..0758c75193 100644 --- a/src/components/GmxAccountModal/hooks.ts +++ b/src/components/GmxAccountModal/hooks.ts @@ -4,7 +4,12 @@ import useSWRSubscription, { SWRSubscription } from "swr/subscription"; import { useAccount } from "wagmi"; import { AnyChainId, ContractsChainId, getChainName, SettlementChainId, SourceChainId } from "config/chains"; -import { getMappedTokenId, MULTI_CHAIN_TOKEN_MAPPING, MultichainTokenMapping } from "config/multichain"; +import { + getMappedTokenId, + MULTI_CHAIN_PLATFORM_TOKENS_MAP, + MULTI_CHAIN_TOKEN_MAPPING, + MultichainTokenMapping, +} from "config/multichain"; import { selectAccount } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { @@ -143,13 +148,25 @@ export function useAvailableToTradeAssetMultichain(): { } const subscribeMultichainTokenBalances: SWRSubscription< - [name: string, chainId: ContractsChainId, account: string, tokens: string[] | undefined], + [ + name: string, + chainId: ContractsChainId, + account: string, + tokens: string[] | undefined, + specificChainId: SourceChainId | undefined, + ], { tokenBalances: Record>; isLoading: boolean; } > = (key, options) => { - const [, settlementChainId, account, tokens] = key as [string, SettlementChainId, string, string[] | undefined]; + const [, settlementChainId, account, tokens, specificChainId] = key as [ + string, + SettlementChainId, + string, + string[] | undefined, + SourceChainId | undefined, + ]; let tokenBalances: Record> | undefined; let isLoaded = false; @@ -162,6 +179,7 @@ const subscribeMultichainTokenBalances: SWRSubscription< options.next(null, { tokenBalances, isLoading: isLoaded ? false : true }); }, tokens, + specificChainId, }).then((finalTokenBalances) => { if (!isLoaded) { isLoaded = true; @@ -175,7 +193,7 @@ const subscribeMultichainTokenBalances: SWRSubscription< }; }; -export function useMultichainTokensRequest( +export function useMultichainTradeTokensRequest( chainId: ContractsChainId, account: string | undefined ): { @@ -186,7 +204,7 @@ export function useMultichainTokensRequest( const { pricesData, isPriceDataLoading } = useTokenRecentPricesRequest(chainId); const { data: balanceData } = useSWRSubscription( - account ? ["multichain-tokens", chainId, account, undefined] : null, + account ? ["multichain-trade-tokens-balances", chainId, account, undefined, undefined] : null, // TODO MLTCH optimistically update useSourceChainTokensDataRequest subscribeMultichainTokenBalances ); @@ -236,7 +254,7 @@ export function useMultichainTokens() { const { chainId } = useChainId(); const account = useSelector(selectAccount); - return useMultichainTokensRequest(chainId, account); + return useMultichainTradeTokensRequest(chainId, account); } export function useMultichainMarketTokenBalancesRequest( @@ -255,7 +273,7 @@ export function useMultichainMarketTokenBalancesRequest( }); const { data: balancesResult } = useSWRSubscription( - account && tokenAddress ? ["multichain-market-tokens", chainId, account, [tokenAddress]] : null, + account && tokenAddress ? ["multichain-market-token-balances", chainId, account, [tokenAddress], undefined] : null, // TODO MLTCH optimistically update useSourceChainTokensDataRequest subscribeMultichainTokenBalances ); @@ -314,6 +332,64 @@ export function useMultichainMarketTokenBalancesRequest( }; } +export function useMultichainMarketTokensBalancesRequest({ + chainId, + account, + enabled, + specificChainId, +}: { + chainId: ContractsChainId; + account: string | undefined; + enabled: boolean; + specificChainId: SourceChainId | undefined; +}): { + tokenBalances: Record; + isLoading: boolean; +} { + const platformTokens = MULTI_CHAIN_PLATFORM_TOKENS_MAP[chainId as SettlementChainId] as string[] | undefined; + + const { data: balancesResult } = useSWRSubscription( + account && platformTokens?.length && enabled && specificChainId !== undefined + ? ["multichain-market-tokens-balances", chainId, account, platformTokens, specificChainId] + : null, + // TODO MLTCH optimistically update useSourceChainTokensDataRequest + subscribeMultichainTokenBalances + ); + + const tokenBalances: Record = useMemo(() => { + if (!balancesResult || !specificChainId) { + return EMPTY_OBJECT; + } + + const balances: Record = {}; + + for (const sourceChainTokenAddress in balancesResult.tokenBalances[specificChainId]) { + const settlementChainTokenId = getMappedTokenId( + specificChainId, + sourceChainTokenAddress, + chainId as SettlementChainId + ); + + if (!settlementChainTokenId) { + continue; + } + + const balance = balancesResult.tokenBalances[specificChainId][sourceChainTokenAddress]; + + if (balance !== undefined && balance !== 0n) { + balances[settlementChainTokenId.address] = balance; + } + } + + return balances; + }, [balancesResult, chainId, specificChainId]); + + return { + tokenBalances, + isLoading: balancesResult?.isLoading ?? true, + }; +} + function getTokensChainData({ chainId, sourceChainTokenIdMap, diff --git a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts index 87075c120c..ea28d5f7eb 100644 --- a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts +++ b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts @@ -51,7 +51,7 @@ export const useBestGmPoolAddressForGlv = ({ marketTokensData: TokensData | undefined; - fees: ReturnType["fees"]; + fees: ReturnType["logicalFees"]; isMarketForGlvSelectedManually: boolean; onSelectedMarketForGlv?: (marketAddress?: string) => void; diff --git a/src/components/Referrals/JoinReferralCode.tsx b/src/components/Referrals/JoinReferralCode.tsx index 3f2a15e0fd..3abf01d678 100644 --- a/src/components/Referrals/JoinReferralCode.tsx +++ b/src/components/Referrals/JoinReferralCode.tsx @@ -18,9 +18,9 @@ import { selectExpressGlobalParams } from "context/SyntheticsStateContext/select import { SyntheticsStateContextProvider } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { type MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { setTraderReferralCodeByUser, validateReferralCodeExists } from "domain/referrals/hooks"; import { getRawRelayerParams, RawRelayParamsPayload, RelayParamsPayload } from "domain/synthetics/express"; import { signSetTraderReferralCode } from "domain/synthetics/express/expressOrderUtils"; @@ -40,7 +40,7 @@ import { nowInSeconds } from "sdk/utils/time"; import type { IStargate } from "typechain-types-stargate"; import Button from "components/Button/Button"; -import { useMultichainTokensRequest } from "components/GmxAccountModal/hooks"; +import { useMultichainTradeTokensRequest } from "components/GmxAccountModal/hooks"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; import { SyntheticsInfoRow } from "components/SyntheticsInfoRow"; @@ -248,7 +248,7 @@ function ReferralCodeFormMultichain({ const [referralCodeExists, setReferralCodeExists] = useState(true); const debouncedReferralCode = useDebounce(referralCode, 300); const settlementChainPublicClient = usePublicClient({ chainId }); - const { tokenChainDataArray: multichainTokens } = useMultichainTokensRequest(chainId, account); + const { tokenChainDataArray: multichainTokens } = useMultichainTradeTokensRequest(chainId, account); const simulationSigner = useMemo(() => { if (!signer?.provider) { @@ -306,7 +306,6 @@ function ReferralCodeFormMultichain({ }, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], - marketsInfoData: p.globalExpressParams.marketsInfoData, }) as RawRelayParamsPayload; const relayParams: RelayParamsPayload = { @@ -453,7 +452,6 @@ function ReferralCodeFormMultichain({ }, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], - marketsInfoData: globalExpressParams.marketsInfoData, }); const relayParamsPayload: RelayParamsPayload = { diff --git a/src/config/multichain.ts b/src/config/multichain.ts index bdd38ff489..1523eae709 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -159,6 +159,78 @@ const TOKEN_GROUPS: Partial", + chainAddresses: { + [ARBITRUM]: { + address: "0xdF03EEd325b82bC1d4Db8b49c30ecc9E05104b96", + stargate: "0xdF03EEd325b82bC1d4Db8b49c30ecc9E05104b96", + }, + [SOURCE_BASE_MAINNET]: { + address: "0xbCB170fEDDa90cd7593f016DFdabA032Ca1F222b", + stargate: "0xbCB170fEDDa90cd7593f016DFdabA032Ca1F222b", + }, + [SOURCE_BSC_MAINNET]: { + address: "0x3c21894169D669C5f0767c1289E71Ec8d6132C0F", + stargate: "0x3c21894169D669C5f0767c1289E71Ec8d6132C0F", + }, + }, +}); + +addMultichainPlatformTokenConfig(TOKEN_GROUPS, { + symbol: "", + chainAddresses: { + [ARBITRUM]: { + address: "0x528A5bac7E746C9A509A1f4F6dF58A03d44279F9", + stargate: "0x8c92eaE643040fF0Fb65B423433001c176cB0bb6", + }, + [SOURCE_BASE_MAINNET]: { + address: "0x8c92eaE643040fF0Fb65B423433001c176cB0bb6", + stargate: "0x8c92eaE643040fF0Fb65B423433001c176cB0bb6", + }, + [SOURCE_BSC_MAINNET]: { + address: "0x0BC5aB50Fd581b34681A9be180179b1Ef0b238c7", + stargate: "0x0BC5aB50Fd581b34681A9be180179b1Ef0b238c7", + }, + }, +}); + +addMultichainPlatformTokenConfig(TOKEN_GROUPS, { + symbol: "", + chainAddresses: { + [ARBITRUM]: { + address: "0x47c031236e19d024b42f8AE6780E44A573170703", + stargate: "0x91dd54AA8BA9Dfde8b956Cfb709a7c418f870e21", + }, + [SOURCE_BASE_MAINNET]: { + address: "0x91dd54AA8BA9Dfde8b956Cfb709a7c418f870e21", + stargate: "0x91dd54AA8BA9Dfde8b956Cfb709a7c418f870e21", + }, + [SOURCE_BSC_MAINNET]: { + address: "0x91dd54AA8BA9Dfde8b956Cfb709a7c418f870e21", + stargate: "0x91dd54AA8BA9Dfde8b956Cfb709a7c418f870e21", + }, + }, +}); + +addMultichainPlatformTokenConfig(TOKEN_GROUPS, { + symbol: "", + chainAddresses: { + [ARBITRUM]: { + address: "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", + stargate: "0xfcff5015627B8ce9CeAA7F5b38a6679F65fE39a7", + }, + [SOURCE_BASE_MAINNET]: { + address: "0xfcff5015627B8ce9CeAA7F5b38a6679F65fE39a7", + stargate: "0xfcff5015627B8ce9CeAA7F5b38a6679F65fE39a7", + }, + [SOURCE_BSC_MAINNET]: { + address: "0xfcff5015627B8ce9CeAA7F5b38a6679F65fE39a7", + stargate: "0xfcff5015627B8ce9CeAA7F5b38a6679F65fE39a7", + }, + }, +}); + if (isDevelopment()) { TOKEN_GROUPS["USDC.SG"] = { ...TOKEN_GROUPS["USDC.SG"], @@ -236,44 +308,65 @@ if (isDevelopment()) { }, }; - // TODO MLTCH wrap it in a factory - TOKEN_GROUPS[""] = { - [ARBITRUM_SEPOLIA]: { - address: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", - decimals: 18, - chainId: ARBITRUM_SEPOLIA, - stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", - symbol: "", - isPlatformToken: true, + addMultichainPlatformTokenConfig(TOKEN_GROUPS, { + symbol: "", + chainAddresses: { + [ARBITRUM_SEPOLIA]: { + address: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", + stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + }, + [SOURCE_SEPOLIA]: { + address: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", + }, }, - [SOURCE_SEPOLIA]: { - address: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", - decimals: 18, - chainId: SOURCE_SEPOLIA, - stargate: "0xe4EBcAC4a2e6CBEE385eE407f7D5E278Bc07e11e", - symbol: "", - isPlatformToken: true, + }); + + addMultichainPlatformTokenConfig(TOKEN_GROUPS, { + symbol: "", + chainAddresses: { + [ARBITRUM_SEPOLIA]: { + address: "0xAb3567e55c205c62B141967145F37b7695a9F854", + stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + }, + [SOURCE_SEPOLIA]: { + address: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", + }, }, - }; + }); +} - TOKEN_GROUPS[""] = { - [ARBITRUM_SEPOLIA]: { - address: "0xAb3567e55c205c62B141967145F37b7695a9F854", - decimals: 18, - chainId: ARBITRUM_SEPOLIA, - stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", - symbol: "", - isPlatformToken: true, - }, - [SOURCE_SEPOLIA]: { - address: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", +function addMultichainPlatformTokenConfig( + tokenGroups: typeof TOKEN_GROUPS, + { + symbol, + chainAddresses, + }: { + symbol: string; + chainAddresses: Partial< + Record< + AnyChainId, + { + address: string; + stargate: string; + } + > + >; + } +) { + tokenGroups[symbol] = {}; + + for (const chainIdString in chainAddresses) { + tokenGroups[symbol][chainIdString] = { + address: chainAddresses[chainIdString].address, decimals: 18, - chainId: SOURCE_SEPOLIA, - stargate: "0xD5BdEa6dC8E4B7429b72675386fC903DEf06599d", - symbol: "", + chainId: parseInt(chainIdString) as SettlementChainId | SourceChainId, + stargate: chainAddresses[chainIdString].stargate, + symbol: symbol, isPlatformToken: true, - }, - }; + } satisfies MultichainTokenId; + } } export const DEBUG_MULTICHAIN_SAME_CHAIN_DEPOSIT = false; @@ -285,6 +378,7 @@ if (isDevelopment() && DEBUG_MULTICHAIN_SAME_CHAIN_DEPOSIT) { export const MULTI_CHAIN_TOKEN_MAPPING = {} as MultichainTokenMapping; export const MULTI_CHAIN_DEPOSIT_TRADE_TOKENS = {} as Record; export const MULTI_CHAIN_WITHDRAWAL_TRADE_TOKENS = {} as Record; +export const MULTI_CHAIN_PLATFORM_TOKENS_MAP = {} as Record; export const CHAIN_ID_TO_TOKEN_ID_MAP: Record< SettlementChainId | SourceChainId, @@ -354,6 +448,11 @@ for (const tokenSymbol in TOKEN_GROUPS) { sourceChainTokenDecimals: sourceChainToken.decimals, }; } + + if (tokenId?.isPlatformToken) { + MULTI_CHAIN_PLATFORM_TOKENS_MAP[settlementChainId] = MULTI_CHAIN_PLATFORM_TOKENS_MAP[settlementChainId] || []; + MULTI_CHAIN_PLATFORM_TOKENS_MAP[settlementChainId].push(tokenId.address); + } } } diff --git a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx index f458fa2eec..5e6dc7dacd 100644 --- a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx +++ b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx @@ -1,51 +1,183 @@ -import { createContext, useContext, useEffect, useMemo, useState } from "react"; -import { Redirect } from "react-router-dom"; +import noop from "lodash/noop"; +import { useCallback, useEffect, useMemo, useState } from "react"; -import { selectGlvAndMarketsInfoData } from "context/SyntheticsStateContext/selectors/globalSelectors"; -import { useSelector } from "context/SyntheticsStateContext/utils"; -import { GlvOrMarketInfo } from "domain/synthetics/markets"; +import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; +import { + selectChainId, + selectDepositMarketTokensData, + selectGlvInfo, + selectMarketsInfoData, +} from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; +import { SyntheticsState } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; +import { createSelector, useSelector } from "context/SyntheticsStateContext/utils"; +import { GlvInfoData, MarketsInfoData, useMarketTokensDataRequest } from "domain/synthetics/markets"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { TokensData } from "domain/synthetics/tokens"; +import { useChainId } from "lib/chains"; +import { useLocalStorageSerializeKey } from "lib/localStorage"; +import { parseValue } from "lib/numbers"; import { getByKey } from "lib/objects"; import useRouteQuery from "lib/useRouteQuery"; +import { useSafeState } from "lib/useSafeState"; +import { MARKETS } from "sdk/configs/markets"; +import { convertTokenAddress, getToken } from "sdk/configs/tokens"; +import { getTokenData } from "sdk/utils/tokens"; import { getGmSwapBoxAvailableModes } from "components/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes"; +import { FocusedInput, GmPaySource } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; import { Mode, Operation, isMode, isOperation } from "components/GmSwap/GmSwapBox/types"; export type PoolsDetailsQueryParams = { market: string; }; -export type PoolsDetailsContext = { - glvOrMarketAddress: string; +function isValidPaySource(paySource: string | undefined): paySource is GmPaySource { + return ( + (paySource as GmPaySource) === "settlementChain" || + (paySource as GmPaySource) === "sourceChain" || + (paySource as GmPaySource) === "gmxAccount" + ); +} + +function fallbackPaySource({ + operation, + mode, + paySource, + srcChainId, +}: { + operation: Operation; + mode: Mode; + paySource: GmPaySource | undefined; + srcChainId: number | undefined; +}) { + if (!isValidPaySource(paySource)) { + return "gmxAccount"; + } else if (paySource === "sourceChain" && srcChainId === undefined) { + return "settlementChain"; + } else if (paySource === "settlementChain" && srcChainId !== undefined) { + return "sourceChain"; + } else if (operation === Operation.Deposit && paySource === "sourceChain" && mode === Mode.Pair) { + return "gmxAccount"; + } + + return paySource; +} + +export type PoolsDetailsState = { + glvOrMarketAddress: string | undefined; + selectedMarketForGlv: string | undefined; operation: Operation; mode: Mode; - glvOrMarketInfo: GlvOrMarketInfo | undefined; + withdrawalMarketTokensData: TokensData | undefined; + + // GM Deposit/Withdrawal Box State + focusedInput: FocusedInput; + paySource: GmPaySource; + firstTokenAddress: string | undefined; + secondTokenAddress: string | undefined; + firstTokenInputValue: string; + secondTokenInputValue: string; + marketOrGlvTokenInputValue: string; + // marketTokensBalancesResult: ReturnType; + setOperation: (operation: Operation) => void; setMode: (mode: Mode) => void; setGlvOrMarketAddress: (glvOrMarketAddress: string) => void; + setSelectedMarketForGlv: (marketAddress?: string) => void; + setFocusedInput: (input: FocusedInput) => void; + setPaySource: (source: GmPaySource) => void; + setFirstTokenAddress: (address: string | undefined) => void; + setSecondTokenAddress: (address: string | undefined) => void; + setFirstTokenInputValue: (value: string) => void; + setSecondTokenInputValue: (value: string) => void; + setMarketOrGlvTokenInputValue: (value: string) => void; }; -const PoolsDetailsContext = createContext(undefined); +function useReactRouterSearchParam(param: string): [string | undefined, (value: string | undefined) => void] { + const searchParams = useRouteQuery(); + const value = searchParams.get(param) ?? undefined; + const setValue = useCallback( + (value: string | undefined) => { + searchParams.set(param, value ?? ""); + }, + [searchParams, param] + ); -export function usePoolsDetailsContext() { - const context = useContext(PoolsDetailsContext); - if (!context) { - throw new Error("usePoolsDetailsContext must be used within a PoolsDetailsContextProvider"); - } - return context; + return [value, setValue] as const; } -export function PoolsDetailsContextProvider({ children }: { children: React.ReactNode }) { +export function usePoolsDetailsState({ + enabled, + marketsInfoData, + account, + glvData, + withGlv, +}: { + enabled: boolean; + marketsInfoData: MarketsInfoData | undefined; + account: string | undefined; + glvData: GlvInfoData | undefined; + withGlv: boolean; +}) { const searchParams = useRouteQuery(); + const { chainId, srcChainId } = useChainId(); - const marketFromQueryParams = searchParams.get("market"); - - const marketsInfoData = useSelector(selectGlvAndMarketsInfoData); + const [glvOrMarketAddress, setGlvOrMarketAddress] = useReactRouterSearchParam("market"); const [operation, setOperation] = useState(Operation.Deposit); const [mode, setMode] = useState(Mode.Single); - const [glvOrMarketAddress, setGlvOrMarketAddress] = useState(marketFromQueryParams); + const [selectedMarketForGlv, setSelectedMarketForGlv] = useState(undefined); + + const { marketTokensData: withdrawalMarketTokensData } = useMarketTokensDataRequest(chainId, srcChainId, { + isDeposit: false, + account, + glvData, + withGlv, + enabled, + withMultichainBalances: enabled, + }); + + // const marketTokensBalancesResult = useMultichainMarketTokensBalancesRequest(chainId, account); + + // GM Deposit/Withdrawal Box State + const isDeposit = operation === Operation.Deposit; + const [focusedInput, setFocusedInput] = useState("market"); + + let [rawPaySource, setPaySource] = useLocalStorageSerializeKey( + [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, "paySource"], + "settlementChain" + ); + + let paySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); + + useEffect( + function fallbackSourceChainPaySource() { + const newPaySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); + if (newPaySource !== rawPaySource) { + setPaySource(newPaySource); + } + }, + [mode, operation, rawPaySource, setPaySource, srcChainId] + ); + + const [firstTokenAddress, setFirstTokenAddress] = useLocalStorageSerializeKey( + [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, glvOrMarketAddress, "first"], + undefined + ); + const [secondTokenAddress, setSecondTokenAddress] = useLocalStorageSerializeKey( + [chainId, SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY, isDeposit, glvOrMarketAddress, "second"], + undefined + ); + const [firstTokenInputValue, setFirstTokenInputValue] = useSafeState(""); + const [secondTokenInputValue, setSecondTokenInputValue] = useSafeState(""); + const [marketOrGlvTokenInputValue, setMarketOrGlvTokenInputValue] = useSafeState(""); useEffect(() => { + if (!enabled) { + return; + } + const operationFromQueryParams = searchParams.get("operation"); if (operationFromQueryParams && isOperation(operationFromQueryParams)) { setOperation(operationFromQueryParams); @@ -55,9 +187,13 @@ export function PoolsDetailsContextProvider({ children }: { children: React.Reac if (modeFromQueryParams && isMode(modeFromQueryParams)) { setMode(modeFromQueryParams); } - }, [searchParams]); + }, [searchParams, enabled]); useEffect(() => { + if (!enabled) { + return; + } + if (!glvOrMarketAddress) { return; } @@ -67,26 +203,529 @@ export function PoolsDetailsContextProvider({ children }: { children: React.Reac if (!newAvailableModes.includes(mode)) { setMode(newAvailableModes[0]); } - }, [glvOrMarketAddress, marketsInfoData, mode, operation]); + }, [glvOrMarketAddress, marketsInfoData, mode, operation, enabled]); - const glvOrMarketInfo = glvOrMarketAddress ? getByKey(marketsInfoData, glvOrMarketAddress) : undefined; + const value = useMemo(() => { + if (!enabled) { + return undefined; + } - const value = useMemo( - () => ({ + return { glvOrMarketAddress, operation, mode, - glvOrMarketInfo, + withdrawalMarketTokensData, + selectedMarketForGlv, + // marketTokensBalancesResult, + + // GM Deposit/Withdrawal Box State + focusedInput, + paySource, + firstTokenAddress, + secondTokenAddress, + firstTokenInputValue, + secondTokenInputValue, + marketOrGlvTokenInputValue, + + // Setters setOperation, setMode, setGlvOrMarketAddress, - }), - [glvOrMarketAddress, operation, mode, glvOrMarketInfo] - ); + setSelectedMarketForGlv, + setFocusedInput, + setPaySource, + setFirstTokenAddress, + setSecondTokenAddress, + setFirstTokenInputValue, + setSecondTokenInputValue, + setMarketOrGlvTokenInputValue, + }; + }, [ + enabled, + glvOrMarketAddress, + operation, + mode, + withdrawalMarketTokensData, + selectedMarketForGlv, + focusedInput, + paySource, + firstTokenAddress, + secondTokenAddress, + firstTokenInputValue, + secondTokenInputValue, + marketOrGlvTokenInputValue, + setGlvOrMarketAddress, + setPaySource, + setFirstTokenAddress, + setSecondTokenAddress, + setFirstTokenInputValue, + setSecondTokenInputValue, + setMarketOrGlvTokenInputValue, + ]); + + // TODO MLTCH move redirect somewhere else + // if (!value.glvOrMarketAddress) { + // return ; + // } + + // return {children}; + return value; +} + +export const selectPoolsDetailsGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.glvOrMarketAddress; +export const selectPoolsDetailsSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.selectedMarketForGlv; +export const selectPoolsDetailsOperation = (s: SyntheticsState) => s.poolsDetails?.operation ?? Operation.Deposit; +const selectPoolsDetailsMode = (s: SyntheticsState) => s.poolsDetails?.mode ?? Mode.Single; +const selectPoolsDetailsWithdrawalMarketTokensData = (s: SyntheticsState) => s.poolsDetails?.withdrawalMarketTokensData; + +// GM Deposit/Withdrawal Box State Selectors +export const selectPoolsDetailsFocusedInput = (s: SyntheticsState) => s.poolsDetails?.focusedInput ?? "market"; +export const selectPoolsDetailsPaySource = (s: SyntheticsState) => s.poolsDetails?.paySource ?? "settlementChain"; +export const selectPoolsDetailsFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.firstTokenAddress; +export const selectPoolsDetailsSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.secondTokenAddress; +const selectPoolsDetailsFirstTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.firstTokenInputValue ?? ""; +const selectPoolsDetailsSecondTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.secondTokenInputValue ?? ""; +const selectPoolsDetailsMarketOrGlvTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.marketOrGlvTokenInputValue ?? ""; +// const selectPoolsDetailsMarketTokenMultichainBalances = (s: SyntheticsState) => +// s.poolsDetails?.marketTokensBalancesResult.tokenBalances; + +const PLATFORM_TOKEN_DECIMALS = 18; + +export const selectPoolsDetailsMarketOrGlvTokenAmount = createSelector((q) => { + const marketOrGlvTokenInputValue = q(selectPoolsDetailsMarketOrGlvTokenInputValue); + + return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; +}); + +// const selectGlvTokenAmount = createSelector((q) => { +// const marketOrGlvTokenInputValue = q(selectMarketOrGlvTokenInputValue); + +// return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; +// }); + +export const selectPoolsDetailsFirstTokenAmount = createSelector((q) => { + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return 0n; + } + + const firstTokenInputValue = q(selectPoolsDetailsFirstTokenInputValue); + const chainId = q(selectChainId); + const token = getToken(chainId, firstTokenAddress); + + return parseValue(firstTokenInputValue || "0", token.decimals)!; +}); + +export const selectPoolsDetailsSecondTokenAmount = createSelector((q) => { + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + + if (!secondTokenAddress) { + return 0n; + } + + const secondTokenInputValue = q(selectPoolsDetailsSecondTokenInputValue); + const chainId = q(selectChainId); + const token = getToken(chainId, secondTokenAddress); + + return parseValue(secondTokenInputValue || "0", token.decimals)!; +}); + +// Setters +const selectSetGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.setGlvOrMarketAddress; +const selectSetSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.setSelectedMarketForGlv; +const selectSetOperation = (s: SyntheticsState) => s.poolsDetails?.setOperation; +const selectSetMode = (s: SyntheticsState) => s.poolsDetails?.setMode; +const selectSetFocusedInput = (s: SyntheticsState) => s.poolsDetails?.setFocusedInput; +const selectSetPaySource = (s: SyntheticsState) => s.poolsDetails?.setPaySource; +const selectSetFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenAddress; +const selectSetSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenAddress; +const selectSetFirstTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenInputValue; +const selectSetSecondTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenInputValue; +const selectSetMarketOrGlvTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setMarketOrGlvTokenInputValue; + +export const selectPoolsDetailsGlvInfo = createSelector((q) => { + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + if (!glvOrMarketAddress) return undefined; + + return q((state) => { + const glvInfo = selectGlvInfo(state); + const info = getByKey(glvInfo, glvOrMarketAddress); + return isGlvInfo(info) ? info : undefined; + }); +}); + +export const selectPoolsDetailsGlvTokenAddress = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + return glvInfo?.glvTokenAddress; +}); + +export const selectPoolsDetailsMarketInfo = createSelector((q) => { + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + const selectedMarketForGlv = q(selectPoolsDetailsSelectedMarketForGlv); + const glvInfo = q(selectPoolsDetailsGlvInfo); + + // If it's a GLV but no market is selected, return undefined + if (glvInfo !== undefined && selectedMarketForGlv === undefined) { + return undefined; + } + + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + + return q((state) => { + if (isGlv) { + return getByKey(selectMarketsInfoData(state), selectedMarketForGlv); + } + + return getByKey(selectMarketsInfoData(state), glvOrMarketAddress); + }); +}); + +export const selectPoolsDetailsFlags = createSelector((q) => { + const operation = q(selectPoolsDetailsOperation); + const mode = q(selectPoolsDetailsMode); + + return { + isPair: mode === Mode.Pair, + isDeposit: operation === Operation.Deposit, + isWithdrawal: operation === Operation.Withdrawal, + }; +}); + +export const selectPoolsDetailsMarketTokensData = createSelector((q) => { + const { isDeposit } = q(selectPoolsDetailsFlags); + // const srcChainId = q(selectSrcChainId); + // const marketTokensMultichainBalances = srcChainId + // ? q((state) => selectPoolsDetailsMarketTokenMultichainBalances(state)?.[srcChainId]) + // : undefined; + + if (isDeposit) { + return q(selectDepositMarketTokensData); + } + + return q(selectPoolsDetailsWithdrawalMarketTokensData); +}); + +// TODO MLTCH with balance source chain +// export const + +export const selectPoolsDetailsMarketTokenData = createSelector((q) => { + const marketTokensData = q(selectPoolsDetailsMarketTokensData); + + if (!marketTokensData) { + return undefined; + } + + const marketInfo = q(selectPoolsDetailsMarketInfo); + + return getTokenData(marketTokensData, marketInfo?.marketTokenAddress); +}); + +export const selectPoolsDetailsLongTokenAddress = createSelector((q) => { + const chainId = q(selectChainId); + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + + if (!glvOrMarketAddress) { + return undefined; + } + + if (MARKETS[chainId][glvOrMarketAddress]) { + return MARKETS[chainId][glvOrMarketAddress].longTokenAddress; + } + + const glvInfo = q(selectPoolsDetailsGlvInfo); + + if (!glvInfo) { + return undefined; + } + + return glvInfo.longTokenAddress; +}); + +export const selectPoolsDetailsShortTokenAddress = createSelector((q) => { + const chainId = q(selectChainId); + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + + if (!glvOrMarketAddress) { + return undefined; + } + + if (MARKETS[chainId][glvOrMarketAddress]) { + return MARKETS[chainId][glvOrMarketAddress].shortTokenAddress; + } + + const glvInfo = q(selectPoolsDetailsGlvInfo); - if (!value.glvOrMarketAddress) { - return ; + if (!glvInfo) { + return undefined; } - return {children}; + return glvInfo.shortTokenAddress; +}); + +// export const selectPoolsDetailsFirstTokenToLongTokenFindSwapPath = createSelector((q) => { +// const firstTokenAddress = q(selectFirstTokenAddress); + +// if (!firstTokenAddress) { +// return undefined; +// } + +// const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + +// if (!longTokenAddress) { +// return undefined; +// } + +// return q(makeSelectFindSwapPath(firstTokenAddress, longTokenAddress)); +// }); + +// export const selectPoolsDetailsSecondTokenToShortTokenFindSwapPath = createSelector((q) => { +// const secondTokenAddress = q(selectSecondTokenAddress); + +// if (!secondTokenAddress) { +// return undefined; +// } + +// const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + +// if (!shortTokenAddress) { +// return undefined; +// } + +// return q(makeSelectFindSwapPath(secondTokenAddress, shortTokenAddress)); +// }); + +// TODO MLTCH maybe its just for deposit and not for withdrawal +// export const selectPoolsDetailsFindSwapPaths = createSelector((q) => { +// const firstTokenToLongTokenFindSwapPath = q(selectPoolsDetailsFirstTokenToLongTokenFindSwapPath); +// const secondTokenToShortTokenFindSwapPath = q(selectPoolsDetailsSecondTokenToShortTokenFindSwapPath); + +// return { +// firstTokenToLongTokenFindSwapPath, +// secondTokenToShortTokenFindSwapPath, +// }; +// }); + +export const selectPoolsDetailsWithdrawalReceiveTokenAddress = createSelector((q) => { + const { isPair, isWithdrawal } = q(selectPoolsDetailsFlags); + + if (isPair || !isWithdrawal) { + return undefined; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return undefined; + } + + const chainId = q(selectChainId); + + return convertTokenAddress(chainId, firstTokenAddress, "wrapped"); +}); + +/** + * Either undefined meaning no swap needed or a swap from either: + * - long token to short token + * - short token to long token + * Allowing user to sell to single token + */ +export const selectPoolsDetailsWithdrawalFindSwapPath = createSelector((q) => { + const receiveTokenAddress = q(selectPoolsDetailsWithdrawalReceiveTokenAddress); + + if (!receiveTokenAddress) { + return undefined; + } + + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + + if (!longTokenAddress) { + return undefined; + } + + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + + if (!shortTokenAddress) { + return undefined; + } + + // if we want long token in the end, we need to swap short to long + if (longTokenAddress === receiveTokenAddress) { + return q(makeSelectFindSwapPath(shortTokenAddress, receiveTokenAddress)); + } + + // if we want short token in the end, we need to swap long to short + if (shortTokenAddress === receiveTokenAddress) { + return q(makeSelectFindSwapPath(longTokenAddress, receiveTokenAddress)); + } + + throw new Error("Weird state"); +}); + +export const selectPoolsDetailsIsMarketTokenDeposit = createSelector((q) => { + const { isDeposit } = q(selectPoolsDetailsFlags); + + if (!isDeposit) { + return false; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return false; + } + + const chainId = q(selectChainId); + const isMarket = Boolean(MARKETS[chainId][firstTokenAddress]); + + return isMarket; +}); + +export const selectPoolsDetailsGlvDepositMarketTokenAddress = createSelector((q) => { + const { isDeposit } = q(selectPoolsDetailsFlags); + + if (!isDeposit) { + return undefined; + } + + const glvInfo = q(selectPoolsDetailsGlvInfo); + + if (!glvInfo) { + return undefined; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return undefined; + } + + if (!glvInfo.markets.some((market) => market.address === firstTokenAddress)) { + return undefined; + } + + return firstTokenAddress; +}); + +// export const selectPoolsDetailsGlvDepositOr + +export const selectPoolsDetailsGlvDepositMarketTokenAmount = createSelector((q) => { + const glvDepositMarketTokenAddress = q(selectPoolsDetailsGlvDepositMarketTokenAddress); + + if (!glvDepositMarketTokenAddress) { + return undefined; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (glvDepositMarketTokenAddress === firstTokenAddress) { + return q(selectPoolsDetailsFirstTokenAmount); + } + + throw new Error("Weird state"); +}); + +export const selectPoolsDetailsLongTokenAmount = createSelector((q) => { + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); + + let longTokenAmount = 0n; + if (firstTokenAddress !== undefined && firstTokenAddress === longTokenAddress) { + longTokenAmount += firstTokenAmount; + } + if (secondTokenAddress !== undefined && secondTokenAddress === longTokenAddress) { + longTokenAmount += secondTokenAmount; + } + + return longTokenAmount; +}); + +export const selectPoolsDetailsShortTokenAmount = createSelector((q) => { + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); + + let shortTokenAmount = 0n; + if (firstTokenAddress !== undefined && firstTokenAddress === shortTokenAddress) { + shortTokenAmount += firstTokenAmount; + } + if (secondTokenAddress !== undefined && secondTokenAddress === shortTokenAddress) { + shortTokenAmount += secondTokenAmount; + } + + return shortTokenAmount; +}); + +// GM Deposit/Withdrawal Box State Hooks +export function usePoolsDetailsFocusedInput() { + const value = useSelector(selectPoolsDetailsFocusedInput); + const setter = useSelector(selectSetFocusedInput); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsPaySource() { + const value = useSelector(selectPoolsDetailsPaySource); + const setter = useSelector(selectSetPaySource); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsFirstTokenAddress() { + const value = useSelector(selectPoolsDetailsFirstTokenAddress); + const setter = useSelector(selectSetFirstTokenAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSecondTokenAddress() { + const value = useSelector(selectPoolsDetailsSecondTokenAddress); + const setter = useSelector(selectSetSecondTokenAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsFirstTokenInputValue() { + const value = useSelector(selectPoolsDetailsFirstTokenInputValue); + const setter = useSelector(selectSetFirstTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSecondTokenInputValue() { + const value = useSelector(selectPoolsDetailsSecondTokenInputValue); + const setter = useSelector(selectSetSecondTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsMarketOrGlvTokenInputValue() { + const value = useSelector(selectPoolsDetailsMarketOrGlvTokenInputValue); + const setter = useSelector(selectSetMarketOrGlvTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +// Additional hooks for operation and mode +export function usePoolsDetailsOperation() { + const value = useSelector(selectPoolsDetailsOperation); + const setter = useSelector(selectSetOperation); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsMode() { + const value = useSelector(selectPoolsDetailsMode); + const setter = useSelector(selectSetMode); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsGlvOrMarketAddress() { + const value = useSelector(selectPoolsDetailsGlvOrMarketAddress); + const setter = useSelector(selectSetGlvOrMarketAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSelectedMarketForGlv() { + const value = useSelector(selectPoolsDetailsSelectedMarketForGlv); + const setter = useSelector(selectSetSelectedMarketForGlv); + return [value, (setter || noop) as Exclude] as const; } diff --git a/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx b/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx index 1352dba6ec..f94ff6e3c0 100644 --- a/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx +++ b/src/context/SyntheticsStateContext/SyntheticsStateContextProvider.tsx @@ -4,6 +4,7 @@ import { useParams } from "react-router-dom"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getKeepLeverageKey } from "config/localStorage"; +import { PoolsDetailsState, usePoolsDetailsState } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { SettingsContextType, useSettings } from "context/SettingsContext/SettingsContextProvider"; import { SubaccountState, useSubaccountContext } from "context/SubaccountContext/SubaccountContextProvider"; import { TokenPermitsState, useTokenPermitsContext } from "context/TokenPermitsContext/TokenPermitsContextProvider"; @@ -138,6 +139,7 @@ export type SyntheticsState = { positionSeller: PositionSellerState; positionEditor: PositionEditorState; confirmationBox: ConfirmationBoxState; + poolsDetails: PoolsDetailsState | undefined; features: FeaturesSettings | undefined; gasPaymentTokenAllowance: TokenAllowanceResult | undefined; sponsoredCallBalanceData: SponsoredCallBalanceData | undefined; @@ -203,6 +205,7 @@ export function SyntheticsStateContextProvider({ account, glvData: glvInfo.glvData, withGlv: shouldFetchGlvMarkets, + withMultichainBalances: pageType === "pools", }); const { positionsConstants } = usePositionsConstantsRequest(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); @@ -284,6 +287,14 @@ export function SyntheticsStateContextProvider({ const positionEditorState = usePositionEditorState(chainId, srcChainId); const confirmationBoxState = useConfirmationBoxState(); + const poolsDetailsState = usePoolsDetailsState({ + enabled: pageType === "pools", + glvData: glvInfo.glvData, + withGlv: shouldFetchGlvMarkets, + marketsInfoData: marketsInfo.marketsInfoData, + account, + }); + const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const l1ExpressOrderGasReference = useL1ExpressOrderGasReference(); @@ -369,6 +380,7 @@ export function SyntheticsStateContextProvider({ positionSeller: positionSellerState, positionEditor: positionEditorState, confirmationBox: confirmationBoxState, + poolsDetails: poolsDetailsState, features, sponsoredCallBalanceData, gasPaymentTokenAllowance, @@ -413,6 +425,7 @@ export function SyntheticsStateContextProvider({ positionSellerState, positionsConstants, positionsInfoData, + poolsDetailsState, setKeepLeverage, settings, signer, diff --git a/src/context/SyntheticsStateContext/selectors/tradeSelectors.ts b/src/context/SyntheticsStateContext/selectors/tradeSelectors.ts index 989dc50675..4b3bd5b896 100644 --- a/src/context/SyntheticsStateContext/selectors/tradeSelectors.ts +++ b/src/context/SyntheticsStateContext/selectors/tradeSelectors.ts @@ -216,7 +216,7 @@ export const makeSelectMaxLiquidityPath = createSelectorFactory( const ENABLE_DEBUG_SWAP_MARKETS_CONFIG = isDevelopment(); export const makeSelectFindSwapPath = createSelectorFactory( - (fromTokenAddress: string | undefined, toTokenAddress: string | undefined) => { + (fromTokenAddress: string | undefined, toTokenAddress: string | undefined, isAtomicSwap?: boolean | undefined) => { return createSelector((q) => { const chainId = q(selectChainId); const marketsInfoData = q(selectMarketsInfoData); @@ -229,7 +229,7 @@ export const makeSelectFindSwapPath = createSelectorFactory( fromTokenAddress, toTokenAddress, marketsInfoData, - isExpressFeeSwap: false, + isExpressFeeSwap: isAtomicSwap, disabledMarkets: _debugSwapMarketsConfig?.disabledSwapMarkets, manualPath: _debugSwapMarketsConfig?.manualPath, gasEstimationParams, diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index a6491b8c13..7e4303a2d8 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -103,7 +103,6 @@ export function getRawBaseRelayerParams({ feeParams: baseRelayFeeSwapParams.feeParams, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: EMPTY_ARRAY, - marketsInfoData, }); return { rawBaseRelayParamsPayload, baseRelayFeeSwapParams }; @@ -275,7 +274,6 @@ export function getArbitraryRelayParamsAndPayload({ feeParams: relayFeeParams.feeParams, externalCalls: getEmptyExternalCallsPayload(), tokenPermits: [], - marketsInfoData: globalExpressParams.marketsInfoData, }); const subaccountValidations = @@ -331,7 +329,6 @@ export function useArbitraryRelayParamsAndPayload({ throw new Error("no baseRelayFeeSwapParams or rawBaseRelayParamsPayload"); } - // HERE const gasLimit: bigint = await estimateArbitraryGasLimit({ chainId, provider: p.provider, diff --git a/src/domain/multichain/codecs/CodecUiHelper.ts b/src/domain/multichain/codecs/CodecUiHelper.ts index 10ab3485b7..0e1b6b8a31 100644 --- a/src/domain/multichain/codecs/CodecUiHelper.ts +++ b/src/domain/multichain/codecs/CodecUiHelper.ts @@ -4,10 +4,10 @@ import { Address, concatHex, encodeAbiParameters, Hex, isHex, toHex, zeroAddress import { TransferRequests } from "domain/multichain/types"; import type { RelayParamsPayload } from "domain/synthetics/express"; import { - CreateDepositParamsStruct, - CreateGlvDepositParamsStruct, - CreateGlvWithdrawalParamsStruct, - CreateWithdrawalParamsStruct, + CreateDepositParams, + CreateGlvDepositParams, + CreateGlvWithdrawalParams, + CreateWithdrawalParams, } from "domain/synthetics/markets/types"; import type { ContractsChainId, SettlementChainId } from "sdk/configs/chains"; import { getContract } from "sdk/configs/contracts"; @@ -49,7 +49,7 @@ type SetTraderReferralCodeAction = { type DepositActionData = CommonActionData & { transferRequests: TransferRequests; - params: CreateDepositParamsStruct; + params: CreateDepositParams; }; type DepositAction = { @@ -75,7 +75,7 @@ type BridgeOutAction = { type GlvDepositActionData = CommonActionData & { transferRequests: TransferRequests; - params: CreateGlvDepositParamsStruct; + params: CreateGlvDepositParams; }; type GlvDepositAction = { @@ -85,7 +85,7 @@ type GlvDepositAction = { type WithdrawalActionData = CommonActionData & { transferRequests: TransferRequests; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; }; type WithdrawalAction = { @@ -95,7 +95,7 @@ type WithdrawalAction = { type GlvWithdrawalActionData = CommonActionData & { transferRequests: TransferRequests; - params: CreateGlvWithdrawalParamsStruct; + params: CreateGlvWithdrawalParams; }; type GlvWithdrawalAction = { diff --git a/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.spec.ts b/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.spec.ts new file mode 100644 index 0000000000..fe727f1bab --- /dev/null +++ b/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.spec.ts @@ -0,0 +1,271 @@ +import { encodeFunctionData } from "viem"; +import { describe, expect, it } from "vitest"; + +import { getProvider } from "lib/rpc"; +import { simulateCallDataWithTenderly, TenderlyConfig } from "lib/tenderly"; +import { ERC20Address } from "sdk/types/tokens"; + +import { + EstimateMultichainDepositNetworkComposeGasParameters, + getEstimateMultichainDepositNetworkComposeGasParameters, +} from "./estimateMultichainDepositNetworkComposeGas"; + +type TenderlyTraceResponse = { + transaction: { + call_trace: { error?: string }[]; + }; +}; + +function hasExecutionRevertedError(json: TenderlyTraceResponse) { + return json.transaction.call_trace.some((call: { error?: string }) => call.error?.includes("execution reverted")); +} + +const tenderlyConfig = { + accessKey: import.meta.env.TENDERLY_ACCESS_KEY, + accountSlug: import.meta.env.TENDERLY_ACCOUNT, + projectSlug: import.meta.env.TENDERLY_PROJECT, + enabled: true, +}; + +const MOCK_VALID_DATA: EstimateMultichainDepositNetworkComposeGasParameters = { + action: { + actionType: 1, + actionData: { + relayParams: { + oracleParams: { + tokens: ["0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"], + providers: ["0xa76BF7f977E80ac0bff49BDC98a27b7b070a937d", "0xa76BF7f977E80ac0bff49BDC98a27b7b070a937d"], + data: ["0x", "0x"], + }, + tokenPermits: [], + externalCalls: { + sendTokens: [], + sendAmounts: [], + externalCallTargets: [], + externalCallDataList: [], + refundReceivers: [], + refundTokens: [], + }, + fee: { + feeToken: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", + feeAmount: 2436711n, + feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + }, + desChainId: 421614n, + userNonce: 1760446679n, + deadline: 1760450279n, + }, + transferRequests: { + tokens: ["0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773"], + receivers: ["0x809Ea82C394beB993c2b6B0d73b8FD07ab92DE5A"], + amounts: [1000000n], + }, + params: { + addresses: { + receiver: "0x414dA6C7c50eADFBD4c67C902c7DAf59F58d32c7", + callbackContract: "0x0000000000000000000000000000000000000000", + uiFeeReceiver: "0xff00000000000000000000000000000000000001", + market: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", + initialLongToken: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73" as ERC20Address, + initialShortToken: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773" as ERC20Address, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minMarketTokens: 917474877705194438n, + shouldUnwrapNativeToken: false, + executionFee: 490769400000000n, + callbackGasLimit: 0n, + dataList: [ + "0x1e00e1bfa18454bf880ac17012d43b7b87f2a386d674ef67395563b8fb6c5a5e", + "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x0000000000000000000000000000000000000000000000000000000000000040", + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "0x0000000000000000000000000000000000000000000000000000000000066eee", + "0x0000000000000000000000000000000000000000000000000000000068ee56e6", + "0x000000000000000000000000e4ebcac4a2e6cbee385ee407f7d5e278bc07e11e", + "0x00000000000000000000000000000000000000000000000000000000000000a0", + "0x0000000000000000000000000000000000000000000000000cbb868a4ff68bc6", + "0x0000000000000000000000000000000000000000000000000000000000000020", + "0x0000000000000000000000000000000000000000000000000000000000009ce1", + ], + }, + signature: + "0x2ea8caa02ce5e873a03e9cadb481b8a02e3e1dd819582437706efa11ae80c53172744a1431803e590a5fc9afd60b017e2a33b188b4ede8cf46d4beb19040c88e1c", + }, + }, + chainId: 421614, + account: "0x9f3DDD654A2bdB2650DCAFdF02392dabf7eCe0Fb", + srcChainId: 11155111, + tokenAddress: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", +}; + +const MOCK_INVALID_DATA: EstimateMultichainDepositNetworkComposeGasParameters = { + action: { + actionType: 1, + actionData: { + relayParams: { + oracleParams: { + tokens: ["0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"], + providers: ["0xa76BF7f977E80ac0bff49BDC98a27b7b070a937d", "0xa76BF7f977E80ac0bff49BDC98a27b7b070a937d"], + data: ["0x", "0x"], + }, + tokenPermits: [], + externalCalls: { + sendTokens: [], + sendAmounts: [], + externalCallTargets: [], + externalCallDataList: [], + refundReceivers: [], + refundTokens: [], + }, + fee: { + feeToken: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", + // Notice huge inadequate fee amount + feeAmount: 2436711_000000000000000000n, + feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], + }, + desChainId: 421614n, + userNonce: 1760446679n, + deadline: 1760450279n, + }, + transferRequests: { + tokens: ["0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773"], + receivers: ["0x809Ea82C394beB993c2b6B0d73b8FD07ab92DE5A"], + amounts: [1000000n], + }, + params: { + addresses: { + receiver: "0x414dA6C7c50eADFBD4c67C902c7DAf59F58d32c7", + callbackContract: "0x0000000000000000000000000000000000000000", + uiFeeReceiver: "0xff00000000000000000000000000000000000001", + market: "0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc", + initialLongToken: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73" as ERC20Address, + initialShortToken: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773" as ERC20Address, + longTokenSwapPath: [], + shortTokenSwapPath: [], + }, + minMarketTokens: 917474877705194438n, + shouldUnwrapNativeToken: false, + executionFee: 490769400000000n, + callbackGasLimit: 0n, + dataList: [ + "0x1e00e1bfa18454bf880ac17012d43b7b87f2a386d674ef67395563b8fb6c5a5e", + "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x0000000000000000000000000000000000000000000000000000000000000040", + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "0x0000000000000000000000000000000000000000000000000000000000066eee", + "0x0000000000000000000000000000000000000000000000000000000068ee56e6", + "0x000000000000000000000000e4ebcac4a2e6cbee385ee407f7d5e278bc07e11e", + "0x00000000000000000000000000000000000000000000000000000000000000a0", + "0x0000000000000000000000000000000000000000000000000cbb868a4ff68bc6", + "0x0000000000000000000000000000000000000000000000000000000000000020", + "0x0000000000000000000000000000000000000000000000000000000000009ce1", + ], + }, + signature: + "0x2ea8caa02ce5e873a03e9cadb481b8a02e3e1dd819582437706efa11ae80c53172744a1431803e590a5fc9afd60b017e2a33b188b4ede8cf46d4beb19040c88e1c", + }, + }, + chainId: 421614, + account: "0x9f3DDD654A2bdB2650DCAFdF02392dabf7eCe0Fb", + srcChainId: 11155111, + tokenAddress: "0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773", +}; + +describe.skipIf(import.meta.env.TENDERLY_TEST !== "true")( + "estimateMultichainDepositNetworkComposeGas", + { timeout: 60_000 }, + () => { + it("should estimate the compose gas", async () => { + const input = structuredClone(MOCK_VALID_DATA); + + const parameters = getEstimateMultichainDepositNetworkComposeGasParameters(input); + const { success, raw } = await simulateCallDataWithTenderly({ + chainId: 421614, + tenderlyConfig, + provider: getProvider(undefined, 421614), + to: parameters.address, + data: encodeFunctionData(parameters), + from: parameters.account as string, + value: 0n, + blockNumber: 204541897, + gasPriceData: { + gasPrice: 0n, + }, + gasLimit: 8000000n, + comment: undefined, + stateOverride: parameters.stateOverride, + }); + + expect(success).toBe(true); + + const hasError = hasExecutionRevertedError(raw); + + expect(hasError).toBe(false); + }); + + it("should contain execution reverted error in the trace", async () => { + const input = structuredClone(MOCK_INVALID_DATA); + + const parameters = getEstimateMultichainDepositNetworkComposeGasParameters(input); + const { success, raw } = await simulateCallDataWithTenderly({ + chainId: 421614, + tenderlyConfig, + provider: getProvider(undefined, 421614), + to: parameters.address, + data: encodeFunctionData(parameters), + from: parameters.account as string, + value: 0n, + blockNumber: 204541897, + gasPriceData: { + gasPrice: 0n, + }, + gasLimit: 8000000n, + comment: undefined, + stateOverride: parameters.stateOverride, + }); + + expect(success).toBe(true); + + const hasError = hasExecutionRevertedError(raw); + + expect(hasError).toBe(true); + }); + + it("fetch failed", async () => { + const simulationId = "92d67a97-8950-488e-b64c-c9fab435b25b"; + + const json = await fetchTenderlySimulation(tenderlyConfig, simulationId); + + const hasError = hasExecutionRevertedError(json); + + expect(hasError).toBe(true); + }); + + it("fetch succeeded", async () => { + const simulationId = "14df1b38-9b31-4932-bcb9-83c9a2abbe25"; + + const json = await fetchTenderlySimulation(tenderlyConfig, simulationId); + + const hasError = hasExecutionRevertedError(json); + + expect(hasError).toBe(false); + }); + } +); + +async function fetchTenderlySimulation( + tenderlyConfig: TenderlyConfig, + simulationId: string +): Promise { + return fetch( + `https://api.tenderly.co/api/v1/account/${tenderlyConfig.accountSlug}/project/${tenderlyConfig.projectSlug}/simulations/${simulationId}`, + { + headers: { + "Content-Type": "application/json", + "X-Access-Key": tenderlyConfig.accessKey, + }, + method: "POST", + } + ).then((res) => res.json() as Promise); +} diff --git a/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.ts b/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.ts new file mode 100644 index 0000000000..4987e3f8a5 --- /dev/null +++ b/src/domain/multichain/estimateMultichainDepositNetworkComposeGas.ts @@ -0,0 +1,142 @@ +import { Address } from "abitype"; +import { EstimateContractGasParameters, PublicClient, StateOverride, toHex, zeroAddress, zeroHash } from "viem"; + +import type { ContractsChainId, SettlementChainId, SourceChainId } from "config/chains"; +import { tryGetContract } from "config/contracts"; +import { + FAKE_INPUT_AMOUNT_MAP, + getLayerZeroEndpointId, + getStargatePoolAddress, + OVERRIDE_ERC20_BYTECODE, + RANDOM_SLOT, +} from "config/multichain"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { abis } from "sdk/abis"; +import { convertTokenAddress, getToken, isValidTokenSafe } from "sdk/configs/tokens"; + +import { CodecUiHelper, MultichainAction } from "./codecs/CodecUiHelper"; +import { OFTComposeMsgCodec } from "./codecs/OFTComposeMsgCodec"; + +export type EstimateMultichainDepositNetworkComposeGasParameters = { + action?: MultichainAction; + chainId: ContractsChainId; + account: string; + srcChainId: SourceChainId; + tokenAddress: string; +}; + +export function getEstimateMultichainDepositNetworkComposeGasParameters({ + action, + chainId, + account, + srcChainId, + tokenAddress: maybeWrappedTokenAddress, +}: EstimateMultichainDepositNetworkComposeGasParameters): EstimateContractGasParameters< + typeof abis.LayerZeroProvider, + "lzCompose" +> { + const unwrappedTokenAddress = convertTokenAddress(chainId, maybeWrappedTokenAddress, "native"); + + const data = action ? CodecUiHelper.encodeMultichainActionData(action) : undefined; + const composeFromWithMsg = CodecUiHelper.composeDepositMessage(chainId as SettlementChainId, account, data); + + const settlementChainEndpointId = getLayerZeroEndpointId(chainId); + const sourceChainEndpointId = getLayerZeroEndpointId(srcChainId); + + if (!settlementChainEndpointId) { + throw new Error("Stargate endpoint ID not found"); + } + + if (!sourceChainEndpointId) { + throw new Error("Stargate endpoint ID not found"); + } + + // TODO get decimals from token config + const fakeAmount = isValidTokenSafe(chainId, unwrappedTokenAddress) + ? FAKE_INPUT_AMOUNT_MAP[getToken(chainId, unwrappedTokenAddress).symbol] ?? 10n ** 18n + : 10n ** 18n; + + const message = OFTComposeMsgCodec.encode(0n, sourceChainEndpointId, fakeAmount, composeFromWithMsg); + + const stargatePool = getStargatePoolAddress(chainId, unwrappedTokenAddress); + + if (!stargatePool) { + throw new Error(`Stargate pool not found for token: ${unwrappedTokenAddress} on chain: ${chainId}`); + } + + const address = tryGetContract(chainId, "LayerZeroProvider")!; + + if (!address) { + throw new Error("LayerZero provider not found"); + } + + const stateOverride: StateOverride = []; + + if (unwrappedTokenAddress !== zeroAddress) { + const stateOverrideForErc20: StateOverride[number] = { + address: unwrappedTokenAddress as Address, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }; + stateOverride.push(stateOverrideForErc20); + } else { + const stateOverrideForNative: StateOverride[number] = { + address, + balance: fakeAmount * 2n, + }; + stateOverride.push(stateOverrideForNative); + } + + return { + address, + abi: abis.LayerZeroProvider, + functionName: "lzCompose", + args: [ + // From + stargatePool, + // Guid + toHex(0, { size: 32 }), + // Message + message, + // Executor + zeroAddress, + // Extra Data + "0x", + ], + account: CodecUiHelper.getLzEndpoint(chainId), + stateOverride, + }; +} + +export async function estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account, + srcChainId, + tokenAddress, + settlementChainPublicClient, +}: { + action?: MultichainAction; + chainId: ContractsChainId; + account: string; + srcChainId: SourceChainId; + tokenAddress: string; + settlementChainPublicClient: PublicClient; +}): Promise { + const parameters = getEstimateMultichainDepositNetworkComposeGasParameters({ + action, + chainId, + account, + srcChainId, + tokenAddress, + }); + + const gas = await settlementChainPublicClient.estimateContractGas(parameters); + + return applyGasLimitBuffer(gas); +} diff --git a/src/domain/multichain/fetchMultichainTokenBalances.ts b/src/domain/multichain/fetchMultichainTokenBalances.ts index 022ab9786b..deb36a2d15 100644 --- a/src/domain/multichain/fetchMultichainTokenBalances.ts +++ b/src/domain/multichain/fetchMultichainTokenBalances.ts @@ -16,11 +16,13 @@ export async function fetchMultichainTokenBalances({ account, progressCallback, tokens = MULTI_CHAIN_DEPOSIT_TRADE_TOKENS[settlementChainId], + specificChainId, }: { settlementChainId: SettlementChainId; account: string; progressCallback?: (chainId: number, tokensChainData: Record) => void; tokens?: string[]; + specificChainId?: SourceChainId | undefined; }): Promise>> { const requests: Promise[] = []; @@ -31,6 +33,10 @@ export async function fetchMultichainTokenBalances({ for (const sourceChainIdString in sourceChainsTokenIdMap) { const sourceChainId = parseInt(sourceChainIdString) as SourceChainId; + if (specificChainId && sourceChainId !== specificChainId) { + continue; + } + const sourceChainTokenIdMap = tokens ? pickBy(sourceChainsTokenIdMap[sourceChainId], (value) => tokens.includes(value.settlementChainTokenAddress)) : sourceChainsTokenIdMap[sourceChainId]; diff --git a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts index 3cc1dfbf33..809df295b6 100644 --- a/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts +++ b/src/domain/multichain/useMultichainDepositNetworkComposeGas.ts @@ -1,25 +1,14 @@ import useSWR from "swr"; -import { Address, PublicClient, StateOverride, toHex, zeroAddress, zeroHash } from "viem"; import { useAccount, usePublicClient } from "wagmi"; -import { type ContractsChainId, type SettlementChainId, type SourceChainId } from "config/chains"; +import { type SourceChainId } from "config/chains"; import { tryGetContract } from "config/contracts"; -import { - CHAIN_ID_PREFERRED_DEPOSIT_TOKEN, - FAKE_INPUT_AMOUNT_MAP, - getLayerZeroEndpointId, - getStargatePoolAddress, - OVERRIDE_ERC20_BYTECODE, - RANDOM_SLOT, -} from "config/multichain"; +import { CHAIN_ID_PREFERRED_DEPOSIT_TOKEN, getStargatePoolAddress } from "config/multichain"; import { useGmxAccountDepositViewChain } from "context/GmxAccountContext/hooks"; import { useChainId } from "lib/chains"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; -import { abis } from "sdk/abis"; -import { getToken, isValidTokenSafe } from "sdk/configs/tokens"; -import { CodecUiHelper, MultichainAction } from "./codecs/CodecUiHelper"; -import { OFTComposeMsgCodec } from "./codecs/OFTComposeMsgCodec"; +import { MultichainAction } from "./codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "./estimateMultichainDepositNetworkComposeGas"; const MULTICHAIN_DEPOSIT_NETWORK_COMPOSE_GAS_REFRESH_INTERVAL = 5000; @@ -74,96 +63,3 @@ export function useMultichainDepositNetworkComposeGas(opts?: { composeGas, }; } - -export async function estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress, - settlementChainPublicClient, -}: { - action?: MultichainAction; - chainId: ContractsChainId; - account: string; - srcChainId: SourceChainId; - tokenAddress: string; - settlementChainPublicClient: PublicClient; -}): Promise { - const data = action ? CodecUiHelper.encodeMultichainActionData(action) : undefined; - const composeFromWithMsg = CodecUiHelper.composeDepositMessage(chainId as SettlementChainId, account, data); - - const settlementChainEndpointId = getLayerZeroEndpointId(chainId); - const sourceChainEndpointId = getLayerZeroEndpointId(srcChainId); - - if (!settlementChainEndpointId) { - throw new Error("Stargate endpoint ID not found"); - } - - if (!sourceChainEndpointId) { - throw new Error("Stargate endpoint ID not found"); - } - - // TODO get decimals from token config - const fakeAmount = isValidTokenSafe(chainId, tokenAddress) - ? FAKE_INPUT_AMOUNT_MAP[getToken(chainId, tokenAddress).symbol] ?? 10n ** 18n - : 10n ** 18n; - - const message = OFTComposeMsgCodec.encode(0n, sourceChainEndpointId, fakeAmount, composeFromWithMsg); - - const stargatePool = getStargatePoolAddress(chainId, tokenAddress); - - if (!stargatePool) { - throw new Error("Stargate pool not found"); - } - - const address = tryGetContract(chainId, "LayerZeroProvider")!; - - if (!address) { - throw new Error("LayerZero provider not found"); - } - - const stateOverride: StateOverride = []; - - if (tokenAddress !== zeroAddress) { - const stateOverrideForErc20: StateOverride[number] = { - address: tokenAddress as Address, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }; - stateOverride.push(stateOverrideForErc20); - } else { - const stateOverrideForNative: StateOverride[number] = { - address, - balance: fakeAmount * 2n, - }; - stateOverride.push(stateOverrideForNative); - } - - const gas = await settlementChainPublicClient.estimateContractGas({ - address, - abi: abis.LayerZeroProvider, - functionName: "lzCompose", - args: [ - // From - stargatePool, - // Guid - toHex(0, { size: 32 }), - // Message - message, - // Executor - zeroAddress, - // Extra Data - "0x", - ], - account: CodecUiHelper.getLzEndpoint(chainId), - stateOverride, - }); - - return applyGasLimitBuffer(gas); -} diff --git a/src/domain/multichain/useMultichainQuoteFeeUsd.ts b/src/domain/multichain/useMultichainQuoteFeeUsd.ts index 0b192c8575..e4ac2d7477 100644 --- a/src/domain/multichain/useMultichainQuoteFeeUsd.ts +++ b/src/domain/multichain/useMultichainQuoteFeeUsd.ts @@ -1,39 +1,26 @@ +import { useEffect, useState } from "react"; import { zeroAddress } from "viem"; -import { AnyChainId, type SettlementChainId, type SourceChainId } from "config/chains"; +import { AnyChainId, getViemChain, type SettlementChainId, type SourceChainId } from "config/chains"; import { getMappedTokenId } from "config/multichain"; -import { useTokenRecentPricesRequest } from "domain/synthetics/tokens"; +import { getMidPrice, useTokenRecentPricesRequest } from "domain/synthetics/tokens"; import { convertToUsd } from "domain/tokens"; import { useChainId } from "lib/chains"; -import { getToken } from "sdk/configs/tokens"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; import { NATIVE_TOKEN_PRICE_MAP } from "./nativeTokenPriceMap"; -import type { QuoteOft, MessagingFee } from "./types"; +import type { MessagingFee, QuoteOft } from "./types"; -export function useMultichainQuoteFeeUsd({ - quoteSend, - quoteOft, - unwrappedTokenAddress, +export function useNativeTokenMultichainUsd({ sourceChainId, + sourceChainTokenAmount, targetChainId, }: { - quoteSend: MessagingFee | undefined; - quoteOft: QuoteOft | undefined; - unwrappedTokenAddress: string | undefined; sourceChainId: AnyChainId | undefined; + sourceChainTokenAmount: bigint | undefined; targetChainId: AnyChainId | undefined; -}): { - networkFee: bigint | undefined; - networkFeeUsd: bigint | undefined; - protocolFeeAmount: bigint | undefined; - protocolFeeUsd: bigint | undefined; - amountReceivedLD: bigint | undefined; -} { +}): bigint | undefined { const { chainId } = useChainId(); - const { pricesData: settlementChainTokenPricesData } = useTokenRecentPricesRequest(chainId); - - const nativeFee = quoteSend?.nativeFee as bigint; - const amountReceivedLD = quoteOft?.receipt.amountReceivedLD as bigint; let sourceNativeTokenPriceChain = chainId; let sourceNativeTokenAddress = zeroAddress; @@ -61,10 +48,90 @@ export function useMultichainQuoteFeeUsd({ const { pricesData: priceChainTokenPricesData } = useTokenRecentPricesRequest(sourceNativeTokenPriceChain); if ( - !unwrappedTokenAddress || + sourceChainTokenAmount === undefined || sourceChainId === undefined || targetChainId === undefined || + chainId === undefined || !hasSourceNativeTokenPrice + ) { + return undefined; + } + + const nativeFeeUsd = + sourceChainTokenAmount !== undefined && priceChainTokenPricesData?.[sourceNativeTokenAddress] !== undefined + ? convertToUsd( + sourceChainTokenAmount as bigint, + getViemChain(sourceChainId).nativeCurrency.decimals, + getMidPrice(priceChainTokenPricesData[sourceNativeTokenAddress]) + ) + : undefined; + + return nativeFeeUsd; +} +export function useGasMultichainUsd({ + sourceChainId, + sourceChainGas, + targetChainId, +}: { + sourceChainId: AnyChainId | undefined; + sourceChainGas: bigint | undefined; + targetChainId: AnyChainId | undefined; +}): bigint | undefined { + const [nativeWeiAmount, setNativeWeiAmount] = useState(undefined); + + useEffect(() => { + if (!sourceChainId || sourceChainGas === undefined) { + return; + } + + getPublicClientWithRpc(sourceChainId) + .getGasPrice() + .then((price) => setNativeWeiAmount(sourceChainGas * price)); + }, [sourceChainGas, sourceChainId]); + + return useNativeTokenMultichainUsd({ + sourceChainId, + sourceChainTokenAmount: nativeWeiAmount, + targetChainId, + }); +} + +export function useMultichainQuoteFeeUsd({ + quoteSend, + quoteOft, + unwrappedTokenAddress, + sourceChainId, + targetChainId, +}: { + quoteSend: MessagingFee | undefined; + quoteOft: QuoteOft | undefined; + unwrappedTokenAddress: string | undefined; + sourceChainId: AnyChainId | undefined; + targetChainId: AnyChainId | undefined; +}): { + networkFee: bigint | undefined; + networkFeeUsd: bigint | undefined; + protocolFeeAmount: bigint | undefined; + protocolFeeUsd: bigint | undefined; + amountReceivedLD: bigint | undefined; +} { + const { chainId } = useChainId(); + const { pricesData: settlementChainTokenPricesData } = useTokenRecentPricesRequest(chainId); + + const nativeFee = quoteSend?.nativeFee as bigint; + const amountReceivedLD = quoteOft?.receipt.amountReceivedLD as bigint; + + const nativeFeeUsd = useNativeTokenMultichainUsd({ + sourceChainId, + sourceChainTokenAmount: nativeFee, + targetChainId, + }); + + if ( + !unwrappedTokenAddress || + sourceChainId === undefined || + targetChainId === undefined || + nativeFeeUsd === undefined ) { return { networkFee: undefined, @@ -81,28 +148,10 @@ export function useMultichainQuoteFeeUsd({ sourceChainId as SourceChainId ); - if (!sourceChainTokenId) { - return { - networkFee: undefined, - networkFeeUsd: undefined, - protocolFeeAmount: undefined, - protocolFeeUsd: undefined, - amountReceivedLD: undefined, - }; - } - - const sourceChainNativeTokenPrices = priceChainTokenPricesData?.[sourceNativeTokenAddress]; - const transferTokenPrices = settlementChainTokenPricesData?.[unwrappedTokenAddress]; - const sourceChainNativeTokenDecimals = getToken(chainId, zeroAddress)?.decimals ?? 18; const sourceChainDepositTokenDecimals = sourceChainTokenId?.decimals; - const nativeFeeUsd = - nativeFee !== undefined - ? convertToUsd(nativeFee as bigint, sourceChainNativeTokenDecimals, sourceChainNativeTokenPrices?.maxPrice) - : undefined; - let protocolFeeAmount: bigint | undefined = undefined; let protocolFeeUsd: bigint | undefined = undefined; if (quoteOft !== undefined) { diff --git a/src/domain/synthetics/express/expressOrderUtils.ts b/src/domain/synthetics/express/expressOrderUtils.ts index 449bc83d56..b4afe9aa06 100644 --- a/src/domain/synthetics/express/expressOrderUtils.ts +++ b/src/domain/synthetics/express/expressOrderUtils.ts @@ -214,7 +214,6 @@ export async function estimateExpressParams({ gasPrice, isSponsoredCall, bufferBps, - marketsInfoData, gasPaymentAllowanceData, } = globalExpressParams; @@ -277,7 +276,6 @@ export async function estimateExpressParams({ feeParams: baseRelayFeeParams.feeParams, externalCalls: baseRelayFeeParams.externalCalls, tokenPermits, - marketsInfoData, }); const baseTxn = await expressTransactionBuilder({ @@ -379,7 +377,6 @@ export async function estimateExpressParams({ feeParams: finalRelayFeeParams.feeParams, externalCalls: finalRelayFeeParams.externalCalls, tokenPermits, - marketsInfoData, }); const gasPaymentValidations = getGasPaymentValidations({ diff --git a/src/domain/synthetics/express/oracleParamsUtils.ts b/src/domain/synthetics/express/oracleParamsUtils.ts index de03b49c30..1a4ec3dfdd 100644 --- a/src/domain/synthetics/express/oracleParamsUtils.ts +++ b/src/domain/synthetics/express/oracleParamsUtils.ts @@ -2,10 +2,9 @@ import uniq from "lodash/uniq"; import { ContractsChainId } from "config/chains"; import { getContract } from "config/contracts"; -import { MarketsInfoData } from "domain/synthetics/markets/types"; +import { MARKETS } from "sdk/configs/markets"; import { convertTokenAddress } from "sdk/configs/tokens"; -import { getOppositeCollateral } from "sdk/utils/markets"; -import { getByKey } from "sdk/utils/objects"; +import { getOppositeCollateralFromConfig } from "sdk/utils/markets"; import { ExternalCallsPayload } from "sdk/utils/orderTransactions"; export function getOracleParams({ chainId, tokenAddresses }: { chainId: ContractsChainId; tokenAddresses: string[] }) { @@ -27,14 +26,14 @@ export function getOracleParamsForRelayParams({ relayerFeeTokenAddress, feeSwapPath, externalCalls, - marketsInfoData, + // marketsInfoData, }: { chainId: ContractsChainId; gasPaymentTokenAddress: string; relayerFeeTokenAddress: string; feeSwapPath: string[]; externalCalls: ExternalCallsPayload | undefined; - marketsInfoData: MarketsInfoData; + // marketsInfoData: MarketsInfoData; }) { const tokenAddresses = [gasPaymentTokenAddress, relayerFeeTokenAddress]; @@ -45,7 +44,8 @@ export function getOracleParamsForRelayParams({ if (feeSwapPath.length) { tokenAddresses.push( ...getSwapPathOracleTokens({ - marketsInfoData, + chainId, + // marketsInfoData, initialCollateralAddress: gasPaymentTokenAddress, swapPath: feeSwapPath, }) @@ -56,11 +56,14 @@ export function getOracleParamsForRelayParams({ } export function getSwapPathOracleTokens({ - marketsInfoData, + chainId, + // marketsInfoData, initialCollateralAddress, swapPath, }: { - marketsInfoData: MarketsInfoData; + chainId: ContractsChainId; + // TODO MLTCH: why is it a heavy MarketsInfoData when it could be static MarketConfig + // marketsInfoData: MarketsInfoData; initialCollateralAddress: string; swapPath: string[]; }): string[] { @@ -68,20 +71,22 @@ export function getSwapPathOracleTokens({ const tokenAddresses: string[] = [initialCollateralAddress]; for (const marketAddress of swapPath) { - const marketInfo = getByKey(marketsInfoData, marketAddress); + // const marketInfo = getByKey(marketsInfoData, marketAddress); + const marketConfig = MARKETS[chainId]?.[marketAddress]; - if (!marketInfo) { + if (!marketConfig) { throw new Error(`Market not found for oracle params: ${marketAddress}`); } - const tokenOut = getOppositeCollateral(marketInfo, currentToken); + // const tokenOut = getOppositeCollateral(marketInfo, currentToken); + const tokenOut = getOppositeCollateralFromConfig(marketConfig, currentToken); - if (!tokenOut?.address) { - throw new Error(`Token not found for oracle params: ${initialCollateralAddress}`); - } + // if (!tokenOut?.address) { + // throw new Error(`Token not found for oracle params: ${initialCollateralAddress}`); + // } - currentToken = tokenOut.address; - tokenAddresses.push(currentToken, marketInfo.indexToken.address); + currentToken = tokenOut; + tokenAddresses.push(currentToken, marketConfig.indexTokenAddress); } return tokenAddresses; diff --git a/src/domain/synthetics/express/relayParamsUtils.ts b/src/domain/synthetics/express/relayParamsUtils.ts index 924e611752..80f528d845 100644 --- a/src/domain/synthetics/express/relayParamsUtils.ts +++ b/src/domain/synthetics/express/relayParamsUtils.ts @@ -6,7 +6,6 @@ import type { SignedTokenPermit, TokenData } from "domain/tokens"; import type { SignatureDomain } from "lib/wallets/signing"; import { abis } from "sdk/abis"; import { ContractName, getContract } from "sdk/configs/contracts"; -import { MarketsInfoData } from "sdk/types/markets"; import { ExternalSwapQuote, FindSwapPath, SwapAmounts } from "sdk/types/trade"; import { combineExternalCalls, @@ -107,7 +106,14 @@ export function getRelayerFeeParams({ * it should also be included in relayParams */ transactionExternalCalls: ExternalCallsPayload | undefined; -}) { +}): + | { + feeParams: RelayFeePayload; + externalCalls: ExternalCallsPayload; + feeExternalSwapGasLimit: bigint; + gasPaymentParams: GasPaymentParams; + } + | undefined { const gasPaymentParams: GasPaymentParams = { gasPaymentToken: gasPaymentToken, relayFeeToken: relayerFeeToken, @@ -198,7 +204,7 @@ export function getRawRelayerParams({ feeParams, externalCalls, tokenPermits, - marketsInfoData, + // marketsInfoData, }: { chainId: ContractsChainId; gasPaymentTokenAddress: string; @@ -206,7 +212,7 @@ export function getRawRelayerParams({ feeParams: RelayFeePayload; externalCalls: ExternalCallsPayload; tokenPermits: SignedTokenPermit[]; - marketsInfoData: MarketsInfoData; + // marketsInfoData: MarketsInfoData; }): RawRelayParamsPayload { const oracleParams = getOracleParamsForRelayParams({ chainId, @@ -214,7 +220,7 @@ export function getRawRelayerParams({ feeSwapPath: feeParams.feeSwapPath, gasPaymentTokenAddress, relayerFeeTokenAddress, - marketsInfoData, + // marketsInfoData, }); const relayParamsPayload: RawRelayParamsPayload = { diff --git a/src/domain/synthetics/markets/createBridgeInTxn.ts b/src/domain/synthetics/markets/createBridgeInTxn.ts index 24c78d2f7f..0bf4d09917 100644 --- a/src/domain/synthetics/markets/createBridgeInTxn.ts +++ b/src/domain/synthetics/markets/createBridgeInTxn.ts @@ -1,17 +1,16 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; import { Contract } from "ethers"; import { encodeFunctionData, Hex, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; import { GlobalExpressParams } from "domain/synthetics/express"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; import { IStargate, IStargate__factory } from "typechain-types-stargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; @@ -37,7 +36,7 @@ export async function createBridgeInTxn({ account, srcChainId, tokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, + settlementChainPublicClient: getPublicClientWithRpc(chainId), }); const sendParams: SendParam = getMultichainTransferSendParams({ diff --git a/src/domain/synthetics/markets/createDepositTxn.ts b/src/domain/synthetics/markets/createDepositTxn.ts index de7026affb..2ecc5d4640 100644 --- a/src/domain/synthetics/markets/createDepositTxn.ts +++ b/src/domain/synthetics/markets/createDepositTxn.ts @@ -15,23 +15,7 @@ import { validateSignerAddress } from "components/Errors/errorToasts"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; import type { TokensData } from "../tokens"; -import type { CreateDepositParamsStruct } from "./types"; - -export type CreateDepositParams = { - chainId: ContractsChainId; - signer: Signer; - longTokenAmount: bigint; - shortTokenAmount: bigint; - executionFee: bigint; - executionGasLimit: bigint; - tokensData: TokensData; - skipSimulation?: boolean; - metricId?: OrderMetricId; - blockTimestampData: BlockTimestampData | undefined; - setPendingTxns: (txns: any) => void; - setPendingDeposit: SetPendingDeposit; - params: CreateDepositParamsStruct; -}; +import type { CreateDepositParams } from "./types"; export async function createDepositTxn({ chainId, @@ -47,7 +31,21 @@ export async function createDepositTxn({ blockTimestampData, setPendingTxns, setPendingDeposit, -}: CreateDepositParams) { +}: { + chainId: ContractsChainId; + signer: Signer; + longTokenAmount: bigint; + shortTokenAmount: bigint; + executionFee: bigint; + executionGasLimit: bigint; + tokensData: TokensData; + skipSimulation?: boolean; + metricId?: OrderMetricId; + blockTimestampData: BlockTimestampData | undefined; + setPendingTxns: (txns: any) => void; + setPendingDeposit: SetPendingDeposit; + params: CreateDepositParams; +}) { const contract = new Contract(getContract(chainId, "ExchangeRouter"), abis.ExchangeRouter, signer); const depositVaultAddress = getContract(chainId, "DepositVault"); diff --git a/src/domain/synthetics/markets/createGlvDepositTxn.ts b/src/domain/synthetics/markets/createGlvDepositTxn.ts index 618b068eb9..91dedda10c 100644 --- a/src/domain/synthetics/markets/createGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createGlvDepositTxn.ts @@ -15,26 +15,7 @@ import { validateSignerAddress } from "components/Errors/errorToasts"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; import type { TokensData } from "../tokens"; -import type { CreateGlvDepositParamsStruct } from "./types"; - -interface CreateGlvDepositParams { - chainId: ContractsChainId; - signer: Signer; - longTokenAddress: string; - shortTokenAddress: string; - longTokenAmount: bigint; - shortTokenAmount: bigint; - executionFee: bigint; - executionGasLimit: bigint; - tokensData: TokensData; - skipSimulation?: boolean; - metricId?: OrderMetricId; - blockTimestampData: BlockTimestampData | undefined; - setPendingTxns: (txns: any) => void; - setPendingDeposit: SetPendingDeposit; - params: CreateGlvDepositParamsStruct; - marketTokenAmount: bigint; -} +import type { CreateGlvDepositParams } from "./types"; export async function createGlvDepositTxn({ chainId, @@ -53,7 +34,24 @@ export async function createGlvDepositTxn({ blockTimestampData, setPendingTxns, setPendingDeposit, -}: CreateGlvDepositParams) { +}: { + chainId: ContractsChainId; + signer: Signer; + longTokenAddress: string; + shortTokenAddress: string; + longTokenAmount: bigint; + shortTokenAmount: bigint; + executionFee: bigint; + executionGasLimit: bigint; + tokensData: TokensData; + skipSimulation?: boolean; + metricId?: OrderMetricId; + blockTimestampData: BlockTimestampData | undefined; + setPendingTxns: (txns: any) => void; + setPendingDeposit: SetPendingDeposit; + params: CreateGlvDepositParams; + marketTokenAmount: bigint; +}) { const contract = new ethers.Contract(getContract(chainId, "GlvRouter"), abis.GlvRouter, signer); const depositVaultAddress = getContract(chainId, "GlvVault"); diff --git a/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts index 48b3641464..f276044f02 100644 --- a/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createGlvWithdrawalTxn.ts @@ -18,9 +18,21 @@ import { SwapPricingType } from "../orders"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; import type { TokensData } from "../tokens"; -import type { CreateGlvWithdrawalParamsStruct } from "./types"; +import type { CreateGlvWithdrawalParams } from "./types"; -type CreateGlvWithdrawalParams = { +export async function createGlvWithdrawalTxn({ + chainId, + signer, + executionGasLimit, + skipSimulation, + tokensData, + metricId, + blockTimestampData, + params, + glvTokenAmount, + setPendingTxns, + setPendingWithdrawal, +}: { chainId: ContractsChainId; signer: WalletSigner; executionGasLimit: bigint; @@ -28,19 +40,17 @@ type CreateGlvWithdrawalParams = { tokensData: TokensData; metricId?: OrderMetricId; blockTimestampData: BlockTimestampData | undefined; - params: CreateGlvWithdrawalParamsStruct; + params: CreateGlvWithdrawalParams; glvTokenAmount: bigint; setPendingTxns: (txns: any) => void; setPendingWithdrawal: SetPendingWithdrawal; -}; +}) { + const contract = new ethers.Contract(getContract(chainId, "GlvRouter"), abis.GlvRouter, signer); + const withdrawalVaultAddress = getContract(chainId, "GlvVault"); -export async function createGlvWithdrawalTxn(p: CreateGlvWithdrawalParams) { - const contract = new ethers.Contract(getContract(p.chainId, "GlvRouter"), abis.GlvRouter, p.signer); - const withdrawalVaultAddress = getContract(p.chainId, "GlvVault"); + const wntAmount = params.executionFee; - const wntAmount = p.params.executionFee; - - await validateSignerAddress(p.signer, p.params.addresses.receiver); + await validateSignerAddress(signer, params.addresses.receiver); // TODO MLTCH: do not forget to apply slippage elsewhere // const minLongTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.minLongTokenAmount); @@ -48,24 +58,24 @@ export async function createGlvWithdrawalTxn(p: CreateGlvWithdrawalParams) { const multicall = [ { method: "sendWnt", params: [withdrawalVaultAddress, wntAmount] }, - { method: "sendTokens", params: [p.params.addresses.glv, withdrawalVaultAddress, p.glvTokenAmount] }, + { method: "sendTokens", params: [params.addresses.glv, withdrawalVaultAddress, glvTokenAmount] }, { method: "createGlvWithdrawal", params: [ { addresses: { - receiver: p.params.addresses.receiver, + receiver: params.addresses.receiver, callbackContract: ethers.ZeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, - market: p.params.addresses.market, - glv: p.params.addresses.glv, - longTokenSwapPath: p.params.addresses.longTokenSwapPath, - shortTokenSwapPath: p.params.addresses.shortTokenSwapPath, + market: params.addresses.market, + glv: params.addresses.glv, + longTokenSwapPath: params.addresses.longTokenSwapPath, + shortTokenSwapPath: params.addresses.shortTokenSwapPath, }, - minLongTokenAmount: p.params.minLongTokenAmount, - minShortTokenAmount: p.params.minShortTokenAmount, - shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, - executionFee: p.params.executionFee, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, callbackGasLimit: 0n, dataList: [], } satisfies IGlvWithdrawalUtils.CreateGlvWithdrawalParamsStruct, @@ -77,51 +87,51 @@ export async function createGlvWithdrawalTxn(p: CreateGlvWithdrawalParams) { .filter(Boolean) .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); - const simulationPromise = !p.skipSimulation - ? simulateExecuteTxn(p.chainId, { - account: p.params.addresses.receiver, + const simulationPromise = !skipSimulation + ? simulateExecuteTxn(chainId, { + account: params.addresses.receiver, primaryPriceOverrides: {}, - tokensData: p.tokensData, + tokensData: tokensData, createMulticallPayload: encodedPayload, method: "simulateExecuteLatestGlvWithdrawal", errorTitle: t`Withdrawal error.`, value: wntAmount, swapPricingType: SwapPricingType.TwoStep, - metricId: p.metricId, - blockTimestampData: p.blockTimestampData, + metricId: metricId, + blockTimestampData: blockTimestampData, }) : undefined; const { gasLimit, gasPriceData } = await prepareOrderTxn( - p.chainId, + chainId, contract, "multicall", [encodedPayload], wntAmount, simulationPromise, - p.metricId + metricId ); - return callContract(p.chainId, contract, "multicall", [encodedPayload], { + return callContract(chainId, contract, "multicall", [encodedPayload], { value: wntAmount, hideSentMsg: true, hideSuccessMsg: true, - metricId: p.metricId, + metricId: metricId, gasLimit, gasPriceData, - setPendingTxns: p.setPendingTxns, + setPendingTxns: setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.params.executionFee, - estimatedExecutionGasLimit: p.executionGasLimit, + estimatedExecutionFee: params.executionFee, + estimatedExecutionGasLimit: executionGasLimit, }, }).then(() => { - p.setPendingWithdrawal({ - account: p.params.addresses.receiver, - marketAddress: p.params.addresses.glv, - marketTokenAmount: p.glvTokenAmount, - minLongTokenAmount: p.params.minLongTokenAmount, - minShortTokenAmount: p.params.minShortTokenAmount, - shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, + setPendingWithdrawal({ + account: params.addresses.receiver, + marketAddress: params.addresses.glv, + marketTokenAmount: glvTokenAmount, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, }); }); } diff --git a/src/domain/synthetics/markets/createMultichainDepositTxn.ts b/src/domain/synthetics/markets/createMultichainDepositTxn.ts index 8353870412..d90dc422c8 100644 --- a/src/domain/synthetics/markets/createMultichainDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainDepositTxn.ts @@ -10,7 +10,7 @@ import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { CreateDepositParamsStruct } from "."; +import { CreateDepositParams } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateDeposit } from "./signCreateDeposit"; @@ -22,7 +22,7 @@ type TxnParams = { emptySignature?: boolean; account: string; transferRequests: TransferRequests; - params: CreateDepositParamsStruct; + params: CreateDepositParams; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; }; @@ -91,7 +91,7 @@ export function createMultichainDepositTxn({ transferRequests: TransferRequests; // TODO MLTCH: make it just ExpressTxnParams asyncExpressTxnResult: AsyncResult; - params: CreateDepositParamsStruct; + params: CreateDepositParams; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts index 9388e91aec..e6b9fe2db1 100644 --- a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -9,7 +9,7 @@ import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { CreateGlvDepositParamsStruct } from "."; +import { CreateGlvDepositParams } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateGlvDeposit } from "./signCreateGlvDeposit"; @@ -21,7 +21,7 @@ export type CreateMultichainGlvDepositParams = { emptySignature?: boolean; account: string; transferRequests: TransferRequests; - params: CreateGlvDepositParamsStruct; + params: CreateGlvDepositParams; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; }; @@ -89,7 +89,7 @@ export function createMultichainGlvDepositTxn({ signer: WalletSigner; transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; - params: CreateGlvDepositParamsStruct; + params: CreateGlvDepositParams; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, diff --git a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts index 357e3ef065..41a962f7d0 100644 --- a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts @@ -11,7 +11,7 @@ import { nowInSeconds } from "sdk/utils/time"; import type { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateGlvWithdrawal } from "./signCreateGlvWithdrawal"; -import type { CreateGlvWithdrawalParamsStruct } from "./types"; +import type { CreateGlvWithdrawalParams } from "./types"; type TxnParams = { chainId: ContractsChainId; @@ -21,7 +21,7 @@ type TxnParams = { emptySignature?: boolean; account: string; transferRequests: TransferRequests; - params: CreateGlvWithdrawalParamsStruct; + params: CreateGlvWithdrawalParams; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; }; @@ -89,7 +89,7 @@ export async function createMultichainGlvWithdrawalTxn({ signer: WalletSigner; transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; - params: CreateGlvWithdrawalParamsStruct; + params: CreateGlvWithdrawalParams; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, diff --git a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts index df222bb9a8..4ba4e5d4e8 100644 --- a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts @@ -9,7 +9,7 @@ import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import { CreateWithdrawalParamsStruct } from "."; +import { CreateWithdrawalParams } from "."; import { ExpressTxnParams, RelayParamsPayload } from "../express"; import { signCreateWithdrawal } from "./signCreateWithdrawal"; @@ -21,7 +21,7 @@ type TxnParams = { emptySignature?: boolean; account: string; transferRequests: TransferRequests; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; relayerFeeTokenAddress: string; relayerFeeAmount: bigint; }; @@ -89,7 +89,7 @@ export async function createMultichainWithdrawalTxn({ signer: WalletSigner; transferRequests: TransferRequests; expressTxnParams: ExpressTxnParams; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; // TODO MLTCH: support pending txns // setPendingTxns, // setPendingDeposit, diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index 76e2c7e4cd..572517fd7b 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -1,6 +1,4 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; -import { Contract } from "ethers"; import { encodeFunctionData, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; @@ -8,65 +6,62 @@ import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam, TransferRequests } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; -import { CreateDepositParamsStruct } from "domain/synthetics/markets"; +import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { CreateDepositParams, RawCreateDepositParams } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; -import { nowInSeconds } from "sdk/utils/time"; -import { IStargate } from "typechain-types-stargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; +import { + estimateSourceChainDepositFees, + sendQuoteFromNative, + SourceChainDepositFees, +} from "./feeEstimation/estimateSourceChainDepositFees"; import { signCreateDeposit } from "./signCreateDeposit"; export async function createSourceChainDepositTxn({ chainId, - globalExpressParams, srcChainId, signer, transferRequests, params, - account, tokenAddress, tokenAmount, - // executionFee, + globalExpressParams, + fees, }: { chainId: SettlementChainId; - globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; transferRequests: TransferRequests; - params: CreateDepositParamsStruct; - account: string; + params: RawCreateDepositParams; tokenAddress: string; tokenAmount: bigint; - executionFee: bigint; -}) { - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - feeParams: { - // feeToken: globalExpressParams!.relayerFeeTokenAddress, - feeToken: tokenAddress, - // TODO MLTCH this is going through the keeper to execute a depost - // so there 100% should be a fee - feeAmount: 2n * 10n ** 6n, - feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], - }, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }); - - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; +} & ( + | { + fees: SourceChainDepositFees; + globalExpressParams?: undefined; + } + | { + fees?: undefined; + globalExpressParams: GlobalExpressParams; + } +)) { + const ensuredFees = fees + ? fees + : await estimateSourceChainDepositFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, + }); + + const adjusterParams: CreateDepositParams = { ...params, executionFee: ensuredFees.executionFee }; + + const relayParams: RelayParamsPayload = ensuredFees.relayParamsPayload; const signature = await signCreateDeposit({ chainId, @@ -74,7 +69,7 @@ export async function createSourceChainDepositTxn({ signer, relayParams, transferRequests, - params, + params: adjusterParams, }); const action: MultichainAction = { @@ -82,26 +77,17 @@ export async function createSourceChainDepositTxn({ actionData: { relayParams: relayParams, transferRequests, - params, + params: adjusterParams, signature, }, }; - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, - account, + account: params.addresses.receiver, srcChainId, amountLD: tokenAmount, - composeGas: composeGas, + composeGas: ensuredFees.txnEstimatedComposeGas, isToGmx: true, action, }); @@ -112,21 +98,27 @@ export async function createSourceChainDepositTxn({ throw new Error("Token ID not found"); } - const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; - - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - - const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount : 0n); + let value = ensuredFees.txnEstimatedNativeFee; + if (tokenAddress === zeroAddress) { + value += tokenAmount; + } try { const txnResult = await sendWalletTransaction({ chainId: srcChainId!, to: sourceChainTokenId.stargate, signer, + gasLimit: ensuredFees.txnEstimatedGasLimit, + gasPriceData: + globalExpressParams?.gasPrice !== undefined + ? { + gasPrice: globalExpressParams.gasPrice, + } + : undefined, callData: encodeFunctionData({ abi: IStargateAbi, functionName: "sendToken", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + args: [sendParams, sendQuoteFromNative(ensuredFees.txnEstimatedNativeFee), params.addresses.receiver], }), value, msg: t`Sent deposit transaction`, diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts index 199337cd2e..46ba316fff 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -1,6 +1,4 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; -import { Contract } from "ethers"; import { encodeFunctionData, zeroAddress } from "viem"; import type { SettlementChainId, SourceChainId } from "config/chains"; @@ -8,99 +6,90 @@ import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam, TransferRequests } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { - getRawRelayerParams, - GlobalExpressParams, - RelayFeePayload, - RelayParamsPayload, -} from "domain/synthetics/express"; -import type { CreateGlvDepositParamsStruct } from "domain/synthetics/markets"; +import { GlobalExpressParams } from "domain/synthetics/express"; +import type { CreateGlvDepositParams, RawCreateGlvDepositParams } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import type { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; -import { nowInSeconds } from "sdk/utils/time"; -import type { IStargate } from "typechain-types-stargate"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; +import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; +import { + estimateSourceChainGlvDepositFees, + SourceChainGlvDepositFees, +} from "./feeEstimation/estimateSourceChainGlvDepositFees"; import { signCreateGlvDeposit } from "./signCreateGlvDeposit"; export async function createSourceChainGlvDepositTxn({ chainId, - globalExpressParams, srcChainId, signer, transferRequests, params, - account, tokenAddress, tokenAmount, - // executionFee, - relayFeePayload, + glvMarketCount, + globalExpressParams, + fees, }: { chainId: SettlementChainId; - globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; transferRequests: TransferRequests; - params: CreateGlvDepositParamsStruct; - account: string; + params: RawCreateGlvDepositParams; tokenAddress: string; tokenAmount: bigint; - relayFeePayload: RelayFeePayload; -}) { - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - feeParams: relayFeePayload, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }); - - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; +} & ( + | { + fees: SourceChainGlvDepositFees; + glvMarketCount?: undefined; + globalExpressParams?: undefined; + } + | { + fees?: undefined; + glvMarketCount: bigint; + globalExpressParams: GlobalExpressParams; + } +)) { + const ensuredFees = fees + ? fees + : await estimateSourceChainGlvDepositFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, + glvMarketCount, + }); + + const adjusterParams: CreateGlvDepositParams = { ...params, executionFee: ensuredFees.executionFee }; const signature = await signCreateGlvDeposit({ chainId, srcChainId, signer, - relayParams, + relayParams: ensuredFees.relayParamsPayload, transferRequests, - params, + params: adjusterParams, }); const action: MultichainAction = { actionType: MultichainActionType.GlvDeposit, actionData: { - relayParams, + relayParams: ensuredFees.relayParamsPayload, transferRequests, - params, + params: adjusterParams, signature, }, }; - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: chainId, - account, + account: params.addresses.receiver, srcChainId, - amountLD: tokenAmount + relayFeePayload.feeAmount, - composeGas: composeGas, + amountLD: tokenAmount, + composeGas: ensuredFees.txnEstimatedComposeGas, isToGmx: true, action, }); @@ -111,11 +100,10 @@ export async function createSourceChainGlvDepositTxn({ throw new Error("Token ID not found"); } - const iStargateInstance = new Contract(sourceChainTokenId.stargate, IStargateAbi, signer) as unknown as IStargate; - - const quoteSend = await iStargateInstance.quoteSend(sendParams, false); - - const value = quoteSend.nativeFee + (tokenAddress === zeroAddress ? tokenAmount + relayFeePayload.feeAmount : 0n); + let value = ensuredFees.txnEstimatedNativeFee; + if (tokenAddress === zeroAddress) { + value += tokenAmount; + } try { const txnResult = await sendWalletTransaction({ @@ -125,7 +113,7 @@ export async function createSourceChainGlvDepositTxn({ callData: encodeFunctionData({ abi: IStargateAbi, functionName: "sendToken", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + args: [sendParams, sendQuoteFromNative(ensuredFees.txnEstimatedNativeFee), params.addresses.receiver], }), value, msg: t`Sent deposit transaction`, diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts index cfdcdcee9d..5be0e14f53 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -1,72 +1,81 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; -import { encodeFunctionData, zeroAddress } from "viem"; +import { encodeFunctionData } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam, TransferRequests } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; -import { CreateGlvWithdrawalParamsStruct } from "domain/synthetics/markets"; +import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { CreateGlvWithdrawalParams, RawCreateGlvWithdrawalParams } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; +import { ISigner } from "lib/transactions/iSigner"; import { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import { abis } from "sdk/abis"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { getTokenBySymbol } from "sdk/configs/tokens"; -import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; -import { nowInSeconds } from "sdk/utils/time"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; +import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; +import { + estimateSourceChainGlvWithdrawalFees, + SourceChainGlvWithdrawalFees, +} from "./feeEstimation/estimateSourceChainGlvWithdrawalFees"; import { signCreateGlvWithdrawal } from "./signCreateGlvWithdrawal"; export async function createSourceChainGlvWithdrawalTxn({ chainId, - globalExpressParams, srcChainId, signer, transferRequests, params, - tokenAmount, + globalExpressParams, + marketsCount, + outputLongTokenAddress, + outputShortTokenAddress, + fees, }: { chainId: SettlementChainId; - globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; - signer: WalletSigner; + signer: WalletSigner | ISigner; transferRequests: TransferRequests; - params: CreateGlvWithdrawalParamsStruct; + params: RawCreateGlvWithdrawalParams; tokenAmount: bigint; - // additionalFee: bigint; -}) { +} & ( + | { + fees: SourceChainGlvWithdrawalFees; + outputLongTokenAddress?: undefined; + outputShortTokenAddress?: undefined; + globalExpressParams?: undefined; + marketsCount?: undefined; + } + | { + fees?: undefined; + outputLongTokenAddress: string; + outputShortTokenAddress: string; + globalExpressParams: GlobalExpressParams; + marketsCount: bigint; + } +)) { const account = params.addresses.receiver; const glvTokenAddress = params.addresses.glv; - // params.executionFee - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - feeParams: { - feeToken: getTokenBySymbol(chainId, "WETH").address, - // TODO MLTCH this is going through the keeper to execute a depost - // so there 100% should be a fee - // feeAmount: 10n * 10n ** 6n, - feeAmount: 1117894200000000n * 2n, // params.executionFee, - // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], - feeSwapPath: [], - }, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }); - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; + const ensuredFees = fees + ? fees + : await estimateSourceChainGlvWithdrawalFees({ + chainId, + srcChainId, + params, + tokenAmount, + globalExpressParams, + marketsCount, + tokenAddress: glvTokenAddress, + outputLongTokenAddress, + outputShortTokenAddress, + }); + + const adjusterParams: CreateGlvWithdrawalParams = { ...params, executionFee: ensuredFees.executionFee }; + const relayParams: RelayParamsPayload = ensuredFees.relayParamsPayload; const signature = await signCreateGlvWithdrawal({ chainId, @@ -74,7 +83,7 @@ export async function createSourceChainGlvWithdrawalTxn({ signer, relayParams, transferRequests, - params, + params: adjusterParams, }); const action: MultichainAction = { @@ -82,20 +91,11 @@ export async function createSourceChainGlvWithdrawalTxn({ actionData: { relayParams, transferRequests, - params, + params: adjusterParams, signature, }, }; - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress: glvTokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - // TODO MLTCH withdrawal also includes a withdrawal compose gas const sendParams: SendParam = getMultichainTransferSendParams({ @@ -103,7 +103,7 @@ export async function createSourceChainGlvWithdrawalTxn({ account, srcChainId, amountLD: tokenAmount, - composeGas: composeGas, + composeGas: ensuredFees.txnEstimatedComposeGas, isToGmx: true, isManualGas: true, action, @@ -115,17 +115,6 @@ export async function createSourceChainGlvWithdrawalTxn({ throw new Error("Token ID not found"); } - const publicClient = getPublicClient(getRainbowKitConfig(), { chainId })!; - - const quoteSend = await publicClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [sendParams, false], - }); - - const value = quoteSend.nativeFee + (glvTokenAddress === zeroAddress ? tokenAmount : 0n); - try { const txnResult = await sendWalletTransaction({ chainId: srcChainId!, @@ -134,9 +123,9 @@ export async function createSourceChainGlvWithdrawalTxn({ callData: encodeFunctionData({ abi: abis.IStargate, functionName: "send", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + args: [sendParams, sendQuoteFromNative(ensuredFees.txnEstimatedNativeFee), account], }), - value, + value: ensuredFees.txnEstimatedNativeFee, msg: t`Sent withdrawal transaction`, }); diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts index 9ba53e819c..479791bd9f 100644 --- a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -1,5 +1,4 @@ import { t } from "@lingui/macro"; -import { getPublicClient } from "@wagmi/core"; import { encodeFunctionData, zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; @@ -7,78 +6,70 @@ import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam, TransferRequests } from "domain/multichain/types"; -import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/useMultichainDepositNetworkComposeGas"; -import { getRawRelayerParams, GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; -import { CreateWithdrawalParamsStruct } from "domain/synthetics/markets"; +import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; +import { CreateWithdrawalParams, RawCreateWithdrawalParams } from "domain/synthetics/markets"; import { sendWalletTransaction } from "lib/transactions"; import { WalletSigner } from "lib/wallets"; -import { getRainbowKitConfig } from "lib/wallets/rainbowKitConfig"; import { abis } from "sdk/abis"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; -import { getTokenBySymbol } from "sdk/configs/tokens"; -import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; -import { nowInSeconds } from "sdk/utils/time"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; +import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; +import { + estimateSourceChainWithdrawalFees, + SourceChainWithdrawalFees, +} from "./feeEstimation/estimateSourceChainWithdrawalFees"; import { signCreateWithdrawal } from "./signCreateWithdrawal"; export async function createSourceChainWithdrawalTxn({ chainId, - globalExpressParams, srcChainId, signer, transferRequests, params, - // account, - // tokenAddress, tokenAmount, - // executionFee, + globalExpressParams, + outputLongTokenAddress, + outputShortTokenAddress, + fees, }: { chainId: SettlementChainId; - globalExpressParams: GlobalExpressParams; srcChainId: SourceChainId; signer: WalletSigner; transferRequests: TransferRequests; - params: CreateWithdrawalParamsStruct; - // account: string; - // tokenAddress: string; + params: RawCreateWithdrawalParams; tokenAmount: bigint; - // executionFee: bigint; -}) { +} & ( + | { + fees: SourceChainWithdrawalFees; + outputLongTokenAddress?: undefined; + outputShortTokenAddress?: undefined; + globalExpressParams?: undefined; + } + | { + fees?: undefined; + outputLongTokenAddress: string; + outputShortTokenAddress: string; + globalExpressParams: GlobalExpressParams; + } +)) { const account = params.addresses.receiver; const marketTokenAddress = params.addresses.market; - const rawRelayParamsPayload = getRawRelayerParams({ - chainId: chainId, - gasPaymentTokenAddress: globalExpressParams!.gasPaymentTokenAddress, - relayerFeeTokenAddress: globalExpressParams!.relayerFeeTokenAddress, - // feeParams: { - // // feeToken: globalExpressParams!.relayerFeeTokenAddress, - // feeToken: getTokenBySymbol(chainId, "USDC.SG").address, - // // TODO MLTCH this is going through the keeper to execute a depost - // // so there 100% should be a fee - // feeAmount: 2n * 10n ** 6n, - // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], - // }, - feeParams: { - feeToken: getTokenBySymbol(chainId, "WETH").address, - // TODO MLTCH this is going through the keeper to execute a depost - // so there 100% should be a fee - // feeAmount: 10n * 10n ** 6n, - feeAmount: 639488160000000n, // params.executionFee, - // feeSwapPath: ["0xb6fC4C9eB02C35A134044526C62bb15014Ac0Bcc"], - feeSwapPath: [], - }, - externalCalls: getEmptyExternalCallsPayload(), - tokenPermits: [], - marketsInfoData: globalExpressParams!.marketsInfoData, - }); - - const relayParams: RelayParamsPayload = { - ...rawRelayParamsPayload, - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - }; + const ensuredFees = fees + ? fees + : await estimateSourceChainWithdrawalFees({ + chainId, + srcChainId, + params, + tokenAmount, + globalExpressParams, + outputLongTokenAddress, + outputShortTokenAddress, + tokenAddress: marketTokenAddress, + }); + const adjusterParams: CreateWithdrawalParams = { ...params, executionFee: ensuredFees.executionFee }; + const relayParams: RelayParamsPayload = ensuredFees.relayParamsPayload; const signature = await signCreateWithdrawal({ chainId, @@ -86,7 +77,7 @@ export async function createSourceChainWithdrawalTxn({ signer, relayParams, transferRequests, - params, + params: adjusterParams, }); const action: MultichainAction = { @@ -94,20 +85,11 @@ export async function createSourceChainWithdrawalTxn({ actionData: { relayParams, transferRequests, - params, + params: adjusterParams, signature, }, }; - const composeGas = await estimateMultichainDepositNetworkComposeGas({ - action, - chainId, - account, - srcChainId, - tokenAddress: marketTokenAddress, - settlementChainPublicClient: getPublicClient(getRainbowKitConfig(), { chainId })!, - }); - // TODO MLTCH withdrawal also includes a withdrawal compose gas const sendParams: SendParam = getMultichainTransferSendParams({ @@ -115,7 +97,7 @@ export async function createSourceChainWithdrawalTxn({ account, srcChainId, amountLD: tokenAmount, - composeGas: composeGas, + composeGas: ensuredFees.txnEstimatedComposeGas, isToGmx: true, isManualGas: true, action, @@ -127,16 +109,10 @@ export async function createSourceChainWithdrawalTxn({ throw new Error("Token ID not found"); } - const publicClient = getPublicClient(getRainbowKitConfig(), { chainId })!; - - const quoteSend = await publicClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [sendParams, false], - }); - - const value = quoteSend.nativeFee + (marketTokenAddress === zeroAddress ? tokenAmount : 0n); + let value = ensuredFees.txnEstimatedNativeFee; + if (marketTokenAddress === zeroAddress) { + value += tokenAmount; + } try { const txnResult = await sendWalletTransaction({ @@ -146,7 +122,7 @@ export async function createSourceChainWithdrawalTxn({ callData: encodeFunctionData({ abi: abis.IStargate, functionName: "send", - args: [sendParams, { nativeFee: quoteSend.nativeFee, lzTokenFee: 0n }, account], + args: [sendParams, sendQuoteFromNative(ensuredFees.txnEstimatedNativeFee), account], }), value, msg: t`Sent withdrawal transaction`, diff --git a/src/domain/synthetics/markets/createWithdrawalTxn.ts b/src/domain/synthetics/markets/createWithdrawalTxn.ts index d0570a12b8..9ee05f6cf7 100644 --- a/src/domain/synthetics/markets/createWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createWithdrawalTxn.ts @@ -16,9 +16,21 @@ import { SwapPricingType } from "../orders"; import { prepareOrderTxn } from "../orders/prepareOrderTxn"; import { simulateExecuteTxn } from "../orders/simulateExecuteTxn"; import type { TokensData } from "../tokens"; -import type { CreateWithdrawalParamsStruct } from "./types"; +import type { CreateWithdrawalParams } from "./types"; -export type CreateWithdrawalParams = { +export async function createWithdrawalTxn({ + chainId, + signer, + marketTokenAmount, + executionGasLimit, + skipSimulation, + tokensData, + metricId, + blockTimestampData, + params, + setPendingTxns, + setPendingWithdrawal, +}: { chainId: ContractsChainId; signer: Signer; marketTokenAmount: bigint; @@ -27,16 +39,14 @@ export type CreateWithdrawalParams = { tokensData: TokensData; metricId?: OrderMetricId; blockTimestampData: BlockTimestampData | undefined; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; setPendingTxns: (txns: any) => void; setPendingWithdrawal: SetPendingWithdrawal; -}; +}) { + const contract = new ethers.Contract(getContract(chainId, "ExchangeRouter"), abis.ExchangeRouter, signer); + const withdrawalVaultAddress = getContract(chainId, "WithdrawalVault"); -export async function createWithdrawalTxn(p: CreateWithdrawalParams) { - const contract = new ethers.Contract(getContract(p.chainId, "ExchangeRouter"), abis.ExchangeRouter, p.signer); - const withdrawalVaultAddress = getContract(p.chainId, "WithdrawalVault"); - - await validateSignerAddress(p.signer, p.params.addresses.receiver); + await validateSignerAddress(signer, params.addresses.receiver); // const wntAmount = p.params.executionFee; @@ -45,27 +55,27 @@ export async function createWithdrawalTxn(p: CreateWithdrawalParams) { // const minShortTokenAmount = applySlippageToMinOut(p.allowedSlippage, p.params.minShortTokenAmount); const multicall = [ - { method: "sendWnt", params: [withdrawalVaultAddress, p.params.executionFee] }, - { method: "sendTokens", params: [p.params.addresses.market, withdrawalVaultAddress, p.marketTokenAmount] }, + { method: "sendWnt", params: [withdrawalVaultAddress, params.executionFee] }, + { method: "sendTokens", params: [params.addresses.market, withdrawalVaultAddress, marketTokenAmount] }, { method: "createWithdrawal", params: [ { addresses: { - receiver: p.params.addresses.receiver, + receiver: params.addresses.receiver, callbackContract: ethers.ZeroAddress, - market: p.params.addresses.market, - longTokenSwapPath: p.params.addresses.longTokenSwapPath, - shortTokenSwapPath: p.params.addresses.shortTokenSwapPath, + market: params.addresses.market, + longTokenSwapPath: params.addresses.longTokenSwapPath, + shortTokenSwapPath: params.addresses.shortTokenSwapPath, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? ethers.ZeroAddress, }, - minLongTokenAmount: p.params.minLongTokenAmount, - minShortTokenAmount: p.params.minShortTokenAmount, - shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, - executionFee: p.params.executionFee, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, + executionFee: params.executionFee, callbackGasLimit: 0n, dataList: [], - } satisfies CreateWithdrawalParamsStruct, + } satisfies CreateWithdrawalParams, ], }, ]; @@ -74,51 +84,51 @@ export async function createWithdrawalTxn(p: CreateWithdrawalParams) { .filter(Boolean) .map((call) => contract.interface.encodeFunctionData(call!.method, call!.params)); - const simulationPromise = !p.skipSimulation - ? simulateExecuteTxn(p.chainId, { - account: p.params.addresses.receiver, + const simulationPromise = !skipSimulation + ? simulateExecuteTxn(chainId, { + account: params.addresses.receiver, primaryPriceOverrides: {}, - tokensData: p.tokensData, + tokensData: tokensData, createMulticallPayload: encodedPayload, method: "simulateExecuteLatestWithdrawal", errorTitle: t`Withdrawal error.`, - value: p.params.executionFee, + value: params.executionFee, swapPricingType: SwapPricingType.TwoStep, - metricId: p.metricId, - blockTimestampData: p.blockTimestampData, + metricId: metricId, + blockTimestampData: blockTimestampData, }) : undefined; const { gasLimit, gasPriceData } = await prepareOrderTxn( - p.chainId, + chainId, contract, "multicall", [encodedPayload], - p.params.executionFee, + params.executionFee, simulationPromise, - p.metricId + metricId ); - return callContract(p.chainId, contract, "multicall", [encodedPayload], { - value: p.params.executionFee, + return callContract(chainId, contract, "multicall", [encodedPayload], { + value: params.executionFee, hideSentMsg: true, hideSuccessMsg: true, - metricId: p.metricId, + metricId: metricId, gasLimit, gasPriceData, - setPendingTxns: p.setPendingTxns, + setPendingTxns: setPendingTxns, pendingTransactionData: { - estimatedExecutionFee: p.params.executionFee, - estimatedExecutionGasLimit: p.executionGasLimit, + estimatedExecutionFee: params.executionFee, + estimatedExecutionGasLimit: executionGasLimit, }, }).then(() => { - p.setPendingWithdrawal({ - account: p.params.addresses.receiver, - marketAddress: p.params.addresses.market, - marketTokenAmount: p.marketTokenAmount, - minLongTokenAmount: p.params.minLongTokenAmount, - minShortTokenAmount: p.params.minShortTokenAmount, - shouldUnwrapNativeToken: p.params.shouldUnwrapNativeToken, + setPendingWithdrawal({ + account: params.addresses.receiver, + marketAddress: params.addresses.market, + marketTokenAmount: marketTokenAmount, + minLongTokenAmount: params.minLongTokenAmount, + minShortTokenAmount: params.minShortTokenAmount, + shouldUnwrapNativeToken: params.shouldUnwrapNativeToken, }); }); } diff --git a/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts new file mode 100644 index 0000000000..1ff05341ee --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts @@ -0,0 +1,82 @@ +import { maxUint256, zeroHash } from "viem"; + +import type { SettlementChainId, SourceChainId } from "config/chains"; +import { getMultichainTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { expandDecimals } from "sdk/utils/numbers"; + +export async function estimateDepositPlatformTokenTransferOutFees({ + fromChainId, + toChainId, + marketOrGlvAddress, +}: { + fromChainId: SettlementChainId | SourceChainId; + toChainId: SettlementChainId | SourceChainId; + marketOrGlvAddress: string; +}): Promise<{ + platformTokenReturnTransferGasLimit: bigint; + platformTokenReturnTransferNativeFee: bigint; +}> { + const settlementChainClient = getPublicClientWithRpc(fromChainId); + + const settlementChainMarketTokenId = getMultichainTokenId(fromChainId, marketOrGlvAddress); + + if (!settlementChainMarketTokenId) { + throw new Error("Settlement chain market token ID not found"); + } + + const returnTransferSendParams = getMultichainTransferSendParams({ + dstChainId: toChainId, + account: RANDOM_WALLET.address, + srcChainId: fromChainId, + amountLD: expandDecimals(1, settlementChainMarketTokenId.decimals), + isToGmx: false, + // TODO MLTCH check that all gm and glv transfers are manual gas + isManualGas: true, + }); + + const primaryStargateQuoteSend = await settlementChainClient.readContract({ + address: settlementChainMarketTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [returnTransferSendParams, false], + }); + + const returnTransferNativeFee = primaryStargateQuoteSend.nativeFee; + + // The txn of stargate itself what will it take + const returnTransferGasLimit = await settlementChainClient + .estimateContractGas({ + address: settlementChainMarketTokenId.stargate, + abi: abis.IStargate, + functionName: "send", + account: RANDOM_WALLET.address, + args: [returnTransferSendParams, primaryStargateQuoteSend, RANDOM_WALLET.address], + value: primaryStargateQuoteSend.nativeFee, // + tokenAmount if native + stateOverride: [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: settlementChainMarketTokenId.address, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + return { + platformTokenReturnTransferGasLimit: returnTransferGasLimit, + platformTokenReturnTransferNativeFee: returnTransferNativeFee, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts new file mode 100644 index 0000000000..f28e097b40 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts @@ -0,0 +1,180 @@ +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, RANDOM_WALLET } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { getContract } from "sdk/configs/contracts"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { buildReverseSwapStrategy } from "sdk/utils/swap/buildSwapStrategy"; +import { nowInSeconds } from "sdk/utils/time"; + +import { getRawRelayerParams } from "../../express"; +import { GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express/types"; +import { signCreateWithdrawal } from "../signCreateWithdrawal"; +import { CreateGlvWithdrawalParams } from "../types"; + +export async function estimateGlvWithdrawalPlatformTokenTransferInFees({ + chainId, + srcChainId, + marketTokenAmount, + fullWntFee, + params, + secondaryOrPrimaryOutputTokenAddress, + globalExpressParams, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + marketTokenAmount: bigint; + fullWntFee: bigint; + params: CreateGlvWithdrawalParams; + secondaryOrPrimaryOutputTokenAddress: string; + globalExpressParams: GlobalExpressParams; +}): Promise<{ + platformTokenTransferInGasLimit: bigint; + platformTokenTransferInNativeFee: bigint; + platformTokenTransferInComposeGas: bigint; + relayParamsPayload: RelayParamsPayload; +}> { + const settlementWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; + + // const marketConfig = MARKETS[chainId][marketAddress]; + + // By default pay with short token + // const feeTokenAddress = isShortTokenBeingTransferred ? marketConfig.shortTokenAddress : marketConfig.longTokenAddress; + + // 922534 gas on atomic swap with one stem USDC -> WETH + // 114185 gas on no swap WETH WETH + const feeSwapStrategy = buildReverseSwapStrategy({ + chainId, + amountOut: fullWntFee, + tokenIn: globalExpressParams.tokensData[secondaryOrPrimaryOutputTokenAddress], + tokenOut: settlementWrappedTokenData, + marketsInfoData: globalExpressParams.marketsInfoData, + swapOptimizationOrder: ["length"], + externalSwapQuoteParams: undefined, + isAtomicSwap: true, + }); + + const returnRawRelayParamsPayload: RawRelayParamsPayload = + convertTokenAddress(chainId, secondaryOrPrimaryOutputTokenAddress, "wrapped") === settlementWrappedTokenData.address + ? getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: settlementWrappedTokenData.address, + relayerFeeTokenAddress: settlementWrappedTokenData.address, + feeParams: { + feeToken: settlementWrappedTokenData.address, + feeAmount: fullWntFee, + feeSwapPath: [], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }) + : getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: feeSwapStrategy.swapPathStats!.tokenInAddress, + relayerFeeTokenAddress: feeSwapStrategy.swapPathStats!.tokenOutAddress, + feeParams: { + feeToken: feeSwapStrategy.swapPathStats!.tokenInAddress, + feeAmount: feeSwapStrategy.amountIn, + feeSwapPath: feeSwapStrategy.swapPathStats!.swapPath, + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }); + + const returnRelayParamsPayload: RelayParamsPayload = { + ...returnRawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const vaultAddress = getContract(chainId, "GlvVault"); + const transferRequests = getTransferRequests([ + { + to: vaultAddress, + token: params.addresses.market, + amount: marketTokenAmount, + }, + ]); + + const signature = await signCreateWithdrawal({ + chainId, + srcChainId, + signer: RANDOM_WALLET, + relayParams: returnRelayParamsPayload, + transferRequests, + params, + shouldUseSignerMethod: true, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.GlvWithdrawal, + actionData: { + relayParams: returnRelayParamsPayload, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account: RANDOM_WALLET.address, + srcChainId, + tokenAddress: params.addresses.market, + settlementChainPublicClient: getPublicClientWithRpc(chainId), + }); + + const returnTransferSendParams = getMultichainTransferSendParams({ + dstChainId: chainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD: marketTokenAmount, + isToGmx: true, + // TODO MLTCH check that all gm and glv transfers are manual gas + isManualGas: true, + action, + composeGas, + }); + + const sourceChainClient = getPublicClientWithRpc(srcChainId); + const sourceChainTokenId = getMappedTokenId(chainId, params.addresses.market, srcChainId); + if (!sourceChainTokenId) { + throw new Error("Source chain token ID not found"); + } + + const platformTokenTransferInQuoteSend = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [returnTransferSendParams, false], + }); + + const platformTokenTransferInNativeFee = platformTokenTransferInQuoteSend.nativeFee; + + // The txn of stargate itself what will it take + const platformTokenTransferInGasLimit = await sourceChainClient + .estimateContractGas({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "send", + account: params.addresses.receiver, + args: [returnTransferSendParams, platformTokenTransferInQuoteSend, params.addresses.receiver], + value: platformTokenTransferInQuoteSend.nativeFee, + // No need to override state because we are using the users account on source chain + }) + .then(applyGasLimitBuffer); + + return { + platformTokenTransferInGasLimit: platformTokenTransferInGasLimit, + platformTokenTransferInNativeFee: platformTokenTransferInNativeFee, + platformTokenTransferInComposeGas: composeGas, + relayParamsPayload: returnRelayParamsPayload, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureDepositGasLimit.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureDepositGasLimit.ts new file mode 100644 index 0000000000..9448d9728a --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureDepositGasLimit.ts @@ -0,0 +1,41 @@ +import { GlobalExpressParams } from "../../express"; +import { + ExecutionFee, + estimateExecuteDepositGasLimit, + estimateDepositOraclePriceCount, + getExecutionFee, +} from "../../fees"; +import { RawCreateDepositParams } from "../types"; + +export function estimatePureDepositGasLimit({ + params, + chainId, + globalExpressParams, +}: { + params: RawCreateDepositParams; + chainId: number; + globalExpressParams: GlobalExpressParams; +}): ExecutionFee { + const swapPathCount = BigInt(params.addresses.longTokenSwapPath.length + params.addresses.shortTokenSwapPath.length); + + const gasLimitPureDeposit = estimateExecuteDepositGasLimit(globalExpressParams.gasLimits, { + swapsCount: swapPathCount, + }); + + const oraclePriceCount = estimateDepositOraclePriceCount(swapPathCount); + + const executionFee = getExecutionFee( + chainId, + globalExpressParams.gasLimits, + globalExpressParams.tokensData, + gasLimitPureDeposit, + globalExpressParams.gasPrice, + oraclePriceCount + ); + + if (executionFee === undefined) { + throw new Error("Execution fee not found"); + } + + return executionFee; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts new file mode 100644 index 0000000000..abb07543d1 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts @@ -0,0 +1,45 @@ +import { GlobalExpressParams } from "../../express"; +import { + ExecutionFee, + estimateExecuteGlvDepositGasLimit, + estimateGlvDepositOraclePriceCount, + getExecutionFee, +} from "../../fees"; +import { RawCreateGlvDepositParams } from "../types"; + +export function estimatePureGlvDepositGasLimit({ + params, + chainId, + globalExpressParams, + marketsCount, +}: { + params: RawCreateGlvDepositParams; + chainId: number; + globalExpressParams: GlobalExpressParams; + marketsCount: bigint; +}): ExecutionFee { + const swapPathCount = BigInt(params.addresses.longTokenSwapPath.length + params.addresses.shortTokenSwapPath.length); + + const gasLimitPureDeposit = estimateExecuteGlvDepositGasLimit(globalExpressParams.gasLimits, { + swapsCount: swapPathCount, + isMarketTokenDeposit: params.isMarketTokenDeposit, + marketsCount, + }); + + const oraclePriceCount = estimateGlvDepositOraclePriceCount(swapPathCount); + + const executionFee = getExecutionFee( + chainId, + globalExpressParams.gasLimits, + globalExpressParams.tokensData, + gasLimitPureDeposit, + globalExpressParams.gasPrice, + oraclePriceCount + ); + + if (executionFee === undefined) { + throw new Error("Execution fee not found"); + } + + return executionFee; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureGlvWithdrawalGasLimit.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvWithdrawalGasLimit.ts new file mode 100644 index 0000000000..456664f659 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvWithdrawalGasLimit.ts @@ -0,0 +1,44 @@ +import { GlobalExpressParams } from "../../express"; +import { + ExecutionFee, + estimateExecuteGlvWithdrawalGasLimit, + getExecutionFee, + estimateGlvWithdrawalOraclePriceCount, +} from "../../fees"; +import { RawCreateGlvWithdrawalParams } from "../types"; + +export function estimatePureGlvWithdrawalGasLimit({ + params, + chainId, + globalExpressParams, + marketsCount, +}: { + params: RawCreateGlvWithdrawalParams; + chainId: number; + globalExpressParams: GlobalExpressParams; + marketsCount: bigint; +}): ExecutionFee { + const swapPathCount = BigInt(params.addresses.longTokenSwapPath.length + params.addresses.shortTokenSwapPath.length); + + const gasLimitPureGlvWithdrawal = estimateExecuteGlvWithdrawalGasLimit(globalExpressParams.gasLimits, { + marketsCount, + swapsCount: swapPathCount, + }); + + const oraclePriceCount = estimateGlvWithdrawalOraclePriceCount(marketsCount, swapPathCount); + + const executionFee = getExecutionFee( + chainId, + globalExpressParams.gasLimits, + globalExpressParams.tokensData, + gasLimitPureGlvWithdrawal, + globalExpressParams.gasPrice, + oraclePriceCount + ); + + if (executionFee === undefined) { + throw new Error("Execution fee not found"); + } + + return executionFee; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee.ts new file mode 100644 index 0000000000..d78d35130d --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee.ts @@ -0,0 +1,75 @@ +import type { GlobalExpressParams } from "domain/synthetics/express/types"; +import { ContractsChainId } from "sdk/configs/chains"; +import { + estimateDepositOraclePriceCount, + estimateExecuteDepositGasLimit, + estimateExecuteGlvDepositGasLimit, + estimateExecuteGlvWithdrawalGasLimit, + estimateExecuteWithdrawalGasLimit, + estimateGlvDepositOraclePriceCount, + estimateGlvWithdrawalOraclePriceCount, + estimateWithdrawalOraclePriceCount, + getExecutionFee, +} from "sdk/utils/fees"; + +import { Operation } from "components/GmSwap/GmSwapBox/types"; + +import type { ExecutionFee } from "../../fees"; + +export type PureAction = + | { operation: Operation.Deposit; isGlv: false; swapsCount: bigint } + | { operation: Operation.Withdrawal; isGlv: false; swapsCount: bigint } + | { + operation: Operation.Deposit; + isGlv: true; + marketsCount: bigint; + swapsCount: bigint; + isMarketTokenDeposit: boolean; + } + | { operation: Operation.Withdrawal; isGlv: true; marketsCount: bigint; swapsCount: bigint }; + +export function estimatePureLpActionExecutionFee({ + action, + chainId, + globalExpressParams, +}: { + action: PureAction; + chainId: ContractsChainId; + globalExpressParams: GlobalExpressParams; +}): ExecutionFee { + let gasLimit = 0n; + let oraclePriceCount = 0n; + if (action.operation === Operation.Deposit && action.isGlv === false) { + gasLimit = estimateExecuteDepositGasLimit(globalExpressParams.gasLimits, { swapsCount: action.swapsCount }); + oraclePriceCount = estimateDepositOraclePriceCount(action.swapsCount); + } else if (action.operation === Operation.Withdrawal && action.isGlv === false) { + gasLimit = estimateExecuteWithdrawalGasLimit(globalExpressParams.gasLimits, { swapsCount: action.swapsCount }); + oraclePriceCount = estimateWithdrawalOraclePriceCount(action.swapsCount); + } else if (action.operation === Operation.Deposit && action.isGlv === true) { + gasLimit = estimateExecuteGlvDepositGasLimit(globalExpressParams.gasLimits, { + swapsCount: action.swapsCount, + marketsCount: action.marketsCount, + isMarketTokenDeposit: action.isMarketTokenDeposit, + }); + oraclePriceCount = estimateGlvDepositOraclePriceCount(action.marketsCount, action.swapsCount); + } else if (action.operation === Operation.Withdrawal && action.isGlv === true) { + gasLimit = estimateExecuteGlvWithdrawalGasLimit(globalExpressParams.gasLimits, { + swapsCount: action.swapsCount, + marketsCount: action.marketsCount, + }); + oraclePriceCount = estimateGlvWithdrawalOraclePriceCount(action.marketsCount, action.swapsCount); + } + + const executionFee = getExecutionFee( + chainId, + globalExpressParams.gasLimits, + globalExpressParams.tokensData, + gasLimit, + globalExpressParams.gasPrice, + oraclePriceCount + ); + + if (!executionFee) throw new Error("Execution fee not found"); + + return executionFee; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureWithdrawalGasLimit.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureWithdrawalGasLimit.ts new file mode 100644 index 0000000000..08f90d47ed --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureWithdrawalGasLimit.ts @@ -0,0 +1,41 @@ +import { GlobalExpressParams } from "../../express"; +import { + ExecutionFee, + estimateExecuteWithdrawalGasLimit, + estimateWithdrawalOraclePriceCount, + getExecutionFee, +} from "../../fees"; +import { RawCreateWithdrawalParams } from "../types"; + +export function estimatePureWithdrawalGasLimit({ + params, + chainId, + globalExpressParams, +}: { + params: RawCreateWithdrawalParams; + chainId: number; + globalExpressParams: GlobalExpressParams; +}): ExecutionFee { + const swapPathCount = BigInt(params.addresses.longTokenSwapPath.length + params.addresses.shortTokenSwapPath.length); + + const gasLimitPureWithdrawal = estimateExecuteWithdrawalGasLimit(globalExpressParams.gasLimits, { + swapsCount: swapPathCount, + }); + + const oraclePriceCount = estimateWithdrawalOraclePriceCount(swapPathCount); + + const executionFee = getExecutionFee( + chainId, + globalExpressParams.gasLimits, + globalExpressParams.tokensData, + gasLimitPureWithdrawal, + globalExpressParams.gasPrice, + oraclePriceCount + ); + + if (executionFee === undefined) { + throw new Error("Execution fee not found"); + } + + return executionFee; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts new file mode 100644 index 0000000000..a2dbfe38c5 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts @@ -0,0 +1,337 @@ +// import { getPublicClient } from "@wagmi/core"; +import { maxUint256, zeroAddress, zeroHash } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import { getMappedTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { MessagingFee, SendParam } from "domain/multichain/types"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { adjustForDecimals } from "lib/numbers"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { MARKETS } from "sdk/configs/markets"; +import { convertTokenAddress, getToken, getWrappedToken } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { buildReverseSwapStrategy } from "sdk/utils/swap/buildSwapStrategy"; +import { nowInSeconds } from "sdk/utils/time"; + +import { getRawRelayerParams, GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express"; +import { convertToUsd, getMidPrice } from "../../tokens"; +import { signCreateDeposit } from "../signCreateDeposit"; +import { CreateDepositParams, RawCreateDepositParams } from "../types"; +import { estimateDepositPlatformTokenTransferOutFees } from "./estimateDepositPlatformTokenTransferOutFees"; +import { estimatePureDepositGasLimit } from "./estimatePureDepositGasLimit"; + +export type SourceChainDepositFees = { + /** + * How much will be used by keeper and stargate + */ + relayParamsPayload: RelayParamsPayload; + /** + * How much will be used by keeper. In settlement chain WNT. + */ + executionFee: bigint; + /** + * How much will be used by keeper + return GM transfer in USD. + */ + relayFeeUsd: bigint; + /** + * How initial tx will cost in SOURCE CHAIN GAS + */ + txnEstimatedGasLimit: bigint; + /** + * How much will be used by initial tx in SOURCE CHAIN NATIVE TOKEN + */ + txnEstimatedNativeFee: bigint; + txnEstimatedComposeGas: bigint; +}; + +/** + * Source chain GM deposit requires following steps where user pays gas for: + * 1. Source chain tx sending. Can be ommitted because user's wallet will show it to him. + * 2. Source chain stargate fee. Usually from USDC or ETH. + * 3. Keeper execution. [executionFee]. + * 4. Additional WNT for keeper to execute GM lz sending. [executionFee]. + * 5. Additional WNT for lz native fee. + */ +export async function estimateSourceChainDepositFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: RawCreateDepositParams; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; +}): Promise { + const { + platformTokenReturnTransferGasLimit: returnGmTransferGasLimit, + platformTokenReturnTransferNativeFee: returnGmTransferNativeFee, + } = await estimateDepositPlatformTokenTransferOutFees({ + fromChainId: chainId, + toChainId: srcChainId, + marketOrGlvAddress: params.addresses.market, + }); + + const keeperDepositGasLimit = estimatePureDepositGasLimit({ + params, + chainId, + globalExpressParams, + }).gasLimit; + + // Add actions gas + const keeperGasLimit = keeperDepositGasLimit + returnGmTransferGasLimit; + + const keeperDepositFeeWNTAmount = keeperGasLimit * globalExpressParams.gasPrice; + + const fullWntFee = keeperDepositFeeWNTAmount + returnGmTransferNativeFee; + + const { initialTxNativeFee, initialTxGasLimit, relayParamsPayload, initialTransferComposeGas } = + await estimateSourceChainDepositInitialTxFees({ + chainId, + srcChainId, + params: { + ...params, + executionFee: keeperDepositFeeWNTAmount, + }, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, + }); + + const relayFeeUsd = convertToUsd( + relayParamsPayload.fee.feeAmount, + getToken(chainId, relayParamsPayload.fee.feeToken).decimals, + getMidPrice(globalExpressParams.tokensData[relayParamsPayload.fee.feeToken].prices) + )!; + + return { + txnEstimatedComposeGas: initialTransferComposeGas, + txnEstimatedGasLimit: initialTxGasLimit, + txnEstimatedNativeFee: initialTxNativeFee, + executionFee: keeperDepositFeeWNTAmount, + relayFeeUsd, + relayParamsPayload, + }; +} + +async function estimateSourceChainDepositInitialTxFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: CreateDepositParams; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; + fullWntFee: bigint; +}): Promise<{ + initialTxNativeFee: bigint; + initialTxGasLimit: bigint; + initialTransferComposeGas: bigint; + relayParamsPayload: RelayParamsPayload; +}> { + const sourceChainClient = getPublicClientWithRpc(srcChainId); + const settlementNativeWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; + const unwrappedPayTokenAddress = convertTokenAddress(chainId, tokenAddress, "native"); + const wrappedPayTokenAddress = convertTokenAddress(chainId, tokenAddress, "wrapped"); + + const marketConfig = MARKETS[chainId][params.addresses.market]; + if ( + marketConfig.longTokenAddress !== wrappedPayTokenAddress && + marketConfig.shortTokenAddress !== wrappedPayTokenAddress + ) { + // console.log("marketConfig", params); + throw new Error( + `Token address not found in market config. Market config: ${JSON.stringify(marketConfig)}, token address: ${wrappedPayTokenAddress}` + ); + } + const initialToken = getToken(chainId, wrappedPayTokenAddress); + const sourceChainTokenId = getMappedTokenId(chainId, unwrappedPayTokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Source chain token ID not found"); + } + + // How much will take to send back the GM to source chain + + const feeSwapStrategy = + wrappedPayTokenAddress === settlementNativeWrappedTokenData.address + ? null + : buildReverseSwapStrategy({ + chainId, + amountOut: fullWntFee, + tokenIn: globalExpressParams.tokensData[wrappedPayTokenAddress], + tokenOut: settlementNativeWrappedTokenData, + marketsInfoData: globalExpressParams.marketsInfoData, + swapOptimizationOrder: ["length"], + externalSwapQuoteParams: undefined, + isAtomicSwap: true, + }); + + if (feeSwapStrategy && !feeSwapStrategy.swapPathStats) { + throw new Error("Fee swap strategy has no swap path stats"); + } + + // console.log({ + // wrappedTokenAddress, + // wrappedTokenData: globalExpressParams.tokensData[wrappedTokenAddress], + // feeSwapStrategy, + // settlementWrappedTokenData, + // }); + + const returnRawRelayParamsPayload: RawRelayParamsPayload = getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: feeSwapStrategy?.swapPathStats!.tokenInAddress ?? settlementNativeWrappedTokenData.address, + relayerFeeTokenAddress: feeSwapStrategy?.swapPathStats!.tokenOutAddress ?? wrappedPayTokenAddress, + feeParams: { + feeToken: feeSwapStrategy?.swapPathStats!.tokenInAddress ?? wrappedPayTokenAddress, + feeAmount: feeSwapStrategy?.amountIn ?? fullWntFee, + feeSwapPath: feeSwapStrategy?.swapPathStats!.swapPath ?? [], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }); + + const returnRelayParamsPayload: RelayParamsPayload = { + ...returnRawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const vaultAddress = getContract(chainId, "DepositVault"); + const transferRequests = getTransferRequests([ + { + to: vaultAddress, + token: params.addresses.initialLongToken, + amount: params.addresses.initialLongToken === wrappedPayTokenAddress ? tokenAmount : 0n, + }, + { + to: vaultAddress, + token: params.addresses.initialShortToken, + amount: params.addresses.initialShortToken === wrappedPayTokenAddress ? tokenAmount : 0n, + }, + ]); + + const signature = await signCreateDeposit({ + chainId, + srcChainId, + signer: RANDOM_WALLET, + relayParams: returnRelayParamsPayload, + transferRequests, + params, + shouldUseSignerMethod: true, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Deposit, + actionData: { + relayParams: returnRelayParamsPayload, + transferRequests, + params, + signature, + }, + }; + + const initialComposeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account: RANDOM_WALLET.address, + srcChainId, + tokenAddress: + params.addresses.initialLongToken === wrappedPayTokenAddress + ? params.addresses.initialLongToken + : params.addresses.initialShortToken, + settlementChainPublicClient: getPublicClientWithRpc(chainId), + }); + + const amountLD = adjustForDecimals(tokenAmount, initialToken.decimals, sourceChainTokenId.decimals); + + const sendParams: SendParam = getMultichainTransferSendParams({ + dstChainId: chainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD, + composeGas: initialComposeGas, + isToGmx: true, + action, + }); + + // const initialQuoteOft = await sourceChainClient.readContract({ + // address: sourceChainTokenId.stargate, + // abi: abis.IStargate, + // functionName: "quoteOFT", + // args: [sendParams], + // }); + + // TODO MLTCH + // sendParams.amountLD = initialQuoteOft[0].minAmountLD * 100n; + + const initialQuoteSend = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }); + + let value = initialQuoteSend.nativeFee; + if (unwrappedPayTokenAddress === zeroAddress) { + value += amountLD; + } + + const initialStargateTxnGasLimit = await sourceChainClient + .estimateContractGas({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "sendToken", + args: [sendParams, initialQuoteSend, RANDOM_WALLET.address], + value, + stateOverride: [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: sourceChainTokenId.address, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + return { + initialTxNativeFee: initialQuoteSend.nativeFee, + initialTxGasLimit: initialStargateTxnGasLimit, + initialTransferComposeGas: initialComposeGas, + relayParamsPayload: returnRelayParamsPayload, + }; +} + +export function sendQuoteFromNative(nativeFee: bigint): MessagingFee { + return { + nativeFee, + lzTokenFee: 0n, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts new file mode 100644 index 0000000000..c20abc068f --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts @@ -0,0 +1,293 @@ +import { maxUint256, zeroHash } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getContract } from "config/contracts"; +import { getMappedTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { SendParam } from "domain/multichain/types"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { expandDecimals } from "lib/numbers"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { MARKETS } from "sdk/configs/markets"; +import { getToken, getWrappedToken } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { buildReverseSwapStrategy } from "sdk/utils/swap/buildSwapStrategy"; +import { nowInSeconds } from "sdk/utils/time"; + +import { estimateDepositPlatformTokenTransferOutFees } from "./estimateDepositPlatformTokenTransferOutFees"; +import { estimatePureGlvDepositGasLimit } from "./estimatePureGlvDepositGasLimit"; +import { getRawRelayerParams, GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express"; +import { convertToUsd, getMidPrice } from "../../tokens"; +import { signCreateGlvDeposit } from "../signCreateGlvDeposit"; +import { CreateGlvDepositParams, RawCreateGlvDepositParams } from "../types"; + +export type SourceChainGlvDepositFees = { + /** + * How much will be used by keeper and stargate + */ + relayParamsPayload: RelayParamsPayload; + /** + * How much will be used by keeper. In settlement chain WNT. + */ + executionFee: bigint; + /** + * How much will be used by keeper + return GM transfer in USD. + */ + relayFeeUsd: bigint; + /** + * How initial tx will cost in SOURCE CHAIN GAS + */ + txnEstimatedGasLimit: bigint; + /** + * How much will be used by initial tx in SOURCE CHAIN NATIVE TOKEN + */ + txnEstimatedNativeFee: bigint; + txnEstimatedComposeGas: bigint; +}; + +/** + * Source chain GM deposit requires following steps where user pays gas for: + * 1. Source chain tx sending. Can be ommitted because user's wallet will show it to him. + * 2. Source chain stargate fee. Usually from USDC or ETH. + * 3. Keeper execution. [executionFee]. + * 4. Additional WNT for keeper to execute GM lz sending. [executionFee]. + * 5. Additional WNT for lz native fee. + */ +export async function estimateSourceChainGlvDepositFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, + glvMarketCount, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: RawCreateGlvDepositParams; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; + glvMarketCount: bigint; +}): Promise { + const { + platformTokenReturnTransferGasLimit: returnGmTransferGasLimit, + platformTokenReturnTransferNativeFee: returnGmTransferNativeFee, + } = await estimateDepositPlatformTokenTransferOutFees({ + fromChainId: chainId, + toChainId: srcChainId, + marketOrGlvAddress: params.addresses.glv, + }); + + const keeperDepositGasLimit = estimatePureGlvDepositGasLimit({ + params, + chainId, + globalExpressParams, + marketsCount: glvMarketCount, + }).gasLimit; + + // Add actions gas + const keeperGasLimit = keeperDepositGasLimit + returnGmTransferGasLimit; + + const keeperDepositFeeWNTAmount = keeperGasLimit * globalExpressParams.gasPrice; + + const fullWntFee = keeperDepositFeeWNTAmount + returnGmTransferNativeFee; + + const { initialTxNativeFee, initialTxGasLimit, relayParamsPayload, initialTransferComposeGas } = + await estimateSourceChainGlvDepositInitialTxFees({ + chainId, + srcChainId, + params: { + ...params, + executionFee: keeperDepositFeeWNTAmount, + }, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, + }); + + const relayFeeUsd = convertToUsd( + relayParamsPayload.fee.feeAmount, + getToken(chainId, relayParamsPayload.fee.feeToken).decimals, + getMidPrice(globalExpressParams.tokensData[relayParamsPayload.fee.feeToken].prices) + )!; + + return { + txnEstimatedComposeGas: initialTransferComposeGas, + txnEstimatedGasLimit: initialTxGasLimit, + txnEstimatedNativeFee: initialTxNativeFee, + executionFee: keeperDepositFeeWNTAmount, + relayFeeUsd, + relayParamsPayload, + }; +} + +async function estimateSourceChainGlvDepositInitialTxFees({ + chainId, + srcChainId, + params, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: CreateGlvDepositParams; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; + fullWntFee: bigint; +}): Promise<{ + initialTxNativeFee: bigint; + initialTxGasLimit: bigint; + initialTransferComposeGas: bigint; + relayParamsPayload: RelayParamsPayload; +}> { + const sourceChainClient = getPublicClientWithRpc(srcChainId); + + const settlementWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; + const marketConfig = MARKETS[chainId][params.addresses.market]; + if (marketConfig.longTokenAddress !== tokenAddress && marketConfig.shortTokenAddress !== tokenAddress) { + throw new Error("Token address not found in market config"); + } + const initialToken = getToken(chainId, tokenAddress); + const sourceChainTokenId = getMappedTokenId(chainId, tokenAddress, srcChainId); + + if (!sourceChainTokenId) { + throw new Error("Source chain token ID not found"); + } + + // How much will take to send back the GM to source chain + + const feeSwapStrategy = buildReverseSwapStrategy({ + chainId, + amountOut: fullWntFee, + tokenIn: globalExpressParams.tokensData[tokenAddress], + tokenOut: settlementWrappedTokenData, + marketsInfoData: globalExpressParams.marketsInfoData, + swapOptimizationOrder: ["length"], + externalSwapQuoteParams: undefined, + isAtomicSwap: true, + }); + + const returnRawRelayParamsPayload: RawRelayParamsPayload = getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: feeSwapStrategy.swapPathStats!.tokenInAddress, + relayerFeeTokenAddress: feeSwapStrategy.swapPathStats!.tokenOutAddress, + feeParams: { + feeToken: feeSwapStrategy.swapPathStats!.tokenInAddress, + feeAmount: feeSwapStrategy.amountIn, + feeSwapPath: feeSwapStrategy.swapPathStats!.swapPath, + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }); + + const returnRelayParamsPayload: RelayParamsPayload = { + ...returnRawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const vaultAddress = getContract(chainId, "GlvVault"); + const transferRequests = getTransferRequests([ + { + to: vaultAddress, + token: params.addresses.initialLongToken, + amount: params.addresses.initialLongToken === tokenAddress ? tokenAmount : 0n, + }, + { + to: vaultAddress, + token: params.addresses.initialShortToken, + amount: params.addresses.initialShortToken === tokenAddress ? tokenAmount : 0n, + }, + ]); + + const signature = await signCreateGlvDeposit({ + chainId, + srcChainId, + signer: RANDOM_WALLET, + relayParams: returnRelayParamsPayload, + transferRequests, + params, + shouldUseSignerMethod: true, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.GlvDeposit, + actionData: { + relayParams: returnRelayParamsPayload, + transferRequests, + params, + signature, + }, + }; + + const initialComposeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account: RANDOM_WALLET.address, + srcChainId, + tokenAddress: + params.addresses.initialLongToken === tokenAddress + ? params.addresses.initialLongToken + : params.addresses.initialShortToken, + settlementChainPublicClient: getPublicClientWithRpc(chainId), + }); + + const sendParams: SendParam = getMultichainTransferSendParams({ + dstChainId: chainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD: expandDecimals(1, initialToken.decimals), + composeGas: initialComposeGas, + isToGmx: true, + action, + }); + + const initialQuoteSend = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }); + + const initialStargateTxnGasLimit = await sourceChainClient + .estimateContractGas({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "sendToken", + args: [sendParams, initialQuoteSend, RANDOM_WALLET.address], + value: initialQuoteSend.nativeFee, + stateOverride: [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: sourceChainTokenId.address, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + return { + initialTxNativeFee: initialQuoteSend.nativeFee, + initialTxGasLimit: initialStargateTxnGasLimit, + initialTransferComposeGas: initialComposeGas, + relayParamsPayload: returnRelayParamsPayload, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees.ts new file mode 100644 index 0000000000..50c3107dd7 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees.ts @@ -0,0 +1,122 @@ +// import { getPublicClient } from "@wagmi/core"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getToken } from "sdk/configs/tokens"; + +import { estimateGlvWithdrawalPlatformTokenTransferInFees } from "./estimateGlvWithdrawalPlatformTokenTransferInFees"; +import { estimatePureGlvWithdrawalGasLimit } from "./estimatePureGlvWithdrawalGasLimit"; +import { estimateSourceChainWithdrawalReturnTokenTransferFees } from "./estimateSourceChainWithdrawalFees"; +import { GlobalExpressParams, RelayParamsPayload } from "../../express"; +import { convertToUsd, getMidPrice } from "../../tokens"; +import { CreateGlvWithdrawalParams, RawCreateGlvWithdrawalParams } from "../types"; + +export type SourceChainGlvWithdrawalFees = { + /** + * How much will be used by keeper and stargate + */ + relayParamsPayload: RelayParamsPayload; + /** + * How much will be used by keeper. In settlement chain WNT. + */ + executionFee: bigint; + /** + * How much will be used by keeper + return GM transfer in USD. + */ + relayFeeUsd: bigint; + /** + * How initial tx will cost in SOURCE CHAIN GAS + */ + txnEstimatedGasLimit: bigint; + /** + * How much will be used by initial tx in SOURCE CHAIN NATIVE TOKEN + */ + txnEstimatedNativeFee: bigint; + txnEstimatedComposeGas: bigint; +}; + +/** + * Source chain GM withdrawal requires following steps where user pays gas for: + * 1. Source chain tx sending. Can be ommitted because user's wallet will show it to him. + * 2. Source chain stargate fee. With GM. + * 3. Keeper withdrawal execution. [executionFee]. + * 4. Additional WNT for keeper to execute 1 OR 2 market token lz sending. Usually USDC or ETH. [executionFee]. + * 5. Additional WNT for 1 OR 2 lz native fee. + */ +export async function estimateSourceChainGlvWithdrawalFees({ + chainId, + srcChainId, + params, + tokenAmount, + globalExpressParams, + marketsCount, + outputLongTokenAddress, + outputShortTokenAddress, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: RawCreateGlvWithdrawalParams; + marketsCount: bigint; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; + outputLongTokenAddress: string; + outputShortTokenAddress: string; +}): Promise { + const { + longTokenTransferGasLimit, + longTokenTransferNativeFee, + shortTokenTransferGasLimit, + shortTokenTransferNativeFee, + } = await estimateSourceChainWithdrawalReturnTokenTransferFees({ + chainId, + srcChainId, + outputLongTokenAddress, + outputShortTokenAddress, + }); + + const keeperWithdrawalGasLimit = estimatePureGlvWithdrawalGasLimit({ + params, + chainId, + globalExpressParams, + marketsCount, + }).gasLimit; + // Add actions gas + const keeperGasLimit = keeperWithdrawalGasLimit + longTokenTransferGasLimit + shortTokenTransferGasLimit; + const keeperWithdrawalFeeWNTAmount = keeperGasLimit * globalExpressParams.gasPrice; + const fullWntFee = keeperWithdrawalFeeWNTAmount + longTokenTransferNativeFee + shortTokenTransferNativeFee; + + const adjusterParams: CreateGlvWithdrawalParams = { + ...params, + executionFee: keeperWithdrawalFeeWNTAmount, + }; + + const { + platformTokenTransferInComposeGas, + platformTokenTransferInGasLimit, + platformTokenTransferInNativeFee, + relayParamsPayload, + } = await estimateGlvWithdrawalPlatformTokenTransferInFees({ + chainId, + srcChainId, + fullWntFee, + params: adjusterParams, + globalExpressParams, + marketTokenAmount: tokenAmount, + secondaryOrPrimaryOutputTokenAddress: outputShortTokenAddress ?? outputLongTokenAddress, + }); + + const relayFeeUsd = convertToUsd( + relayParamsPayload.fee.feeAmount, + getToken(chainId, relayParamsPayload.fee.feeToken).decimals, + getMidPrice(globalExpressParams.tokensData[relayParamsPayload.fee.feeToken].prices) + )!; + + return { + txnEstimatedComposeGas: platformTokenTransferInComposeGas, + txnEstimatedGasLimit: platformTokenTransferInGasLimit, + txnEstimatedNativeFee: platformTokenTransferInNativeFee, + executionFee: keeperWithdrawalFeeWNTAmount, + relayFeeUsd, + relayParamsPayload, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts new file mode 100644 index 0000000000..cd0a4b7dcf --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts @@ -0,0 +1,275 @@ +// import { getPublicClient } from "@wagmi/core"; +import { maxUint256, zeroAddress, zeroHash } from "viem"; + +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getStargatePoolAddress, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { SendParam } from "domain/multichain/types"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { expandDecimals } from "lib/numbers"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { convertTokenAddress, getToken } from "sdk/configs/tokens"; + +import { GlobalExpressParams, RelayParamsPayload } from "../../express"; +import { convertToUsd, getMidPrice } from "../../tokens"; +import { CreateWithdrawalParams, RawCreateWithdrawalParams } from "../types"; +import { estimatePureWithdrawalGasLimit } from "./estimatePureWithdrawalGasLimit"; +import { estimateWithdrawalPlatformTokenTransferInFees } from "./estimateWithdrawalPlatformTokenTransferInFees"; + +export type SourceChainWithdrawalFees = { + /** + * How much will be used by keeper and stargate + */ + relayParamsPayload: RelayParamsPayload; + /** + * How much will be used by keeper. In settlement chain WNT. + */ + executionFee: bigint; + /** + * How much will be used by keeper + return GM transfer in USD. + */ + relayFeeUsd: bigint; + /** + * How initial tx will cost in SOURCE CHAIN GAS + */ + txnEstimatedGasLimit: bigint; + /** + * How much will be used by initial tx in SOURCE CHAIN NATIVE TOKEN + */ + txnEstimatedNativeFee: bigint; + txnEstimatedComposeGas: bigint; +}; + +/** + * Source chain GM withdrawal requires following steps where user pays gas for: + * 1. Source chain tx sending. Can be ommitted because user's wallet will show it to him. + * 2. Source chain stargate fee. With GM. + * 3. Keeper withdrawal execution. [executionFee]. + * 4. Additional WNT for keeper to execute 1 OR 2 market token lz sending. Usually USDC or ETH. [executionFee]. + * 5. Additional WNT for 1 OR 2 lz native fee. + */ +export async function estimateSourceChainWithdrawalFees({ + chainId, + srcChainId, + params, + tokenAmount, + globalExpressParams, + outputLongTokenAddress, + outputShortTokenAddress, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + params: RawCreateWithdrawalParams; + tokenAddress: string; + tokenAmount: bigint; + globalExpressParams: GlobalExpressParams; + outputLongTokenAddress: string; + outputShortTokenAddress: string; +}): Promise { + const { + longTokenTransferGasLimit, + longTokenTransferNativeFee, + shortTokenTransferGasLimit, + shortTokenTransferNativeFee, + } = await estimateSourceChainWithdrawalReturnTokenTransferFees({ + chainId, + srcChainId, + outputLongTokenAddress, + outputShortTokenAddress, + }); + + const keeperWithdrawalGasLimit = estimatePureWithdrawalGasLimit({ + params, + chainId, + globalExpressParams, + }).gasLimit; + // Add actions gas + const keeperGasLimit = keeperWithdrawalGasLimit + longTokenTransferGasLimit + shortTokenTransferGasLimit; + const keeperWithdrawalFeeWNTAmount = keeperGasLimit * globalExpressParams.gasPrice; + const fullWntFee = keeperWithdrawalFeeWNTAmount + longTokenTransferNativeFee + shortTokenTransferNativeFee; + + const adjusterParams: CreateWithdrawalParams = { + ...params, + executionFee: keeperWithdrawalFeeWNTAmount, + }; + + const { + platformTokenTransferInComposeGas, + platformTokenTransferInGasLimit, + platformTokenTransferInNativeFee, + relayParamsPayload, + } = await estimateWithdrawalPlatformTokenTransferInFees({ + chainId, + srcChainId, + marketTokenAmount: tokenAmount, + fullWntFee, + params: adjusterParams, + secondaryOrPrimaryOutputTokenAddress: outputShortTokenAddress ?? outputLongTokenAddress, + globalExpressParams, + }); + + const relayFeeUsd = convertToUsd( + relayParamsPayload.fee.feeAmount, + getToken(chainId, relayParamsPayload.fee.feeToken).decimals, + getMidPrice(globalExpressParams.tokensData[relayParamsPayload.fee.feeToken].prices) + )!; + + return { + txnEstimatedComposeGas: platformTokenTransferInComposeGas, + txnEstimatedGasLimit: platformTokenTransferInGasLimit, + txnEstimatedNativeFee: platformTokenTransferInNativeFee, + executionFee: keeperWithdrawalFeeWNTAmount, + relayFeeUsd, + relayParamsPayload, + }; +} + +export async function estimateSourceChainWithdrawalReturnTokenTransferFees({ + chainId, + srcChainId, + outputLongTokenAddress, + outputShortTokenAddress, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + outputLongTokenAddress: string; + outputShortTokenAddress: string; +}): Promise<{ + longTokenTransferGasLimit: bigint; + longTokenTransferNativeFee: bigint; + shortTokenTransferGasLimit: bigint; + shortTokenTransferNativeFee: bigint; +}> { + const settlementChainClient = getPublicClientWithRpc(chainId); + + let longTokenTransferGasLimit = 0n; + let longTokenTransferNativeFee = 0n; + + const outputLongToken = getToken(chainId, outputLongTokenAddress); + const outputLongTokenUnwrappedAddress = convertTokenAddress(chainId, outputLongTokenAddress, "native"); + const outputLongTokenStargate = getStargatePoolAddress(chainId, outputLongTokenUnwrappedAddress); + + if (!outputLongTokenStargate) { + throw new Error(`Output long token stargate not found: ${outputLongTokenAddress}`); + } + + const someAmount = expandDecimals(1, outputLongToken.decimals) / 100n; + + const sendParams: SendParam = getMultichainTransferSendParams({ + dstChainId: srcChainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD: someAmount, + isToGmx: false, + }); + + const quoteSend = await settlementChainClient.readContract({ + address: outputLongTokenStargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }); + + let longNativeValue = quoteSend.nativeFee; + if (outputLongTokenUnwrappedAddress === zeroAddress) { + longNativeValue += someAmount; + } + + longTokenTransferGasLimit = await settlementChainClient + .estimateContractGas({ + address: outputLongTokenStargate, + abi: abis.IStargate, + functionName: "sendToken", + args: [sendParams, quoteSend, RANDOM_WALLET.address], + value: longNativeValue, + stateOverride: [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: outputLongTokenAddress, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + let shortTokenTransferGasLimit = 0n; + let shortTokenTransferNativeFee = 0n; + if (outputShortTokenAddress !== outputLongTokenAddress) { + const outputShortToken = getToken(chainId, outputShortTokenAddress); + const outputShortTokenUnwrappedAddress = convertTokenAddress(chainId, outputShortTokenAddress, "native"); + const outputShortTokenStargate = getStargatePoolAddress(chainId, outputShortTokenUnwrappedAddress); + + if (!outputShortTokenStargate) { + throw new Error("Output short token stargate not found"); + } + + const someAmount = expandDecimals(1, outputShortToken.decimals) / 100n; + + const secondarySendParams: SendParam = getMultichainTransferSendParams({ + dstChainId: srcChainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD: someAmount, + isToGmx: false, + }); + + // console.log({ outputShortTokenStargate , }); + + const secondaryQuoteSend = await settlementChainClient.readContract({ + address: outputShortTokenStargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [secondarySendParams, false], + }); + + let secondaryNativeValue = secondaryQuoteSend.nativeFee; + if (outputShortTokenUnwrappedAddress === zeroAddress) { + secondaryNativeValue += someAmount; + } + + shortTokenTransferGasLimit = await settlementChainClient + .estimateContractGas({ + address: outputShortTokenStargate, + abi: abis.IStargate, + functionName: "sendToken", + args: [secondarySendParams, secondaryQuoteSend, RANDOM_WALLET.address], + value: secondaryNativeValue, + stateOverride: [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: outputShortTokenAddress, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + shortTokenTransferNativeFee = secondaryQuoteSend.nativeFee; + } + + return { + longTokenTransferGasLimit, + longTokenTransferNativeFee, + shortTokenTransferGasLimit, + shortTokenTransferNativeFee, + }; +} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts new file mode 100644 index 0000000000..c0e2d556e5 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts @@ -0,0 +1,181 @@ +import { SettlementChainId, SourceChainId } from "config/chains"; +import { getMappedTokenId, RANDOM_WALLET } from "config/multichain"; +import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; +import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; +import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; +import { getContract } from "sdk/configs/contracts"; +import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; +import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; +import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; +import { buildReverseSwapStrategy } from "sdk/utils/swap/buildSwapStrategy"; +import { nowInSeconds } from "sdk/utils/time"; + +import { getRawRelayerParams } from "../../express"; +import { GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express/types"; +import { signCreateWithdrawal } from "../signCreateWithdrawal"; +import { CreateWithdrawalParams } from "../types"; + +export async function estimateWithdrawalPlatformTokenTransferInFees({ + chainId, + srcChainId, + marketTokenAmount, + fullWntFee, + params, + secondaryOrPrimaryOutputTokenAddress, + globalExpressParams, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + marketTokenAmount: bigint; + fullWntFee: bigint; + params: CreateWithdrawalParams; + secondaryOrPrimaryOutputTokenAddress: string; + globalExpressParams: GlobalExpressParams; +}): Promise<{ + platformTokenTransferInGasLimit: bigint; + platformTokenTransferInNativeFee: bigint; + platformTokenTransferInComposeGas: bigint; + relayParamsPayload: RelayParamsPayload; +}> { + const settlementWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; + + // const marketConfig = MARKETS[chainId][marketAddress]; + + // By default pay with short token + // const feeTokenAddress = isShortTokenBeingTransferred ? marketConfig.shortTokenAddress : marketConfig.longTokenAddress; + + const feeSwapStrategy = buildReverseSwapStrategy({ + chainId, + amountOut: fullWntFee, + tokenIn: globalExpressParams.tokensData[secondaryOrPrimaryOutputTokenAddress], + tokenOut: settlementWrappedTokenData, + marketsInfoData: globalExpressParams.marketsInfoData, + swapOptimizationOrder: ["length"], + externalSwapQuoteParams: undefined, + isAtomicSwap: true, + }); + + const returnRawRelayParamsPayload: RawRelayParamsPayload = + convertTokenAddress(chainId, secondaryOrPrimaryOutputTokenAddress, "wrapped") === settlementWrappedTokenData.address + ? getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: settlementWrappedTokenData.address, + relayerFeeTokenAddress: settlementWrappedTokenData.address, + feeParams: { + feeToken: settlementWrappedTokenData.address, + feeAmount: fullWntFee, + feeSwapPath: [], + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }) + : getRawRelayerParams({ + chainId, + gasPaymentTokenAddress: feeSwapStrategy.swapPathStats!.tokenInAddress, + relayerFeeTokenAddress: feeSwapStrategy.swapPathStats!.tokenOutAddress, + feeParams: { + feeToken: feeSwapStrategy.swapPathStats!.tokenInAddress, + feeAmount: feeSwapStrategy.amountIn, + feeSwapPath: feeSwapStrategy.swapPathStats!.swapPath, + }, + externalCalls: getEmptyExternalCallsPayload(), + tokenPermits: [], + }); + + const returnRelayParamsPayload: RelayParamsPayload = { + ...returnRawRelayParamsPayload, + deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), + }; + + const vaultAddress = getContract(chainId, "WithdrawalVault"); + const transferRequests = getTransferRequests([ + { + to: vaultAddress, + token: params.addresses.market, + amount: marketTokenAmount, + }, + ]); + + const signature = await signCreateWithdrawal({ + chainId, + srcChainId, + signer: RANDOM_WALLET, + relayParams: returnRelayParamsPayload, + transferRequests, + params, + shouldUseSignerMethod: true, + }); + + const action: MultichainAction = { + actionType: MultichainActionType.Withdrawal, + actionData: { + relayParams: returnRelayParamsPayload, + transferRequests, + params, + signature, + }, + }; + + const composeGas = await estimateMultichainDepositNetworkComposeGas({ + action, + chainId, + account: RANDOM_WALLET.address, + srcChainId, + tokenAddress: params.addresses.market, + settlementChainPublicClient: getPublicClientWithRpc(chainId), + }); + + const returnTransferSendParams = getMultichainTransferSendParams({ + dstChainId: chainId, + account: RANDOM_WALLET.address, + srcChainId, + amountLD: marketTokenAmount, + isToGmx: true, + // TODO MLTCH check that all gm and glv transfers are manual gas + isManualGas: true, + action, + composeGas, + }); + + const sourceChainClient = getPublicClientWithRpc(srcChainId); + const sourceChainTokenId = getMappedTokenId(chainId, params.addresses.market, srcChainId); + if (!sourceChainTokenId) { + throw new Error("Source chain token ID not found"); + } + + const platformTokenTransferInQuoteSend = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [returnTransferSendParams, false], + }); + + // No need to quote OFT because we are using our own contracts that do not apply any fees + + const platformTokenTransferInNativeFee = platformTokenTransferInQuoteSend.nativeFee; + + // The txn of stargate itself what will it take + const platformTokenTransferInGasLimit = await sourceChainClient + .estimateContractGas({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "send", + account: params.addresses.receiver, + args: [returnTransferSendParams, platformTokenTransferInQuoteSend, params.addresses.receiver], + value: platformTokenTransferInQuoteSend.nativeFee, + // No need to override state because we are using the users account on source chain + // where tokens already are an initial state + }) + .then(applyGasLimitBuffer); + + return { + platformTokenTransferInGasLimit, + platformTokenTransferInNativeFee, + platformTokenTransferInComposeGas: composeGas, + relayParamsPayload: returnRelayParamsPayload, + }; +} diff --git a/src/domain/synthetics/markets/signCreateDeposit.ts b/src/domain/synthetics/markets/signCreateDeposit.ts index c2493ab4e1..9d43e765e5 100644 --- a/src/domain/synthetics/markets/signCreateDeposit.ts +++ b/src/domain/synthetics/markets/signCreateDeposit.ts @@ -1,4 +1,4 @@ -import type { Wallet } from "ethers"; +import type { AbstractSigner, Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; @@ -6,7 +6,7 @@ import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { CreateDepositParamsStruct } from "."; +import type { CreateDepositParams } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; import type { RelayParamsPayload } from "../express/types"; @@ -17,13 +17,15 @@ export async function signCreateDeposit({ relayParams, transferRequests, params, + shouldUseSignerMethod, }: { - signer: WalletSigner | Wallet; + signer: WalletSigner | Wallet | AbstractSigner; relayParams: RelayParamsPayload; transferRequests: TransferRequests; - params: CreateDepositParamsStruct; + params: CreateDepositParams; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; + shouldUseSignerMethod?: boolean; }) { const types = { CreateDeposit: [ @@ -64,5 +66,5 @@ export async function signCreateDeposit({ relayParams: hashRelayParams(relayParams), }; - return signTypedData({ signer, domain, types, typedData }); + return signTypedData({ signer, domain, types, typedData, shouldUseSignerMethod }); } diff --git a/src/domain/synthetics/markets/signCreateGlvDeposit.ts b/src/domain/synthetics/markets/signCreateGlvDeposit.ts index d1378a26c1..81b4351044 100644 --- a/src/domain/synthetics/markets/signCreateGlvDeposit.ts +++ b/src/domain/synthetics/markets/signCreateGlvDeposit.ts @@ -1,10 +1,11 @@ +import { AbstractSigner } from "ethers"; + import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; import { TransferRequests } from "domain/multichain/types"; -import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { CreateGlvDepositParamsStruct } from "."; +import type { CreateGlvDepositParams } from "."; import { getGelatoRelayRouterDomain, hashRelayParams, RelayParamsPayload } from "../express"; export function signCreateGlvDeposit({ @@ -14,13 +15,15 @@ export function signCreateGlvDeposit({ relayParams, transferRequests, params, + shouldUseSignerMethod, }: { chainId: ContractsChainId; srcChainId: SourceChainId | undefined; - signer: WalletSigner; + signer: AbstractSigner; relayParams: RelayParamsPayload; transferRequests: TransferRequests; - params: CreateGlvDepositParamsStruct; + params: CreateGlvDepositParams; + shouldUseSignerMethod?: boolean; }) { const types = { CreateGlvDeposit: [ @@ -64,5 +67,5 @@ export function signCreateGlvDeposit({ relayParams: hashRelayParams(relayParams), }; - return signTypedData({ signer, domain, types, typedData }); + return signTypedData({ signer, domain, types, typedData, shouldUseSignerMethod }); } diff --git a/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts index b27b3dbf56..5fbed3cbe1 100644 --- a/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts +++ b/src/domain/synthetics/markets/signCreateGlvWithdrawal.ts @@ -3,10 +3,11 @@ import type { Wallet } from "ethers"; import type { ContractsChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; import { TransferRequests } from "domain/multichain/types"; +import { ISigner } from "lib/transactions/iSigner"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { CreateWithdrawalParamsStruct } from "."; +import type { CreateWithdrawalParams } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; import type { RelayParamsPayload } from "../express/types"; @@ -18,10 +19,10 @@ export async function signCreateGlvWithdrawal({ transferRequests, params, }: { - signer: WalletSigner | Wallet; + signer: WalletSigner | Wallet | ISigner; relayParams: RelayParamsPayload; transferRequests: TransferRequests; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; }) { diff --git a/src/domain/synthetics/markets/signCreateWithdrawal.ts b/src/domain/synthetics/markets/signCreateWithdrawal.ts index 8f04cc82e6..02a11a7cb8 100644 --- a/src/domain/synthetics/markets/signCreateWithdrawal.ts +++ b/src/domain/synthetics/markets/signCreateWithdrawal.ts @@ -6,7 +6,7 @@ import { TransferRequests } from "domain/multichain/types"; import type { WalletSigner } from "lib/wallets"; import { signTypedData } from "lib/wallets/signing"; -import type { CreateWithdrawalParamsStruct } from "."; +import type { CreateWithdrawalParams } from "."; import { getGelatoRelayRouterDomain, hashRelayParams } from "../express/relayParamsUtils"; import type { RelayParamsPayload } from "../express/types"; @@ -17,13 +17,15 @@ export async function signCreateWithdrawal({ relayParams, transferRequests, params, + shouldUseSignerMethod = false, }: { signer: AbstractSigner | WalletSigner | Wallet; relayParams: RelayParamsPayload; transferRequests: TransferRequests; - params: CreateWithdrawalParamsStruct; + params: CreateWithdrawalParams; chainId: ContractsChainId; srcChainId: SourceChainId | undefined; + shouldUseSignerMethod?: boolean; }) { const types = { CreateWithdrawal: [ @@ -64,5 +66,5 @@ export async function signCreateWithdrawal({ relayParams: hashRelayParams(relayParams), }; - return signTypedData({ signer, domain, types, typedData }); + return signTypedData({ signer, domain, types, typedData, shouldUseSignerMethod }); } diff --git a/src/domain/synthetics/markets/types.ts b/src/domain/synthetics/markets/types.ts index 48bf010e11..2847201c6e 100644 --- a/src/domain/synthetics/markets/types.ts +++ b/src/domain/synthetics/markets/types.ts @@ -63,7 +63,7 @@ export type ClaimableFundingData = { [marketAddress: string]: ClaimableFunding; }; -export type CreateDepositParamsAddressesStruct = { +export type CreateDepositParamsAddresses = { receiver: string; callbackContract: string; uiFeeReceiver: string; @@ -74,8 +74,8 @@ export type CreateDepositParamsAddressesStruct = { shortTokenSwapPath: string[]; }; -export type CreateDepositParamsStruct = { - addresses: CreateDepositParamsAddressesStruct; +export type CreateDepositParams = { + addresses: CreateDepositParamsAddresses; minMarketTokens: bigint; shouldUnwrapNativeToken: boolean; executionFee: bigint; @@ -83,7 +83,9 @@ export type CreateDepositParamsStruct = { dataList: string[]; }; -export type CreateGlvDepositAddressesStruct = { +export type RawCreateDepositParams = Omit; + +export type CreateGlvDepositAddresses = { glv: string; market: string; receiver: string; @@ -95,8 +97,8 @@ export type CreateGlvDepositAddressesStruct = { shortTokenSwapPath: string[]; }; -export type CreateGlvDepositParamsStruct = { - addresses: CreateGlvDepositAddressesStruct; +export type CreateGlvDepositParams = { + addresses: CreateGlvDepositAddresses; minGlvTokens: bigint; executionFee: bigint; callbackGasLimit: bigint; @@ -105,7 +107,9 @@ export type CreateGlvDepositParamsStruct = { dataList: string[]; }; -export type CreateWithdrawalAddressesStruct = { +export type RawCreateGlvDepositParams = Omit; + +export type CreateWithdrawalAddresses = { receiver: string; callbackContract: string; uiFeeReceiver: string; @@ -114,8 +118,8 @@ export type CreateWithdrawalAddressesStruct = { shortTokenSwapPath: string[]; }; -export type CreateWithdrawalParamsStruct = { - addresses: CreateWithdrawalAddressesStruct; +export type CreateWithdrawalParams = { + addresses: CreateWithdrawalAddresses; minLongTokenAmount: bigint; minShortTokenAmount: bigint; shouldUnwrapNativeToken: boolean; @@ -124,7 +128,9 @@ export type CreateWithdrawalParamsStruct = { dataList: string[]; }; -export type CreateGlvWithdrawalAddressesStruct = { +export type RawCreateWithdrawalParams = Omit; + +export type CreateGlvWithdrawalAddresses = { receiver: string; callbackContract: string; uiFeeReceiver: string; @@ -134,8 +140,8 @@ export type CreateGlvWithdrawalAddressesStruct = { shortTokenSwapPath: string[]; }; -export type CreateGlvWithdrawalParamsStruct = { - addresses: CreateGlvWithdrawalAddressesStruct; +export type CreateGlvWithdrawalParams = { + addresses: CreateGlvWithdrawalAddresses; minLongTokenAmount: bigint; minShortTokenAmount: bigint; shouldUnwrapNativeToken: boolean; @@ -143,3 +149,5 @@ export type CreateGlvWithdrawalParamsStruct = { callbackGasLimit: bigint; dataList: string[]; }; + +export type RawCreateGlvWithdrawalParams = Omit; diff --git a/src/domain/synthetics/markets/useMarketTokensData.ts b/src/domain/synthetics/markets/useMarketTokensData.ts index 6c9c79c38f..bc5f3a2cc5 100644 --- a/src/domain/synthetics/markets/useMarketTokensData.ts +++ b/src/domain/synthetics/markets/useMarketTokensData.ts @@ -1,3 +1,4 @@ +import mapValues from "lodash/mapValues"; import { useMemo } from "react"; import { getExplorerUrl } from "config/chains"; @@ -24,6 +25,8 @@ import { FREQUENT_MULTICALL_REFRESH_INTERVAL } from "lib/timeConstants"; import type { ContractsChainId, SourceChainId } from "sdk/configs/chains"; import { getTokenBySymbol } from "sdk/configs/tokens"; +import { useMultichainMarketTokensBalancesRequest } from "components/GmxAccountModal/hooks"; + import { isGlvEnabled } from "./glv"; import { GlvInfoData } from "./types"; import { useMarkets } from "./useMarkets"; @@ -44,12 +47,26 @@ export function useMarketTokensDataRequest( * @default true */ withGlv?: boolean; + enabled?: boolean; + withMultichainBalances?: boolean; } ): MarketTokensDataResult { - const { isDeposit, account, glvData = {}, withGlv = true } = p; - const { tokensData } = useTokensDataRequest(chainId, srcChainId); + const { isDeposit, account, glvData = {}, withGlv = true, enabled = true, withMultichainBalances = false } = p; + const { tokensData } = useTokensDataRequest(chainId, srcChainId, { + enabled: enabled, + }); const { marketsData, marketsAddresses } = useMarkets(chainId); const { resetTokensBalancesUpdates } = useTokensBalancesUpdates(); + const marketTokensMultichainBalancesResult = useMultichainMarketTokensBalancesRequest({ + chainId, + account, + enabled: enabled && withMultichainBalances && srcChainId !== undefined, + specificChainId: srcChainId, + }); + + // useEffect(() => { + // console.log({ marketTokensMultichainBalancesResult }); + // }, [marketTokensMultichainBalancesResult]); let isGlvTokensLoaded; @@ -62,7 +79,7 @@ export function useMarketTokensDataRequest( const isDataLoaded = tokensData && marketsAddresses?.length && isGlvTokensLoaded; const { data: marketTokensData } = useMulticall(chainId, "useMarketTokensData", { - key: isDataLoaded ? [account, marketsAddresses.join("-")] : undefined, + key: isDataLoaded && enabled ? [account, marketsAddresses.join("-")] : undefined, refreshInterval: FREQUENT_MULTICALL_REFRESH_INTERVAL, clearUnusedKeys: true, @@ -171,6 +188,7 @@ export function useMarketTokensDataRequest( account && gmxAccountData?.balance?.returnValues ? BigInt(gmxAccountData?.balance?.returnValues[0]) : undefined; + const balance = srcChainId !== undefined ? gmxAccountBalance : walletBalance; marketTokensMap[marketAddress] = { @@ -183,6 +201,7 @@ export function useMarketTokensDataRequest( totalSupply: BigInt(tokenData?.totalSupply.returnValues[0]), walletBalance, gmxAccountBalance, + // sourceChainBalance, balanceType: getBalanceTypeFromSrcChainId(srcChainId), balance, explorerUrl: `${getExplorerUrl(chainId)}/token/${marketAddress}`, @@ -196,7 +215,20 @@ export function useMarketTokensDataRequest( const gmAndGlvMarketTokensData = useMemo(() => { if (!marketTokensData || !glvData || Object.values(glvData).length === 0 || !withGlv) { - return marketTokensData; + if (!marketTokensData) { + return undefined; + } + + if (!withMultichainBalances || !marketTokensMultichainBalancesResult.isLoading) { + return marketTokensData; + } + + return mapValues(marketTokensData, (marketToken) => { + return { + ...marketToken, + sourceChainBalance: marketTokensMultichainBalancesResult.tokenBalances[marketToken.address], + }; + }); } const result = { ...marketTokensData }; @@ -204,8 +236,24 @@ export function useMarketTokensDataRequest( result[glvMarket.glvTokenAddress] = glvMarket.glvToken; }); + if (withMultichainBalances && !marketTokensMultichainBalancesResult.isLoading) { + return mapValues(result, (marketToken) => { + return { + ...marketToken, + sourceChainBalance: marketTokensMultichainBalancesResult.tokenBalances[marketToken.address], + }; + }); + } + return result; - }, [marketTokensData, glvData, withGlv]); + }, [ + marketTokensData, + glvData, + withGlv, + withMultichainBalances, + marketTokensMultichainBalancesResult.isLoading, + marketTokensMultichainBalancesResult.tokenBalances, + ]); const updatedGmAndGlvMarketTokensData = useUpdatedTokensBalances(gmAndGlvMarketTokensData); @@ -217,7 +265,7 @@ export function useMarketTokensDataRequest( export function useMarketTokensData( chainId: ContractsChainId, srcChainId: SourceChainId | undefined, - p: { isDeposit: boolean; withGlv?: boolean; glvData?: GlvInfoData } + p: { isDeposit: boolean; withGlv?: boolean; glvData?: GlvInfoData; enabled?: boolean } ): MarketTokensDataResult { const { isDeposit } = p; const account = useSelector((s) => s.globals.account); @@ -231,5 +279,6 @@ export function useMarketTokensData( account, glvData: glvData, withGlv: glvs?.length ? p.withGlv : false, + enabled: p.enabled, }); } diff --git a/src/domain/synthetics/tokens/useOnchainTokenConfigs.ts b/src/domain/synthetics/tokens/useOnchainTokenConfigs.ts index 747c22a0b0..4ff27d9c54 100644 --- a/src/domain/synthetics/tokens/useOnchainTokenConfigs.ts +++ b/src/domain/synthetics/tokens/useOnchainTokenConfigs.ts @@ -6,11 +6,12 @@ import { useMulticall } from "lib/multicall"; import type { ContractsChainId } from "sdk/configs/chains"; import { getV2Tokens, getWrappedToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; -export function useOnchainTokenConfigs(chainId: ContractsChainId) { +export function useOnchainTokenConfigs(chainId: ContractsChainId, params?: { enabled?: boolean }) { + const { enabled = true } = params ?? {}; const tokens = getV2Tokens(chainId); const { data, error } = useMulticall(chainId, "useOnchainTokenConfigs", { - key: [], + key: enabled ? [] : undefined, refreshInterval: null, diff --git a/src/domain/synthetics/tokens/useTokenRecentPricesData.ts b/src/domain/synthetics/tokens/useTokenRecentPricesData.ts index 72fb946c4a..ff2766740b 100644 --- a/src/domain/synthetics/tokens/useTokenRecentPricesData.ts +++ b/src/domain/synthetics/tokens/useTokenRecentPricesData.ts @@ -17,7 +17,8 @@ export type TokenPricesDataResult = { isPriceDataLoading: boolean; }; -export function useTokenRecentPricesRequest(chainId: number): TokenPricesDataResult { +export function useTokenRecentPricesRequest(chainId: number, params?: { enabled?: boolean }): TokenPricesDataResult { + const { enabled = true } = params ?? {}; const oracleKeeperFetcher = useOracleKeeperFetcher(chainId); const pathname = useLocation().pathname; @@ -28,44 +29,47 @@ export function useTokenRecentPricesRequest(chainId: number): TokenPricesDataRes : PRICES_UPDATE_INTERVAL; }, [pathname]); - const { data, error, isLoading } = useSequentialTimedSWR([chainId, oracleKeeperFetcher.url, "useTokenRecentPrices"], { - refreshInterval: refreshPricesInterval, - keepPreviousData: true, + const { data, error, isLoading } = useSequentialTimedSWR( + enabled ? [chainId, oracleKeeperFetcher.url, "useTokenRecentPrices"] : undefined, + { + refreshInterval: refreshPricesInterval, + keepPreviousData: true, - fetcher: ([chainId]) => - oracleKeeperFetcher.fetchTickers().then((priceItems) => { - const result: TokenPricesData = {}; + fetcher: ([chainId]) => + oracleKeeperFetcher.fetchTickers().then((priceItems) => { + const result: TokenPricesData = {}; - priceItems.forEach((priceItem) => { - let tokenConfig: Token; + priceItems.forEach((priceItem) => { + let tokenConfig: Token; - try { - tokenConfig = getToken(chainId, priceItem.tokenAddress); - } catch (e) { - // ignore unknown token errors + try { + tokenConfig = getToken(chainId, priceItem.tokenAddress); + } catch (e) { + // ignore unknown token errors - return; - } + return; + } - result[tokenConfig.address] = { - minPrice: parseContractPrice(BigInt(priceItem.minPrice), tokenConfig.decimals), - maxPrice: parseContractPrice(BigInt(priceItem.maxPrice), tokenConfig.decimals), - }; - }); + result[tokenConfig.address] = { + minPrice: parseContractPrice(BigInt(priceItem.minPrice), tokenConfig.decimals), + maxPrice: parseContractPrice(BigInt(priceItem.maxPrice), tokenConfig.decimals), + }; + }); - const wrappedToken = getWrappedToken(chainId); + const wrappedToken = getWrappedToken(chainId); - if (result[wrappedToken.address] && !result[NATIVE_TOKEN_ADDRESS]) { - result[NATIVE_TOKEN_ADDRESS] = result[wrappedToken.address]; - } + if (result[wrappedToken.address] && !result[NATIVE_TOKEN_ADDRESS]) { + result[NATIVE_TOKEN_ADDRESS] = result[wrappedToken.address]; + } - return { - pricesData: result, - updatedAt: Date.now(), - }; - }), - refreshWhenHidden: true, - }); + return { + pricesData: result, + updatedAt: Date.now(), + }; + }), + refreshWhenHidden: true, + } + ); return { pricesData: data?.pricesData, diff --git a/src/domain/synthetics/tokens/useTokensDataRequest.ts b/src/domain/synthetics/tokens/useTokensDataRequest.ts index 6225139da5..99ab843a35 100644 --- a/src/domain/synthetics/tokens/useTokensDataRequest.ts +++ b/src/domain/synthetics/tokens/useTokensDataRequest.ts @@ -23,18 +23,32 @@ export type TokensDataResult = { error: Error | undefined; }; -export function useTokensDataRequest(chainId: ContractsChainId, srcChainId?: SourceChainId): TokensDataResult { +export function useTokensDataRequest( + chainId: ContractsChainId, + srcChainId?: SourceChainId, + params?: { enabled?: boolean } +): TokensDataResult { const tokenConfigs = getTokensMap(chainId); - const { balancesData: walletBalancesData, error: walletBalancesError } = useTokenBalances(chainId); - const { balancesData: gmxAccountBalancesData, error: gmxAccountBalancesError } = useGmxAccountTokenBalances(chainId); - const { pricesData, updatedAt: pricesUpdatedAt, error: pricesError } = useTokenRecentPricesRequest(chainId); - const { data: onchainConfigsData, error: onchainConfigsError } = useOnchainTokenConfigs(chainId); + const { balancesData: walletBalancesData, error: walletBalancesError } = useTokenBalances(chainId, { + enabled: params?.enabled, + }); + const { balancesData: gmxAccountBalancesData, error: gmxAccountBalancesError } = useGmxAccountTokenBalances(chainId, { + enabled: params?.enabled, + }); + const { + pricesData, + updatedAt: pricesUpdatedAt, + error: pricesError, + } = useTokenRecentPricesRequest(chainId, { + enabled: params?.enabled, + }); + const { data: onchainConfigsData, error: onchainConfigsError } = useOnchainTokenConfigs(chainId, { + enabled: params?.enabled, + }); const error = walletBalancesError || pricesError || onchainConfigsError || gmxAccountBalancesError; return useMemo((): TokensDataResult => { - const tokenAddresses = getV2Tokens(chainId).map((token) => token.address); - if (!pricesData) { return { tokensData: undefined, @@ -46,6 +60,8 @@ export function useTokensDataRequest(chainId: ContractsChainId, srcChainId?: Sou }; } + const tokenAddresses = getV2Tokens(chainId).map((token) => token.address); + const isWalletBalancesLoaded = Boolean(walletBalancesData); const isGmxAccountBalancesLoaded = Boolean(gmxAccountBalancesData); diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index 6de2f978eb..625452ed9b 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -1,8 +1,9 @@ import { t } from "@lingui/macro"; import { ethers } from "ethers"; -import { IS_NETWORK_DISABLED, getChainName } from "config/chains"; +import { ContractsChainId, IS_NETWORK_DISABLED, SourceChainId, getChainName } from "config/chains"; import { BASIS_POINTS_DIVISOR, BASIS_POINTS_DIVISOR_BIGINT, USD_DECIMALS } from "config/factors"; +import { getMappedTokenId } from "config/multichain"; import { ExpressTxnParams } from "domain/synthetics/express/types"; import { GlvInfo, @@ -18,7 +19,7 @@ import { import { PositionInfo, willPositionCollateralBeSufficientForPosition } from "domain/synthetics/positions"; import { TokenData, TokensData, TokensRatio, getIsEquivalentTokens } from "domain/synthetics/tokens"; import { DUST_USD, isAddressZero } from "lib/legacy"; -import { PRECISION, expandDecimals, formatAmount, formatUsd } from "lib/numbers"; +import { PRECISION, adjustForDecimals, expandDecimals, formatAmount, formatUsd } from "lib/numbers"; import { getByKey } from "lib/objects"; import { NATIVE_TOKEN_ADDRESS, getToken } from "sdk/configs/tokens"; import { MAX_TWAP_NUMBER_OF_PARTS, MIN_TWAP_NUMBER_OF_PARTS } from "sdk/configs/twap"; @@ -666,6 +667,8 @@ export function getGmSwapError(p: { isMarketTokenDeposit?: boolean; paySource: GmPaySource; isPair: boolean; + chainId: ContractsChainId; + srcChainId: SourceChainId | undefined; }) { const { isDeposit, @@ -690,6 +693,8 @@ export function getGmSwapError(p: { isMarketTokenDeposit, paySource, isPair, + chainId, + srcChainId, } = p; if (!marketInfo || !marketToken) { @@ -780,6 +785,35 @@ export function getGmSwapError(p: { return [t`Enter an amount`]; } + let marketTokenBalance = 0n; + // let glvTokenBalance = 0n; + if (paySource === "settlementChain") { + marketTokenBalance = marketToken?.walletBalance ?? 0n; + // glvTokenBalance = glvToken?.walletBalance ?? 0n; + } else if (paySource === "sourceChain") { + if (srcChainId) { + if (marketToken) { + const mappedTokenId = getMappedTokenId(chainId as SourceChainId, marketToken.address, srcChainId); + if (mappedTokenId) { + marketTokenBalance = + adjustForDecimals(marketToken?.sourceChainBalance ?? 0n, marketToken?.decimals, mappedTokenId.decimals) ?? + 0n; + } + } + + // if (glvToken) { + // const mappedTokenId = getMappedTokenId(chainId as SourceChainId, glvToken.address, srcChainId); + // if (mappedTokenId) { + // glvTokenBalance = + // adjustForDecimals(glvToken.sourceChainBalance ?? 0n, glvToken.decimals, mappedTokenId.decimals) ?? 0n; + // } + // } + } + } else if (paySource === "gmxAccount") { + marketTokenBalance = marketToken?.gmxAccountBalance ?? 0n; + // glvTokenBalance = glvToken?.gmxAccountBalance ?? 0n; + } + if (isDeposit) { if (marketInfo.isSameCollaterals) { if ((longTokenAmount ?? 0n) + (shortTokenAmount ?? 0n) > (longToken?.balance ?? 0n)) { @@ -796,7 +830,7 @@ export function getGmSwapError(p: { } if (glvInfo) { - if (isMarketTokenDeposit && marketToken && (marketTokenAmount ?? 0n) > (marketToken?.balance ?? 0n)) { + if (isMarketTokenDeposit && marketToken && (marketTokenAmount ?? 0n) > marketTokenBalance) { return [t`Insufficient GM balance`]; } @@ -827,7 +861,7 @@ export function getGmSwapError(p: { return [t`Insufficient ${glvToken?.symbol} balance`]; } } else { - if (marketTokenAmount > (marketToken?.balance ?? 0n)) { + if (marketTokenAmount > marketTokenBalance) { return [t`Insufficient ${marketToken?.symbol} balance`]; } } diff --git a/src/lib/errors/additionalValidation.ts b/src/lib/errors/additionalValidation.ts index 6fa3a64757..0753f0948f 100644 --- a/src/lib/errors/additionalValidation.ts +++ b/src/lib/errors/additionalValidation.ts @@ -3,6 +3,7 @@ import { BaseContract, Overrides, Provider, TransactionRequest } from "ethers"; import { ErrorLike, parseError } from "lib/errors"; import { ErrorEvent } from "lib/metrics"; import { emitMetricEvent } from "lib/metrics/emitMetricEvent"; +import { ISigner, ISignerSendTransactionParams } from "lib/transactions/iSigner"; import { ErrorPattern } from "sdk/utils/errors/transactionsErrors"; import { mustNeverExist } from "sdk/utils/types"; @@ -39,7 +40,7 @@ export function getAdditionalValidationType(error: Error) { return undefined; } -export function getEstimateGasError(provider: Provider, txnData: TransactionRequest) { +export function getEstimateGasError(provider: Provider | ISigner, txnData: TransactionRequest) { return provider .estimateGas(txnData) .then(() => { @@ -53,7 +54,7 @@ export function getEstimateGasError(provider: Provider, txnData: TransactionRequ export async function getCallStaticError( chainId: number, - provider: Provider, + provider: Provider | ISigner, txnData?: TransactionRequest, txnHash?: string ): Promise<{ error?: ErrorLike; txnData?: TransactionRequest }> { @@ -97,8 +98,8 @@ export async function getCallStaticError( export async function additionalTxnErrorValidation( error: Error, chainId: number, - provider: Provider, - txnData: TransactionRequest + provider: Provider | ISigner, + txnData: ISignerSendTransactionParams ) { const additionalValidationType = getAdditionalValidationType(error); diff --git a/src/lib/gas/estimateGasLimit.ts b/src/lib/gas/estimateGasLimit.ts index 27df311180..7f51b8f5d0 100644 --- a/src/lib/gas/estimateGasLimit.ts +++ b/src/lib/gas/estimateGasLimit.ts @@ -1,11 +1,12 @@ import type { Provider } from "ethers"; import { extendError } from "lib/errors"; +import { ISigner } from "lib/transactions/iSigner"; const MIN_GAS_LIMIT = 22000n; export async function estimateGasLimit( - provider: Provider, + provider: Provider | ISigner, txnParams: { to: string; data: string; diff --git a/src/lib/metrics/utils.ts b/src/lib/metrics/utils.ts index ab10348577..f451b98876 100644 --- a/src/lib/metrics/utils.ts +++ b/src/lib/metrics/utils.ts @@ -507,7 +507,8 @@ export function initGMSwapMetricData({ longTokenAddress, shortTokenAddress, isDeposit, - executionFee, + executionFeeTokenAmount, + executionFeeTokenDecimals, marketInfo, marketToken, longTokenAmount, @@ -521,7 +522,8 @@ export function initGMSwapMetricData({ shortTokenAddress: string | undefined; marketToken: TokenData | undefined; isDeposit: boolean; - executionFee: ExecutionFee | undefined; + executionFeeTokenAmount: bigint | undefined; + executionFeeTokenDecimals: number | undefined; marketInfo: MarketInfo | undefined; longTokenAmount: bigint | undefined; shortTokenAmount: bigint | undefined; @@ -533,7 +535,7 @@ export function initGMSwapMetricData({ return metrics.setCachedMetricData({ metricId: getGMSwapMetricId({ marketAddress: marketInfo?.marketTokenAddress, - executionFee: executionFee?.feeTokenAmount, + executionFee: executionFeeTokenAmount, }), metricType: isDeposit ? "buyGM" : "sellGM", requestId: getRequestId(), @@ -541,7 +543,7 @@ export function initGMSwapMetricData({ initialShortTokenAddress: shortTokenAddress, marketAddress: marketInfo?.marketTokenAddress, marketName: marketInfo?.name, - executionFee: formatAmountForMetrics(executionFee?.feeTokenAmount, executionFee?.feeToken.decimals), + executionFee: formatAmountForMetrics(executionFeeTokenAmount, executionFeeTokenDecimals), longTokenAmount: formatAmountForMetrics( longTokenAmount, longTokenAddress ? getToken(chainId, longTokenAddress)?.decimals : undefined @@ -561,7 +563,8 @@ export function initGLVSwapMetricData({ longTokenAddress, shortTokenAddress, isDeposit, - executionFee, + executionFeeTokenAmount, + executionFeeTokenDecimals, marketName, glvAddress, selectedMarketForGlv, @@ -577,7 +580,8 @@ export function initGLVSwapMetricData({ shortTokenAddress: string | undefined; selectedMarketForGlv: string | undefined; isDeposit: boolean; - executionFee: ExecutionFee | undefined; + executionFeeTokenAmount: bigint | undefined; + executionFeeTokenDecimals: number | undefined; marketName: string | undefined; glvAddress: string | undefined; longTokenAmount: bigint | undefined; @@ -591,7 +595,7 @@ export function initGLVSwapMetricData({ return metrics.setCachedMetricData({ metricId: getGLVSwapMetricId({ glvAddress, - executionFee: executionFee?.feeTokenAmount, + executionFee: executionFeeTokenAmount, }), metricType: isDeposit ? "buyGLV" : "sellGLV", requestId: getRequestId(), @@ -600,7 +604,7 @@ export function initGLVSwapMetricData({ glvAddress, selectedMarketForGlv, marketName, - executionFee: formatAmountForMetrics(executionFee?.feeTokenAmount, executionFee?.feeToken.decimals), + executionFee: formatAmountForMetrics(executionFeeTokenAmount, executionFeeTokenDecimals), longTokenAmount: formatAmountForMetrics( longTokenAmount, longTokenAddress ? getToken(chainId, longTokenAddress)?.decimals : undefined diff --git a/src/lib/tenderly.tsx b/src/lib/tenderly.tsx index 05a3e9c5b4..3920ecd1c3 100644 --- a/src/lib/tenderly.tsx +++ b/src/lib/tenderly.tsx @@ -1,4 +1,5 @@ import { BaseContract, Provider } from "ethers"; +import { numberToHex, type StateOverride } from "viem"; import { isDevelopment } from "config/env"; @@ -9,8 +10,9 @@ import { estimateGasLimit } from "./gas/estimateGasLimit"; import { GasPriceData, getGasPrice } from "./gas/gasPrice"; import { helperToast } from "./helperToast"; import { getProvider } from "./rpc"; +import { ISigner } from "./transactions/iSigner"; -type TenderlyConfig = { +export type TenderlyConfig = { accountSlug: string; projectSlug: string; accessKey: string; @@ -34,20 +36,22 @@ export async function simulateCallDataWithTenderly({ gasPriceData, gasLimit, comment, + stateOverride, }: { chainId: number; tenderlyConfig: TenderlyConfig; - provider: Provider; + provider: Provider | ISigner; to: string; data: string; from: string; value: bigint | number | undefined; - blockNumber: number | undefined; + blockNumber: "latest" | number | undefined; gasPriceData: GasPriceData | undefined; gasLimit: bigint | number | undefined; comment: string | undefined; + stateOverride?: StateOverride; }) { - if (!blockNumber) { + if (blockNumber === undefined) { blockNumber = await provider.getBlockNumber(); } @@ -76,6 +80,7 @@ export async function simulateCallDataWithTenderly({ gasPriceData, blockNumber, comment, + stateOverride, }); } @@ -89,6 +94,7 @@ export const simulateTxWithTenderly = async ( gasLimit?: bigint; value?: bigint; comment: string; + stateOverride?: StateOverride; } ) => { const config = getTenderlyConfig(); @@ -132,6 +138,7 @@ export const simulateTxWithTenderly = async ( value: opts.value ?? 0n, blockNumber, comment: opts.comment, + stateOverride: opts.stateOverride, }); return result; @@ -144,10 +151,11 @@ async function processSimulation({ data, value, to, - gasLimit, - gasPriceData, + // gasLimit, + // gasPriceData, blockNumber, comment, + stateOverride, }: { config: TenderlyConfig; chainId: number; @@ -156,19 +164,21 @@ async function processSimulation({ data: string; value: bigint | number | undefined; gasLimit: bigint | number | undefined; - gasPriceData: GasPriceData; - blockNumber: number; + gasPriceData: GasPriceData | undefined; + blockNumber: "latest" | number | undefined; comment: string | undefined; + stateOverride?: StateOverride; }) { const simulationParams = buildSimulationRequest( chainId, { from, to, - gas: gasLimit !== undefined ? BigInt(gasLimit) : undefined, + // gas: gasLimit !== undefined ? BigInt(gasLimit) : undefined, input: data, value: Number(value), - ...gasPriceData, + stateOverride, + // ...gasPriceData, }, blockNumber ); @@ -190,10 +200,11 @@ async function processSimulation({ ); let success = false; + let json: any; try { if (!response.ok) throw new Error(`Failed to send transaction to Tenderly: ${response.statusText}`); - const json = await response.json(); + json = await response.json(); const url = `https://dashboard.tenderly.co/${config.accountSlug}/${config.projectSlug}/simulator/${json.simulation.id}`; sentReports.push({ url, comment: comment ?? "" }); success = json.simulation.status; @@ -224,7 +235,7 @@ async function processSimulation({ ); } - return { success }; + return { success, raw: json }; } // https://docs.tenderly.co/reference/api#/operations/simulateTransaction @@ -237,13 +248,14 @@ function buildSimulationRequest( input: string; gas?: bigint; gasPrice?: bigint; + stateOverride?: StateOverride; /* api doesn't support these yet maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint; */ }, - blockNumber: number + blockNumber: "latest" | number | undefined ) { return { network_id: chainId.toString(), @@ -258,10 +270,19 @@ function buildSimulationRequest( */ value: params.value, input: params.input, - save: true, - save_if_fails: true, + save: import.meta.env.TENDERLY_TEST === "true" ? false : true, + save_if_fails: import.meta.env.TENDERLY_TEST === "true" ? false : true, simulation_type: "quick", block_number: blockNumber, + state_objects: params.stateOverride?.reduce((acc, curr) => { + acc[curr.address] = { + code: curr.code, + balance: curr.balance ? numberToHex(curr.balance) : undefined, + nonce: 0, + storage: curr.state ? Object.fromEntries(curr.state.map((s) => [s.slot, s.value])) : undefined, + }; + return acc; + }, {}), }; } diff --git a/src/lib/transactions/iSigner.ts b/src/lib/transactions/iSigner.ts new file mode 100644 index 0000000000..c795036d0f --- /dev/null +++ b/src/lib/transactions/iSigner.ts @@ -0,0 +1,307 @@ +import { + AddressLike, + BigNumberish, + BrowserProvider, + AbstractSigner as EthersSigner, + JsonRpcProvider, + TransactionRequest, +} from "ethers"; +import { Account, Chain, Client, PublicActions, StateOverride, Transport, WalletActions, WalletRpcSchema } from "viem"; + +import { SignatureDomain, SignatureTypes } from "lib/wallets/signing"; + +// export type ISignerSendTransactionParams = { +// to: string; +// data: string; +// value?: bigint; +// gasLimit?: bigint; +// gasPrice?: bigint; +// nonce?: number | bigint; +// from?: string; +// maxFeePerGas?: bigint; +// maxPriorityFeePerGas?: bigint; +// }; + +export type ISignerSendTransactionParams = Pick< + TransactionRequest, + "to" | "data" | "value" | "gasLimit" | "gasPrice" | "nonce" | "from" | "maxFeePerGas" | "maxPriorityFeePerGas" +>; + +export type ISignerEstimateGasParams = ISignerSendTransactionParams & { + stateOverride?: StateOverride; +}; + +export type ISignerSendTransactionResult = { + hash: string; + wait: () => Promise< + | { + blockNumber: number; + status: number | null; + } + | undefined + | null + >; +}; + +type ViemSigner = Client< + Transport, + Chain, + Account, + WalletRpcSchema, + WalletActions & PublicActions +>; + +/** + * Abstraction above ethers and viem signers + */ +export interface ISignerInterface { + address: string; + sendTransaction: (params: ISignerSendTransactionParams) => Promise; + estimateGas: (params: ISignerEstimateGasParams) => Promise; + provider: this; +} + +export class ISigner implements ISignerInterface { + private readonly isEthersSigner: boolean; + + private _address: string; + + get address() { + return this._address; + } + + getAddress() { + return this._address; + } + + private constructor(private readonly signer: EthersSigner | ViemSigner) { + this.isEthersSigner = signer instanceof EthersSigner; + } + + static async from(signer: EthersSigner | ViemSigner) { + const gmxSigner = new ISigner(signer); + await gmxSigner + .match({ + viem: (signer: ViemSigner) => signer.account.address, + ethers: (signer: EthersSigner) => signer.getAddress(), + }) + .then((address) => (gmxSigner._address = address)); + return gmxSigner; + } + + async sendTransaction(params: ISignerSendTransactionParams): Promise { + return this.match({ + viem: async (signer: ViemSigner) => + signer + .sendTransaction({ + to: await toAddress(params.to), + data: (params.data ?? undefined) as string | undefined, + value: toBigInt(params.value), + gas: toBigInt(params.gasLimit), + gasPrice: toBigInt(params.gasPrice), + maxFeePerGas: toBigInt(params.maxFeePerGas) as undefined, + maxPriorityFeePerGas: toBigInt(params.maxPriorityFeePerGas) as undefined, + nonce: params.nonce !== undefined ? Number(params.nonce) : undefined, + }) + .then((hash) => ({ + hash, + wait: () => + signer.waitForTransactionReceipt({ hash }).then((receipt) => ({ + blockNumber: Number(receipt.blockNumber), + status: receipt.status === "success" ? 1 : 0, + })), + })), + ethers: (signer: EthersSigner) => + signer + .sendTransaction({ + to: params.to, + data: params.data, + value: params.value, + gasLimit: params.gasLimit, + gasPrice: params.gasPrice, + maxFeePerGas: params.maxFeePerGas, + maxPriorityFeePerGas: params.maxPriorityFeePerGas, + nonce: params.nonce !== undefined ? Number(params.nonce) : undefined, + }) + .then(({ hash, wait }) => ({ + hash, + wait: () => + wait().then((receipt) => + receipt + ? { + blockNumber: Number(receipt.blockNumber), + status: receipt.status === 1 ? 1 : 0, + } + : undefined + ), + })), + }); + } + + async estimateGas(params: ISignerEstimateGasParams): Promise { + return this.match({ + viem: async (signer: ViemSigner) => + signer.estimateGas({ + to: await toAddress(params.to), + data: (params.data ?? undefined) as string | undefined, + value: toBigInt(params.value), + account: await toAddress(params.from), + gas: toBigInt(params.gasLimit), + gasPrice: toBigInt(params.gasPrice), + maxFeePerGas: toBigInt(params.maxFeePerGas) as undefined, + maxPriorityFeePerGas: toBigInt(params.maxPriorityFeePerGas) as undefined, + nonce: params.nonce !== undefined ? Number(params.nonce) : undefined, + stateOverride: params.stateOverride, + }), + ethers: (signer: EthersSigner) => { + if (params.stateOverride?.length) { + throw new Error("State override is not supported for ethers signer"); + } + return signer.estimateGas({ + to: params.to, + data: params.data, + value: params.value, + gasLimit: params.gasLimit, + gasPrice: params.gasPrice, + maxFeePerGas: params.maxFeePerGas, + maxPriorityFeePerGas: params.maxPriorityFeePerGas, + from: params.from, + }); + }, + }); + } + + async call(params: ISignerSendTransactionParams): Promise { + return this.match({ + viem: async (signer: ViemSigner) => + await signer + .call({ + to: await toAddress(params.to), + data: (params.data ?? undefined) as string | undefined, + value: toBigInt(params.value), + account: await toAddress(params.from), + gas: toBigInt(params.gasLimit), + gasPrice: toBigInt(params.gasPrice), + maxFeePerGas: toBigInt(params.maxFeePerGas) as undefined, + maxPriorityFeePerGas: toBigInt(params.maxPriorityFeePerGas) as undefined, + nonce: params.nonce !== undefined ? Number(params.nonce) : undefined, + }) + .then(({ data }) => data ?? "0x"), + ethers: (signer: EthersSigner) => + signer.call({ + to: params.to, + data: params.data, + value: params.value, + gasLimit: params.gasLimit, + gasPrice: params.gasPrice, + maxFeePerGas: params.maxFeePerGas, + maxPriorityFeePerGas: params.maxPriorityFeePerGas, + from: params.from, + nonce: params.nonce !== undefined ? Number(params.nonce) : undefined, + }), + }); + } + + async signTypedData(domain: SignatureDomain, types: SignatureTypes, value: Record): Promise { + return this.match({ + viem: async (signer: ViemSigner) => + // TODO: check if primaryType is correct + signer.signTypedData({ domain, types, message: value, primaryType: Object.keys(types)[0] }), + ethers: (signer: EthersSigner) => signer.signTypedData(domain, types, value), + }); + } + + async send(method: "eth_signTypedData_v4", params: any[]): Promise { + return this.match({ + viem: async (signer: ViemSigner) => signer.request({ method, params: params as any }), + ethers: (signer: EthersSigner) => (signer.provider as BrowserProvider | JsonRpcProvider).send(method, params), + }); + } + + async getBlockNumber(): Promise { + return this.match({ + viem: async (signer: ViemSigner) => signer.getBlockNumber().then(Number), + ethers: (signer: EthersSigner) => signer.provider!.getBlockNumber(), + }); + } + + async getTransaction(hash: string): Promise { + return this.match({ + viem: async (signer: ViemSigner) => + signer + .getTransaction({ + hash, + }) + .then((tx): ISignerSendTransactionParams | undefined => ({ + to: tx.to, + data: tx.input, + value: tx.value, + gasLimit: tx.gas, + gasPrice: tx.gasPrice, + maxFeePerGas: tx.maxFeePerGas, + maxPriorityFeePerGas: tx.maxPriorityFeePerGas, + from: tx.from, + nonce: tx.nonce, + })), + ethers: (signer: EthersSigner) => + signer.provider!.getTransaction(hash).then((tx): ISignerSendTransactionParams | undefined => + !tx + ? undefined + : { + to: tx.to, + data: tx.data, + value: tx.value, + gasLimit: tx.gasLimit, + gasPrice: tx.gasPrice, + maxFeePerGas: tx.maxFeePerGas, + maxPriorityFeePerGas: tx.maxPriorityFeePerGas, + from: tx.from, + nonce: tx.nonce, + } + ), + }); + } + + get provider() { + return this; + } + + private async match(branches: { + viem: (signer: ViemSigner) => T | Promise; + ethers: (signer: EthersSigner) => T | Promise; + }): Promise { + if (this.isEthersSigner) { + return await branches.ethers(this.signer as EthersSigner); + } else { + return await branches.viem(this.signer as ViemSigner); + } + } +} + +async function toAddress(address: AddressLike | undefined | null): Promise { + if (address === undefined) { + return undefined; + } + if (typeof address === "string") { + return address; + } + const awaitedAddress = await address; + if (!awaitedAddress) { + return undefined; + } + if (typeof awaitedAddress === "string") { + return awaitedAddress; + } + return await awaitedAddress.getAddress(); +} + +function toBigInt(value: BigNumberish | undefined | null): bigint | undefined { + if (value === undefined || value === null) { + return undefined; + } + if (typeof value === "bigint") { + return value; + } + + return BigInt(value); +} diff --git a/src/lib/transactions/sendWalletTransaction.ts b/src/lib/transactions/sendWalletTransaction.ts index cc2c7ef548..9335722af4 100644 --- a/src/lib/transactions/sendWalletTransaction.ts +++ b/src/lib/transactions/sendWalletTransaction.ts @@ -1,5 +1,3 @@ -import { TransactionRequest, TransactionResponse } from "ethers"; - import { extendError } from "lib/errors"; import { additionalTxnErrorValidation } from "lib/errors/additionalValidation"; import { estimateGasLimit } from "lib/gas/estimateGasLimit"; @@ -8,6 +6,7 @@ import { getProvider } from "lib/rpc"; import { getTenderlyConfig, simulateCallDataWithTenderly } from "lib/tenderly"; import { WalletSigner } from "lib/wallets"; +import { ISigner, ISignerSendTransactionParams, ISignerSendTransactionResult } from "./iSigner"; import { TransactionWaiterResult, TxnCallback, TxnEventBuilder } from "./types"; export type WalletTxnCtx = {}; @@ -31,11 +30,11 @@ export async function sendWalletTransaction({ callback, }: { chainId: number; - signer: WalletSigner; + signer: WalletSigner | ISigner; to: string; callData: string; - value?: bigint | number; - gasLimit?: bigint | number; + value?: bigint; + gasLimit?: bigint; gasPriceData?: GasPriceData; nonce?: number | bigint; msg?: string; @@ -94,7 +93,7 @@ export async function sendWalletTransaction({ callback?.(eventBuilder.Sending()); - const txnData: TransactionRequest = { + const txnData: ISignerSendTransactionParams = { to, data: callData, value, @@ -130,7 +129,7 @@ export async function sendWalletTransaction({ } } -function makeWalletTxnResultWaiter(hash: string, txn: TransactionResponse) { +function makeWalletTxnResultWaiter(hash: string, txn: ISignerSendTransactionResult) { return async () => { const receipt = await txn.wait(); return { diff --git a/src/lib/wallets/rainbowKitConfig.ts b/src/lib/wallets/rainbowKitConfig.ts index 11ea81cc92..85ed979402 100644 --- a/src/lib/wallets/rainbowKitConfig.ts +++ b/src/lib/wallets/rainbowKitConfig.ts @@ -12,11 +12,13 @@ import { walletConnectWallet, } from "@rainbow-me/rainbowkit/wallets"; import once from "lodash/once"; -import { http } from "viem"; +import { createPublicClient, http, PublicClient } from "viem"; import { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, bsc, optimismSepolia, sepolia } from "viem/chains"; -import { botanix } from "config/chains"; +import { botanix, getFallbackRpcUrl, getViemChain } from "config/chains"; import { isDevelopment } from "config/env"; +import { getCurrentRpcUrls } from "lib/rpc/bestRpcTracker"; +import { LRUCache } from "sdk/utils/LruCache"; import binanceWallet from "./connecters/binanceW3W/binanceWallet"; @@ -63,13 +65,29 @@ export const getRainbowKitConfig = once(() => [arbitrum.id]: http(), [avalanche.id]: http(), [avalancheFuji.id]: http(), - [arbitrumSepolia.id]: http(), + [arbitrumSepolia.id]: http(getFallbackRpcUrl(arbitrumSepolia.id, false)), [base.id]: http(), - [optimismSepolia.id]: http(), - [sepolia.id]: http(), + [optimismSepolia.id]: http(getFallbackRpcUrl(optimismSepolia.id, false)), + [sepolia.id]: http(getFallbackRpcUrl(sepolia.id, false)), [botanix.id]: http(), [bsc.id]: http(), }, wallets: [...popularWalletList, ...othersWalletList], }) ); + +const PUBLIC_CLIENTS_CACHE = new LRUCache(100); + +export function getPublicClientWithRpc(chainId: number): PublicClient { + const primaryRpcUrl = getCurrentRpcUrls(chainId).primary; + const key = `chainId:${chainId}-rpcUrl:${primaryRpcUrl}`; + if (PUBLIC_CLIENTS_CACHE.has(key)) { + return PUBLIC_CLIENTS_CACHE.get(key)!; + } + const publicClient = createPublicClient({ + transport: http(primaryRpcUrl), + chain: getViemChain(chainId), + }); + PUBLIC_CLIENTS_CACHE.set(key, publicClient); + return publicClient; +} diff --git a/src/lib/wallets/signing.ts b/src/lib/wallets/signing.ts index 5a557a0d95..601f4f0caa 100644 --- a/src/lib/wallets/signing.ts +++ b/src/lib/wallets/signing.ts @@ -2,6 +2,7 @@ import { AbstractSigner, TypedDataEncoder, type Wallet } from "ethers"; import { withRetry } from "viem"; import { parseError } from "lib/errors"; +import { ISigner } from "lib/transactions/iSigner"; import type { WalletSigner } from "."; @@ -15,7 +16,7 @@ export type SignatureDomain = { export type SignatureTypes = Record; export type SignTypedDataParams = { - signer: WalletSigner | Wallet | AbstractSigner; + signer: WalletSigner | Wallet | AbstractSigner | ISigner; types: SignatureTypes; typedData: Record; domain: SignatureDomain; @@ -98,7 +99,7 @@ export async function signTypedData({ const signature = await withRetry( () => { - return (provider as any).send("eth_signTypedData_v4", [from, JSON.stringify(eip712)]); + return (provider as ISigner).send("eth_signTypedData_v4", [from, JSON.stringify(eip712)]); }, { retryCount: 1, diff --git a/src/pages/PoolsDetails/PoolsDetails.tsx b/src/pages/PoolsDetails/PoolsDetails.tsx index ddc951b350..5070e9fc16 100644 --- a/src/pages/PoolsDetails/PoolsDetails.tsx +++ b/src/pages/PoolsDetails/PoolsDetails.tsx @@ -1,8 +1,12 @@ import { Trans } from "@lingui/macro"; import cx from "classnames"; -import { useState } from "react"; -import { usePoolsDetailsContext } from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { + usePoolsDetailsGlvOrMarketAddress, + usePoolsDetailsMode, + usePoolsDetailsOperation, + usePoolsDetailsSelectedMarketForGlv, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; import { selectDepositMarketTokensData, selectGlvAndMarketsInfoData, @@ -37,10 +41,10 @@ export function PoolsDetails() { const depositMarketTokensData = useSelector(selectDepositMarketTokensData); - const { operation, mode, glvOrMarketAddress, setOperation, setMode, setGlvOrMarketAddress } = - usePoolsDetailsContext(); - - const [selectedMarketForGlv, setSelectedMarketForGlv] = useState(undefined); + const [operation, setOperation] = usePoolsDetailsOperation(); + const [mode, setMode] = usePoolsDetailsMode(); + const [glvOrMarketAddress, setGlvOrMarketAddress] = usePoolsDetailsGlvOrMarketAddress(); + const [selectedMarketForGlv, setSelectedMarketForGlv] = usePoolsDetailsSelectedMarketForGlv(); const glvOrMarketInfo = getByKey(glvAndMarketsInfoData, glvOrMarketAddress); diff --git a/vitest.global-setup.js b/vitest.global-setup.js index 44469a4cbe..251d6ba762 100644 --- a/vitest.global-setup.js +++ b/vitest.global-setup.js @@ -1,3 +1,5 @@ +import "dotenv/config"; + export const setup = () => { process.env.TZ = "Asia/Dubai"; -} \ No newline at end of file +}; diff --git a/yarn.lock b/yarn.lock index 6de3b69f14..0f817fccfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16380,7 +16380,7 @@ __metadata: "viem@patch:viem@npm:2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341::locator=gmx-interface%40workspace%3A.": version: 2.37.1 - resolution: "viem@patch:viem@npm%3A2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=410eea&locator=gmx-interface%40workspace%3A." + resolution: "viem@patch:viem@npm%3A2.37.1#.yarn/patches/viem-npm-2.37.1-7013552341::version=2.37.1&hash=aa32ba&locator=gmx-interface%40workspace%3A." dependencies: "@noble/curves": 1.9.1 "@noble/hashes": 1.8.0 @@ -16395,7 +16395,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 7f0c63f1f263c9af7bc437aa0a99503985733bb779578462c5c225098637fa0735abab219f9c0b6cbac593c977c4fd1f735f80536ab7d47cec60f6e25c124df4 + checksum: d6e24123d5ccab32ccfad86f35d5800876e677992ba5c7a8cf29110cab7653aa5a45a583b6d44e6a5451278f8307630f25eb4c6a8bda07c6f41dc96c3b4aec20 languageName: node linkType: hard From 3d824b3cf4142e7701261226fa9b73a9a0be51eb Mon Sep 17 00:00:00 2001 From: midas-myth Date: Mon, 20 Oct 2025 19:39:45 +0200 Subject: [PATCH 25/38] Multichain fix lint errors --- src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx | 1 - src/config/multichain.ts | 2 +- src/domain/synthetics/trade/utils/validation.ts | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx index e6cb99ac62..2107cb0f20 100644 --- a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx @@ -114,7 +114,6 @@ export function GmShiftBox({ const { fees, executionFee } = useShiftFees({ gasLimits, gasPrice, tokensData, amounts, chainId }); const { shouldShowWarning, shouldShowWarningForExecutionFee, shouldShowWarningForPosition } = useGmWarningState({ - executionFee, logicalFees: fees, }); diff --git a/src/config/multichain.ts b/src/config/multichain.ts index 1523eae709..c785f0c1e5 100644 --- a/src/config/multichain.ts +++ b/src/config/multichain.ts @@ -358,7 +358,7 @@ function addMultichainPlatformTokenConfig( tokenGroups[symbol] = {}; for (const chainIdString in chainAddresses) { - tokenGroups[symbol][chainIdString] = { + tokenGroups[symbol]![chainIdString] = { address: chainAddresses[chainIdString].address, decimals: 18, chainId: parseInt(chainIdString) as SettlementChainId | SourceChainId, diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index 625452ed9b..cf6d341808 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -667,8 +667,8 @@ export function getGmSwapError(p: { isMarketTokenDeposit?: boolean; paySource: GmPaySource; isPair: boolean; - chainId: ContractsChainId; - srcChainId: SourceChainId | undefined; + chainId?: ContractsChainId | undefined; + srcChainId?: SourceChainId | undefined; }) { const { isDeposit, From b4d06e63ae552245ba6680ffe81a1312ed833634 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 21 Oct 2025 03:41:46 +0200 Subject: [PATCH 26/38] Multichain enhancements --- sdk/src/configs/dataStore.ts | 5 - sdk/src/configs/tokens.ts | 32 +- sdk/src/utils/markets.ts | 48 ++- .../GmDepositWithdrawalBox.tsx | 346 +++++------------- ...arams.tsx => selectPoolsDetailsParams.tsx} | 14 +- .../lpTxn/useDepositTransactions.tsx | 233 +++--------- .../useGmSwapSubmitState.tsx | 55 +-- .../useTokensToApprove.tsx | 19 +- .../useUpdateInputAmounts.tsx | 183 ++++----- .../MarketStats/hooks/useBestGmPoolForGlv.ts | 145 ++++---- .../TokenSelector/MultichainTokenSelector.tsx | 113 ++++-- .../PoolsDetailsContext.tsx | 306 ++++++++++------ src/domain/multichain/arbitraryRelayParams.ts | 30 +- .../estimatePureGlvDepositGasLimit.ts | 2 +- .../estimateSourceChainDepositFees.ts | 57 ++- .../estimateSourceChainGlvDepositFees.ts | 42 ++- .../synthetics/trade/utils/validation.ts | 101 +++-- src/lib/wallets/rainbowKitConfig.ts | 4 +- 18 files changed, 831 insertions(+), 904 deletions(-) rename src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/{useParams.tsx => selectPoolsDetailsParams.tsx} (96%) diff --git a/sdk/src/configs/dataStore.ts b/sdk/src/configs/dataStore.ts index 00c3d11a9f..e74eb4e265 100644 --- a/sdk/src/configs/dataStore.ts +++ b/sdk/src/configs/dataStore.ts @@ -174,11 +174,6 @@ export function atomicSwapFeeFactorKey(market: string) { return hashData(["bytes32", "address"], [ATOMIC_SWAP_FEE_FACTOR_KEY, market]); } -// 0xc46dff7dcd179b6c69db86df5ffc8eaf8ae18c2a8aa86f51a930178d6a1f63b9 -// 22500000000000000000000000000 -console.log("ATOMIC_SWAP_FEE_FACTOR_KEY", atomicSwapFeeFactorKey("0xb6fc4c9eb02c35a134044526c62bb15014ac0bcc")); -console.log(applyFactor(expandDecimals(1, 30), 22500000000000000000000000000n)); - export function openInterestKey(market: string, collateralToken: string, isLong: boolean) { return hashData(["bytes32", "address", "address", "bool"], [OPEN_INTEREST_KEY, market, collateralToken, isLong]); } diff --git a/sdk/src/configs/tokens.ts b/sdk/src/configs/tokens.ts index 00a10922ca..312301e861 100644 --- a/sdk/src/configs/tokens.ts +++ b/sdk/src/configs/tokens.ts @@ -7,6 +7,12 @@ import { getContract } from "./contracts"; export const NATIVE_TOKEN_ADDRESS = zeroAddress; +export const GM_STUB_ADDRESS = ""; +const GLV_STUB_ADDRESS = ""; +const GMX_STUB_ADDRESS = ""; +const ESGMX_STUB_ADDRESS = ""; +const GLP_STUB_ADDRESS = ""; + export const TOKENS: { [chainId: number]: Token[] } = { [ARBITRUM]: [ { @@ -1029,7 +1035,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX Market tokens", symbol: "GM", - address: "", + address: GM_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png", isPlatformToken: true, @@ -1037,7 +1043,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GLV Market tokens", symbol: "GLV", - address: "", + address: GLV_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png", isPlatformToken: true, @@ -1526,7 +1532,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX Market tokens", symbol: "GM", - address: "", + address: GM_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png", isPlatformToken: true, @@ -1534,7 +1540,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GLV Market tokens", symbol: "GLV", - address: "", + address: GLV_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png", isPlatformToken: true, @@ -1756,7 +1762,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX Market tokens", symbol: "GM", - address: "", + address: GM_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png", isPlatformToken: true, @@ -1764,7 +1770,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GLV Market tokens", symbol: "GLV", - address: "", + address: GLV_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png", isPlatformToken: true, @@ -1843,7 +1849,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX", symbol: "GMX", - address: "", + address: GMX_STUB_ADDRESS, decimals: 18, imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468", isPlatformToken: true, @@ -1851,14 +1857,14 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "Escrowed GMX", symbol: "ESGMX", - address: "", + address: ESGMX_STUB_ADDRESS, decimals: 18, isPlatformToken: true, }, { name: "GMX LP", symbol: "GLP", - address: "", + address: GLP_STUB_ADDRESS, decimals: 18, imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true", isPlatformToken: true, @@ -1866,7 +1872,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX Market tokens", symbol: "GM", - address: "", + address: GM_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png", isPlatformToken: true, @@ -1874,7 +1880,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GLV Market tokens", symbol: "GLV", - address: "", + address: GLV_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png", isPlatformToken: true, @@ -1969,7 +1975,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GMX Market tokens", symbol: "GM", - address: "", + address: GM_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png", isPlatformToken: true, @@ -1977,7 +1983,7 @@ export const TOKENS: { [chainId: number]: Token[] } = { { name: "GLV Market tokens", symbol: "GLV", - address: "", + address: GLV_STUB_ADDRESS, decimals: 18, imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png", isPlatformToken: true, diff --git a/sdk/src/utils/markets.ts b/sdk/src/utils/markets.ts index f56bc13df0..658a48b99b 100644 --- a/sdk/src/utils/markets.ts +++ b/sdk/src/utils/markets.ts @@ -1,6 +1,6 @@ import { BASIS_POINTS_DIVISOR } from "configs/factors"; -import { MarketConfig } from "configs/markets"; -import { getTokenVisualMultiplier, NATIVE_TOKEN_ADDRESS } from "configs/tokens"; +import { MARKETS, MarketConfig } from "configs/markets"; +import { convertTokenAddress, getToken, getTokenVisualMultiplier, NATIVE_TOKEN_ADDRESS } from "configs/tokens"; import { ContractMarketPrices, Market, MarketInfo } from "types/markets"; import { Token, TokenPrices, TokensData } from "types/tokens"; @@ -233,3 +233,47 @@ export function getIsMarketAvailableForExpressSwaps(marketInfo: MarketInfo) { (token) => token.hasPriceFeedProvider ); } + +export function isMarketTokenAddress(chainId: number, marketTokenAddress: string): boolean { + return Boolean(MARKETS[chainId]?.[marketTokenAddress]); +} + +export function getMarketIndexTokenAddress(chainId: number, marketTokenAddress: string): string | undefined { + return convertTokenAddress(chainId, MARKETS[chainId]?.[marketTokenAddress]?.indexTokenAddress, "native"); +} + +export function getMarketIndexToken(chainId: number, marketTokenAddress: string): Token | undefined { + const indexTokenAddress = getMarketIndexTokenAddress(chainId, marketTokenAddress); + if (!indexTokenAddress) { + return undefined; + } + + return getToken(chainId, indexTokenAddress); +} + +export function getMarketIndexTokenSymbol(chainId: number, marketTokenAddress: string): string { + const indexToken = getMarketIndexToken(chainId, marketTokenAddress); + if (!indexToken) { + return ""; + } + + return indexToken.symbol; +} + +export function getMarketLongTokenSymbol(chainId: number, marketTokenAddress: string): string { + const longTokenAddress = MARKETS[chainId]?.[marketTokenAddress]?.longTokenAddress; + if (!longTokenAddress) { + return ""; + } + + return getToken(chainId, convertTokenAddress(chainId, longTokenAddress, "native")).symbol; +} + +export function getMarketShortTokenSymbol(chainId: number, marketTokenAddress: string): string { + const shortTokenAddress = MARKETS[chainId]?.[marketTokenAddress]?.shortTokenAddress; + if (!shortTokenAddress) { + return ""; + } + + return getToken(chainId, convertTokenAddress(chainId, shortTokenAddress, "native")).symbol; +} diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index 3a4962de20..a70d038b2a 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -1,18 +1,33 @@ import { t } from "@lingui/macro"; import cx from "classnames"; -import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; import pickBy from "lodash/pickBy"; import uniqBy from "lodash/uniqBy"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo } from "react"; import { useAccount } from "wagmi"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; import { getMappedTokenId, isSourceChain } from "config/multichain"; import { + selectPoolsDetailsFlags, + selectPoolsDetailsGlvInfo, selectPoolsDetailsGlvOrMarketAddress, + selectPoolsDetailsGlvTokenData, + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsMarketAndTradeTokensData, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketOrGlvTokenAmount, + selectPoolsDetailsMarketOrGlvTokenData, selectPoolsDetailsMarketTokenData, + selectPoolsDetailsMarketTokensData, + selectPoolsDetailsMultichainTokensArray, + selectPoolsDetailsOperation, + selectPoolsDetailsSelectedMarketForGlv, + selectPoolsDetailsSetIsMarketForGlvSelectedManually, + selectPoolsDetailsShortTokenAddress, + selectPoolsDetailsTradeTokensDataWithSourceChainBalances, usePoolsDetailsFirstTokenAddress, usePoolsDetailsFirstTokenInputValue, usePoolsDetailsFocusedInput, @@ -22,7 +37,6 @@ import { usePoolsDetailsSecondTokenInputValue, } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; -import { useTokensData } from "context/SyntheticsStateContext/hooks/globalsHooks"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectGlvAndMarketsInfoData, @@ -36,14 +50,12 @@ import { RawCreateGlvDepositParams, RawCreateGlvWithdrawalParams, RawCreateWithdrawalParams, - useMarketTokensData, } from "domain/synthetics/markets"; import { estimatePureLpActionExecutionFee } from "domain/synthetics/markets/feeEstimation/estimatePureLpActionExecutionFee"; import { estimateSourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; import { estimateSourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; import { estimateSourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; import { estimateSourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; -import { isGlvInfo } from "domain/synthetics/markets/glv"; import { getAvailableUsdLiquidityForCollateral, getGlvOrMarketAddress, @@ -52,7 +64,7 @@ import { } from "domain/synthetics/markets/utils"; import { convertToUsd, getMidPrice, getTokenData } from "domain/synthetics/tokens"; import useSortedPoolsWithIndexToken from "domain/synthetics/trade/useSortedPoolsWithIndexToken"; -import { Token, TokenBalanceType } from "domain/tokens"; +import { Token } from "domain/tokens"; import { useMaxAvailableAmount } from "domain/tokens/useMaxAvailableAmount"; import { useChainId } from "lib/chains"; import { formatAmountFree, formatBalanceAmount, formatUsd, parseValue } from "lib/numbers"; @@ -61,13 +73,14 @@ import { usePrevious } from "lib/usePrevious"; import { useThrottledAsync } from "lib/useThrottledAsync"; import { switchNetwork } from "lib/wallets"; import { MARKETS } from "sdk/configs/markets"; -import { getNativeToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; +import { convertTokenAddress, getNativeToken, getToken, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import { WithdrawalAmounts } from "sdk/types/trade"; import Button from "components/Button/Button"; import BuyInputSection from "components/BuyInputSection/BuyInputSection"; -import { useMultichainMarketTokenBalancesRequest, useMultichainTokens } from "components/GmxAccountModal/hooks"; +import { useMultichainMarketTokenBalancesRequest } from "components/GmxAccountModal/hooks"; import { useBestGmPoolAddressForGlv } from "components/MarketStats/hooks/useBestGmPoolForGlv"; +import TokenIcon from "components/TokenIcon/TokenIcon"; import TokenWithIcon from "components/TokenIcon/TokenWithIcon"; import { MultichainMarketTokenSelector } from "components/TokenSelector/MultichainMarketTokenSelector"; import { MultichainTokenSelector } from "components/TokenSelector/MultichainTokenSelector"; @@ -77,12 +90,11 @@ import TooltipWithPortal from "components/Tooltip/TooltipWithPortal"; import type { GmSwapBoxProps } from "../GmSwapBox"; import { GmSwapBoxPoolRow } from "../GmSwapBoxPoolRow"; import { GmSwapWarningsRow } from "../GmSwapWarningsRow"; -import { Mode, Operation } from "../types"; +import { Operation } from "../types"; import { useGmWarningState } from "../useGmWarningState"; import { InfoRows } from "./InfoRows"; -import { selectPoolsDetailsParams } from "./lpTxn/useParams"; +import { selectPoolsDetailsParams } from "./lpTxn/selectPoolsDetailsParams"; import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts"; -import { TokenInputState } from "./types"; import { useDepositWithdrawalFees } from "./useDepositWithdrawalFees"; import { useGmSwapSubmitState } from "./useGmSwapSubmitState"; import { useUpdateInputAmounts } from "./useUpdateInputAmounts"; @@ -91,10 +103,7 @@ import { useUpdateTokens } from "./useUpdateTokens"; export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const { // selectedGlvOrMarketAddress, - operation, - mode, onSelectGlvOrMarket, - selectedMarketForGlv, onSelectedMarketForGlv, } = p; const selectedGlvOrMarketAddress = useSelector(selectPoolsDetailsGlvOrMarketAddress); @@ -102,15 +111,10 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // const [, setSettlementChainId] = useGmxAccountSettlementChainId(); const { shouldDisableValidationForTesting } = useSettings(); const { chainId, srcChainId } = useChainId(); - const [isMarketForGlvSelectedManually, setIsMarketForGlvSelectedManually] = useState(false); const { address: account } = useAccount(); // #region Requests - const { marketTokensData: depositMarketTokensData } = useMarketTokensData(chainId, srcChainId, { isDeposit: true }); - const { marketTokensData: withdrawalMarketTokensData } = useMarketTokensData(chainId, srcChainId, { - isDeposit: false, - }); const { tokenBalancesData: selectedGlvOrMarketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( chainId, srcChainId, @@ -120,7 +124,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); - const { tokenChainDataArray } = useMultichainTokens(); const { tokenBalancesData: marketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( chainId, srcChainId, @@ -133,16 +136,21 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #region Selectors const glvAndMarketsInfoData = useSelector(selectGlvAndMarketsInfoData); const marketsInfoData = useSelector(selectMarketsInfoData); + const marketTokensData = useSelector(selectPoolsDetailsMarketTokensData); const { marketsInfo: sortedGlvOrMarketsInfoByIndexToken } = useSortedPoolsWithIndexToken( glvAndMarketsInfoData, - depositMarketTokensData + marketTokensData ); - const isDeposit = operation === Operation.Deposit; - const rawTradeTokensData = useTokensData(); + + const { isDeposit, isWithdrawal, isPair, isSingle } = useSelector(selectPoolsDetailsFlags); + + const tokenChainDataArray = useSelector(selectPoolsDetailsMultichainTokensArray); // #region State - const [focusedInput, setFocusedInput] = usePoolsDetailsFocusedInput(); + const operation = useSelector(selectPoolsDetailsOperation); + const selectedMarketForGlv = useSelector(selectPoolsDetailsSelectedMarketForGlv); + const [, setFocusedInput] = usePoolsDetailsFocusedInput(); const [paySource, setPaySource] = usePoolsDetailsPaySource(); const [firstTokenAddress, setFirstTokenAddress] = usePoolsDetailsFirstTokenAddress(); const [secondTokenAddress, setSecondTokenAddress] = usePoolsDetailsSecondTokenAddress(); @@ -152,66 +160,19 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #endregion // #region Derived state - const tradeTokensData = useMemo(() => { - if (paySource !== "sourceChain") { - return rawTradeTokensData; - } - - return mapValues(rawTradeTokensData, (token) => { - const sourceChainToken = tokenChainDataArray.find( - (t) => t.address === token.address && t.sourceChainId === srcChainId - ); - - if (!sourceChainToken) { - return token; - } - - return { - ...token, - balanceType: TokenBalanceType.SourceChain, - balance: sourceChainToken.sourceChainBalance, - sourceChainBalance: sourceChainToken.sourceChainBalance, - }; - }); - }, [rawTradeTokensData, tokenChainDataArray, srcChainId, paySource]); + const tradeTokensData = useSelector(selectPoolsDetailsTradeTokensDataWithSourceChainBalances); - /** - * When buy/sell GM - marketInfo is GM market, glvInfo is undefined - * When buy/sell GLV - marketInfo is corresponding GM market, glvInfo is selected GLV - */ - const { marketInfo, glvInfo } = useMemo(() => { - const initialGlvOrMarketInfo = getByKey(glvAndMarketsInfoData, selectedGlvOrMarketAddress); - const isGlv = initialGlvOrMarketInfo && isGlvInfo(initialGlvOrMarketInfo); - const marketInfo = isGlv - ? selectedMarketForGlv - ? marketsInfoData?.[selectedMarketForGlv] - : undefined - : initialGlvOrMarketInfo; - - const glvInfo = isGlv ? initialGlvOrMarketInfo : undefined; - - return { - marketInfo, - glvInfo, - }; - }, [selectedGlvOrMarketAddress, glvAndMarketsInfoData, marketsInfoData, selectedMarketForGlv]); + const marketInfo = useSelector(selectPoolsDetailsMarketInfo); + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); const nativeToken = getByKey(tradeTokensData, NATIVE_TOKEN_ADDRESS); - const isWithdrawal = operation === Operation.Withdrawal; - const isSingle = mode === Mode.Single; - const isPair = mode === Mode.Pair; - - const marketTokensData = isDeposit ? depositMarketTokensData : withdrawalMarketTokensData; - const indexName = useMemo(() => marketInfo && getMarketIndexName(marketInfo), [marketInfo]); const routerAddress = useMemo(() => getContract(chainId, "SyntheticsRouter"), [chainId]); - const marketAndTradeTokensData = useMemo(() => { - return { - ...tradeTokensData, - ...marketTokensData, - }; - }, [tradeTokensData, marketTokensData]); + + const marketAndTradeTokensData = useSelector(selectPoolsDetailsMarketAndTradeTokensData); let firstToken = getTokenData(marketAndTradeTokensData, firstTokenAddress); let firstTokenAmount = parseValue(firstTokenInputValue, firstToken?.decimals || 0); @@ -229,116 +190,25 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isDeposit ? secondToken?.prices?.minPrice : secondToken?.prices?.maxPrice ); - const { - // Undefined when paying with GM - longTokenInputState, - // Undefined when isSameCollaterals is true, or when paying with GM - shortTokenInputState, - // undefined when not paying with GM - fromMarketTokenInputState, - } = useMemo((): Partial<{ - longTokenInputState: TokenInputState; - shortTokenInputState: TokenInputState; - fromMarketTokenInputState: TokenInputState; - }> => { - if (!marketInfo) { - return {}; - } - - const inputs: { - address: string; - value: string; - amount: bigint | undefined; - isMarketToken: boolean; - usd: bigint | undefined; - setValue: (val: string) => void; - }[] = []; - - if (firstTokenAddress) { - inputs.push({ - address: firstTokenAddress, - isMarketToken: firstToken?.symbol === "GM", - value: firstTokenInputValue || "", - setValue: setFirstTokenInputValue, - amount: firstTokenAmount, - usd: firstTokenUsd, - }); - } - - if (isPair && secondTokenAddress) { - inputs.push({ - address: secondTokenAddress, - value: secondTokenInputValue || "", - isMarketToken: false, - setValue: setSecondTokenInputValue, - amount: secondTokenAmount, - usd: secondTokenUsd, - }); - } - - const longTokenInputState = inputs.find( - (input) => input.isMarketToken === false && getTokenPoolType(marketInfo, input.address) === "long" - ); - const shortTokenInputState = inputs.find( - (input) => input.isMarketToken === false && getTokenPoolType(marketInfo, input.address) === "short" - ); - const fromMarketTokenInputState = inputs.find((input) => input.isMarketToken); - - return { - longTokenInputState, - shortTokenInputState, - fromMarketTokenInputState, - }; - }, [ - firstToken, - firstTokenAddress, - firstTokenAmount, - firstTokenInputValue, - firstTokenUsd, - isPair, - marketInfo, - secondTokenAddress, - secondTokenAmount, - secondTokenInputValue, - secondTokenUsd, - setFirstTokenInputValue, - setSecondTokenInputValue, - ]); - - /** - * When buy/sell GM - marketToken is GM token, glvToken is undefined - * When buy/sell GLV - marketToken is corresponding GM token, glvToken is selected GLV token - */ - const { marketTokenAmount, glvToken, glvTokenAmount } = useMemo(() => { - const marketToken = getTokenData(marketTokensData, marketInfo?.marketTokenAddress); - const marketTokenAmount = glvInfo - ? fromMarketTokenInputState?.amount ?? 0n - : parseValue(marketOrGlvTokenInputValue || "0", marketToken?.decimals || 0)!; + const glvToken = useSelector(selectPoolsDetailsGlvTokenData); - const glvTokenAmount = glvInfo - ? parseValue(marketOrGlvTokenInputValue || "0", glvInfo?.glvToken.decimals || 0)! - : 0n; - - return { - marketToken, - marketTokenAmount, - glvToken: glvInfo?.glvToken, - glvTokenAmount, - }; - }, [glvInfo, marketInfo, marketTokensData, marketOrGlvTokenInputValue, fromMarketTokenInputState?.amount]); + const marketOrGlvTokenAmount = useSelector(selectPoolsDetailsMarketOrGlvTokenAmount); + const marketOrGlvTokenData = useSelector(selectPoolsDetailsMarketOrGlvTokenData); + const setIsMarketForGlvSelectedManually = useSelector(selectPoolsDetailsSetIsMarketForGlvSelectedManually); // TODO MLTCH: remove dependecy from dynamic market info as this hook can more static const tokenOptions: (Token & { isMarketToken?: boolean })[] = useMemo( function getTokenOptions(): Token[] { - const { longToken, shortToken } = marketInfo || {}; + // const { longToken, shortToken } = marketInfo || {}; - if (!longToken || !shortToken) return []; + if (!longTokenAddress || !shortTokenAddress) return []; const nativeToken = getNativeToken(chainId); const result: Token[] = []; - for (const sideToken of [longToken, shortToken]) { + for (const sideTokeAddress of [longTokenAddress, shortTokenAddress]) { + const sideToken = getToken(chainId, sideTokeAddress); if (paySource === "sourceChain" && sideToken.isWrapped) { result.push(nativeToken); } else if (paySource !== "gmxAccount" && paySource !== "sourceChain" && sideToken.isWrapped) { @@ -349,7 +219,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { } if (glvInfo && !isPair && isDeposit) { - const options = [longToken, shortToken]; + const options = [longTokenAddress, shortTokenAddress].map((address) => getToken(chainId, address)); options.push( ...glvInfo.markets @@ -378,14 +248,24 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { return uniqBy(result, (token) => token.address); }, - [marketInfo, chainId, glvInfo, isPair, isDeposit, paySource, marketTokensData, marketsInfoData] + [ + longTokenAddress, + shortTokenAddress, + chainId, + glvInfo, + isPair, + isDeposit, + paySource, + marketTokensData, + marketsInfoData, + ] ); const availableTokensData = useMemo(() => { - return pickBy(tradeTokensData, (token) => { + return pickBy(marketAndTradeTokensData, (token) => { return tokenOptions.find((t) => t.address === token.address); }); - }, [tradeTokensData, tokenOptions]); + }, [marketAndTradeTokensData, tokenOptions]); const { longCollateralLiquidityUsd, shortCollateralLiquidityUsd } = useMemo(() => { if (!marketInfo) { @@ -398,35 +278,21 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }; }, [marketInfo]); - const isMarketTokenDeposit = Boolean(fromMarketTokenInputState); + const isMarketTokenDeposit = useSelector(selectPoolsDetailsIsMarketTokenDeposit); const amounts = useSelector(selectDepositWithdrawalAmounts); const globalExpressParams = useSelector(selectExpressGlobalParams); - const tokenAddress = - longTokenInputState?.amount !== undefined && longTokenInputState?.amount > 0n - ? longTokenInputState?.address - : shortTokenInputState?.address; - const tokenAmount = - longTokenInputState?.amount !== undefined && longTokenInputState?.amount > 0n - ? longTokenInputState?.amount - : shortTokenInputState?.amount; - const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; const params = useSelector(selectPoolsDetailsParams); - // paySource !== usePrevious(paySource) || operation !== usePrevious(operation) const prevPaySource = usePrevious(paySource); const prevOperation = usePrevious(operation); const prevIsPair = usePrevious(isPair); const forceRecalculate = prevPaySource !== paySource || prevOperation !== operation || prevIsPair !== isPair; - // if (forceRecalculate) { - // console.log({ forceRecalculate }); - // } - const technicalFeesAsyncResult = useThrottledAsync( async (p) => { if (p.params.paySource === "gmxAccount" || p.params.paySource === "settlementChain") { @@ -581,9 +447,9 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { glvInfo, paySource, srcChainId, - tokenAddress, - marketTokenAmount, - tokenAmount, + tokenAddress: firstTokenAddress, + marketTokenAmount: marketOrGlvTokenAmount, + tokenAmount: firstTokenAmount, operation, amounts, } @@ -616,28 +482,14 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const submitState = useGmSwapSubmitState({ routerAddress, - // amounts, logicalFees, technicalFees: technicalFeesAsyncResult.data, - // isDeposit, - // marketInfo, - // glvInfo, - // operation, - // glvToken, shouldDisableValidation: shouldDisableValidationForTesting, tokensData: tradeTokensData, - // longTokenAddress: longTokenInputState?.address, - // shortTokenAddress: shortTokenInputState?.address, longTokenLiquidityUsd: longCollateralLiquidityUsd, shortTokenLiquidityUsd: shortCollateralLiquidityUsd, - // marketTokensData, - // selectedMarketForGlv, - // selectedMarketInfoForGlv: getByKey(marketsInfoData, selectedMarketForGlv), - // isMarketTokenDeposit: isMarketTokenDeposit, marketsInfoData, glvAndMarketsInfoData, - // paySource: paySource || "settlementChain", - // isPair, }); const firstTokenMaxDetails = useMaxAvailableAmount({ @@ -663,8 +515,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const secondTokenShowMaxButton = isDeposit && secondTokenMaxDetails.showClickMax; const marketTokenMaxDetails = useMaxAvailableAmount({ - fromToken: glvInfo ? glvToken : marketToken, - fromTokenAmount: glvInfo ? glvTokenAmount : marketTokenAmount, + fromToken: marketOrGlvTokenData, + fromTokenAmount: marketOrGlvTokenAmount, fromTokenInputValue: marketOrGlvTokenInputValue, nativeToken: nativeToken, minResidualAmount: undefined, @@ -701,7 +553,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const receiveTokenUsd = glvInfo ? amounts?.glvTokenUsd ?? 0n : convertToUsd( - marketTokenAmount, + marketOrGlvTokenAmount, marketToken?.decimals, isDeposit ? marketToken?.prices?.maxPrice : marketToken?.prices?.minPrice )!; @@ -774,7 +626,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { onSelectGlvOrMarket(glvOrMarketAddress); setIsMarketForGlvSelectedManually(false); }, - [onSelectGlvOrMarket, resetInputs] + [onSelectGlvOrMarket, resetInputs, setIsMarketForGlvSelectedManually] ); const onMarketChange = useCallback( @@ -782,7 +634,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { setIsMarketForGlvSelectedManually(true); onSelectedMarketForGlv?.(marketAddress); }, - [onSelectedMarketForGlv] + [onSelectedMarketForGlv, setIsMarketForGlvSelectedManually] ); const onMaxClickFirstToken = useCallback(() => { @@ -883,25 +735,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #endregion // #region Effects - useUpdateInputAmounts({ - chainId, - marketToken, - marketInfo, - fromMarketTokenInputState, - longTokenInputState, - shortTokenInputState, - isDeposit, - glvInfo, - glvToken, - focusedInput, - amounts, - marketTokenAmount, - glvTokenAmount, - isWithdrawal, - setMarketOrGlvTokenInputValue, - setFirstTokenInputValue, - setSecondTokenInputValue, - }); + useUpdateInputAmounts(); useEffect( function updateMarket() { @@ -928,20 +762,10 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { }); useBestGmPoolAddressForGlv({ - isDeposit, - glvInfo, - selectedMarketForGlv, fees: logicalFees, uiFeeFactor, - focusedInput, - marketTokenAmount, - isMarketTokenDeposit, - isMarketForGlvSelectedManually, - glvTokenAmount, + marketTokenAmount: marketOrGlvTokenAmount, onSelectedMarketForGlv, - longTokenInputState, - shortTokenInputState, - fromMarketTokenInputState, marketTokensData, }); // #endregion @@ -972,7 +796,25 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { */ const firstTokenPlaceholder = useMemo(() => { if (firstToken?.symbol === "GM") { - return null; + return ( +
+ {/* */} + +
+ ); } return ( @@ -984,7 +826,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { /> ); - }, [firstToken?.symbol, paySource, srcChainId]); + }, [chainId, firstToken?.address, firstToken?.symbol, paySource, srcChainId]); return ( <> @@ -1129,8 +971,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { marketTokensData={marketTokensData} isDeposit={isDeposit} glvInfo={glvInfo} - selectedMarketForGlv={selectedMarketForGlv} - disablePoolSelector={fromMarketTokenInputState !== undefined} + selectedMarketForGlv={isMarketTokenDeposit ? firstTokenAddress : selectedMarketForGlv} + disablePoolSelector={isMarketTokenDeposit} onMarketChange={glvInfo ? onMarketChange : onGlvOrMarketChange} /> diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx similarity index 96% rename from src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx rename to src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx index f96d46ce70..41a695e1c1 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx @@ -194,7 +194,7 @@ export const selectPoolsDetailsParams = createSelector((q) => { if (isDeposit && isGlv) { // Raw GLV Deposit Params - if (!marketInfo || !glvTokenAddress || marketOrGlvTokenAmount === undefined) { + if (!marketInfo || !glvTokenAddress || !selectedMarketForGlv || marketOrGlvTokenAmount === undefined) { return undefined; } @@ -203,13 +203,15 @@ export const selectPoolsDetailsParams = createSelector((q) => { let dataList: string[] = EMPTY_ARRAY; if (paySource === "sourceChain") { if (!srcChainId) { - throw new Error("Source chain ID is required"); + // throw new Error("Source chain ID is required"); + return undefined; } const tokenId = getMultichainTokenId(chainId, glvTokenAddress); if (!tokenId) { - throw new Error("Token ID not found"); + // throw new Error("Token ID not found"); + return undefined; } const actionHash = CodecUiHelper.encodeMultichainActionData({ @@ -235,16 +237,16 @@ export const selectPoolsDetailsParams = createSelector((q) => { return { addresses: { glv: glvInfo!.glvTokenAddress, - market: selectedMarketForGlv!, + market: selectedMarketForGlv, receiver: glvInfo!.glvToken.totalSupply === 0n ? numberToHex(1, { size: 20 }) : account, callbackContract: zeroAddress, uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, initialLongToken: isMarketTokenDeposit ? zeroAddress - : (MARKETS[chainId][marketOrGlvTokenAddress!].longTokenAddress as ERC20Address), + : (MARKETS[chainId][selectedMarketForGlv].longTokenAddress as ERC20Address), initialShortToken: isMarketTokenDeposit ? zeroAddress - : (MARKETS[chainId][marketOrGlvTokenAddress!].shortTokenAddress as ERC20Address), + : (MARKETS[chainId][selectedMarketForGlv].shortTokenAddress as ERC20Address), longTokenSwapPath: [], shortTokenSwapPath: [], }, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index 48a2e2b092..5f5004f57a 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -1,19 +1,15 @@ import { t } from "@lingui/macro"; -import chunk from "lodash/chunk"; import { useCallback, useMemo } from "react"; -import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; import { SettlementChainId } from "config/chains"; -import { DEFAULT_SLIPPAGE_AMOUNT } from "config/factors"; -import { CHAIN_ID_TO_ENDPOINT_ID, getMultichainTokenId } from "config/multichain"; -import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { selectPoolsDetailsGlvInfo, - selectPoolsDetailsGlvOrMarketAddress, selectPoolsDetailsLongTokenAddress, selectPoolsDetailsMarketInfo, selectPoolsDetailsMarketTokenData, + selectPoolsDetailsPaySource, + selectPoolsDetailsSelectedMarketForGlv, selectPoolsDetailsShortTokenAddress, } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; @@ -23,7 +19,6 @@ import { selectSrcChainId, } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; -import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; import { TransferRequests } from "domain/multichain/types"; import { @@ -49,16 +44,13 @@ import { sendOrderSubmittedMetric, sendTxnValidationErrorMetric, } from "lib/metrics"; -import { EMPTY_ARRAY } from "lib/objects"; import { makeUserAnalyticsOrderFailResultHandler, sendUserAnalyticsOrderConfirmClickEvent } from "lib/userAnalytics"; import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; import { ExecutionFee } from "sdk/types/fees"; -import { nowInSeconds } from "sdk/utils/time"; -import { applySlippageToMinOut } from "sdk/utils/trade"; +import { selectPoolsDetailsParams } from "./selectPoolsDetailsParams"; import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainDepositExpressTxnParams } from "./useMultichainDepositExpressTxnParams"; @@ -72,11 +64,10 @@ export const useDepositTransactions = ({ shouldDisableValidation, tokensData, technicalFees, - selectedMarketForGlv, + // selectedMarketForGlv, selectedMarketInfoForGlv, - isMarketTokenDeposit, isFirstBuy, - paySource, + // paySource, }: UseLpTransactionProps): { onCreateDeposit: () => Promise; } => { @@ -86,19 +77,14 @@ export const useDepositTransactions = ({ const { setPendingDeposit } = useSyntheticsEvents(); const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); - // const globalExpressParams = useSelector(selectExpressGlobalParams); - // const marketTokenAddress = marketToken?.address || marketInfo?.marketTokenAddress; - const marketTokenAddress = useSelector(selectPoolsDetailsGlvOrMarketAddress); const glvInfo = useSelector(selectPoolsDetailsGlvInfo); const marketInfo = useSelector(selectPoolsDetailsMarketInfo); const marketToken = useSelector(selectPoolsDetailsMarketTokenData); const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); - - const shouldUnwrapNativeToken = - (longTokenAddress === zeroAddress && longTokenAmount !== undefined && longTokenAmount > 0n) || - (shortTokenAddress === zeroAddress && shortTokenAmount !== undefined && shortTokenAmount > 0n); + const paySource = useSelector(selectPoolsDetailsPaySource); + const selectedMarketForGlv = useSelector(selectPoolsDetailsSelectedMarketForGlv); const initialLongTokenAddress = longTokenAddress ? convertTokenAddress(chainId, longTokenAddress, "wrapped") @@ -116,6 +102,26 @@ export const useDepositTransactions = ({ const transferRequests = useMemo((): TransferRequests => { const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); + + if (paySource === "sourceChain") { + const tokenAddress = + longTokenAmount !== undefined && longTokenAmount > 0n ? initialLongTokenAddress : initialShortTokenAddress; + + const estimatedReceivedAmount = + (technicalFees as SourceChainDepositFees | SourceChainGlvDepositFees | undefined)?.txnEstimatedReceivedAmount ?? + 0n; + + let amount = longTokenAmount !== undefined && longTokenAmount > 0n ? longTokenAmount : shortTokenAmount!; + + return getTransferRequests([ + { + to: vaultAddress, + token: tokenAddress, + amount: estimatedReceivedAmount ?? amount, + }, + ]); + } + return getTransferRequests([ { to: vaultAddress, @@ -128,175 +134,24 @@ export const useDepositTransactions = ({ amount: shortTokenAmount, }, ]); - }, [chainId, initialLongTokenAddress, initialShortTokenAddress, isGlv, longTokenAmount, shortTokenAmount]); - - const rawGmParams = useMemo((): RawCreateDepositParams | undefined => { - if ( - !account || - !marketTokenAddress || - marketTokenAmount === undefined || - // executionFeeTokenAmount === undefined || - isGlv || - !initialLongTokenAddress || - !initialShortTokenAddress - ) { - return undefined; - } - - const minMarketTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketTokenAmount); - - let dataList: string[] = EMPTY_ARRAY; - - if (paySource === "sourceChain") { - if (!srcChainId) { - return undefined; - } - - const multichainTokenConfig = getMultichainTokenId(chainId, marketTokenAddress); - if (!multichainTokenConfig) { - return undefined; - } - - const actionHash = CodecUiHelper.encodeMultichainActionData({ - actionType: MultichainActionType.BridgeOut, - actionData: { - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - desChainId: chainId, - provider: multichainTokenConfig.stargate, - providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), - minAmountOut: minMarketTokens, - secondaryProvider: zeroAddress, - secondaryProviderData: zeroAddress, - secondaryMinAmountOut: 0n, - }, - }); - const bytes = hexToBytes(actionHash as Hex); - const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); - - dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; - } - - const params: RawCreateDepositParams = { - addresses: { - receiver: account, - callbackContract: zeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - market: marketTokenAddress, - initialLongToken: initialLongTokenAddress, - initialShortToken: initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - }, - minMarketTokens, - shouldUnwrapNativeToken: false, - callbackGasLimit: 0n, - dataList, - }; - - return params; }, [ - account, chainId, - // executionFeeTokenAmount, initialLongTokenAddress, initialShortTokenAddress, isGlv, - marketTokenAddress, - marketTokenAmount, + longTokenAmount, paySource, - srcChainId, + shortTokenAmount, + technicalFees, ]); - const rawGlvParams = useMemo((): RawCreateGlvDepositParams | undefined => { - if ( - !account || - !marketInfo || - marketTokenAmount === undefined || - // executionFeeTokenAmount === undefined || - !isGlv || - glvTokenAmount === undefined || - !initialLongTokenAddress || - !initialShortTokenAddress - ) { - return undefined; - } - - const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, glvTokenAmount); - - let dataList: string[] = EMPTY_ARRAY; - if (paySource === "sourceChain") { - if (!srcChainId) { - return undefined; - } - - const tokenId = getMultichainTokenId(chainId, glvInfo!.glvTokenAddress); - if (!tokenId) { - return undefined; - } - - const actionHash = CodecUiHelper.encodeMultichainActionData({ - actionType: MultichainActionType.BridgeOut, - actionData: { - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - desChainId: chainId, - minAmountOut: minGlvTokens, - provider: tokenId.stargate, - providerData: numberToHex(CHAIN_ID_TO_ENDPOINT_ID[srcChainId], { size: 32 }), - secondaryProvider: zeroAddress, - secondaryProviderData: zeroAddress, - secondaryMinAmountOut: 0n, - }, - }); - const bytes = hexToBytes(actionHash as Hex); - - const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); - - dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; - } - - const params: RawCreateGlvDepositParams = { - addresses: { - glv: glvInfo!.glvTokenAddress, - market: selectedMarketForGlv!, - receiver: glvInfo!.glvToken.totalSupply === 0n ? numberToHex(1, { size: 20 }) : account, - callbackContract: zeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - initialLongToken: isMarketTokenDeposit ? zeroAddress : initialLongTokenAddress, - initialShortToken: isMarketTokenDeposit ? zeroAddress : initialShortTokenAddress, - longTokenSwapPath: [], - shortTokenSwapPath: [], - }, - minGlvTokens, - callbackGasLimit: 0n, - shouldUnwrapNativeToken, - isMarketTokenDeposit: Boolean(isMarketTokenDeposit), - dataList, - }; - - return params; - }, [ - account, - chainId, - // executionFeeTokenAmount, - glvInfo, - glvTokenAmount, - initialLongTokenAddress, - initialShortTokenAddress, - isGlv, - isMarketTokenDeposit, - marketInfo, - marketTokenAmount, - paySource, - selectedMarketForGlv, - shouldUnwrapNativeToken, - srcChainId, - ]); + const rawParams = useSelector(selectPoolsDetailsParams); const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; const gmParams = useMemo((): CreateDepositParams | undefined => { - if (!rawGmParams || !technicalFees) { + if (!rawParams || !technicalFees) { // console.log("no gm params becayse no", { rawGmParams, technicalFees }); return undefined; @@ -308,13 +163,13 @@ export const useDepositTransactions = ({ : (technicalFees as ExecutionFee).feeTokenAmount; return { - ...rawGmParams, + ...(rawParams as RawCreateDepositParams), executionFee, }; - }, [rawGmParams, technicalFees, paySource]); + }, [rawParams, technicalFees, paySource]); const glvParams = useMemo((): CreateGlvDepositParams | undefined => { - if (!rawGlvParams || !technicalFees) { + if (!rawParams || !technicalFees) { return undefined; } @@ -324,10 +179,10 @@ export const useDepositTransactions = ({ : (technicalFees as ExecutionFee).feeTokenAmount; return { - ...rawGlvParams, + ...(rawParams as RawCreateGlvDepositParams), executionFee, }; - }, [paySource, rawGlvParams, technicalFees]); + }, [paySource, rawParams, technicalFees]); const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ transferRequests, @@ -400,7 +255,7 @@ export const useDepositTransactions = ({ sendOrderSubmittedMetric(metricData.metricId); - if (!tokensData || !account || !signer || !rawGmParams) { + if (!tokensData || !account || !signer || !rawParams) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); return Promise.resolve(); @@ -427,7 +282,7 @@ export const useDepositTransactions = ({ srcChainId: srcChainId!, signer, transferRequests, - params: rawGmParams!, + params: rawParams as RawCreateDepositParams, tokenAddress, tokenAmount, fees: technicalFees as SourceChainDepositFees, @@ -471,11 +326,12 @@ export const useDepositTransactions = ({ tokensData, account, signer, - rawGmParams, + rawParams, chainId, paySource, longTokenAmount, shortTokenAmount, + technicalFees, longTokenAddress, shortTokenAddress, srcChainId, @@ -483,7 +339,6 @@ export const useDepositTransactions = ({ multichainDepositExpressTxnParams, gmParams, blockTimestampData, - technicalFees, shouldDisableValidation, setPendingTxns, setPendingDeposit, @@ -506,7 +361,7 @@ export const useDepositTransactions = ({ marketTokenAmount === undefined || !tokensData || !signer || - (isGlv && !rawGlvParams) + (isGlv && !rawParams) ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -530,7 +385,7 @@ export const useDepositTransactions = ({ srcChainId: srcChainId!, signer, transferRequests, - params: rawGlvParams!, + params: rawParams as RawCreateGlvDepositParams, tokenAddress, tokenAmount, fees: technicalFees as SourceChainGlvDepositFees, @@ -584,7 +439,7 @@ export const useDepositTransactions = ({ tokensData, signer, isGlv, - rawGlvParams, + rawParams, chainId, paySource, longTokenAmount, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 99941af069..0c85184026 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -3,17 +3,17 @@ import { useConnectModal } from "@rainbow-me/rainbowkit"; import { useCallback, useMemo } from "react"; import { - selectPoolsDetailsFirstTokenAddress, selectPoolsDetailsFlags, selectPoolsDetailsGlvInfo, selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAddress, selectPoolsDetailsMarketInfo, selectPoolsDetailsMarketTokenData, selectPoolsDetailsMarketTokensData, selectPoolsDetailsOperation, selectPoolsDetailsPaySource, - selectPoolsDetailsSecondTokenAddress, selectPoolsDetailsSelectedMarketForGlv, + selectPoolsDetailsShortTokenAddress, } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; @@ -21,6 +21,8 @@ import type { ExecutionFee } from "domain/synthetics/fees"; import type { GlvAndGmMarketsInfoData, MarketsInfoData } from "domain/synthetics/markets"; import type { SourceChainDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees"; import type { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; +import { SourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; +import { SourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; import { getTokenData, TokensData } from "domain/synthetics/tokens"; import { getCommonError, getGmSwapError } from "domain/synthetics/trade/utils/validation"; import { useHasOutdatedUi } from "lib/useHasOutdatedUi"; @@ -35,35 +37,21 @@ import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts import { useTokensToApprove } from "./useTokensToApprove"; interface Props { - // amounts: DepositAmounts | WithdrawalAmounts | undefined; - // isDeposit: boolean; routerAddress: string; - // marketInfo?: MarketInfo; - // glvInfo?: GlvInfo; - // marketToken: TokenData; - // operation: Operation; - // longTokenAddress: string | undefined; - // shortTokenAddress: string | undefined; - // glvToken: TokenData | undefined; longTokenLiquidityUsd?: bigint | undefined; shortTokenLiquidityUsd?: bigint | undefined; - shouldDisableValidation?: boolean; - tokensData: TokensData | undefined; - // marketTokensData?: TokensData; - technicalFees: ExecutionFee | SourceChainGlvDepositFees | SourceChainDepositFees | undefined; + technicalFees: + | ExecutionFee + | SourceChainGlvDepositFees + | SourceChainDepositFees + | SourceChainWithdrawalFees + | SourceChainGlvWithdrawalFees + | undefined; logicalFees: GmSwapFees | undefined; - // selectedMarketForGlv?: string; - // isMarketTokenDeposit?: boolean; marketsInfoData?: MarketsInfoData; glvAndMarketsInfoData: GlvAndGmMarketsInfoData; - // selectedMarketInfoForGlv?: MarketInfo; - // paySource: GmPaySource; - // isPair: boolean; - // needTokenApprove: boolean; - // isApproving: boolean; - // handleApprove: () => void; } const processingTextMap = { @@ -83,29 +71,13 @@ type SubmitButtonState = { }; export const useGmSwapSubmitState = ({ - // isDeposit, routerAddress, - // amounts, logicalFees, technicalFees, - // marketInfo, - // longTokenAddress, - // shortTokenAddress, - // operation, - // glvToken, longTokenLiquidityUsd, shortTokenLiquidityUsd, - shouldDisableValidation, - tokensData, - // marketTokensData, - // selectedMarketForGlv, - // selectedMarketInfoForGlv, - // glvInfo, - // isMarketTokenDeposit, - // paySource, - // isPair, }: Props): SubmitButtonState => { const { isDeposit, isPair } = useSelector(selectPoolsDetailsFlags); const operation = useSelector(selectPoolsDetailsOperation); @@ -116,8 +88,8 @@ export const useGmSwapSubmitState = ({ const marketTokensData = useSelector(selectPoolsDetailsMarketTokensData); const marketToken = useSelector(selectPoolsDetailsMarketTokenData); const selectedMarketForGlv = useSelector(selectPoolsDetailsSelectedMarketForGlv); - const longTokenAddress = useSelector(selectPoolsDetailsFirstTokenAddress); - const shortTokenAddress = useSelector(selectPoolsDetailsSecondTokenAddress); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); const marketInfo = useSelector(selectPoolsDetailsMarketInfo); const amounts = useSelector(selectDepositWithdrawalAmounts); const chainId = useSelector(selectChainId); @@ -178,7 +150,6 @@ export const useGmSwapSubmitState = ({ isDeposit, marketInfo, glvInfo, - // marketToken, longToken: getTokenData(tokensData, longTokenAddress), shortToken: getTokenData(tokensData, shortTokenAddress), glvToken, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx index 30572026ae..d30c43f392 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx @@ -8,6 +8,7 @@ import { SourceChainId } from "config/chains"; import { getMappedTokenId } from "config/multichain"; import { useGmxAccountSettlementChainId } from "context/GmxAccountContext/hooks"; import { + selectPoolsDetailsFirstToken, selectPoolsDetailsFirstTokenAddress, selectPoolsDetailsFirstTokenAmount, selectPoolsDetailsPaySource, @@ -84,6 +85,7 @@ export const useTokensToApprove = ({ const firstTokenAmount = useSelector(selectPoolsDetailsFirstTokenAmount); const secondTokenAmount = useSelector(selectPoolsDetailsSecondTokenAmount); + const firstToken = useSelector(selectPoolsDetailsFirstToken); const firstTokenSourceChainTokenId = firstTokenAddress !== undefined && srcChainId !== undefined ? getMappedTokenId(chainId as SourceChainId, firstTokenAddress, srcChainId) @@ -106,14 +108,13 @@ export const useTokensToApprove = ({ srcChainId !== undefined ? multichainTokensAllowanceResult.tokensAllowanceData : undefined; const firstTokenAmountLD = - firstTokenAmount !== undefined && firstTokenAddress !== undefined && firstTokenSourceChainTokenId !== undefined - ? adjustForDecimals( - firstTokenAmount, - getToken(chainId, firstTokenAddress).decimals, - firstTokenSourceChainTokenId.decimals - ) + firstTokenAmount !== undefined && + firstTokenAddress !== undefined && + firstTokenSourceChainTokenId !== undefined && + firstToken + ? adjustForDecimals(firstTokenAmount, firstToken.decimals, firstTokenSourceChainTokenId.decimals) : undefined; - const firstTokenSymbol = firstTokenAddress ? getToken(chainId, firstTokenAddress).symbol : undefined; + const fistToken = useSelector(selectPoolsDetailsFirstToken); const multichainNeedTokenApprove = paySource === "sourceChain" ? getNeedTokenApprove( @@ -124,8 +125,8 @@ export const useTokensToApprove = ({ ) : false; const multichainTokensToApproveSymbols = useMemo(() => { - return firstTokenSymbol && multichainNeedTokenApprove ? [firstTokenSymbol] : EMPTY_ARRAY; - }, [firstTokenSymbol, multichainNeedTokenApprove]); + return fistToken?.symbol && multichainNeedTokenApprove ? [fistToken.symbol] : EMPTY_ARRAY; + }, [fistToken, multichainNeedTokenApprove]); const handleApproveSourceChain = useCallback(async () => { if (!firstTokenAddress || firstTokenAmountLD === undefined || !multichainSpenderAddress || !srcChainId) { diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx index 6d4979446a..aeeb8e0b30 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx @@ -1,59 +1,52 @@ import { useEffect } from "react"; -import { GlvInfo, MarketInfo } from "domain/synthetics/markets/types"; -import { TokenData } from "domain/synthetics/tokens"; -import type { DepositAmounts, WithdrawalAmounts } from "domain/synthetics/trade"; +import { + selectPoolsDetailsFirstToken, + selectPoolsDetailsFlags, + selectPoolsDetailsFocusedInput, + selectPoolsDetailsGlvInfo, + selectPoolsDetailsGlvTokenAmount, + selectPoolsDetailsGlvTokenData, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketOrGlvTokenAmount, + selectPoolsDetailsMarketTokenData, + selectPoolsDetailsSecondToken, + selectPoolsDetailsSetFirstTokenInputValue, + selectPoolsDetailsSetMarketOrGlvTokenInputValue, + selectPoolsDetailsSetSecondTokenInputValue, + selectPoolsDetailsShortTokenAddress, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { useSelector } from "context/SyntheticsStateContext/utils"; import { formatAmountFree } from "lib/numbers"; -import { ContractsChainId } from "sdk/configs/chains"; -import { getToken } from "sdk/configs/tokens"; - -import { TokenInputState } from "./types"; - -export function useUpdateInputAmounts({ - chainId, - marketToken, - marketInfo, - longTokenInputState, - shortTokenInputState, - fromMarketTokenInputState, - isDeposit, - focusedInput, - amounts, - glvInfo, - glvToken, - setMarketOrGlvTokenInputValue, - marketTokenAmount, - glvTokenAmount, - isWithdrawal, - setFirstTokenInputValue, - setSecondTokenInputValue, -}: { - chainId: ContractsChainId; - marketToken: TokenData | undefined; - glvToken: TokenData | undefined; - marketInfo: MarketInfo | undefined; - glvInfo: GlvInfo | undefined; - longTokenInputState: TokenInputState | undefined; - shortTokenInputState: TokenInputState | undefined; - fromMarketTokenInputState: TokenInputState | undefined; - isDeposit: boolean; - focusedInput: string; - amounts: DepositAmounts | WithdrawalAmounts | undefined; - setMarketOrGlvTokenInputValue: (value: string) => void; - marketTokenAmount: bigint; - glvTokenAmount: bigint; - isWithdrawal: boolean; - setFirstTokenInputValue: (value: string) => void; - setSecondTokenInputValue: (value: string) => void; -}) { + +import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts"; + +export function useUpdateInputAmounts() { + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); + const glvToken = useSelector(selectPoolsDetailsGlvTokenData); + const glvTokenAmount = useSelector(selectPoolsDetailsGlvTokenAmount); + const marketToken = useSelector(selectPoolsDetailsMarketTokenData); + const marketTokenAmount = useSelector(selectPoolsDetailsMarketOrGlvTokenAmount); + const marketInfo = useSelector(selectPoolsDetailsMarketInfo); + const longToken = useSelector(selectPoolsDetailsLongTokenAddress); + const shortToken = useSelector(selectPoolsDetailsShortTokenAddress); + const { isDeposit, isWithdrawal } = useSelector(selectPoolsDetailsFlags); + const amounts = useSelector(selectDepositWithdrawalAmounts); + const firstToken = useSelector(selectPoolsDetailsFirstToken); + const secondToken = useSelector(selectPoolsDetailsSecondToken); + const focusedInput = useSelector(selectPoolsDetailsFocusedInput); + + const setFirstTokenInputValue = useSelector(selectPoolsDetailsSetFirstTokenInputValue); + const setSecondTokenInputValue = useSelector(selectPoolsDetailsSetSecondTokenInputValue); + const setMarketOrGlvTokenInputValue = useSelector(selectPoolsDetailsSetMarketOrGlvTokenInputValue); + useEffect( function updateInputAmounts() { if (!marketToken || !marketInfo) { return; } - const longToken = longTokenInputState ? getToken(chainId, longTokenInputState.address) : undefined; - const shortToken = shortTokenInputState ? getToken(chainId, shortTokenInputState.address) : undefined; const fromMarketToken = marketToken; if (isDeposit) { @@ -74,30 +67,41 @@ export function useUpdateInputAmounts({ } } else if (focusedInput === "market") { if (glvInfo ? glvTokenAmount <= 0 : marketTokenAmount <= 0) { - longTokenInputState?.setValue(""); - shortTokenInputState?.setValue(""); - fromMarketTokenInputState?.setValue(""); + // longTokenInputState?.setValue(""); + // shortTokenInputState?.setValue(""); + // fromMarketTokenInputState?.setValue(""); + setFirstTokenInputValue(""); + setSecondTokenInputValue(""); return; } if (amounts) { - if (longToken) { + if (longToken && firstToken) { let longTokenAmountToSet = amounts.longTokenAmount; - longTokenInputState?.setValue( - longTokenAmountToSet > 0 ? formatAmountFree(longTokenAmountToSet, longToken.decimals) : "" + // longTokenInputState?.setValue( + // longTokenAmountToSet > 0 ? formatAmountFree(longTokenAmountToSet, longToken.decimals) : "" + // ); + setFirstTokenInputValue( + longTokenAmountToSet > 0 ? formatAmountFree(longTokenAmountToSet, firstToken.decimals) : "" ); } - if (shortToken) { - shortTokenInputState?.setValue( - amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" + if (shortToken && secondToken) { + // shortTokenInputState?.setValue( + // amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" + // ); + setSecondTokenInputValue( + amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, secondToken.decimals) : "" ); } - if (fromMarketToken) { - fromMarketTokenInputState?.setValue( - amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, marketToken.decimals) : "" + if (fromMarketToken && firstToken) { + // fromMarketTokenInputState?.setValue( + // amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, marketToken.decimals) : "" + // ); + setFirstTokenInputValue( + amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, firstToken.decimals) : "" ); } return; @@ -110,42 +114,52 @@ export function useUpdateInputAmounts({ if (isWithdrawal) { if (focusedInput === "market") { if ((amounts?.marketTokenAmount ?? 0) <= 0) { - longTokenInputState?.setValue(""); - shortTokenInputState?.setValue(""); + // longTokenInputState?.setValue(""); + setFirstTokenInputValue(""); + // shortTokenInputState?.setValue(""); + setSecondTokenInputValue(""); return; } if (amounts) { if (marketInfo.isSameCollaterals) { - if (longToken) { + if (longToken && firstToken) { setFirstTokenInputValue( amounts.longTokenAmount > 0 - ? formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, longToken.decimals) + ? formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, firstToken.decimals) : "" ); } } else { - if (longToken) { - longTokenInputState?.setValue( - amounts.longTokenAmount > 0 ? formatAmountFree(amounts.longTokenAmount, longToken.decimals) : "" + if (longToken && firstToken) { + // longTokenInputState?.setValue( + // amounts.longTokenAmount > 0 ? formatAmountFree(amounts.longTokenAmount, longToken.decimals) : "" + // ); + setFirstTokenInputValue( + amounts.longTokenAmount > 0 ? formatAmountFree(amounts.longTokenAmount, firstToken.decimals) : "" ); } - if (shortToken) { - shortTokenInputState?.setValue( - amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" + if (shortToken && secondToken) { + // shortTokenInputState?.setValue( + // amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" + // ); + setSecondTokenInputValue( + amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, secondToken.decimals) : "" ); } } } } else if (["longCollateral", "shortCollateral"].includes(focusedInput)) { if (focusedInput === "longCollateral" && (amounts?.longTokenAmount ?? 0) <= 0) { - shortTokenInputState?.setValue(""); + // shortTokenInputState?.setValue(""); + setSecondTokenInputValue(""); setMarketOrGlvTokenInputValue(""); return; } if (focusedInput === "shortCollateral" && (amounts?.shortTokenAmount ?? 0) <= 0) { - longTokenInputState?.setValue(""); + // longTokenInputState?.setValue(""); + setFirstTokenInputValue(""); setMarketOrGlvTokenInputValue(""); return; } @@ -155,17 +169,22 @@ export function useUpdateInputAmounts({ amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, marketToken.decimals) : "" ); if (marketInfo.isSameCollaterals) { - if (longToken) { - longTokenInputState?.setValue( - formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, longToken.decimals) + if (longToken && firstToken) { + // longTokenInputState?.setValue( + // formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, longToken.decimals) + // ); + setFirstTokenInputValue( + formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, firstToken.decimals) ); } } else { - if (longToken) { - longTokenInputState?.setValue(formatAmountFree(amounts.longTokenAmount, longToken.decimals)); + if (longToken && firstToken) { + // longTokenInputState?.setValue(formatAmountFree(amounts.longTokenAmount, longToken.decimals)); + setFirstTokenInputValue(formatAmountFree(amounts.longTokenAmount, firstToken.decimals)); } - if (shortToken) { - shortTokenInputState?.setValue(formatAmountFree(amounts.shortTokenAmount, shortToken.decimals)); + if (shortToken && secondToken) { + // shortTokenInputState?.setValue(formatAmountFree(amounts.shortTokenAmount, shortToken.decimals)); + setSecondTokenInputValue(formatAmountFree(amounts.shortTokenAmount, secondToken.decimals)); } } } @@ -177,19 +196,19 @@ export function useUpdateInputAmounts({ focusedInput, isDeposit, isWithdrawal, - longTokenInputState, marketInfo, marketToken, marketTokenAmount, setFirstTokenInputValue, setMarketOrGlvTokenInputValue, setSecondTokenInputValue, - shortTokenInputState, - fromMarketTokenInputState, glvInfo, glvToken, glvTokenAmount, - chainId, + longToken, + firstToken, + shortToken, + secondToken, ] ); } diff --git a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts index ea28d5f7eb..dc46c77370 100644 --- a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts +++ b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts @@ -1,13 +1,27 @@ import { useEffect, useMemo } from "react"; -import { getAvailableUsdLiquidityForCollateral, GlvInfo } from "domain/synthetics/markets"; +import { + selectPoolsDetailsFlags, + selectPoolsDetailsIsMarketForGlvSelectedManually, + selectPoolsDetailsFocusedInput, + selectPoolsDetailsGlvInfo, + selectPoolsDetailsGlvTokenAmount, + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsLongTokenAmount, + selectPoolsDetailsSelectedMarketForGlv, + selectPoolsDetailsShortTokenAddress, + selectPoolsDetailsShortTokenAmount, +} from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { useSelector } from "context/SyntheticsStateContext/utils"; +import { getAvailableUsdLiquidityForCollateral } from "domain/synthetics/markets"; import { isGlvInfo } from "domain/synthetics/markets/glv"; import { TokensData } from "domain/synthetics/tokens"; import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; import { getGmSwapError } from "domain/synthetics/trade/utils/validation"; +import { useChainId } from "lib/chains"; import { usePrevious } from "lib/usePrevious"; -import { TokenInputState } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; import type { useDepositWithdrawalFees } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useDepositWithdrawalFees"; import { useGlvGmMarketsWithComposition } from "./useMarketGlvGmMarketsCompositions"; @@ -15,81 +29,64 @@ import { useGlvGmMarketsWithComposition } from "./useMarketGlvGmMarketsCompositi export const useBestGmPoolAddressForGlv = ({ fees, uiFeeFactor, - focusedInput, - isDeposit, - - fromMarketTokenInputState, - longTokenInputState, - shortTokenInputState, - - isMarketForGlvSelectedManually, - isMarketTokenDeposit, - selectedMarketForGlv, - - glvInfo, - glvTokenAmount, - marketTokenAmount, marketTokensData, - onSelectedMarketForGlv, }: { - isDeposit: boolean; - glvInfo: GlvInfo | undefined; - selectedMarketForGlv?: string; - uiFeeFactor: bigint; - focusedInput: string; - - longTokenInputState: TokenInputState | undefined; - shortTokenInputState: TokenInputState | undefined; - fromMarketTokenInputState: TokenInputState | undefined; - marketTokenAmount: bigint; - isMarketTokenDeposit: boolean; - glvTokenAmount: bigint | undefined; - marketTokensData: TokensData | undefined; - fees: ReturnType["logicalFees"]; - - isMarketForGlvSelectedManually: boolean; onSelectedMarketForGlv?: (marketAddress?: string) => void; }) => { + const { chainId, srcChainId } = useChainId(); + + const glvInfo = useSelector(selectPoolsDetailsGlvInfo); + const glvTokenAmount = useSelector(selectPoolsDetailsGlvTokenAmount); + const { isDeposit } = useSelector(selectPoolsDetailsFlags); const marketsWithComposition = useGlvGmMarketsWithComposition(isDeposit, glvInfo?.glvTokenAddress); + const isMarketTokenDeposit = useSelector(selectPoolsDetailsIsMarketTokenDeposit); + const focusedInput = useSelector(selectPoolsDetailsFocusedInput); + const isMarketForGlvSelectedManually = useSelector(selectPoolsDetailsIsMarketForGlvSelectedManually); const isEligible = useMemo(() => { return glvInfo && isGlvInfo(glvInfo) && marketsWithComposition.length > 0 && !isMarketTokenDeposit; }, [glvInfo, marketsWithComposition, isMarketTokenDeposit]); + const longTokenAmount = useSelector(selectPoolsDetailsLongTokenAmount); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAmount = useSelector(selectPoolsDetailsShortTokenAmount); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); + const selectedMarketForGlv = useSelector(selectPoolsDetailsSelectedMarketForGlv); + const markets = useMemo(() => { if (!isEligible || !glvInfo) { return []; } - const halfOfLong = longTokenInputState?.amount !== undefined ? longTokenInputState.amount / 2n : undefined; + const halfOfLong = longTokenAmount !== undefined ? longTokenAmount / 2n : undefined; return [...marketsWithComposition].map((marketConfig) => { const marketInfo = marketConfig.market; - const longTokenAmount = (marketInfo.isSameCollaterals ? halfOfLong : longTokenInputState?.amount) || 0n; - const shortTokenAmount = + const adjustedLongTokenAmount = (marketInfo.isSameCollaterals ? halfOfLong : longTokenAmount) || 0n; + const adjustedShortTokenAmount = (marketInfo.isSameCollaterals - ? longTokenInputState?.amount !== undefined - ? longTokenInputState.amount - longTokenAmount + ? longTokenAmount !== undefined + ? longTokenAmount - longTokenAmount : undefined - : shortTokenInputState?.amount) || 0n; + : shortTokenAmount) || 0n; const amounts = getDepositAmounts({ marketInfo, marketToken: marketConfig.token, longToken: marketInfo.longToken, shortToken: marketInfo.shortToken, - longTokenAmount, - shortTokenAmount, + longTokenAmount: adjustedLongTokenAmount, + shortTokenAmount: adjustedShortTokenAmount, marketTokenAmount, - includeLongToken: Boolean(longTokenInputState?.address), - includeShortToken: Boolean(shortTokenInputState?.address), + includeLongToken: adjustedLongTokenAmount > 0n, + includeShortToken: adjustedShortTokenAmount > 0n, uiFeeFactor, glvTokenAmount: glvTokenAmount ?? 0n, strategy: focusedInput === "market" ? "byMarketToken" : "byCollaterals", @@ -124,6 +121,9 @@ export const useBestGmPoolAddressForGlv = ({ marketTokensData, paySource: "settlementChain", isPair: false, + chainId, + srcChainId, + isMarketTokenDeposit, }); return { @@ -134,18 +134,21 @@ export const useBestGmPoolAddressForGlv = ({ }; }); }, [ + isEligible, + glvInfo, + longTokenAmount, marketsWithComposition, + shortTokenAmount, marketTokenAmount, - longTokenInputState, - shortTokenInputState, uiFeeFactor, + glvTokenAmount, focusedInput, - glvInfo, - isEligible, isDeposit, fees, marketTokensData, - glvTokenAmount, + chainId, + srcChainId, + isMarketTokenDeposit, ]); const byAmount = useMemo( @@ -195,8 +198,8 @@ export const useBestGmPoolAddressForGlv = ({ if (isDeposit) { if ( - (longTokenInputState?.amount === 0n || longTokenInputState?.amount === undefined) && - (shortTokenInputState?.amount === 0n || shortTokenInputState?.amount === undefined) + (longTokenAmount === 0n || longTokenAmount === undefined) && + (shortTokenAmount === 0n || shortTokenAmount === undefined) ) { return byComposition[0]?.marketTokenAddress; } @@ -206,38 +209,39 @@ export const useBestGmPoolAddressForGlv = ({ return byComposition[0]?.marketTokenAddress; } }, [ - byComposition, - isDeposit, - selectedMarketForGlv, - byAmount, isMarketTokenDeposit, - longTokenInputState, - shortTokenInputState, + selectedMarketForGlv, isMarketForGlvSelectedManually, + isDeposit, + longTokenAmount, + shortTokenAmount, + byAmount, + byComposition, ]); - const previousLongAmount = usePrevious(longTokenInputState?.amount); - const previousShortAmount = usePrevious(shortTokenInputState?.amount); + const previousLongAmount = usePrevious(longTokenAmount); + const previousShortAmount = usePrevious(shortTokenAmount); const previousMarketTokenAmount = usePrevious(marketTokenAmount); - const previousLongTokenAddress = usePrevious(longTokenInputState?.address); - const previousShortTokenAddress = usePrevious(shortTokenInputState?.address); + const previousLongTokenAddress = usePrevious(longTokenAddress); + const previousShortTokenAddress = usePrevious(shortTokenAddress); useEffect(() => { if (!isEligible) { - if (selectedMarketForGlv !== fromMarketTokenInputState?.address) { - onSelectedMarketForGlv?.(fromMarketTokenInputState?.address); - } + // TODO MLTCH check it + // if (selectedMarketForGlv !== fromMarketTokenInputState?.address) { + // onSelectedMarketForGlv?.(fromMarketTokenInputState?.address); + // } return; } const shouldSetBestGmMarket = !isMarketForGlvSelectedManually && - (previousLongAmount !== longTokenInputState?.amount || - previousShortAmount !== shortTokenInputState?.amount || + (previousLongAmount !== longTokenAmount || + previousShortAmount !== shortTokenAmount || previousMarketTokenAmount !== marketTokenAmount || - previousLongTokenAddress !== longTokenInputState?.address || - previousShortTokenAddress !== shortTokenInputState?.address); + previousLongTokenAddress !== longTokenAddress || + previousShortTokenAddress !== shortTokenAddress); if ( ((!selectedMarketForGlv && bestGmMarketAddress) || shouldSetBestGmMarket) && @@ -250,8 +254,6 @@ export const useBestGmPoolAddressForGlv = ({ onSelectedMarketForGlv, selectedMarketForGlv, isMarketForGlvSelectedManually, - longTokenInputState, - shortTokenInputState, marketTokenAmount, previousLongAmount, previousShortAmount, @@ -259,7 +261,10 @@ export const useBestGmPoolAddressForGlv = ({ previousLongTokenAddress, previousShortTokenAddress, isEligible, - fromMarketTokenInputState, isDeposit, + longTokenAmount, + shortTokenAmount, + longTokenAddress, + shortTokenAddress, ]); }; diff --git a/src/components/TokenSelector/MultichainTokenSelector.tsx b/src/components/TokenSelector/MultichainTokenSelector.tsx index 07589a18a1..d717a68012 100644 --- a/src/components/TokenSelector/MultichainTokenSelector.tsx +++ b/src/components/TokenSelector/MultichainTokenSelector.tsx @@ -11,7 +11,17 @@ import { stripBlacklistedWords } from "domain/tokens/utils"; import { formatBalanceAmount, formatUsd } from "lib/numbers"; import { EMPTY_ARRAY, EMPTY_OBJECT } from "lib/objects"; import { searchBy } from "lib/searchBy"; -import { getToken } from "sdk/configs/tokens"; +import { MARKETS } from "sdk/configs/markets"; +import { getToken, GM_STUB_ADDRESS } from "sdk/configs/tokens"; +import { + getMarketIndexName, + getMarketIndexToken, + getMarketIndexTokenSymbol, + getMarketLongTokenSymbol, + getMarketPoolName, + getMarketShortTokenSymbol, + isMarketTokenAddress, +} from "sdk/utils/markets"; import Button from "components/Button/Button"; import ConnectWalletButton from "components/ConnectWalletButton/ConnectWalletButton"; @@ -74,7 +84,9 @@ export function MultichainTokenSelector({ }: Props) { const [isModalVisible, setIsModalVisible] = useState(false); const [searchKeyword, setSearchKeyword] = useState(""); - let token: Token | undefined = getToken(chainId, tokenAddress); + let token: Token | undefined = isMarketTokenAddress(chainId, tokenAddress) + ? getToken(chainId, GM_STUB_ADDRESS) + : getToken(chainId, tokenAddress); const onSelectTokenAddress = (tokenAddress: string, _chainId: AnyChainId | 0) => { setIsModalVisible(false); @@ -199,6 +211,7 @@ export function MultichainTokenSelector({ <> {activeFilter === "pay" && ( @@ -214,17 +227,32 @@ export function MultichainTokenSelector({ className="group/hoverable group flex cursor-pointer items-center gap-5 whitespace-nowrap hover:text-blue-300" onClick={() => setIsModalVisible(true)} > - - - {token.symbol} - + {!token.isPlatformToken ? ( + + + {token.symbol} + + ) : ( + + + {getMarketIndexName({ + indexToken: getMarketIndexToken(chainId, tokenAddress)!, + isSpotOnly: false, + })} + + )} @@ -366,9 +394,11 @@ function useAvailableToTradeTokenList({ } function AvailableToTradeTokenList({ + chainId, onSelectTokenAddress, tokens, }: { + chainId: ContractsChainId; onSelectTokenAddress: (tokenAddress: string, chainId: AnyChainId | 0) => void; tokens: DisplayAvailableToTradeToken[]; }) { @@ -382,18 +412,53 @@ function AvailableToTradeTokenList({ onClick={() => onSelectTokenAddress(token.address, token.chainId)} >
- - -
-
{token.symbol}
- {token.name} -
+ {token.isPlatformToken && isMarketTokenAddress(chainId, token.address) ? ( + <> + + +
+ GM:{" "} + {getMarketIndexName({ + indexToken: getMarketIndexToken(chainId, token.address)!, + isSpotOnly: false, + })}{" "} + + [ + {getMarketPoolName({ + longToken: getToken(chainId, MARKETS[chainId]?.[token.address]?.longTokenAddress), + shortToken: getToken(chainId, MARKETS[chainId]?.[token.address]?.shortTokenAddress), + })} + ] + +
+ + ) : ( + <> + +
+
{token.symbol}
+ {token.name} +
+ + )}
diff --git a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx index 5e6dc7dacd..674a134761 100644 --- a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx +++ b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx @@ -1,3 +1,4 @@ +import mapValues from "lodash/mapValues"; import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; @@ -7,26 +8,35 @@ import { selectDepositMarketTokensData, selectGlvInfo, selectMarketsInfoData, + selectSrcChainId, + selectTokensData, } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; import { SyntheticsState } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; import { createSelector, useSelector } from "context/SyntheticsStateContext/utils"; -import { GlvInfoData, MarketsInfoData, useMarketTokensDataRequest } from "domain/synthetics/markets"; +import { + GlvInfoData, + isMarketTokenAddress, + MarketsInfoData, + useMarketTokensDataRequest, +} from "domain/synthetics/markets"; import { isGlvInfo } from "domain/synthetics/markets/glv"; import { TokensData } from "domain/synthetics/tokens"; +import { Token, TokenBalanceType } from "domain/tokens"; import { useChainId } from "lib/chains"; import { useLocalStorageSerializeKey } from "lib/localStorage"; import { parseValue } from "lib/numbers"; -import { getByKey } from "lib/objects"; +import { EMPTY_ARRAY, getByKey } from "lib/objects"; import useRouteQuery from "lib/useRouteQuery"; import { useSafeState } from "lib/useSafeState"; import { MARKETS } from "sdk/configs/markets"; -import { convertTokenAddress, getToken } from "sdk/configs/tokens"; +import { convertTokenAddress, getToken, GM_STUB_ADDRESS } from "sdk/configs/tokens"; import { getTokenData } from "sdk/utils/tokens"; import { getGmSwapBoxAvailableModes } from "components/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes"; import { FocusedInput, GmPaySource } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; import { Mode, Operation, isMode, isOperation } from "components/GmSwap/GmSwapBox/types"; +import { useMultichainTokens, useMultichainTradeTokensRequest } from "components/GmxAccountModal/hooks"; export type PoolsDetailsQueryParams = { market: string; @@ -79,6 +89,8 @@ export type PoolsDetailsState = { firstTokenInputValue: string; secondTokenInputValue: string; marketOrGlvTokenInputValue: string; + isMarketForGlvSelectedManually: boolean; + multichainTokensResult: ReturnType; // marketTokensBalancesResult: ReturnType; setOperation: (operation: Operation) => void; @@ -92,6 +104,7 @@ export type PoolsDetailsState = { setFirstTokenInputValue: (value: string) => void; setSecondTokenInputValue: (value: string) => void; setMarketOrGlvTokenInputValue: (value: string) => void; + setIsMarketForGlvSelectedManually: (value: boolean) => void; }; function useReactRouterSearchParam(param: string): [string | undefined, (value: string | undefined) => void] { @@ -137,8 +150,7 @@ export function usePoolsDetailsState({ enabled, withMultichainBalances: enabled, }); - - // const marketTokensBalancesResult = useMultichainMarketTokensBalancesRequest(chainId, account); + const multichainTokensResult = useMultichainTradeTokensRequest(chainId, account); // GM Deposit/Withdrawal Box State const isDeposit = operation === Operation.Deposit; @@ -149,7 +161,7 @@ export function usePoolsDetailsState({ "settlementChain" ); - let paySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); + const paySource = fallbackPaySource({ operation, mode, paySource: rawPaySource, srcChainId }); useEffect( function fallbackSourceChainPaySource() { @@ -172,6 +184,7 @@ export function usePoolsDetailsState({ const [firstTokenInputValue, setFirstTokenInputValue] = useSafeState(""); const [secondTokenInputValue, setSecondTokenInputValue] = useSafeState(""); const [marketOrGlvTokenInputValue, setMarketOrGlvTokenInputValue] = useSafeState(""); + const [isMarketForGlvSelectedManually, setIsMarketForGlvSelectedManually] = useState(false); useEffect(() => { if (!enabled) { @@ -226,6 +239,8 @@ export function usePoolsDetailsState({ firstTokenInputValue, secondTokenInputValue, marketOrGlvTokenInputValue, + isMarketForGlvSelectedManually, + multichainTokensResult, // Setters setOperation, @@ -239,6 +254,7 @@ export function usePoolsDetailsState({ setFirstTokenInputValue, setSecondTokenInputValue, setMarketOrGlvTokenInputValue, + setIsMarketForGlvSelectedManually, }; }, [ enabled, @@ -254,6 +270,8 @@ export function usePoolsDetailsState({ firstTokenInputValue, secondTokenInputValue, marketOrGlvTokenInputValue, + isMarketForGlvSelectedManually, + multichainTokensResult, setGlvOrMarketAddress, setPaySource, setFirstTokenAddress, @@ -287,6 +305,8 @@ const selectPoolsDetailsFirstTokenInputValue = (s: SyntheticsState) => s.poolsDe const selectPoolsDetailsSecondTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.secondTokenInputValue ?? ""; const selectPoolsDetailsMarketOrGlvTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.marketOrGlvTokenInputValue ?? ""; +export const selectPoolsDetailsIsMarketForGlvSelectedManually = (s: SyntheticsState) => + s.poolsDetails?.isMarketForGlvSelectedManually ?? false; // const selectPoolsDetailsMarketTokenMultichainBalances = (s: SyntheticsState) => // s.poolsDetails?.marketTokensBalancesResult.tokenBalances; @@ -298,40 +318,43 @@ export const selectPoolsDetailsMarketOrGlvTokenAmount = createSelector((q) => { return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; }); -// const selectGlvTokenAmount = createSelector((q) => { -// const marketOrGlvTokenInputValue = q(selectMarketOrGlvTokenInputValue); +export const selectPoolsDetailsGlvTokenAmount = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); -// return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; -// }); + if (!glvInfo) { + return 0n; + } + + return marketOrGlvTokenAmount; +}); export const selectPoolsDetailsFirstTokenAmount = createSelector((q) => { - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const firstToken = q(selectPoolsDetailsFirstToken); - if (!firstTokenAddress) { + if (!firstToken) { return 0n; } const firstTokenInputValue = q(selectPoolsDetailsFirstTokenInputValue); - const chainId = q(selectChainId); - const token = getToken(chainId, firstTokenAddress); - return parseValue(firstTokenInputValue || "0", token.decimals)!; + return parseValue(firstTokenInputValue || "0", firstToken.decimals)!; }); export const selectPoolsDetailsSecondTokenAmount = createSelector((q) => { - const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const secondToken = q(selectPoolsDetailsSecondToken); - if (!secondTokenAddress) { + if (!secondToken) { return 0n; } const secondTokenInputValue = q(selectPoolsDetailsSecondTokenInputValue); - const chainId = q(selectChainId); - const token = getToken(chainId, secondTokenAddress); - return parseValue(secondTokenInputValue || "0", token.decimals)!; + return parseValue(secondTokenInputValue || "0", secondToken.decimals)!; }); +const FALLBACK_STRING_SETTER = noop as (value: string) => void; +const FALLBACK_BOOLEAN_SETTER = noop as (value: boolean) => void; // Setters const selectSetGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.setGlvOrMarketAddress; const selectSetSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.setSelectedMarketForGlv; @@ -341,9 +364,14 @@ const selectSetFocusedInput = (s: SyntheticsState) => s.poolsDetails?.setFocused const selectSetPaySource = (s: SyntheticsState) => s.poolsDetails?.setPaySource; const selectSetFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenAddress; const selectSetSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenAddress; -const selectSetFirstTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenInputValue; -const selectSetSecondTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenInputValue; -const selectSetMarketOrGlvTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.setMarketOrGlvTokenInputValue; +export const selectPoolsDetailsSetFirstTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setFirstTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetSecondTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setSecondTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetMarketOrGlvTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setMarketOrGlvTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetIsMarketForGlvSelectedManually = (s: SyntheticsState) => + s.poolsDetails?.setIsMarketForGlvSelectedManually ?? FALLBACK_BOOLEAN_SETTER; export const selectPoolsDetailsGlvInfo = createSelector((q) => { const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); @@ -361,9 +389,26 @@ export const selectPoolsDetailsGlvTokenAddress = createSelector((q) => { return glvInfo?.glvTokenAddress; }); -export const selectPoolsDetailsMarketInfo = createSelector((q) => { +export const selectPoolsDetailsGlvTokenData = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + return glvInfo?.glvToken; +}); + +export const selectPoolsDetailsMarketOrGlvTokenData = createSelector((q) => { + const glvTokenData = q(selectPoolsDetailsGlvTokenData); + if (glvTokenData) { + return glvTokenData; + } + + return q(selectPoolsDetailsMarketTokenData); +}); + +export const selectPoolsDetailsMarketTokenAddress = createSelector((q) => { + const chainId = q(selectChainId); const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); const selectedMarketForGlv = q(selectPoolsDetailsSelectedMarketForGlv); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const glvInfo = q(selectPoolsDetailsGlvInfo); // If it's a GLV but no market is selected, return undefined @@ -373,12 +418,22 @@ export const selectPoolsDetailsMarketInfo = createSelector((q) => { const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; - return q((state) => { - if (isGlv) { - return getByKey(selectMarketsInfoData(state), selectedMarketForGlv); + if (isGlv) { + if (firstTokenAddress && MARKETS[chainId][firstTokenAddress]) { + return firstTokenAddress; } - return getByKey(selectMarketsInfoData(state), glvOrMarketAddress); + return selectedMarketForGlv; + } + + return glvOrMarketAddress; +}); + +export const selectPoolsDetailsMarketInfo = createSelector((q) => { + const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); + + return q((state) => { + return getByKey(selectMarketsInfoData(state), marketTokenAddress); }); }); @@ -390,15 +445,12 @@ export const selectPoolsDetailsFlags = createSelector((q) => { isPair: mode === Mode.Pair, isDeposit: operation === Operation.Deposit, isWithdrawal: operation === Operation.Withdrawal, + isSingle: mode === Mode.Single, }; }); export const selectPoolsDetailsMarketTokensData = createSelector((q) => { const { isDeposit } = q(selectPoolsDetailsFlags); - // const srcChainId = q(selectSrcChainId); - // const marketTokensMultichainBalances = srcChainId - // ? q((state) => selectPoolsDetailsMarketTokenMultichainBalances(state)?.[srcChainId]) - // : undefined; if (isDeposit) { return q(selectDepositMarketTokensData); @@ -416,10 +468,9 @@ export const selectPoolsDetailsMarketTokenData = createSelector((q) => { if (!marketTokensData) { return undefined; } + const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); - const marketInfo = q(selectPoolsDetailsMarketInfo); - - return getTokenData(marketTokensData, marketInfo?.marketTokenAddress); + return getTokenData(marketTokensData, marketTokenAddress); }); export const selectPoolsDetailsLongTokenAddress = createSelector((q) => { @@ -464,49 +515,6 @@ export const selectPoolsDetailsShortTokenAddress = createSelector((q) => { return glvInfo.shortTokenAddress; }); -// export const selectPoolsDetailsFirstTokenToLongTokenFindSwapPath = createSelector((q) => { -// const firstTokenAddress = q(selectFirstTokenAddress); - -// if (!firstTokenAddress) { -// return undefined; -// } - -// const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); - -// if (!longTokenAddress) { -// return undefined; -// } - -// return q(makeSelectFindSwapPath(firstTokenAddress, longTokenAddress)); -// }); - -// export const selectPoolsDetailsSecondTokenToShortTokenFindSwapPath = createSelector((q) => { -// const secondTokenAddress = q(selectSecondTokenAddress); - -// if (!secondTokenAddress) { -// return undefined; -// } - -// const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); - -// if (!shortTokenAddress) { -// return undefined; -// } - -// return q(makeSelectFindSwapPath(secondTokenAddress, shortTokenAddress)); -// }); - -// TODO MLTCH maybe its just for deposit and not for withdrawal -// export const selectPoolsDetailsFindSwapPaths = createSelector((q) => { -// const firstTokenToLongTokenFindSwapPath = q(selectPoolsDetailsFirstTokenToLongTokenFindSwapPath); -// const secondTokenToShortTokenFindSwapPath = q(selectPoolsDetailsSecondTokenToShortTokenFindSwapPath); - -// return { -// firstTokenToLongTokenFindSwapPath, -// secondTokenToShortTokenFindSwapPath, -// }; -// }); - export const selectPoolsDetailsWithdrawalReceiveTokenAddress = createSelector((q) => { const { isPair, isWithdrawal } = q(selectPoolsDetailsFlags); @@ -577,54 +585,53 @@ export const selectPoolsDetailsIsMarketTokenDeposit = createSelector((q) => { } const chainId = q(selectChainId); - const isMarket = Boolean(MARKETS[chainId][firstTokenAddress]); - return isMarket; + return isMarketTokenAddress(chainId, firstTokenAddress); }); -export const selectPoolsDetailsGlvDepositMarketTokenAddress = createSelector((q) => { - const { isDeposit } = q(selectPoolsDetailsFlags); +// export const selectPoolsDetailsGlvDepositMarketTokenAddress = createSelector((q) => { +// const { isDeposit } = q(selectPoolsDetailsFlags); - if (!isDeposit) { - return undefined; - } +// if (!isDeposit) { +// return undefined; +// } - const glvInfo = q(selectPoolsDetailsGlvInfo); +// const glvInfo = q(selectPoolsDetailsGlvInfo); - if (!glvInfo) { - return undefined; - } +// if (!glvInfo) { +// return undefined; +// } - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); +// const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - if (!firstTokenAddress) { - return undefined; - } +// if (!firstTokenAddress) { +// return undefined; +// } - if (!glvInfo.markets.some((market) => market.address === firstTokenAddress)) { - return undefined; - } +// if (!glvInfo.markets.some((market) => market.address === firstTokenAddress)) { +// return undefined; +// } - return firstTokenAddress; -}); +// return firstTokenAddress; +// }); // export const selectPoolsDetailsGlvDepositOr -export const selectPoolsDetailsGlvDepositMarketTokenAmount = createSelector((q) => { - const glvDepositMarketTokenAddress = q(selectPoolsDetailsGlvDepositMarketTokenAddress); +// export const selectPoolsDetailsGlvDepositMarketTokenAmount = createSelector((q) => { +// const glvDepositMarketTokenAddress = q(selectPoolsDetailsGlvDepositMarketTokenAddress); - if (!glvDepositMarketTokenAddress) { - return undefined; - } +// if (!glvDepositMarketTokenAddress) { +// return undefined; +// } - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); +// const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - if (glvDepositMarketTokenAddress === firstTokenAddress) { - return q(selectPoolsDetailsFirstTokenAmount); - } +// if (glvDepositMarketTokenAddress === firstTokenAddress) { +// return q(selectPoolsDetailsFirstTokenAmount); +// } - throw new Error("Weird state"); -}); +// throw new Error("Weird state"); +// }); export const selectPoolsDetailsLongTokenAmount = createSelector((q) => { const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); @@ -662,6 +669,75 @@ export const selectPoolsDetailsShortTokenAmount = createSelector((q) => { return shortTokenAmount; }); +export const selectPoolsDetailsFirstToken = createSelector((q): Token | undefined => { + const chainId = q(selectChainId); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + if (!firstTokenAddress) { + return undefined; + } + + if (MARKETS[chainId][firstTokenAddress]) { + return getToken(chainId, GM_STUB_ADDRESS); + } + + return getToken(chainId, firstTokenAddress); +}); + +export const selectPoolsDetailsSecondToken = createSelector((q): Token | undefined => { + const chainId = q(selectChainId); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + if (!secondTokenAddress) { + return undefined; + } + + if (MARKETS[chainId][secondTokenAddress]) { + return getToken(chainId, GM_STUB_ADDRESS); + } + + return getToken(chainId, secondTokenAddress); +}); + +export const selectPoolsDetailsMultichainTokensArray = (s: SyntheticsState) => + s.poolsDetails?.multichainTokensResult?.tokenChainDataArray || EMPTY_ARRAY; + +export const selectPoolsDetailsTradeTokensDataWithSourceChainBalances = createSelector((q) => { + const srcChainId = q(selectSrcChainId); + const paySource = q(selectPoolsDetailsPaySource); + const rawTradeTokensData = q(selectTokensData); + const tokenChainDataArray = q(selectPoolsDetailsMultichainTokensArray); + + if (paySource !== "sourceChain") { + return rawTradeTokensData; + } + + return mapValues(rawTradeTokensData, (token) => { + const sourceChainToken = tokenChainDataArray.find( + (t) => t.address === token.address && t.sourceChainId === srcChainId + ); + + if (!sourceChainToken) { + return token; + } + + return { + ...token, + balanceType: TokenBalanceType.SourceChain, + balance: sourceChainToken.sourceChainBalance, + sourceChainBalance: sourceChainToken.sourceChainBalance, + }; + }); +}); + +export const selectPoolsDetailsMarketAndTradeTokensData = createSelector((q) => { + const marketTokensData = q(selectPoolsDetailsMarketTokensData); + const tradeTokensData = q(selectPoolsDetailsTradeTokensDataWithSourceChainBalances); + + return { + ...marketTokensData, + ...tradeTokensData, + }; +}); + // GM Deposit/Withdrawal Box State Hooks export function usePoolsDetailsFocusedInput() { const value = useSelector(selectPoolsDetailsFocusedInput); @@ -689,19 +765,19 @@ export function usePoolsDetailsSecondTokenAddress() { export function usePoolsDetailsFirstTokenInputValue() { const value = useSelector(selectPoolsDetailsFirstTokenInputValue); - const setter = useSelector(selectSetFirstTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetFirstTokenInputValue); return [value, (setter || noop) as Exclude] as const; } export function usePoolsDetailsSecondTokenInputValue() { const value = useSelector(selectPoolsDetailsSecondTokenInputValue); - const setter = useSelector(selectSetSecondTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetSecondTokenInputValue); return [value, (setter || noop) as Exclude] as const; } export function usePoolsDetailsMarketOrGlvTokenInputValue() { const value = useSelector(selectPoolsDetailsMarketOrGlvTokenInputValue); - const setter = useSelector(selectSetMarketOrGlvTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetMarketOrGlvTokenInputValue); return [value, (setter || noop) as Exclude] as const; } @@ -729,3 +805,9 @@ export function usePoolsDetailsSelectedMarketForGlv() { const setter = useSelector(selectSetSelectedMarketForGlv); return [value, (setter || noop) as Exclude] as const; } + +export function usePoolsDetailsIsMarketForGlvSelectedManually() { + const value = useSelector(selectPoolsDetailsIsMarketForGlvSelectedManually); + const setter = useSelector(selectPoolsDetailsSetIsMarketForGlvSelectedManually); + return [value, (setter || noop) as Exclude] as const; +} diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index 7e4303a2d8..738c0dea37 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -34,6 +34,7 @@ import { getSubaccountValidations } from "domain/synthetics/subaccount"; import type { Subaccount, SubaccountValidations } from "domain/synthetics/subaccount/types"; import { convertToTokenAmount } from "domain/tokens"; import { CustomError, isCustomError } from "lib/errors"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { metrics } from "lib/metrics"; import { expandDecimals, USD_DECIMALS } from "lib/numbers"; import { EMPTY_ARRAY, EMPTY_OBJECT } from "lib/objects"; @@ -139,29 +140,20 @@ async function estimateArbitraryGasLimit({ ] ); - // try { const gasLimit = await fallbackCustomError( async () => - provider.estimateGas({ - from: GMX_SIMULATION_ORIGIN as Address, - to: baseTxnData.to as Address, - data: baseData, - value: 0n, - }), + provider + .estimateGas({ + from: GMX_SIMULATION_ORIGIN as Address, + to: baseTxnData.to as Address, + data: baseData, + value: 0n, + }) + .then(applyGasLimitBuffer), "gasLimit" ); - // } catch (error) { - // console.log({ - // from: GMX_SIMULATION_ORIGIN as Address, - // to: baseTxnData.to as Address, - // data: baseData, - // value: 0n, - // }); - // debugger; - // throw error; - // } - - return gasLimit + 100_000n; + + return gasLimit; } export async function estimateArbitraryRelayFee({ diff --git a/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts index abb07543d1..c5709cc22d 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimatePureGlvDepositGasLimit.ts @@ -26,7 +26,7 @@ export function estimatePureGlvDepositGasLimit({ marketsCount, }); - const oraclePriceCount = estimateGlvDepositOraclePriceCount(swapPathCount); + const oraclePriceCount = estimateGlvDepositOraclePriceCount(marketsCount, swapPathCount); const executionFee = getExecutionFee( chainId, diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts index a2dbfe38c5..c03778ed38 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts @@ -49,6 +49,7 @@ export type SourceChainDepositFees = { */ txnEstimatedNativeFee: bigint; txnEstimatedComposeGas: bigint; + txnEstimatedReceivedAmount: bigint; }; /** @@ -96,19 +97,24 @@ export async function estimateSourceChainDepositFees({ const fullWntFee = keeperDepositFeeWNTAmount + returnGmTransferNativeFee; - const { initialTxNativeFee, initialTxGasLimit, relayParamsPayload, initialTransferComposeGas } = - await estimateSourceChainDepositInitialTxFees({ - chainId, - srcChainId, - params: { - ...params, - executionFee: keeperDepositFeeWNTAmount, - }, - tokenAddress, - tokenAmount, - globalExpressParams, - fullWntFee, - }); + const { + initialTxNativeFee, + initialTxGasLimit, + relayParamsPayload, + initialTransferComposeGas, + initialTxReceivedAmount, + } = await estimateSourceChainDepositInitialTxFees({ + chainId, + srcChainId, + params: { + ...params, + executionFee: keeperDepositFeeWNTAmount, + }, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, + }); const relayFeeUsd = convertToUsd( relayParamsPayload.fee.feeAmount, @@ -123,6 +129,7 @@ export async function estimateSourceChainDepositFees({ executionFee: keeperDepositFeeWNTAmount, relayFeeUsd, relayParamsPayload, + txnEstimatedReceivedAmount: initialTxReceivedAmount, }; } @@ -145,6 +152,7 @@ async function estimateSourceChainDepositInitialTxFees({ }): Promise<{ initialTxNativeFee: bigint; initialTxGasLimit: bigint; + initialTxReceivedAmount: bigint; initialTransferComposeGas: bigint; relayParamsPayload: RelayParamsPayload; }> { @@ -190,13 +198,6 @@ async function estimateSourceChainDepositInitialTxFees({ throw new Error("Fee swap strategy has no swap path stats"); } - // console.log({ - // wrappedTokenAddress, - // wrappedTokenData: globalExpressParams.tokensData[wrappedTokenAddress], - // feeSwapStrategy, - // settlementWrappedTokenData, - // }); - const returnRawRelayParamsPayload: RawRelayParamsPayload = getRawRelayerParams({ chainId, gasPaymentTokenAddress: feeSwapStrategy?.swapPathStats!.tokenInAddress ?? settlementNativeWrappedTokenData.address, @@ -273,15 +274,12 @@ async function estimateSourceChainDepositInitialTxFees({ action, }); - // const initialQuoteOft = await sourceChainClient.readContract({ - // address: sourceChainTokenId.stargate, - // abi: abis.IStargate, - // functionName: "quoteOFT", - // args: [sendParams], - // }); - - // TODO MLTCH - // sendParams.amountLD = initialQuoteOft[0].minAmountLD * 100n; + const initialQuoteOft = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteOFT", + args: [sendParams], + }); const initialQuoteSend = await sourceChainClient.readContract({ address: sourceChainTokenId.stargate, @@ -324,6 +322,7 @@ async function estimateSourceChainDepositInitialTxFees({ return { initialTxNativeFee: initialQuoteSend.nativeFee, initialTxGasLimit: initialStargateTxnGasLimit, + initialTxReceivedAmount: initialQuoteOft[2].amountReceivedLD, initialTransferComposeGas: initialComposeGas, relayParamsPayload: returnRelayParamsPayload, }; diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts index c20abc068f..159ee56346 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts @@ -48,6 +48,7 @@ export type SourceChainGlvDepositFees = { */ txnEstimatedNativeFee: bigint; txnEstimatedComposeGas: bigint; + txnEstimatedReceivedAmount: bigint; }; /** @@ -98,19 +99,24 @@ export async function estimateSourceChainGlvDepositFees({ const fullWntFee = keeperDepositFeeWNTAmount + returnGmTransferNativeFee; - const { initialTxNativeFee, initialTxGasLimit, relayParamsPayload, initialTransferComposeGas } = - await estimateSourceChainGlvDepositInitialTxFees({ - chainId, - srcChainId, - params: { - ...params, - executionFee: keeperDepositFeeWNTAmount, - }, - tokenAddress, - tokenAmount, - globalExpressParams, - fullWntFee, - }); + const { + initialTxNativeFee, + initialTxGasLimit, + relayParamsPayload, + initialTransferComposeGas, + initialTxReceivedAmount, + } = await estimateSourceChainGlvDepositInitialTxFees({ + chainId, + srcChainId, + params: { + ...params, + executionFee: keeperDepositFeeWNTAmount, + }, + tokenAddress, + tokenAmount, + globalExpressParams, + fullWntFee, + }); const relayFeeUsd = convertToUsd( relayParamsPayload.fee.feeAmount, @@ -125,6 +131,7 @@ export async function estimateSourceChainGlvDepositFees({ executionFee: keeperDepositFeeWNTAmount, relayFeeUsd, relayParamsPayload, + txnEstimatedReceivedAmount: initialTxReceivedAmount, }; } @@ -149,6 +156,7 @@ async function estimateSourceChainGlvDepositInitialTxFees({ initialTxGasLimit: bigint; initialTransferComposeGas: bigint; relayParamsPayload: RelayParamsPayload; + initialTxReceivedAmount: bigint; }> { const sourceChainClient = getPublicClientWithRpc(srcChainId); @@ -251,6 +259,13 @@ async function estimateSourceChainGlvDepositInitialTxFees({ action, }); + const initialQuoteOft = await sourceChainClient.readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteOFT", + args: [sendParams], + }); + const initialQuoteSend = await sourceChainClient.readContract({ address: sourceChainTokenId.stargate, abi: abis.IStargate, @@ -289,5 +304,6 @@ async function estimateSourceChainGlvDepositInitialTxFees({ initialTxGasLimit: initialStargateTxnGasLimit, initialTransferComposeGas: initialComposeGas, relayParamsPayload: returnRelayParamsPayload, + initialTxReceivedAmount: initialQuoteOft[2].amountReceivedLD, }; } diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index cf6d341808..a8fb80c3ae 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -1,7 +1,7 @@ import { t } from "@lingui/macro"; import { ethers } from "ethers"; -import { ContractsChainId, IS_NETWORK_DISABLED, SourceChainId, getChainName } from "config/chains"; +import { ContractsChainId, IS_NETWORK_DISABLED, SettlementChainId, SourceChainId, getChainName } from "config/chains"; import { BASIS_POINTS_DIVISOR, BASIS_POINTS_DIVISOR_BIGINT, USD_DECIMALS } from "config/factors"; import { getMappedTokenId } from "config/multichain"; import { ExpressTxnParams } from "domain/synthetics/express/types"; @@ -643,6 +643,61 @@ export function decreasePositionSizeByLeverageDiff( ); } +// function getTokenBalance(token: TokenData | undefined, balanceType: TokenBalanceType) { +// if (!token) { +// return 0n; +// } + +// if (balanceType === TokenBalanceType.Wallet) { +// return token.walletBalance; +// } + +// if (balanceType === TokenBalanceType.GmxAccount) { +// return token.gmxAccountBalance; +// } + +// if (balanceType === TokenBalanceType.SourceChain) { +// return token.sourceChainBalance; +// } + +// throw new Error(`Invalid balance type: ${balanceType}`); +// } + +function getTokenBalanceByPaySource( + token: TokenData | undefined, + paySource: GmPaySource, + chainId: ContractsChainId, + srcChainId: SourceChainId | undefined +): bigint { + if (!token) { + return 0n; + } + + if (paySource === "settlementChain") { + return token.walletBalance ?? 0n; + } + + if (paySource === "sourceChain") { + // adjust for decimals + const mappedTokenId = getMappedTokenId(chainId as SettlementChainId, token.address, srcChainId as SourceChainId); + if (!mappedTokenId) { + return 0n; + } + + if (token.sourceChainBalance === undefined) { + return 0n; + } + + return adjustForDecimals(token.sourceChainBalance, mappedTokenId.decimals, token.decimals) ?? 0n; + } + + if (paySource === "gmxAccount") { + return token.gmxAccountBalance ?? 0n; + } + + return 0n; +} + export function getGmSwapError(p: { isDeposit: boolean; marketInfo: MarketInfo | undefined; @@ -667,7 +722,7 @@ export function getGmSwapError(p: { isMarketTokenDeposit?: boolean; paySource: GmPaySource; isPair: boolean; - chainId?: ContractsChainId | undefined; + chainId: ContractsChainId; srcChainId?: SourceChainId | undefined; }) { const { @@ -785,46 +840,22 @@ export function getGmSwapError(p: { return [t`Enter an amount`]; } - let marketTokenBalance = 0n; - // let glvTokenBalance = 0n; - if (paySource === "settlementChain") { - marketTokenBalance = marketToken?.walletBalance ?? 0n; - // glvTokenBalance = glvToken?.walletBalance ?? 0n; - } else if (paySource === "sourceChain") { - if (srcChainId) { - if (marketToken) { - const mappedTokenId = getMappedTokenId(chainId as SourceChainId, marketToken.address, srcChainId); - if (mappedTokenId) { - marketTokenBalance = - adjustForDecimals(marketToken?.sourceChainBalance ?? 0n, marketToken?.decimals, mappedTokenId.decimals) ?? - 0n; - } - } - - // if (glvToken) { - // const mappedTokenId = getMappedTokenId(chainId as SourceChainId, glvToken.address, srcChainId); - // if (mappedTokenId) { - // glvTokenBalance = - // adjustForDecimals(glvToken.sourceChainBalance ?? 0n, glvToken.decimals, mappedTokenId.decimals) ?? 0n; - // } - // } - } - } else if (paySource === "gmxAccount") { - marketTokenBalance = marketToken?.gmxAccountBalance ?? 0n; - // glvTokenBalance = glvToken?.gmxAccountBalance ?? 0n; - } + const marketTokenBalance = getTokenBalanceByPaySource(marketToken, paySource, chainId, srcChainId); if (isDeposit) { + const longTokenBalance = getTokenBalanceByPaySource(longToken, paySource, chainId, srcChainId); + const shortTokenBalance = getTokenBalanceByPaySource(shortToken, paySource, chainId, srcChainId); + if (marketInfo.isSameCollaterals) { - if ((longTokenAmount ?? 0n) + (shortTokenAmount ?? 0n) > (longToken?.balance ?? 0n)) { + if ((longTokenAmount ?? 0n) + (shortTokenAmount ?? 0n) > longTokenBalance) { return [t`Insufficient ${longToken?.symbol} balance`]; } } else { - if ((longTokenAmount ?? 0n) > (longToken?.balance ?? 0n)) { + if ((longTokenAmount ?? 0n) > longTokenBalance) { return [t`Insufficient ${longToken?.symbol} balance`]; } - if ((shortTokenAmount ?? 0n) > (shortToken?.balance ?? 0n)) { + if ((shortTokenAmount ?? 0n) > shortTokenBalance) { return [t`Insufficient ${shortToken?.symbol} balance`]; } } @@ -856,8 +887,9 @@ export function getGmSwapError(p: { } } } else { + const glvTokenBalance = getTokenBalanceByPaySource(glvToken, paySource, chainId, srcChainId); if (glvInfo) { - if ((glvTokenAmount ?? 0n) > (glvToken?.balance ?? 0n)) { + if ((glvTokenAmount ?? 0n) > glvTokenBalance) { return [t`Insufficient ${glvToken?.symbol} balance`]; } } else { @@ -897,6 +929,7 @@ export function getGmSwapError(p: { return [undefined]; } + export function getGmShiftError({ fromMarketInfo, fromToken, diff --git a/src/lib/wallets/rainbowKitConfig.ts b/src/lib/wallets/rainbowKitConfig.ts index 85ed979402..de7878c08c 100644 --- a/src/lib/wallets/rainbowKitConfig.ts +++ b/src/lib/wallets/rainbowKitConfig.ts @@ -62,11 +62,11 @@ export const getRainbowKitConfig = once(() => ...(isDevelopment() ? [avalancheFuji, arbitrumSepolia, optimismSepolia, sepolia] : []), ], transports: { - [arbitrum.id]: http(), + [arbitrum.id]: http(getFallbackRpcUrl(arbitrum.id, false)), [avalanche.id]: http(), [avalancheFuji.id]: http(), [arbitrumSepolia.id]: http(getFallbackRpcUrl(arbitrumSepolia.id, false)), - [base.id]: http(), + [base.id]: http(getFallbackRpcUrl(base.id, false)), [optimismSepolia.id]: http(getFallbackRpcUrl(optimismSepolia.id, false)), [sepolia.id]: http(getFallbackRpcUrl(sepolia.id, false)), [botanix.id]: http(), From 3a89e55adeb34b626f5a77ecb5ed460dbbce5e1f Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 21 Oct 2025 03:42:17 +0200 Subject: [PATCH 27/38] Sync translations --- src/locales/de/messages.po | 8 ++++++-- src/locales/en/messages.po | 8 ++++++-- src/locales/es/messages.po | 8 ++++++-- src/locales/fr/messages.po | 8 ++++++-- src/locales/ja/messages.po | 8 ++++++-- src/locales/ko/messages.po | 8 ++++++-- src/locales/pseudo/messages.po | 8 ++++++-- src/locales/ru/messages.po | 8 ++++++-- src/locales/zh/messages.po | 8 ++++++-- 9 files changed, 54 insertions(+), 18 deletions(-) diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index bfadf1d9ec..1db97113c4 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "Tausch" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "Du benötigst insgesamt mindestens {0} {stakeTokenLabel}, um {1} esGMX zu vesten." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "Staken" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "Gesamt gestaket" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Geworbene Trader auf Avalanche" msgid "Funding Fees" msgstr "Finanzierungsgebühren" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 16d47124ba..f42625f94a 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "Swaps" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "The amount you are trying to deposit exceeds the limit. Please try an am msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "Native token cannot be approved" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "Stake" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "How do I get started on GMX?" msgid "Total Staked" msgstr "Total Staked" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Traders Referred on Avalanche" msgid "Funding Fees" msgstr "Funding Fees" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index 244aaa00f8..b1a8428274 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "Intercambios" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "Necesitas un total de al menos {0} {stakeTokenLabel} para adquirir {1} esGMX." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "Stake" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "Total Stakeado" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Traders Referidos en Avalanche" msgid "Funding Fees" msgstr "Comisiones de Financiación" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index accc0595c7..5ff479e3f3 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "Swaps" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "Vous avez besoin d'au moins {0} {stakeTokenLabel} au total pour vester {1} esGMX." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "Staker" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "Total staké" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Traders parrainés sur Avalanche" msgid "Funding Fees" msgstr "Frais de financement" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 31c5cd2afd..aedfc315f3 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "スワップ" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "合計で少なくとも{0} {stakeTokenLabel}が必要で、{1} esGMXをベストできます。" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "ステーク" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "ステーク総額" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Avalancheで紹介したトレーダー" msgid "Funding Fees" msgstr "ファンディング手数料" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index 9aaa19c874..e42091366f 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "스왑" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "최소 {0} {stakeTokenLabel}이 {1} esGMX를 베스팅하기 위해 필요합니다." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "스테이킹" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "총 스테이킹" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Avalanche에서 추천된 거래자" msgid "Funding Fees" msgstr "자금 수수료" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index cb76eb1a92..708599e218 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "" msgid "Stake" msgstr "" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "" msgid "Funding Fees" msgstr "" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index d43754c40e..cc515e90c9 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "Обмены" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "Вам нужно минимум {0} {stakeTokenLabel} для вестинга {1} esGMX." +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "Стейкинг" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "Всего Стейкано" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "Трейдеры, Привлечённые на Avalanche" msgid "Funding Fees" msgstr "Комиссии за Финансирование" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index 3302372603..4436283494 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -2049,6 +2049,8 @@ msgid "Swaps" msgstr "交换" #: src/components/ApproveTokenButton/ApproveTokenButton.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx #: src/components/PositionEditor/usePositionEditorButtonState.tsx @@ -2111,6 +2113,7 @@ msgstr "" msgid "You need a total of at least {0} {stakeTokenLabel} to vest {1} esGMX." msgstr "您至少需要总计 {0} {stakeTokenLabel} 来授权 {1} esGMX。" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Native token cannot be approved" msgstr "" @@ -2604,8 +2607,6 @@ msgstr "SL" msgid "Stake" msgstr "质押" -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx -#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx #: src/components/GmSwap/GmSwapBox/GmShiftBox/useShiftSubmitState.tsx msgid "Allow {tokenSymbol} to be spent" @@ -2709,6 +2710,7 @@ msgstr "" msgid "Total Staked" msgstr "总质押" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/InfoRows.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/WithdrawalView.tsx #: src/components/NetworkFeeRow/NetworkFeeRow.tsx @@ -3334,6 +3336,8 @@ msgstr "在 Avalanche 上推荐的交易者" msgid "Funding Fees" msgstr "资金费用" +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +#: src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx #: src/components/GmxAccountModal/DepositView.tsx #: src/components/GmxAccountModal/DepositView.tsx msgid "Approval failed" From 75bc28619e9613ca757f48a000aa836f7e620323 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 21 Oct 2025 13:29:32 +0200 Subject: [PATCH 28/38] Multichain LP enhancement --- .../lpTxn/selectPoolsDetailsParams.tsx | 12 +- .../lpTxn/useDepositTransactions.tsx | 5 +- .../lpTxn/useWithdrawalTransactions.tsx | 227 ++---------------- .../useTokensToApprove.tsx | 8 +- src/domain/multichain/arbitraryRelayParams.ts | 2 +- 5 files changed, 32 insertions(+), 222 deletions(-) diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx index 41a695e1c1..0f9af5e738 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx @@ -134,6 +134,7 @@ export const selectPoolsDetailsParams = createSelector((q) => { : false : false; + //#region GM Deposit if (isDeposit && !isGlv) { // Raw GM Deposit Params if (!marketOrGlvTokenAddress || marketOrGlvTokenAmount === undefined) { @@ -191,14 +192,18 @@ export const selectPoolsDetailsParams = createSelector((q) => { dataList, } satisfies RawCreateDepositParams; } + //#endregion + //#region GLV Deposit if (isDeposit && isGlv) { // Raw GLV Deposit Params if (!marketInfo || !glvTokenAddress || !selectedMarketForGlv || marketOrGlvTokenAmount === undefined) { return undefined; } - const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketOrGlvTokenAmount); + // TODO MLTCH: do not forget to apply slippage here + // const minGlvTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketOrGlvTokenAmount); + const minGlvTokens = 0n; //applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketOrGlvTokenAmount); let dataList: string[] = EMPTY_ARRAY; if (paySource === "sourceChain") { @@ -257,7 +262,9 @@ export const selectPoolsDetailsParams = createSelector((q) => { dataList, } satisfies RawCreateGlvDepositParams; } + //#endregion + //#region GM Withdrawal if (isWithdrawal && !isGlv) { // Raw GM Withdrawal Params if (!longTokenAddress || !shortTokenAddress) { @@ -335,7 +342,9 @@ export const selectPoolsDetailsParams = createSelector((q) => { dataList, } satisfies RawCreateWithdrawalParams; } + //#endregion + //#region GLV Withdrawal if (isWithdrawal && isGlv) { // Raw GLV Withdrawal Params if (!firstTokenAddress || !secondTokenAddress) { @@ -421,6 +430,7 @@ export const selectPoolsDetailsParams = createSelector((q) => { dataList, } satisfies RawCreateGlvWithdrawalParams; } + //#endregion return undefined; }); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index 5f5004f57a..3010280783 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -49,6 +49,7 @@ import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; import { ExecutionFee } from "sdk/types/fees"; +import { applySlippageToMinOut } from "sdk/utils/trade"; import { selectPoolsDetailsParams } from "./selectPoolsDetailsParams"; import type { UseLpTransactionProps } from "./useLpTransactions"; @@ -117,7 +118,7 @@ export const useDepositTransactions = ({ { to: vaultAddress, token: tokenAddress, - amount: estimatedReceivedAmount ?? amount, + amount: applySlippageToMinOut(1, estimatedReceivedAmount ?? amount), }, ]); } @@ -152,8 +153,6 @@ export const useDepositTransactions = ({ const gmParams = useMemo((): CreateDepositParams | undefined => { if (!rawParams || !technicalFees) { - // console.log("no gm params becayse no", { rawGmParams, technicalFees }); - return undefined; } diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index 2d8a2d46f6..68d57f4a95 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -1,23 +1,19 @@ import { t } from "@lingui/macro"; -import chunk from "lodash/chunk"; import { useCallback, useMemo } from "react"; -import { bytesToHex, Hex, hexToBytes, numberToHex, zeroAddress } from "viem"; -import { getLayerZeroEndpointId, getStargatePoolAddress, isSettlementChain } from "config/multichain"; -import { UI_FEE_RECEIVER_ACCOUNT } from "config/ui"; +import { getStargatePoolAddress, isSettlementChain } from "config/multichain"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { selectPoolsDetailsGlvInfo, selectPoolsDetailsLongTokenAddress, selectPoolsDetailsMarketInfo, selectPoolsDetailsMarketTokenData, + selectPoolsDetailsShortTokenAddress, } from "context/PoolsDetailsContext/PoolsDetailsContext"; -import { selectPoolsDetailsShortTokenAddress } from "context/PoolsDetailsContext/PoolsDetailsContext"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectBlockTimestampData } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; -import { CodecUiHelper, GMX_DATA_ACTION_HASH, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; import { TransferRequests } from "domain/multichain/types"; import { @@ -43,14 +39,12 @@ import { makeTxnSentMetricsHandler, sendTxnValidationErrorMetric, } from "lib/metrics"; -import { EMPTY_ARRAY } from "lib/objects"; import useWallet from "lib/wallets/useWallet"; import { getContract } from "sdk/configs/contracts"; -import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; import { ExecutionFee } from "sdk/types/fees"; -import { nowInSeconds } from "sdk/utils/time"; +import { selectPoolsDetailsParams } from "./selectPoolsDetailsParams"; import type { UseLpTransactionProps } from "./useLpTransactions"; import { useMultichainWithdrawalExpressTxnParams } from "./useMultichainWithdrawalExpressTxnParams"; @@ -197,202 +191,10 @@ export const useWithdrawalTransactions = ({ // fromStargateAddress: shortOftProvider, // }); - const rawGmParams = useMemo((): RawCreateWithdrawalParams | undefined => { - if ( - !account || - !marketTokenAddress || - marketTokenAmount === undefined || - // executionFeeTokenAmount === undefined || - isGlv - ) { - return undefined; - } - - // const minMarketTokens = applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, marketTokenAmount); - - let dataList: string[] = EMPTY_ARRAY; - - // let executionFee = executionFeeTokenAmount; - - if (paySource === "sourceChain") { - if (!srcChainId) { - return undefined; - } - - const provider = longOftProvider ?? shortOftProvider; - - if (!provider) { - return undefined; - } - - const secondaryProvider = provider === shortOftProvider ? undefined : shortTokenAddress; - - const dstEid = getLayerZeroEndpointId(srcChainId); - - if (!dstEid) { - return undefined; - } - - const providerData = numberToHex(dstEid, { size: 32 }); - - const actionHash = CodecUiHelper.encodeMultichainActionData({ - actionType: MultichainActionType.BridgeOut, - actionData: { - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - desChainId: chainId, - provider: provider, - providerData: providerData, - // TODO MLTCH apply some slippage - minAmountOut: 0n, - // TODO MLTCH put secondary provider and data - secondaryProvider: secondaryProvider ?? zeroAddress, - secondaryProviderData: secondaryProvider ? providerData : "0x", - secondaryMinAmountOut: 0n, - }, - }); - const bytes = hexToBytes(actionHash as Hex); - const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); - - dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; - } - - let shouldUnwrapNativeToken = false; - if (paySource === "settlementChain") { - shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; - } - - const params: RawCreateWithdrawalParams = { - addresses: { - market: marketTokenAddress, - receiver: account, - callbackContract: zeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - longTokenSwapPath: longTokenSwapPath ?? [], - shortTokenSwapPath: shortTokenSwapPath ?? [], - }, - // TODO MLTCH: do not forget to apply slippage here - // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), - minLongTokenAmount: 0n, - // TODO MLTCH: do not forget to apply slippage - // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), - minShortTokenAmount: 0n, - shouldUnwrapNativeToken, - callbackGasLimit: 0n, - dataList, - }; - - return params; - }, [ - account, - chainId, - isGlv, - longOftProvider, - longTokenAddress, - longTokenSwapPath, - marketTokenAddress, - marketTokenAmount, - paySource, - shortOftProvider, - shortTokenAddress, - shortTokenSwapPath, - srcChainId, - ]); - - const rawGlvParams = useMemo((): RawCreateGlvWithdrawalParams | undefined => { - if (!account || !isGlv || glvTokenAmount === undefined) { - return undefined; - } - - let dataList: string[] = EMPTY_ARRAY; - if (paySource === "sourceChain") { - if (!srcChainId) { - return undefined; - } - - const provider = longOftProvider ?? shortOftProvider; - - if (!provider) { - return undefined; - } - - const secondaryProvider = provider === shortOftProvider ? undefined : shortTokenAddress; - - const dstEid = getLayerZeroEndpointId(srcChainId); - - if (!dstEid) { - return undefined; - } - - const providerData = numberToHex(dstEid, { size: 32 }); - - const actionHash = CodecUiHelper.encodeMultichainActionData({ - actionType: MultichainActionType.BridgeOut, - actionData: { - deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), - desChainId: chainId, - provider: provider, - providerData: providerData, - // TODO MLTCH apply some slippage - minAmountOut: 0n, - secondaryProvider: secondaryProvider ?? zeroAddress, - secondaryProviderData: secondaryProvider ? providerData : "0x", - secondaryMinAmountOut: 0n, - }, - }); - const bytes = hexToBytes(actionHash as Hex); - - const bytes32array = chunk(bytes, 32).map((b) => bytesToHex(Uint8Array.from(b))); - - dataList = [GMX_DATA_ACTION_HASH, ...bytes32array]; - } - - let shouldUnwrapNativeToken = false; - if (paySource === "settlementChain") { - shouldUnwrapNativeToken = longTokenAddress === zeroAddress || shortTokenAddress === zeroAddress ? true : false; - } - - const params: RawCreateGlvWithdrawalParams = { - addresses: { - glv: glvTokenAddress!, - market: selectedMarketForGlv!, - receiver: glvTokenTotalSupply === 0n ? numberToHex(1, { size: 20 }) : account, - callbackContract: zeroAddress, - uiFeeReceiver: UI_FEE_RECEIVER_ACCOUNT ?? zeroAddress, - longTokenSwapPath: longTokenSwapPath ?? [], - shortTokenSwapPath: shortTokenSwapPath ?? [], - }, - // minLongTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, longTokenAmount ?? 0n), - minLongTokenAmount: 0n, - // minShortTokenAmount: applySlippageToMinOut(DEFAULT_SLIPPAGE_AMOUNT, shortTokenAmount ?? 0n), - minShortTokenAmount: 0n, - callbackGasLimit: 0n, - shouldUnwrapNativeToken, - dataList, - }; - - return params; - }, [ - account, - chainId, - glvTokenAddress, - glvTokenAmount, - glvTokenTotalSupply, - isGlv, - longOftProvider, - longTokenAddress, - longTokenSwapPath, - paySource, - selectedMarketForGlv, - shortOftProvider, - shortTokenAddress, - shortTokenSwapPath, - srcChainId, - ]); + const rawParams = useSelector(selectPoolsDetailsParams); const gmParams = useMemo((): CreateWithdrawalParams | undefined => { - if (!rawGmParams || !technicalFees) { - // console.log("no gm params becayse no", { rawGmParams, technicalFees }); - + if (!rawParams || !technicalFees) { return undefined; } @@ -402,13 +204,13 @@ export const useWithdrawalTransactions = ({ : (technicalFees as ExecutionFee).feeTokenAmount; return { - ...rawGmParams, + ...(rawParams as RawCreateWithdrawalParams), executionFee, }; - }, [rawGmParams, technicalFees, paySource]); + }, [rawParams, technicalFees, paySource]); const glvParams = useMemo((): CreateGlvWithdrawalParams | undefined => { - if (!rawGlvParams || !technicalFees) { + if (!rawParams || !technicalFees) { return undefined; } @@ -418,10 +220,10 @@ export const useWithdrawalTransactions = ({ : (technicalFees as ExecutionFee).feeTokenAmount; return { - ...rawGlvParams, + ...(rawParams as RawCreateGlvWithdrawalParams), executionFee, }; - }, [paySource, rawGlvParams, technicalFees]); + }, [paySource, rawParams, technicalFees]); const multichainWithdrawalExpressTxnParams = useMultichainWithdrawalExpressTxnParams({ transferRequests, @@ -607,18 +409,17 @@ export const useWithdrawalTransactions = ({ let promise: Promise; if (paySource === "sourceChain") { - if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams || !technicalFees || !rawGmParams) { + if (!isSettlementChain(chainId) || !srcChainId || !globalExpressParams || !technicalFees || !rawParams) { throw new Error("An error occurred"); } - // throw new Error("Not implemented"); promise = createSourceChainWithdrawalTxn({ chainId, srcChainId, signer, fees: technicalFees as SourceChainWithdrawalFees, transferRequests, - params: rawGmParams!, + params: rawParams as RawCreateWithdrawalParams, tokenAmount: marketTokenAmount!, }); } else if (paySource === "gmxAccount") { @@ -663,6 +464,7 @@ export const useWithdrawalTransactions = ({ marketToken, longTokenAmount, shortTokenAmount, + transferRequests, tokensData, signer, gmParams, @@ -671,8 +473,7 @@ export const useWithdrawalTransactions = ({ srcChainId, globalExpressParams, technicalFees, - rawGmParams, - transferRequests, + rawParams, marketTokenAmount, multichainWithdrawalExpressTxnParams.promise, shouldDisableValidation, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx index d30c43f392..56e6d2888d 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx @@ -18,7 +18,7 @@ import { import { useMultichainApprovalsActiveListener } from "context/SyntheticsEvents/useMultichainEvents"; import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; -import { GlvInfo } from "domain/synthetics/markets"; +import { GlvInfo, isMarketTokenAddress } from "domain/synthetics/markets"; import { getNeedTokenApprove, TokenData, useTokensAllowanceData } from "domain/synthetics/tokens"; import { approveTokens } from "domain/tokens"; import { helperToast } from "lib/helperToast"; @@ -214,7 +214,7 @@ export const useTokensToApprove = ({ } = useTokensAllowanceData(paySource === "settlementChain" ? chainId : undefined, { spenderAddress: routerAddress, tokenAddresses: payTokenAddresses, - skip: paySource === "settlementChain" ? true : false, + skip: paySource === "settlementChain" ? false : true, }); const settlementChainTokensToApprove = useMemo( @@ -292,8 +292,8 @@ export const useTokensToApprove = ({ ] ); - const settlementChainTokensToApproveSymbols = settlementChainTokensToApprove.map( - (tokenAddress) => getToken(chainId, tokenAddress).symbol + const settlementChainTokensToApproveSymbols = settlementChainTokensToApprove.map((tokenAddress) => + isMarketTokenAddress(chainId, tokenAddress) ? "GM" : getToken(chainId, tokenAddress).symbol ); const onApproveSettlementChain = () => { diff --git a/src/domain/multichain/arbitraryRelayParams.ts b/src/domain/multichain/arbitraryRelayParams.ts index 738c0dea37..c4d0743537 100644 --- a/src/domain/multichain/arbitraryRelayParams.ts +++ b/src/domain/multichain/arbitraryRelayParams.ts @@ -73,7 +73,7 @@ export function getRawBaseRelayerParams({ } const baseRelayerFeeAmount = convertToTokenAmount( - expandDecimals(10, USD_DECIMALS), + expandDecimals(3, USD_DECIMALS), relayerFeeToken.decimals, relayerFeeToken.prices.maxPrice )!; From c3a5b976e43a9606e91f1f47e06c8b42a3111fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=C3=A9rt=20de=20Lalye?= Date: Thu, 23 Oct 2025 23:23:38 +0400 Subject: [PATCH 29/38] added limits for subsquid queries on homepage --- landing/src/pages/Home/hooks/usePoolsData.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/landing/src/pages/Home/hooks/usePoolsData.tsx b/landing/src/pages/Home/hooks/usePoolsData.tsx index 019d32414d..9fb7373e2c 100644 --- a/landing/src/pages/Home/hooks/usePoolsData.tsx +++ b/landing/src/pages/Home/hooks/usePoolsData.tsx @@ -133,13 +133,13 @@ function useApysByChainId(chainId: number) { const marketInfoQuery = { query: gql` query MarketInfos { - marketInfos(orderBy: poolValue_DESC, where: { isDisabled_eq: false }) { + marketInfos(orderBy: poolValue_DESC, where: { isDisabled_eq: false }, limit: 1000) { poolValue longOpenInterestUsd shortOpenInterestUsd id } - platformStats { + platformStats(limit: 1) { depositedUsers } } From 221c4ca270804ce3048b80fb96091d223aff8d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=C3=A9rt=20de=20Lalye?= Date: Fri, 24 Oct 2025 12:32:24 +0400 Subject: [PATCH 30/38] fixed types in useAccountType --- src/lib/wallets/useAccountType.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/wallets/useAccountType.ts b/src/lib/wallets/useAccountType.ts index 14798c085c..4715e91501 100644 --- a/src/lib/wallets/useAccountType.ts +++ b/src/lib/wallets/useAccountType.ts @@ -33,7 +33,7 @@ const KNOWN_SAFE_SINGLETONS = new Set( async function isSafeAccount( bytecode: Hex, - address: `0x${string}`, + address: string, client: PublicClient, safeSingletonAddresses: Set ): Promise { @@ -52,7 +52,7 @@ async function isSafeAccount( } async function getAccountType( - address: `0x${string}`, + address: string, client: PublicClient, safeSingletonAddresses: Set ): Promise { From 4c1a8676dea8aa4640c00213b9332b979162f15f Mon Sep 17 00:00:00 2001 From: qwinndev Date: Fri, 24 Oct 2025 11:43:54 +0200 Subject: [PATCH 31/38] Fix price chart timestamp --- src/components/MarketStats/MarketGraphs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MarketStats/MarketGraphs.tsx b/src/components/MarketStats/MarketGraphs.tsx index 6f3cdf6bc4..68f816778f 100644 --- a/src/components/MarketStats/MarketGraphs.tsx +++ b/src/components/MarketStats/MarketGraphs.tsx @@ -277,7 +277,7 @@ const GraphChart = ({ const priceData = useMemo( () => priceSnapshots.map((snapshot) => ({ - snapshotTimestamp: new Date(snapshot.snapshotTimestamp ?? 0 * 1000), + snapshotTimestamp: new Date((snapshot.snapshotTimestamp ?? 0) * 1000), value: bigintToNumber( getMidPrice({ minPrice: BigInt(snapshot.minPrice), From 7a1c3675164e2a411bc0eb0aa4c0cb34a2b1b71e Mon Sep 17 00:00:00 2001 From: qwinndev Date: Fri, 24 Oct 2025 11:59:34 +0200 Subject: [PATCH 32/38] Hotfix footer links --- src/components/Footer/Footer.tsx | 4 ++-- src/components/Footer/constants.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 8672714c0b..7f55b3621a 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -8,7 +8,7 @@ import { LandingPageFooterMenuEvent } from "lib/userAnalytics/types"; import Button from "components/Button/Button"; import { TrackingLink } from "components/TrackingLink/TrackingLink"; -import { FOOTER_LINKS, SOCIAL_LINKS } from "./constants"; +import { getFooterLinks, SOCIAL_LINKS } from "./constants"; import { UserFeedbackModal } from "../UserFeedbackModal/UserFeedbackModal"; type Props = { @@ -24,7 +24,7 @@ export default function Footer({ showRedirectModal, redirectPopupTimestamp, isMo <>
- {FOOTER_LINKS.map(({ external, label, link, isAppLink }) => { + {getFooterLinks().map(({ external, label, link, isAppLink }) => { if (external) { return ( + ); } function DepositButton({ children }: { children: React.ReactNode }) { @@ -35,16 +33,15 @@ function DepositButton({ children }: { children: React.ReactNode }) { const [, setDepositViewTokenAddress] = useGmxAccountDepositViewTokenAddress(); return ( - + ); } export function InsufficientWntBanner({ @@ -96,9 +93,11 @@ export function InsufficientWntBanner({ return ( - {firstLine} -
- {secondLine} +
+ {firstLine} +
+ {secondLine} +
); } diff --git a/src/components/OldSubaccountWithdraw/OldSubaccountWithdraw.tsx b/src/components/OldSubaccountWithdraw/OldSubaccountWithdraw.tsx index 647d9c40cd..bae73d18cf 100644 --- a/src/components/OldSubaccountWithdraw/OldSubaccountWithdraw.tsx +++ b/src/components/OldSubaccountWithdraw/OldSubaccountWithdraw.tsx @@ -15,8 +15,7 @@ import { useJsonRpcProvider } from "lib/rpc"; import useWallet from "lib/wallets/useWallet"; import { getNativeToken } from "sdk/configs/tokens"; -import Button from "components/Button/Button"; -import { ColorfulBanner } from "components/ColorfulBanner/ColorfulBanner"; +import { ColorfulBanner, ColorfulButtonLink } from "components/ColorfulBanner/ColorfulBanner"; import { StatusNotification } from "components/StatusNotification/StatusNotification"; import { TransactionStatus } from "components/TransactionStatus/TransactionStatus"; @@ -98,10 +97,10 @@ export function OldSubaccountWithdraw() { return ( You have {balanceFormatted} remaining in your old version 1CT subaccount. -
- +
); } diff --git a/src/components/TradeBox/ExpressTradingWarningCard.tsx b/src/components/TradeBox/ExpressTradingWarningCard.tsx index 0b40b324c3..cab7228b64 100644 --- a/src/components/TradeBox/ExpressTradingWarningCard.tsx +++ b/src/components/TradeBox/ExpressTradingWarningCard.tsx @@ -178,12 +178,9 @@ export function ExpressTradingWarningCard({ {content} {onClick && ( - <> -
- - {buttonText} - - + + {buttonText} + )}
); diff --git a/src/domain/multichain/SettlementChainWarningContainer.tsx b/src/domain/multichain/SettlementChainWarningContainer.tsx index 9201bc5c5b..a11cfd0bc7 100644 --- a/src/domain/multichain/SettlementChainWarningContainer.tsx +++ b/src/domain/multichain/SettlementChainWarningContainer.tsx @@ -9,8 +9,7 @@ import { useChainId } from "lib/chains"; import { formatUsd } from "lib/numbers"; import { EMPTY_OBJECT } from "lib/objects"; -import Button from "components/Button/Button"; -import { ColorfulBanner } from "components/ColorfulBanner/ColorfulBanner"; +import { ColorfulBanner, ColorfulButtonLink } from "components/ColorfulBanner/ColorfulBanner"; import { useAvailableToTradeAssetMultichainRequest } from "components/GmxAccountModal/hooks"; import InfoIcon from "img/ic_info.svg?react"; @@ -50,16 +49,14 @@ export function SettlementChainWarningContainer() { return ( -
- - You switched your settlement network to {getChainName(settlementChainId)}, but you still have{" "} - {formatUsd(gmxAccountUsd)} remaining in your {getChainName(anyNonEmptyGmxAccountChainId)} GMX Account. - -
- -
+ + You switched your settlement network to {getChainName(settlementChainId)}, but you still have{" "} + {formatUsd(gmxAccountUsd)} remaining in your {getChainName(anyNonEmptyGmxAccountChainId)} GMX Account. + + + + Change to {getChainName(anyNonEmptyGmxAccountChainId)} +
); } From a848d49a6d77cbb49f8d956ef468e423d1b5a6b6 Mon Sep 17 00:00:00 2001 From: qwinndev Date: Sat, 25 Oct 2025 10:41:37 +0200 Subject: [PATCH 34/38] Update withdrawal view banner --- .../GmxAccountModal/WithdrawalView.tsx | 88 ++++++++++--------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/src/components/GmxAccountModal/WithdrawalView.tsx b/src/components/GmxAccountModal/WithdrawalView.tsx index 9701c6e0f4..86d6515620 100644 --- a/src/components/GmxAccountModal/WithdrawalView.tsx +++ b/src/components/GmxAccountModal/WithdrawalView.tsx @@ -997,50 +997,52 @@ export const WithdrawalView = () => { !errors.isOutOfTokenError.isGasPaymentToken && isOutOfTokenErrorToken !== undefined && ( - - Withdrawing requires{" "} - {" "} - while you have{" "} - - . Please{" "} - {" "} - or{" "} - {" "} - more {isOutOfTokenErrorToken?.symbol} to your GMX account. - + if (errors?.isOutOfTokenError?.requiredAmount !== undefined) { + setDepositViewTokenInputValue( + formatAmountFree(errors.isOutOfTokenError.requiredAmount, isOutOfTokenErrorToken.decimals) + ); + } + setIsVisibleOrView("deposit"); + }} + > + deposit + {" "} + more {isOutOfTokenErrorToken?.symbol} to your GMX account. + +
)} From 9d0598ce648cf205544fbd166f5ae40daeacd223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=C3=A9rt=20de=20Lalye?= Date: Mon, 27 Oct 2025 15:45:51 +0400 Subject: [PATCH 35/38] fixed SDK's readme --- sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/README.md b/sdk/README.md index a2423f324c..9b3e8210f8 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -139,7 +139,7 @@ Here and further, `name` field in tokens data object will be taken from the exte ### Markets customization -To enable/disable market in SDK use config field `markets +To enable/disable market in SDK use config field `markets` ```typescript const sdk = new GmxSdk({ From 44445eae7086bafa0adcb856923730907a7f74ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hub=C3=A9rt=20de=20Lalye?= Date: Mon, 27 Oct 2025 19:04:41 +0400 Subject: [PATCH 36/38] used LLM to improve SDK's readme wording --- sdk/README.md | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/sdk/README.md b/sdk/README.md index 9b3e8210f8..19b929d97c 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -1,13 +1,13 @@ # GMX SDK -## Install +## Installation ```bash yarn add @gmx-io/sdk # or npm install --save @gmx-io/sdk ``` -## Usage +## Getting Started ```typescript import { GmxSdk } from "@gmx-io/sdk"; @@ -37,50 +37,50 @@ sdk.positions }); ``` -## Documentation +## API Reference -### Read methods +### Read Methods ### Markets -- `getMarkets(offset?: number, limit?: number): Promise` - returns a list of markets -- `getMarketsInfo(): Promise<{ marketsInfoData: MarketInfoData[], tokensData: TokenData[] }>` - returns a list of markets info and tokens data -- `getDailyVolumes(): Promise<{market: string; volume: bigint}[]>` - returns markets' daily volume data +- `getMarkets(offset?: number, limit?: number): Promise` - fetches a list of available markets +- `getMarketsInfo(): Promise<{ marketsInfoData: MarketInfoData[], tokensData: TokenData[] }>` - retrieves detailed market information along with token data +- `getDailyVolumes(): Promise<{market: string; volume: bigint}[]>` - gets daily trading volume for each market ### Positions -- `getPositions(): Promise` - returns a list of positions +- `getPositions(): Promise` - retrieves all open positions ### Tokens -- `getTokensData(): Promise` - returns a list of tokens data +- `getTokensData(): Promise` - fetches data for all available tokens ### Orders -- `getOrders(): Promise` - returns a list of orders +- `getOrders(): Promise` - retrieves all active orders ### Trades -- `getTradeHistory(p: Parameters): Promise` - returns a list of trades +- `getTradeHistory(p: Parameters): Promise` - fetches historical trade data -### Write methods +### Write Methods ### Orders -#### Quick methods: +#### Quick Methods: -- `long(p: Parameters)` - creates long positions (see [examples](#helpers)) -- `short(p: Parameters)` - creates short positions (see [examples](#helpers)) -- `swap(p: Parameters)` - creates a swap order (see [examples](#helpers)) +- `long(p: Parameters)` - opens a long position (see [examples](#helpers)) +- `short(p: Parameters)` - opens a short position (see [examples](#helpers)) +- `swap(p: Parameters)` - executes a token swap (see [examples](#helpers)) -#### Full methods: +#### Full Methods: -- `cancelOrders(orderKeys: string[])` - cancels orders by order keys -- `createIncreaseOrder(p: Parameters)` - creates an increase order (see [examples](#examples)) -- `createDecreaseOrder(p: Parameters)` - creates a decrease order (see [examples](#examples)) -- `createSwapOrder(p: Parameters)` - creates a swap order (see [examples](#examples)) +- `cancelOrders(orderKeys: string[])` - cancels one or more orders using their keys +- `createIncreaseOrder(p: Parameters)` - creates an order to increase position size (see [examples](#examples)) +- `createDecreaseOrder(p: Parameters)` - creates an order to decrease position size (see [examples](#examples)) +- `createSwapOrder(p: Parameters)` - creates a token swap order (see [examples](#examples)) -## Configuration +## Configuration Options ```typescript interface GmxSdkConfig { @@ -101,9 +101,9 @@ interface GmxSdkConfig { } ``` -### Custom Viem clients +### Setting Up Custom Viem Clients -When using custom Viem clients, pass batching configuration to the client. +When working with custom Viem clients, make sure to include the batching configuration: ```typescript import { BATCH_CONFIGS } from "@gmx-io/sdk/configs/batch"; @@ -114,15 +114,15 @@ const publicClient = createPublicClient({ }); ``` -### Urls +### Network URLs -- RPC URLs - use preferred RPC URL -- [Actual Oracle URLs](https://github.com/gmx-io/gmx-interface/blob/master/src/config/oracleKeeper.ts#L5-L11) -- [Actual Subsquid/Subgraph URLs](https://github.com/gmx-io/gmx-interface/blob/master/src/config/subgraph.ts#L5) (subgraph url is `synthetics-stats` field) +- RPC URLs - use your preferred RPC endpoint +- [Current Oracle URLs](https://github.com/gmx-io/gmx-interface/blob/master/src/config/oracleKeeper.ts#L5-L11) +- [Current Subsquid/Subgraph URLs](https://github.com/gmx-io/gmx-interface/blob/master/src/config/subgraph.ts#L5) (the subgraph url corresponds to the `synthetics-stats` field) -### Tokens customization +### Customizing Token Data -If you need to override some field in tokens, just pass extension object in SDK config: +You can override default token properties by passing an extension object in the SDK configuration: ```typescript const sdk = new GmxSdk({ @@ -135,11 +135,11 @@ const sdk = new GmxSdk({ }); ``` -Here and further, `name` field in tokens data object will be taken from the extension object. +With this configuration, the `name` field for this token will use your custom value throughout the SDK. -### Markets customization +### Customizing Market Availability -To enable/disable market in SDK use config field `markets` +To control which markets are available in the SDK, use the `markets` configuration field: ```typescript const sdk = new GmxSdk({ @@ -152,9 +152,9 @@ const sdk = new GmxSdk({ }); ``` -## Examples +## Usage Examples -### Open long position +### Opening a Long Position ```typescript import type { IncreasePositionAmounts } from "@gmx-io/sdk/types/orders"; @@ -209,7 +209,7 @@ sdk.orders.createIncreaseOrder({ ### Helpers -Helpers are a set of functions that help you create orders without manually calculating the amounts, swap paths, etc. By default helpers will fetch the latest data from the API, but you can pass both `marketsInfoData` and `tokensData` to the helpers to avoid extra calls to the API. +Helper functions simplify order creation by automatically calculating amounts, swap paths, and other parameters. By default, helpers fetch the latest data from the API, but you can optionally pass `marketsInfoData` and `tokensData` yourself to reduce API calls. ```typescript sdk.orders.long({ @@ -229,4 +229,4 @@ sdk.orders.swap({ }); ``` -Pay attention to the `payTokenAddress` and `collateralTokenAddress` fields. They are the addresses of ERC20 tokens that you are paying for and receiving, respectively, some markets may have synthetic tokens in these fields, so you need to pass the correct address. For instance BTC/USD [WETH-USDC] market has synthetic BTC token in `indexTokenAddress` so you need to pass WBTC address instead of BTC. +Note the distinction between `payTokenAddress` and `collateralTokenAddress`. These represent the ERC20 token addresses for payment and collateral respectively. Some markets use synthetic tokens, so you'll need to provide the correct underlying token address. For example, the BTC/USD [WETH-USDC] market has a synthetic BTC token as its `indexTokenAddress`, so you should pass the WBTC address instead of BTC. From f1ab7b25fe62105f893065f2c4dd9787b45b0328 Mon Sep 17 00:00:00 2001 From: midas-myth Date: Tue, 28 Oct 2025 19:06:51 +0100 Subject: [PATCH 37/38] Refactor PoolsDetailsContext: Migrate hooks and selectors to improve code organization and clarity. Update imports across components to utilize new hooks. Adjust balance formatting logic in useMaxAvailableAmount for better handling of source chain balances. --- .../GmDepositWithdrawalBox.tsx | 103 +--- .../lpTxn/selectPoolsDetailsParams.tsx | 2 +- .../lpTxn/useDepositTransactions.tsx | 2 +- .../lpTxn/useLpTransactions.tsx | 4 +- .../useMultichainDepositExpressTxnParams.tsx | 3 +- ...seMultichainWithdrawalExpressTxnParams.tsx | 3 +- .../lpTxn/useWithdrawalTransactions.tsx | 2 +- .../selectDepositWithdrawalAmounts.ts | 30 +- .../GmSwapBox/GmDepositWithdrawalBox/types.ts | 5 - .../useGmSwapSubmitState.tsx | 2 +- .../useTokensToApprove.tsx | 2 +- .../useUpdateInputAmounts.tsx | 375 +++++++----- .../GmSwapBox/GmShiftBox/GmShiftBox.tsx | 2 +- .../MarketStats/hooks/useBestGmPoolForGlv.ts | 2 +- .../MultichainMarketTokenSelector.tsx | 210 ++----- .../PoolsDetailsContext.tsx | 559 +----------------- src/context/PoolsDetailsContext/hooks.tsx | 102 ++++ src/context/PoolsDetailsContext/selectors.tsx | 440 ++++++++++++++ .../paySourceToTokenBalanceType.tsx | 12 + src/domain/multichain/sendQuoteFromNative.ts | 8 + .../markets/createSourceChainDepositTxn.ts | 7 +- .../markets/createSourceChainGlvDepositTxn.ts | 2 +- .../createSourceChainGlvWithdrawalTxn.ts | 2 +- .../markets/createSourceChainWithdrawalTxn.ts | 2 +- ...mateDepositPlatformTokenTransferOutFees.ts | 55 +- ...lvWithdrawalPlatformTokenTransferInFees.ts | 47 +- .../estimateSourceChainDepositFees.ts | 71 +-- .../estimateSourceChainGlvDepositFees.ts | 61 +- .../estimateSourceChainWithdrawalFees.ts | 189 ++---- ...teWithdrawalPlatformTokenTransferInFees.ts | 28 +- .../feeEstimation/stargateTransferFees.ts | 96 +++ src/domain/synthetics/markets/types.ts | 6 + src/domain/synthetics/tokens/utils.ts | 20 +- .../synthetics/trade/utils/validation.ts | 3 +- .../synthetics/trade/utils/withdrawal.ts | 71 ++- src/domain/tokens/useMaxAvailableAmount.ts | 35 +- src/locales/de/messages.po | 2 + src/locales/en/messages.po | 2 + src/locales/es/messages.po | 2 + src/locales/fr/messages.po | 2 + src/locales/ja/messages.po | 2 + src/locales/ko/messages.po | 2 + src/locales/pseudo/messages.po | 2 + src/locales/ru/messages.po | 2 + src/locales/zh/messages.po | 2 + src/pages/PoolsDetails/PoolsDetails.tsx | 2 +- 46 files changed, 1253 insertions(+), 1330 deletions(-) create mode 100644 src/context/PoolsDetailsContext/hooks.tsx create mode 100644 src/context/PoolsDetailsContext/selectors.tsx create mode 100644 src/domain/multichain/paySourceToTokenBalanceType.tsx create mode 100644 src/domain/multichain/sendQuoteFromNative.ts create mode 100644 src/domain/synthetics/markets/feeEstimation/stargateTransferFees.ts diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx index a70d038b2a..ee0cdb59c5 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/GmDepositWithdrawalBox.tsx @@ -8,7 +8,16 @@ import { useAccount } from "wagmi"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; -import { getMappedTokenId, isSourceChain } from "config/multichain"; +import { isSourceChain } from "config/multichain"; +import { + usePoolsDetailsFirstTokenAddress, + usePoolsDetailsFirstTokenInputValue, + usePoolsDetailsFocusedInput, + usePoolsDetailsMarketOrGlvTokenInputValue, + usePoolsDetailsPaySource, + usePoolsDetailsSecondTokenAddress, + usePoolsDetailsSecondTokenInputValue, +} from "context/PoolsDetailsContext/hooks"; import { selectPoolsDetailsFlags, selectPoolsDetailsGlvInfo, @@ -28,14 +37,7 @@ import { selectPoolsDetailsSetIsMarketForGlvSelectedManually, selectPoolsDetailsShortTokenAddress, selectPoolsDetailsTradeTokensDataWithSourceChainBalances, - usePoolsDetailsFirstTokenAddress, - usePoolsDetailsFirstTokenInputValue, - usePoolsDetailsFocusedInput, - usePoolsDetailsMarketOrGlvTokenInputValue, - usePoolsDetailsPaySource, - usePoolsDetailsSecondTokenAddress, - usePoolsDetailsSecondTokenInputValue, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { @@ -43,6 +45,7 @@ import { selectMarketsInfoData, } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; +import { paySourceToTokenBalanceType } from "domain/multichain/paySourceToTokenBalanceType"; import { useGasLimits, useGasPrice } from "domain/synthetics/fees"; import useUiFeeFactorRequest from "domain/synthetics/fees/utils/useUiFeeFactor"; import { @@ -115,12 +118,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { // #region Requests - const { tokenBalancesData: selectedGlvOrMarketTokenBalancesData } = useMultichainMarketTokenBalancesRequest( - chainId, - srcChainId, - account, - selectedGlvOrMarketAddress - ); const gasLimits = useGasLimits(chainId); const gasPrice = useGasPrice(chainId); const { uiFeeFactor } = useUiFeeFactorRequest(chainId); @@ -156,6 +153,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { const [secondTokenAddress, setSecondTokenAddress] = usePoolsDetailsSecondTokenAddress(); const [firstTokenInputValue, setFirstTokenInputValue] = usePoolsDetailsFirstTokenInputValue(); const [secondTokenInputValue, setSecondTokenInputValue] = usePoolsDetailsSecondTokenInputValue(); + const [marketOrGlvTokenInputValue, setMarketOrGlvTokenInputValue] = usePoolsDetailsMarketOrGlvTokenInputValue(); // #endregion // #region Derived state @@ -454,15 +452,11 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { amounts, } : undefined, - withLoading: true, + withLoading: false, forceRecalculate, } ); - // useEffect(() => { - // console.log(technicalFeesAsyncResult); - // }, [technicalFeesAsyncResult]); - const { logicalFees } = useDepositWithdrawalFees({ amounts, chainId, @@ -499,6 +493,8 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { nativeToken: nativeToken, minResidualAmount: undefined, isLoading: false, + srcChainId, + tokenBalanceType: paySourceToTokenBalanceType(paySource), }); const firstTokenShowMaxButton = isDeposit && firstTokenMaxDetails.showClickMax; @@ -521,35 +517,11 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { nativeToken: nativeToken, minResidualAmount: undefined, isLoading: false, + tokenBalanceType: paySourceToTokenBalanceType(paySource), }); const marketTokenInputShowMaxButton = isWithdrawal && marketTokenMaxDetails.showClickMax; - const marketTokenBalanceFormatted = useMemo(() => { - const usedMarketToken = glvInfo ? glvToken : marketToken; - - if (!usedMarketToken) { - return undefined; - } - - let balance; - if (paySource === "gmxAccount") { - balance = usedMarketToken.gmxAccountBalance; - } else if (paySource === "sourceChain") { - if (srcChainId !== undefined) { - balance = selectedGlvOrMarketTokenBalancesData[srcChainId]; - } - } else { - balance = usedMarketToken.walletBalance; - } - - if (balance === undefined) { - return undefined; - } - - return formatBalanceAmount(balance, usedMarketToken.decimals); - }, [glvInfo, glvToken, marketToken, paySource, selectedGlvOrMarketTokenBalancesData, srcChainId]); - const receiveTokenUsd = glvInfo ? amounts?.glvTokenUsd ?? 0n : convertToUsd( @@ -558,41 +530,6 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { isDeposit ? marketToken?.prices?.maxPrice : marketToken?.prices?.minPrice )!; - const payTokenBalanceFormatted = useMemo(() => { - if (!firstToken) { - return undefined; - } - - let balance; - let decimals; - if (paySource === "gmxAccount") { - balance = firstToken.gmxAccountBalance; - decimals = firstToken.decimals; - } else if (paySource === "sourceChain") { - balance = firstToken.sourceChainBalance; - - decimals = getMappedTokenId( - chainId as SettlementChainId, - firstToken.address, - srcChainId as SourceChainId - )?.decimals; - if (!decimals) { - return undefined; - } - } else { - balance = firstToken.walletBalance; - decimals = firstToken.decimals; - } - - if (balance === undefined) { - return undefined; - } - - return formatBalanceAmount(balance, decimals, undefined, { - isStable: firstToken.isStable, - }); - }, [firstToken, paySource, chainId, srcChainId]); - // #region Callbacks const onFocusedCollateralInputChange = useCallback( (tokenAddress: string) => { @@ -839,7 +776,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { topLeftLabel={isDeposit ? t`Pay` : t`Receive`} bottomLeftValue={formatUsd(firstTokenUsd ?? 0n)} bottomRightLabel={t`Balance`} - bottomRightValue={payTokenBalanceFormatted} + bottomRightValue={firstTokenMaxDetails.formattedBalance} onClickTopRightLabel={isDeposit ? onMaxClickFirstToken : undefined} inputValue={firstTokenInputValue} onInputValueChange={handleFirstTokenInputValueChange} @@ -924,7 +861,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) { topLeftLabel={isWithdrawal ? t`Pay` : t`Receive`} bottomLeftValue={formatUsd(receiveTokenUsd ?? 0n)} bottomRightLabel={t`Balance`} - bottomRightValue={marketTokenBalanceFormatted} + bottomRightValue={marketTokenMaxDetails.formattedBalance} inputValue={marketOrGlvTokenInputValue} onInputValueChange={marketOrGlvTokenInputValueChange} onClickTopRightLabel={marketTokenInputClickTopRightLabel} @@ -986,7 +923,7 @@ export function GmSwapBoxDepositWithdrawal(p: GmSwapBoxProps) {
{submitButton}
- + ); diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx index 0f9af5e738..af87170790 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/selectPoolsDetailsParams.tsx @@ -23,7 +23,7 @@ import { selectPoolsDetailsSelectedMarketForGlv, selectPoolsDetailsShortTokenAddress, selectPoolsDetailsShortTokenAmount, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { selectGlvAndMarketsInfoData, selectMarketsInfoData, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index 3010280783..c1f6b585d2 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -11,7 +11,7 @@ import { selectPoolsDetailsPaySource, selectPoolsDetailsSelectedMarketForGlv, selectPoolsDetailsShortTokenAddress, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; import { selectBlockTimestampData, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx index 77479c652f..9cab6c1028 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useLpTransactions.tsx @@ -6,12 +6,12 @@ import type { SourceChainDepositFees } from "domain/synthetics/markets/feeEstima import type { SourceChainGlvDepositFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees"; import { SourceChainGlvWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainGlvWithdrawalFees"; import { SourceChainWithdrawalFees } from "domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees"; +import type { GmPaySource } from "domain/synthetics/markets/types"; import type { TokensData } from "domain/synthetics/tokens"; -import { Operation } from "../../types"; -import type { GmPaySource } from "../types"; import { useDepositTransactions } from "./useDepositTransactions"; import { useWithdrawalTransactions } from "./useWithdrawalTransactions"; +import { Operation } from "../../types"; export interface UseLpTransactionProps { operation: Operation; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx index 2c28a1c700..10a53ab15d 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx @@ -3,13 +3,12 @@ import { TransferRequests } from "domain/multichain/types"; import type { CreateDepositParams, CreateGlvDepositParams } from "domain/synthetics/markets"; import { buildAndSignMultichainDepositTxn } from "domain/synthetics/markets/createMultichainDepositTxn"; import { buildAndSignMultichainGlvDepositTxn } from "domain/synthetics/markets/createMultichainGlvDepositTxn"; +import type { GmPaySource } from "domain/synthetics/markets/types"; import { useChainId } from "lib/chains"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { GmPaySource } from "../types"; - export function useMultichainDepositExpressTxnParams({ transferRequests, paySource, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx index 3d71ad206d..ab34708874 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx @@ -3,13 +3,12 @@ import { TransferRequests } from "domain/multichain/types"; import type { CreateGlvWithdrawalParams, CreateWithdrawalParams } from "domain/synthetics/markets"; import { buildAndSignMultichainGlvWithdrawalTxn } from "domain/synthetics/markets/createMultichainGlvWithdrawalTxn"; import { buildAndSignMultichainWithdrawalTxn } from "domain/synthetics/markets/createMultichainWithdrawalTxn"; +import type { GmPaySource } from "domain/synthetics/markets/types"; import { useChainId } from "lib/chains"; import useWallet from "lib/wallets/useWallet"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { nowInSeconds } from "sdk/utils/time"; -import type { GmPaySource } from "../types"; - export function useMultichainWithdrawalExpressTxnParams({ transferRequests, paySource, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index 74f90fb156..16bc5e8275 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -9,7 +9,7 @@ import { selectPoolsDetailsMarketInfo, selectPoolsDetailsMarketTokenData, selectPoolsDetailsShortTokenAddress, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useSyntheticsEvents } from "context/SyntheticsEvents"; import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors"; import { selectBlockTimestampData } from "context/SyntheticsStateContext/selectors/globalSelectors"; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts index 55d7263475..e3ae7d047b 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/selectDepositWithdrawalAmounts.ts @@ -1,21 +1,23 @@ import { - selectPoolsDetailsIsMarketTokenDeposit, - selectPoolsDetailsLongTokenAmount, - selectPoolsDetailsMarketOrGlvTokenAmount, - selectPoolsDetailsShortTokenAmount, - selectPoolsDetailsWithdrawalFindSwapPath, - selectPoolsDetailsWithdrawalReceiveTokenAddress, selectPoolsDetailsFirstTokenAddress, selectPoolsDetailsFirstTokenAmount, selectPoolsDetailsFlags, selectPoolsDetailsFocusedInput, selectPoolsDetailsGlvInfo, + selectPoolsDetailsIsMarketTokenDeposit, + selectPoolsDetailsLongTokenAddress, + selectPoolsDetailsLongTokenAmount, selectPoolsDetailsMarketInfo, + selectPoolsDetailsMarketOrGlvTokenAmount, selectPoolsDetailsMarketTokenData, selectPoolsDetailsMarketTokensData, selectPoolsDetailsSecondTokenAddress, selectPoolsDetailsSecondTokenAmount, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; + selectPoolsDetailsShortTokenAddress, + selectPoolsDetailsShortTokenAmount, + selectPoolsDetailsWithdrawalFindSwapPath, + selectPoolsDetailsWithdrawalReceiveTokenAddress, +} from "context/PoolsDetailsContext/selectors"; import { selectUiFeeFactor } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { createSelector } from "context/SyntheticsStateContext/utils"; import { getDepositAmounts } from "domain/synthetics/trade/utils/deposit"; @@ -36,8 +38,11 @@ export const selectDepositWithdrawalAmounts = createSelector((q): DepositAmounts const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); + const { isPair } = q(selectPoolsDetailsFlags); const longTokenAmount = q(selectPoolsDetailsLongTokenAmount); const shortTokenAmount = q(selectPoolsDetailsShortTokenAmount); + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); @@ -109,9 +114,12 @@ export const selectDepositWithdrawalAmounts = createSelector((q): DepositAmounts shortTokenAmount, marketTokenAmount, glvTokenAmount, - // TODO MLTCH check it - includeLongToken: longTokenAmount > 0n, - includeShortToken: shortTokenAmount > 0n, + includeLongToken: isPair + ? true + : firstTokenAddress === longTokenAddress || secondTokenAddress === longTokenAddress, + includeShortToken: isPair + ? true + : secondTokenAddress === shortTokenAddress || firstTokenAddress === shortTokenAddress, uiFeeFactor, strategy: focusedInput === "market" ? "byMarketToken" : "byCollaterals", isMarketTokenDeposit, @@ -119,7 +127,7 @@ export const selectDepositWithdrawalAmounts = createSelector((q): DepositAmounts glvToken: glvToken!, }); } else if (isWithdrawal) { - let strategy; + let strategy: "byMarketToken" | "byLongCollateral" | "byShortCollateral" | "byCollaterals" = "byMarketToken"; if (focusedInput === "market") { strategy = "byMarketToken"; } else if (focusedInput === "longCollateral") { diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts index 0232c3addf..a472aecacb 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types.ts @@ -7,11 +7,6 @@ export type TokenInputState = { isMarketToken: boolean; }; -/** - * GM or GLV pay source - */ -export type GmPaySource = "settlementChain" | "gmxAccount" | "sourceChain"; - /** * Focused input types for GM deposit/withdrawal box */ diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx index 0c85184026..9e72c21061 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useGmSwapSubmitState.tsx @@ -14,7 +14,7 @@ import { selectPoolsDetailsPaySource, selectPoolsDetailsSelectedMarketForGlv, selectPoolsDetailsShortTokenAddress, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import type { ExecutionFee } from "domain/synthetics/fees"; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx index 56e6d2888d..99b5d6d2e6 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useTokensToApprove.tsx @@ -14,7 +14,7 @@ import { selectPoolsDetailsPaySource, selectPoolsDetailsSecondTokenAddress, selectPoolsDetailsSecondTokenAmount, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useMultichainApprovalsActiveListener } from "context/SyntheticsEvents/useMultichainEvents"; import { selectChainId, selectSrcChainId } from "context/SyntheticsStateContext/selectors/globalSelectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx index aeeb8e0b30..d21a127ad2 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/useUpdateInputAmounts.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { selectPoolsDetailsFirstToken, @@ -16,12 +16,47 @@ import { selectPoolsDetailsSetMarketOrGlvTokenInputValue, selectPoolsDetailsSetSecondTokenInputValue, selectPoolsDetailsShortTokenAddress, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; +import { Token } from "domain/tokens"; import { formatAmountFree } from "lib/numbers"; +import { DepositAmounts, WithdrawalAmounts } from "sdk/types/trade"; import { selectDepositWithdrawalAmounts } from "./selectDepositWithdrawalAmounts"; +function formatTokenAmount(amount: bigint | undefined, decimals: number): string { + if (amount === undefined || amount <= 0n) return ""; + return formatAmountFree(amount, decimals); +} + +function isTokenMatch(tokenWrappedAddress: string | undefined, targetAddress: string | undefined): boolean { + return !!tokenWrappedAddress && !!targetAddress && tokenWrappedAddress === targetAddress; +} + +function updateTokenInputForMatch({ + token, + tokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue, +}: { + token: Token | undefined; + tokenWrappedAddress: string | undefined; + longTokenAddress: string | undefined; + shortTokenAddress: string | undefined; + amounts: DepositAmounts | WithdrawalAmounts; + setInputValue: (value: string) => void; +}) { + if (!token) return; + + if (isTokenMatch(tokenWrappedAddress, longTokenAddress)) { + setInputValue(formatTokenAmount(amounts.longTokenAmount, token.decimals)); + } else if (isTokenMatch(tokenWrappedAddress, shortTokenAddress)) { + setInputValue(formatTokenAmount(amounts.shortTokenAmount, token.decimals)); + } +} + export function useUpdateInputAmounts() { const glvInfo = useSelector(selectPoolsDetailsGlvInfo); const glvToken = useSelector(selectPoolsDetailsGlvTokenData); @@ -29,186 +64,204 @@ export function useUpdateInputAmounts() { const marketToken = useSelector(selectPoolsDetailsMarketTokenData); const marketTokenAmount = useSelector(selectPoolsDetailsMarketOrGlvTokenAmount); const marketInfo = useSelector(selectPoolsDetailsMarketInfo); - const longToken = useSelector(selectPoolsDetailsLongTokenAddress); - const shortToken = useSelector(selectPoolsDetailsShortTokenAddress); + const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); + const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); const { isDeposit, isWithdrawal } = useSelector(selectPoolsDetailsFlags); const amounts = useSelector(selectDepositWithdrawalAmounts); + const firstToken = useSelector(selectPoolsDetailsFirstToken); + const firstTokenWrappedAddress = firstToken?.wrappedAddress ?? firstToken?.address; const secondToken = useSelector(selectPoolsDetailsSecondToken); + const secondTokenWrappedAddress = secondToken?.wrappedAddress ?? secondToken?.address; const focusedInput = useSelector(selectPoolsDetailsFocusedInput); const setFirstTokenInputValue = useSelector(selectPoolsDetailsSetFirstTokenInputValue); const setSecondTokenInputValue = useSelector(selectPoolsDetailsSetSecondTokenInputValue); const setMarketOrGlvTokenInputValue = useSelector(selectPoolsDetailsSetMarketOrGlvTokenInputValue); - useEffect( - function updateInputAmounts() { - if (!marketToken || !marketInfo) { + // Deposit: User entered collateral tokens → calculate output market/GLV tokens + const handleDepositInputUpdate = useCallback(() => { + if (!amounts || !marketToken) return; + + const isCollateralFocused = ["longCollateral", "shortCollateral"].includes(focusedInput); + + if (isCollateralFocused) { + // Check if any input has value + const hasAnyInput = + (amounts.longTokenUsd ?? 0) > 0 || (amounts.shortTokenUsd ?? 0) > 0 || (amounts.marketTokenUsd ?? 0) > 0; + + if (!hasAnyInput) { + setMarketOrGlvTokenInputValue(""); return; } - const fromMarketToken = marketToken; + // Update market/GLV token output + const outputAmount = glvInfo ? amounts.glvTokenAmount : amounts.marketTokenAmount; + const outputToken = glvInfo ? glvToken : marketToken; + if (!outputToken) return; - if (isDeposit) { - if (["longCollateral", "shortCollateral"].includes(focusedInput)) { - if ( - (amounts?.longTokenUsd ?? 0) <= 0 && - (amounts?.shortTokenUsd ?? 0) <= 0 && - (amounts?.marketTokenUsd ?? 0) <= 0 - ) { - setMarketOrGlvTokenInputValue(""); - return; - } - - if (amounts) { - const setAmount = glvInfo ? amounts.glvTokenAmount : amounts.marketTokenAmount; - const setToken = glvInfo ? glvToken! : marketToken; - setMarketOrGlvTokenInputValue(setAmount > 0 ? formatAmountFree(setAmount, setToken.decimals) : ""); - } - } else if (focusedInput === "market") { - if (glvInfo ? glvTokenAmount <= 0 : marketTokenAmount <= 0) { - // longTokenInputState?.setValue(""); - // shortTokenInputState?.setValue(""); - // fromMarketTokenInputState?.setValue(""); - setFirstTokenInputValue(""); - setSecondTokenInputValue(""); - return; - } - - if (amounts) { - if (longToken && firstToken) { - let longTokenAmountToSet = amounts.longTokenAmount; - - // longTokenInputState?.setValue( - // longTokenAmountToSet > 0 ? formatAmountFree(longTokenAmountToSet, longToken.decimals) : "" - // ); - setFirstTokenInputValue( - longTokenAmountToSet > 0 ? formatAmountFree(longTokenAmountToSet, firstToken.decimals) : "" - ); - } - - if (shortToken && secondToken) { - // shortTokenInputState?.setValue( - // amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" - // ); - setSecondTokenInputValue( - amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, secondToken.decimals) : "" - ); - } - - if (fromMarketToken && firstToken) { - // fromMarketTokenInputState?.setValue( - // amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, marketToken.decimals) : "" - // ); - setFirstTokenInputValue( - amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, firstToken.decimals) : "" - ); - } - return; - } + setMarketOrGlvTokenInputValue(formatTokenAmount(outputAmount, outputToken.decimals)); + } else if (focusedInput === "market") { + // User entered market/GLV amount → calculate collateral inputs + const inputAmount = glvInfo ? glvTokenAmount : marketTokenAmount; + + if (inputAmount <= 0) { + setFirstTokenInputValue(""); + setSecondTokenInputValue(""); + return; + } + + // Special case: platform token deposit + if (firstToken?.isPlatformToken) { + setFirstTokenInputValue(formatTokenAmount(amounts.marketTokenAmount, firstToken.decimals)); + return; + } + + // Update collateral token inputs based on their match with long/short tokens + updateTokenInputForMatch({ + token: firstToken, + tokenWrappedAddress: firstTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setFirstTokenInputValue, + }); + + updateTokenInputForMatch({ + token: secondToken, + tokenWrappedAddress: secondTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setSecondTokenInputValue, + }); + } + }, [ + amounts, + marketToken, + focusedInput, + glvInfo, + glvToken, + glvTokenAmount, + marketTokenAmount, + firstToken, + firstTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + secondToken, + secondTokenWrappedAddress, + setMarketOrGlvTokenInputValue, + setFirstTokenInputValue, + setSecondTokenInputValue, + ]); + + // Withdrawal: User entered market tokens → calculate output collateral tokens + const handleWithdrawalInputUpdate = useCallback(() => { + if (!amounts || !marketInfo || !marketToken) return; + + if (focusedInput === "market") { + // User entered market token amount → calculate collateral outputs + if (amounts.marketTokenAmount <= 0n) { + setFirstTokenInputValue(""); + setSecondTokenInputValue(""); + return; + } + + if (marketInfo.isSameCollaterals) { + // Both tokens are the same, combine amounts + if (longTokenAddress && firstToken) { + const combinedAmount = amounts.longTokenAmount + amounts.shortTokenAmount; + setFirstTokenInputValue(formatTokenAmount(combinedAmount, firstToken.decimals)); } + } else { + // Different tokens, update separately + updateTokenInputForMatch({ + token: firstToken, + tokenWrappedAddress: firstTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setFirstTokenInputValue, + }); + + updateTokenInputForMatch({ + token: secondToken, + tokenWrappedAddress: secondTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setSecondTokenInputValue, + }); + } + } else if (["longCollateral", "shortCollateral"].includes(focusedInput)) { + // User entered collateral amount → calculate market token input + const isLongFocused = focusedInput === "longCollateral"; + const focusedAmount = isLongFocused ? amounts.longTokenAmount : amounts.shortTokenAmount; + if (focusedAmount <= 0n) { + // Clear the opposite token and market token + if (isLongFocused) { + setSecondTokenInputValue(""); + } else { + setFirstTokenInputValue(""); + } + setMarketOrGlvTokenInputValue(""); return; } - if (isWithdrawal) { - if (focusedInput === "market") { - if ((amounts?.marketTokenAmount ?? 0) <= 0) { - // longTokenInputState?.setValue(""); - setFirstTokenInputValue(""); - // shortTokenInputState?.setValue(""); - setSecondTokenInputValue(""); - return; - } - - if (amounts) { - if (marketInfo.isSameCollaterals) { - if (longToken && firstToken) { - setFirstTokenInputValue( - amounts.longTokenAmount > 0 - ? formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, firstToken.decimals) - : "" - ); - } - } else { - if (longToken && firstToken) { - // longTokenInputState?.setValue( - // amounts.longTokenAmount > 0 ? formatAmountFree(amounts.longTokenAmount, longToken.decimals) : "" - // ); - setFirstTokenInputValue( - amounts.longTokenAmount > 0 ? formatAmountFree(amounts.longTokenAmount, firstToken.decimals) : "" - ); - } - if (shortToken && secondToken) { - // shortTokenInputState?.setValue( - // amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, shortToken.decimals) : "" - // ); - setSecondTokenInputValue( - amounts.shortTokenAmount > 0 ? formatAmountFree(amounts.shortTokenAmount, secondToken.decimals) : "" - ); - } - } - } - } else if (["longCollateral", "shortCollateral"].includes(focusedInput)) { - if (focusedInput === "longCollateral" && (amounts?.longTokenAmount ?? 0) <= 0) { - // shortTokenInputState?.setValue(""); - setSecondTokenInputValue(""); - setMarketOrGlvTokenInputValue(""); - return; - } - - if (focusedInput === "shortCollateral" && (amounts?.shortTokenAmount ?? 0) <= 0) { - // longTokenInputState?.setValue(""); - setFirstTokenInputValue(""); - setMarketOrGlvTokenInputValue(""); - return; - } - - if (amounts) { - setMarketOrGlvTokenInputValue( - amounts.marketTokenAmount > 0 ? formatAmountFree(amounts.marketTokenAmount, marketToken.decimals) : "" - ); - if (marketInfo.isSameCollaterals) { - if (longToken && firstToken) { - // longTokenInputState?.setValue( - // formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, longToken.decimals) - // ); - setFirstTokenInputValue( - formatAmountFree(amounts.longTokenAmount + amounts.shortTokenAmount, firstToken.decimals) - ); - } - } else { - if (longToken && firstToken) { - // longTokenInputState?.setValue(formatAmountFree(amounts.longTokenAmount, longToken.decimals)); - setFirstTokenInputValue(formatAmountFree(amounts.longTokenAmount, firstToken.decimals)); - } - if (shortToken && secondToken) { - // shortTokenInputState?.setValue(formatAmountFree(amounts.shortTokenAmount, shortToken.decimals)); - setSecondTokenInputValue(formatAmountFree(amounts.shortTokenAmount, secondToken.decimals)); - } - } - } + // Update market token input + setMarketOrGlvTokenInputValue(formatTokenAmount(amounts.marketTokenAmount, marketToken.decimals)); + + // Update both collateral token displays + if (marketInfo.isSameCollaterals) { + if (longTokenAddress && firstToken) { + const combinedAmount = amounts.longTokenAmount + amounts.shortTokenAmount; + setFirstTokenInputValue(formatAmountFree(combinedAmount, firstToken.decimals)); } + } else { + updateTokenInputForMatch({ + token: firstToken, + tokenWrappedAddress: firstTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setFirstTokenInputValue, + }); + + updateTokenInputForMatch({ + token: secondToken, + tokenWrappedAddress: secondTokenWrappedAddress, + longTokenAddress, + shortTokenAddress, + amounts, + setInputValue: setSecondTokenInputValue, + }); + } + } + }, [ + amounts, + marketInfo, + marketToken, + focusedInput, + longTokenAddress, + firstToken, + firstTokenWrappedAddress, + shortTokenAddress, + secondToken, + secondTokenWrappedAddress, + setFirstTokenInputValue, + setSecondTokenInputValue, + setMarketOrGlvTokenInputValue, + ]); + + useEffect( + function updateInputAmounts() { + if (isDeposit) { + handleDepositInputUpdate(); + } else if (isWithdrawal) { + handleWithdrawalInputUpdate(); } }, - [ - amounts, - focusedInput, - isDeposit, - isWithdrawal, - marketInfo, - marketToken, - marketTokenAmount, - setFirstTokenInputValue, - setMarketOrGlvTokenInputValue, - setSecondTokenInputValue, - glvInfo, - glvToken, - glvTokenAmount, - longToken, - firstToken, - shortToken, - secondToken, - ] + [handleDepositInputUpdate, handleWithdrawalInputUpdate, isDeposit, isWithdrawal] ); } diff --git a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx index 2107cb0f20..04d8a45e13 100644 --- a/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx +++ b/src/components/GmSwap/GmSwapBox/GmShiftBox/GmShiftBox.tsx @@ -2,7 +2,7 @@ import { t } from "@lingui/macro"; import { useCallback, useEffect, useMemo, useState } from "react"; import { getContract } from "config/contracts"; -import { usePoolsDetailsFirstTokenAddress } from "context/PoolsDetailsContext/PoolsDetailsContext"; +import { usePoolsDetailsFirstTokenAddress } from "context/PoolsDetailsContext/hooks"; import { useSettings } from "context/SettingsContext/SettingsContextProvider"; import { useTokensData, useUiFeeFactor } from "context/SyntheticsStateContext/hooks/globalsHooks"; import { diff --git a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts index dc46c77370..fb9b12f1b1 100644 --- a/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts +++ b/src/components/MarketStats/hooks/useBestGmPoolForGlv.ts @@ -12,7 +12,7 @@ import { selectPoolsDetailsSelectedMarketForGlv, selectPoolsDetailsShortTokenAddress, selectPoolsDetailsShortTokenAmount, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/selectors"; import { useSelector } from "context/SyntheticsStateContext/utils"; import { getAvailableUsdLiquidityForCollateral } from "domain/synthetics/markets"; import { isGlvInfo } from "domain/synthetics/markets/glv"; diff --git a/src/components/TokenSelector/MultichainMarketTokenSelector.tsx b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx index f8b8efebe1..fdcde7f154 100644 --- a/src/components/TokenSelector/MultichainMarketTokenSelector.tsx +++ b/src/components/TokenSelector/MultichainMarketTokenSelector.tsx @@ -1,4 +1,4 @@ -import { t } from "@lingui/macro"; +import { Trans } from "@lingui/macro"; import cx from "classnames"; import { useMemo, useState } from "react"; @@ -7,6 +7,7 @@ import { getChainIcon } from "config/icons"; import { MULTI_CHAIN_TOKEN_MAPPING } from "config/multichain"; import { isGlvInfo } from "domain/synthetics/markets/glv"; import { GlvOrMarketInfo } from "domain/synthetics/markets/types"; +import { GmPaySource } from "domain/synthetics/markets/types"; import { convertToUsd } from "domain/tokens"; import { formatAmount, formatBalanceAmount } from "lib/numbers"; import { EMPTY_ARRAY, EMPTY_OBJECT } from "lib/objects"; @@ -14,11 +15,11 @@ import { USD_DECIMALS } from "sdk/configs/factors"; import { getTokenBySymbol } from "sdk/configs/tokens"; import { getMarketPoolName } from "sdk/utils/markets"; -import Button from "components/Button/Button"; -import { GmPaySource } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; import { SelectedPoolLabel } from "components/GmSwap/GmSwapBox/SelectedPool"; import { SlideModal } from "components/Modal/SlideModal"; import { ButtonRowScrollFadeContainer } from "components/TableScrollFade/TableScrollFade"; +import Tabs from "components/Tabs/Tabs"; +import type { RegularOption } from "components/Tabs/types"; import TokenIcon from "components/TokenIcon/TokenIcon"; import ChevronDownIcon from "img/ic_chevron_down.svg?react"; @@ -54,15 +55,46 @@ export function MultichainMarketTokenSelector({ const [isModalVisible, setIsModalVisible] = useState(false); const [activeFilter, setActiveFilter] = useState<"all" | AnyChainId | 0>("all"); - const NETWORKS_FILTER = useMemo(() => { - const wildCard = { id: "all" as const, name: t`All Networks` }; - const gmxAccount = { id: 0 as const, name: t`GMX Account` }; - const settlementChain = { id: chainId, name: getChainName(chainId) }; + const NETWORKS_FILTER = useMemo[]>(() => { + const wildCard: RegularOption<"all"> = { + value: "all", + label: ( + + All Networks + + ), + }; + const gmxAccount: RegularOption<0> = { + value: 0, + label: ( + + GMX Account + + ), + icon: GMX Account, + }; + const settlementChain: RegularOption = { + value: chainId, + label: ( + + {getChainName(chainId)} + + ), + icon: {getChainName(chainId)}, + }; - const chainFilters = Object.keys(MULTI_CHAIN_TOKEN_MAPPING[chainId] ?? EMPTY_OBJECT).map((sourceChainId) => ({ - id: parseInt(sourceChainId) as AnyChainId | 0, - name: getChainName(parseInt(sourceChainId)), - })); + const chainFilters = Object.keys(MULTI_CHAIN_TOKEN_MAPPING[chainId] ?? EMPTY_OBJECT).map((sourceChainId) => { + const chainIdNum = parseInt(sourceChainId) as AnyChainId | 0; + return { + value: chainIdNum, + label: ( + + {getChainName(chainIdNum)} + + ), + icon: {getChainName(chainIdNum)}, + }; + }); return [wildCard, settlementChain, gmxAccount, ...chainFilters]; }, [chainId]); @@ -72,55 +104,11 @@ export function MultichainMarketTokenSelector({ propsOnSelectTokenAddress(tokenChainId); }; - // useEffect(() => { - // if (isModalVisible) { - // setSearchKeyword(""); - // } - // }, [isModalVisible]); - - // TODO implement - // const _handleKeyDown = (e) => { - // if (e.key === "Enter") { - // e.preventDefault(); - // e.stopPropagation(); - // if (filteredTokens.length > 0) { - // onSelectToken(filteredTokens[0]); - // } - // } - // }; - - // const isGmxAccountEmpty = useMemo(() => { - // if (!tokensData) return true; - - // const allEmpty = Object.values(tokensData).every( - // (token) => token.gmxAccountBalance === undefined || token.gmxAccountBalance === 0n - // ); - - // return allEmpty; - // }, [tokensData]); - - // useEffect(() => { - // if (isModalVisible) { - // setSearchKeyword(""); - - // if (srcChainId === undefined) { - // setActiveFilter("pay"); - // } else { - // if (isGmxAccountEmpty) { - // setActiveFilter("deposit"); - // } else { - // setActiveFilter("pay"); - // } - // } - // } - // }, [isGmxAccountEmpty, isModalVisible, setSearchKeyword, srcChainId]); - - // if (!token) { - // return null; - // } - return ( -
event.stopPropagation()}> +
event.stopPropagation()} + > -
- {NETWORKS_FILTER.map((network) => ( - - ))} -
+ setActiveFilter(value)} + type="inline" + qa="network-filter" + regularOptionClassname="shrink-0" + />
} @@ -166,7 +143,7 @@ export function MultichainMarketTokenSelector({
setIsModalVisible(true)} > {marketInfo && ( @@ -182,7 +159,7 @@ export function MultichainMarketTokenSelector({ )} - +
); @@ -225,79 +202,6 @@ function AvailableToTradeTokenList({ const sortedFilteredTokens = useMemo((): DisplayToken[] => { if (!marketInfo) return EMPTY_ARRAY; - // const concatenatedTokens: DisplayToken[] = []; - - // if (includeMultichainTokensInPay && multichainTokens) { - // for (const token of multichainTokens) { - // if (token.sourceChainBalance === undefined) { - // continue; - // } - - // const balanceUsd = - // convertToUsd(token.sourceChainBalance, token.sourceChainDecimals, token.sourceChainPrices?.maxPrice) ?? 0n; - // concatenatedTokens.push({ - // ...token, - // balance: token.sourceChainBalance, - // balanceUsd, - // chainId: token.sourceChainId, - // }); - // } - // } - - // let filteredTokens: DisplayToken[]; - // if (!searchKeyword.trim()) { - // filteredTokens = concatenatedTokens; - // } else { - // filteredTokens = searchBy( - // concatenatedTokens, - // [ - // (item) => { - // let name = item.name; - - // return stripBlacklistedWords(name); - // }, - // "symbol", - // ], - // searchKeyword - // ); - // } - - // const tokensWithBalance: DisplayToken[] = []; - // const tokensWithoutBalance: DisplayToken[] = []; - - // for (const token of filteredTokens) { - // const balance = token.balance; - - // if (balance !== undefined && balance > 0n) { - // tokensWithBalance.push(token); - // } else { - // tokensWithoutBalance.push(token); - // } - // } - - // const sortedTokensWithBalance: DisplayToken[] = tokensWithBalance.sort((a, b) => { - // if (a.balanceUsd === b.balanceUsd) { - // return 0; - // } - // return b.balanceUsd - a.balanceUsd > 0n ? 1 : -1; - // }); - - // const sortedTokensWithoutBalance: DisplayToken[] = tokensWithoutBalance.sort((a, b) => { - // if (extendedSortSequence) { - // // making sure to use the wrapped address if it exists in the extended sort sequence - // const aAddress = - // a.wrappedAddress && extendedSortSequence.includes(a.wrappedAddress) ? a.wrappedAddress : a.address; - - // const bAddress = - // b.wrappedAddress && extendedSortSequence.includes(b.wrappedAddress) ? b.wrappedAddress : b.address; - - // return extendedSortSequence.indexOf(aAddress) - extendedSortSequence.indexOf(bAddress); - // } - - // return 0; - // }); - - // return [...sortedTokensWithBalance, ...sortedTokensWithoutBalance]; return Object.entries(tokenBalancesData) .filter(([chainId]) => { if (activeFilter === "all") { diff --git a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx index 674a134761..dc16c3b11c 100644 --- a/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx +++ b/src/context/PoolsDetailsContext/PoolsDetailsContext.tsx @@ -1,40 +1,18 @@ -import mapValues from "lodash/mapValues"; -import noop from "lodash/noop"; import { useCallback, useEffect, useMemo, useState } from "react"; import { SYNTHETICS_MARKET_DEPOSIT_TOKEN_KEY } from "config/localStorage"; -import { - selectChainId, - selectDepositMarketTokensData, - selectGlvInfo, - selectMarketsInfoData, - selectSrcChainId, - selectTokensData, -} from "context/SyntheticsStateContext/selectors/globalSelectors"; -import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; -import { SyntheticsState } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; -import { createSelector, useSelector } from "context/SyntheticsStateContext/utils"; -import { - GlvInfoData, - isMarketTokenAddress, - MarketsInfoData, - useMarketTokensDataRequest, -} from "domain/synthetics/markets"; -import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { GlvInfoData, MarketsInfoData, useMarketTokensDataRequest } from "domain/synthetics/markets"; +import { GmPaySource } from "domain/synthetics/markets/types"; import { TokensData } from "domain/synthetics/tokens"; -import { Token, TokenBalanceType } from "domain/tokens"; +import { ERC20Address, NativeTokenSupportedAddress } from "domain/tokens"; import { useChainId } from "lib/chains"; import { useLocalStorageSerializeKey } from "lib/localStorage"; -import { parseValue } from "lib/numbers"; -import { EMPTY_ARRAY, getByKey } from "lib/objects"; +import { getByKey } from "lib/objects"; import useRouteQuery from "lib/useRouteQuery"; import { useSafeState } from "lib/useSafeState"; -import { MARKETS } from "sdk/configs/markets"; -import { convertTokenAddress, getToken, GM_STUB_ADDRESS } from "sdk/configs/tokens"; -import { getTokenData } from "sdk/utils/tokens"; import { getGmSwapBoxAvailableModes } from "components/GmSwap/GmSwapBox/getGmSwapBoxAvailableModes"; -import { FocusedInput, GmPaySource } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; +import { FocusedInput } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; import { Mode, Operation, isMode, isOperation } from "components/GmSwap/GmSwapBox/types"; import { useMultichainTokens, useMultichainTradeTokensRequest } from "components/GmxAccountModal/hooks"; @@ -84,8 +62,8 @@ export type PoolsDetailsState = { // GM Deposit/Withdrawal Box State focusedInput: FocusedInput; paySource: GmPaySource; - firstTokenAddress: string | undefined; - secondTokenAddress: string | undefined; + firstTokenAddress: NativeTokenSupportedAddress | ERC20Address | undefined; + secondTokenAddress: NativeTokenSupportedAddress | ERC20Address | undefined; firstTokenInputValue: string; secondTokenInputValue: string; marketOrGlvTokenInputValue: string; @@ -286,528 +264,5 @@ export function usePoolsDetailsState({ // return ; // } - // return {children}; return value; } - -export const selectPoolsDetailsGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.glvOrMarketAddress; -export const selectPoolsDetailsSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.selectedMarketForGlv; -export const selectPoolsDetailsOperation = (s: SyntheticsState) => s.poolsDetails?.operation ?? Operation.Deposit; -const selectPoolsDetailsMode = (s: SyntheticsState) => s.poolsDetails?.mode ?? Mode.Single; -const selectPoolsDetailsWithdrawalMarketTokensData = (s: SyntheticsState) => s.poolsDetails?.withdrawalMarketTokensData; - -// GM Deposit/Withdrawal Box State Selectors -export const selectPoolsDetailsFocusedInput = (s: SyntheticsState) => s.poolsDetails?.focusedInput ?? "market"; -export const selectPoolsDetailsPaySource = (s: SyntheticsState) => s.poolsDetails?.paySource ?? "settlementChain"; -export const selectPoolsDetailsFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.firstTokenAddress; -export const selectPoolsDetailsSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.secondTokenAddress; -const selectPoolsDetailsFirstTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.firstTokenInputValue ?? ""; -const selectPoolsDetailsSecondTokenInputValue = (s: SyntheticsState) => s.poolsDetails?.secondTokenInputValue ?? ""; -const selectPoolsDetailsMarketOrGlvTokenInputValue = (s: SyntheticsState) => - s.poolsDetails?.marketOrGlvTokenInputValue ?? ""; -export const selectPoolsDetailsIsMarketForGlvSelectedManually = (s: SyntheticsState) => - s.poolsDetails?.isMarketForGlvSelectedManually ?? false; -// const selectPoolsDetailsMarketTokenMultichainBalances = (s: SyntheticsState) => -// s.poolsDetails?.marketTokensBalancesResult.tokenBalances; - -const PLATFORM_TOKEN_DECIMALS = 18; - -export const selectPoolsDetailsMarketOrGlvTokenAmount = createSelector((q) => { - const marketOrGlvTokenInputValue = q(selectPoolsDetailsMarketOrGlvTokenInputValue); - - return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; -}); - -export const selectPoolsDetailsGlvTokenAmount = createSelector((q) => { - const glvInfo = q(selectPoolsDetailsGlvInfo); - const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); - - if (!glvInfo) { - return 0n; - } - - return marketOrGlvTokenAmount; -}); - -export const selectPoolsDetailsFirstTokenAmount = createSelector((q) => { - const firstToken = q(selectPoolsDetailsFirstToken); - - if (!firstToken) { - return 0n; - } - - const firstTokenInputValue = q(selectPoolsDetailsFirstTokenInputValue); - - return parseValue(firstTokenInputValue || "0", firstToken.decimals)!; -}); - -export const selectPoolsDetailsSecondTokenAmount = createSelector((q) => { - const secondToken = q(selectPoolsDetailsSecondToken); - - if (!secondToken) { - return 0n; - } - - const secondTokenInputValue = q(selectPoolsDetailsSecondTokenInputValue); - - return parseValue(secondTokenInputValue || "0", secondToken.decimals)!; -}); - -const FALLBACK_STRING_SETTER = noop as (value: string) => void; -const FALLBACK_BOOLEAN_SETTER = noop as (value: boolean) => void; -// Setters -const selectSetGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.setGlvOrMarketAddress; -const selectSetSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.setSelectedMarketForGlv; -const selectSetOperation = (s: SyntheticsState) => s.poolsDetails?.setOperation; -const selectSetMode = (s: SyntheticsState) => s.poolsDetails?.setMode; -const selectSetFocusedInput = (s: SyntheticsState) => s.poolsDetails?.setFocusedInput; -const selectSetPaySource = (s: SyntheticsState) => s.poolsDetails?.setPaySource; -const selectSetFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenAddress; -const selectSetSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenAddress; -export const selectPoolsDetailsSetFirstTokenInputValue = (s: SyntheticsState) => - s.poolsDetails?.setFirstTokenInputValue ?? FALLBACK_STRING_SETTER; -export const selectPoolsDetailsSetSecondTokenInputValue = (s: SyntheticsState) => - s.poolsDetails?.setSecondTokenInputValue ?? FALLBACK_STRING_SETTER; -export const selectPoolsDetailsSetMarketOrGlvTokenInputValue = (s: SyntheticsState) => - s.poolsDetails?.setMarketOrGlvTokenInputValue ?? FALLBACK_STRING_SETTER; -export const selectPoolsDetailsSetIsMarketForGlvSelectedManually = (s: SyntheticsState) => - s.poolsDetails?.setIsMarketForGlvSelectedManually ?? FALLBACK_BOOLEAN_SETTER; - -export const selectPoolsDetailsGlvInfo = createSelector((q) => { - const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); - if (!glvOrMarketAddress) return undefined; - - return q((state) => { - const glvInfo = selectGlvInfo(state); - const info = getByKey(glvInfo, glvOrMarketAddress); - return isGlvInfo(info) ? info : undefined; - }); -}); - -export const selectPoolsDetailsGlvTokenAddress = createSelector((q) => { - const glvInfo = q(selectPoolsDetailsGlvInfo); - return glvInfo?.glvTokenAddress; -}); - -export const selectPoolsDetailsGlvTokenData = createSelector((q) => { - const glvInfo = q(selectPoolsDetailsGlvInfo); - return glvInfo?.glvToken; -}); - -export const selectPoolsDetailsMarketOrGlvTokenData = createSelector((q) => { - const glvTokenData = q(selectPoolsDetailsGlvTokenData); - if (glvTokenData) { - return glvTokenData; - } - - return q(selectPoolsDetailsMarketTokenData); -}); - -export const selectPoolsDetailsMarketTokenAddress = createSelector((q) => { - const chainId = q(selectChainId); - const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); - const selectedMarketForGlv = q(selectPoolsDetailsSelectedMarketForGlv); - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - - const glvInfo = q(selectPoolsDetailsGlvInfo); - - // If it's a GLV but no market is selected, return undefined - if (glvInfo !== undefined && selectedMarketForGlv === undefined) { - return undefined; - } - - const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; - - if (isGlv) { - if (firstTokenAddress && MARKETS[chainId][firstTokenAddress]) { - return firstTokenAddress; - } - - return selectedMarketForGlv; - } - - return glvOrMarketAddress; -}); - -export const selectPoolsDetailsMarketInfo = createSelector((q) => { - const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); - - return q((state) => { - return getByKey(selectMarketsInfoData(state), marketTokenAddress); - }); -}); - -export const selectPoolsDetailsFlags = createSelector((q) => { - const operation = q(selectPoolsDetailsOperation); - const mode = q(selectPoolsDetailsMode); - - return { - isPair: mode === Mode.Pair, - isDeposit: operation === Operation.Deposit, - isWithdrawal: operation === Operation.Withdrawal, - isSingle: mode === Mode.Single, - }; -}); - -export const selectPoolsDetailsMarketTokensData = createSelector((q) => { - const { isDeposit } = q(selectPoolsDetailsFlags); - - if (isDeposit) { - return q(selectDepositMarketTokensData); - } - - return q(selectPoolsDetailsWithdrawalMarketTokensData); -}); - -// TODO MLTCH with balance source chain -// export const - -export const selectPoolsDetailsMarketTokenData = createSelector((q) => { - const marketTokensData = q(selectPoolsDetailsMarketTokensData); - - if (!marketTokensData) { - return undefined; - } - const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); - - return getTokenData(marketTokensData, marketTokenAddress); -}); - -export const selectPoolsDetailsLongTokenAddress = createSelector((q) => { - const chainId = q(selectChainId); - const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); - - if (!glvOrMarketAddress) { - return undefined; - } - - if (MARKETS[chainId][glvOrMarketAddress]) { - return MARKETS[chainId][glvOrMarketAddress].longTokenAddress; - } - - const glvInfo = q(selectPoolsDetailsGlvInfo); - - if (!glvInfo) { - return undefined; - } - - return glvInfo.longTokenAddress; -}); - -export const selectPoolsDetailsShortTokenAddress = createSelector((q) => { - const chainId = q(selectChainId); - const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); - - if (!glvOrMarketAddress) { - return undefined; - } - - if (MARKETS[chainId][glvOrMarketAddress]) { - return MARKETS[chainId][glvOrMarketAddress].shortTokenAddress; - } - - const glvInfo = q(selectPoolsDetailsGlvInfo); - - if (!glvInfo) { - return undefined; - } - - return glvInfo.shortTokenAddress; -}); - -export const selectPoolsDetailsWithdrawalReceiveTokenAddress = createSelector((q) => { - const { isPair, isWithdrawal } = q(selectPoolsDetailsFlags); - - if (isPair || !isWithdrawal) { - return undefined; - } - - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - - if (!firstTokenAddress) { - return undefined; - } - - const chainId = q(selectChainId); - - return convertTokenAddress(chainId, firstTokenAddress, "wrapped"); -}); - -/** - * Either undefined meaning no swap needed or a swap from either: - * - long token to short token - * - short token to long token - * Allowing user to sell to single token - */ -export const selectPoolsDetailsWithdrawalFindSwapPath = createSelector((q) => { - const receiveTokenAddress = q(selectPoolsDetailsWithdrawalReceiveTokenAddress); - - if (!receiveTokenAddress) { - return undefined; - } - - const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); - - if (!longTokenAddress) { - return undefined; - } - - const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); - - if (!shortTokenAddress) { - return undefined; - } - - // if we want long token in the end, we need to swap short to long - if (longTokenAddress === receiveTokenAddress) { - return q(makeSelectFindSwapPath(shortTokenAddress, receiveTokenAddress)); - } - - // if we want short token in the end, we need to swap long to short - if (shortTokenAddress === receiveTokenAddress) { - return q(makeSelectFindSwapPath(longTokenAddress, receiveTokenAddress)); - } - - throw new Error("Weird state"); -}); - -export const selectPoolsDetailsIsMarketTokenDeposit = createSelector((q) => { - const { isDeposit } = q(selectPoolsDetailsFlags); - - if (!isDeposit) { - return false; - } - - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - - if (!firstTokenAddress) { - return false; - } - - const chainId = q(selectChainId); - - return isMarketTokenAddress(chainId, firstTokenAddress); -}); - -// export const selectPoolsDetailsGlvDepositMarketTokenAddress = createSelector((q) => { -// const { isDeposit } = q(selectPoolsDetailsFlags); - -// if (!isDeposit) { -// return undefined; -// } - -// const glvInfo = q(selectPoolsDetailsGlvInfo); - -// if (!glvInfo) { -// return undefined; -// } - -// const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - -// if (!firstTokenAddress) { -// return undefined; -// } - -// if (!glvInfo.markets.some((market) => market.address === firstTokenAddress)) { -// return undefined; -// } - -// return firstTokenAddress; -// }); - -// export const selectPoolsDetailsGlvDepositOr - -// export const selectPoolsDetailsGlvDepositMarketTokenAmount = createSelector((q) => { -// const glvDepositMarketTokenAddress = q(selectPoolsDetailsGlvDepositMarketTokenAddress); - -// if (!glvDepositMarketTokenAddress) { -// return undefined; -// } - -// const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - -// if (glvDepositMarketTokenAddress === firstTokenAddress) { -// return q(selectPoolsDetailsFirstTokenAmount); -// } - -// throw new Error("Weird state"); -// }); - -export const selectPoolsDetailsLongTokenAmount = createSelector((q) => { - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); - const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); - const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); - const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); - - let longTokenAmount = 0n; - if (firstTokenAddress !== undefined && firstTokenAddress === longTokenAddress) { - longTokenAmount += firstTokenAmount; - } - if (secondTokenAddress !== undefined && secondTokenAddress === longTokenAddress) { - longTokenAmount += secondTokenAmount; - } - - return longTokenAmount; -}); - -export const selectPoolsDetailsShortTokenAmount = createSelector((q) => { - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); - const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); - const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); - const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); - - let shortTokenAmount = 0n; - if (firstTokenAddress !== undefined && firstTokenAddress === shortTokenAddress) { - shortTokenAmount += firstTokenAmount; - } - if (secondTokenAddress !== undefined && secondTokenAddress === shortTokenAddress) { - shortTokenAmount += secondTokenAmount; - } - - return shortTokenAmount; -}); - -export const selectPoolsDetailsFirstToken = createSelector((q): Token | undefined => { - const chainId = q(selectChainId); - const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); - if (!firstTokenAddress) { - return undefined; - } - - if (MARKETS[chainId][firstTokenAddress]) { - return getToken(chainId, GM_STUB_ADDRESS); - } - - return getToken(chainId, firstTokenAddress); -}); - -export const selectPoolsDetailsSecondToken = createSelector((q): Token | undefined => { - const chainId = q(selectChainId); - const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); - if (!secondTokenAddress) { - return undefined; - } - - if (MARKETS[chainId][secondTokenAddress]) { - return getToken(chainId, GM_STUB_ADDRESS); - } - - return getToken(chainId, secondTokenAddress); -}); - -export const selectPoolsDetailsMultichainTokensArray = (s: SyntheticsState) => - s.poolsDetails?.multichainTokensResult?.tokenChainDataArray || EMPTY_ARRAY; - -export const selectPoolsDetailsTradeTokensDataWithSourceChainBalances = createSelector((q) => { - const srcChainId = q(selectSrcChainId); - const paySource = q(selectPoolsDetailsPaySource); - const rawTradeTokensData = q(selectTokensData); - const tokenChainDataArray = q(selectPoolsDetailsMultichainTokensArray); - - if (paySource !== "sourceChain") { - return rawTradeTokensData; - } - - return mapValues(rawTradeTokensData, (token) => { - const sourceChainToken = tokenChainDataArray.find( - (t) => t.address === token.address && t.sourceChainId === srcChainId - ); - - if (!sourceChainToken) { - return token; - } - - return { - ...token, - balanceType: TokenBalanceType.SourceChain, - balance: sourceChainToken.sourceChainBalance, - sourceChainBalance: sourceChainToken.sourceChainBalance, - }; - }); -}); - -export const selectPoolsDetailsMarketAndTradeTokensData = createSelector((q) => { - const marketTokensData = q(selectPoolsDetailsMarketTokensData); - const tradeTokensData = q(selectPoolsDetailsTradeTokensDataWithSourceChainBalances); - - return { - ...marketTokensData, - ...tradeTokensData, - }; -}); - -// GM Deposit/Withdrawal Box State Hooks -export function usePoolsDetailsFocusedInput() { - const value = useSelector(selectPoolsDetailsFocusedInput); - const setter = useSelector(selectSetFocusedInput); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsPaySource() { - const value = useSelector(selectPoolsDetailsPaySource); - const setter = useSelector(selectSetPaySource); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsFirstTokenAddress() { - const value = useSelector(selectPoolsDetailsFirstTokenAddress); - const setter = useSelector(selectSetFirstTokenAddress); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsSecondTokenAddress() { - const value = useSelector(selectPoolsDetailsSecondTokenAddress); - const setter = useSelector(selectSetSecondTokenAddress); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsFirstTokenInputValue() { - const value = useSelector(selectPoolsDetailsFirstTokenInputValue); - const setter = useSelector(selectPoolsDetailsSetFirstTokenInputValue); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsSecondTokenInputValue() { - const value = useSelector(selectPoolsDetailsSecondTokenInputValue); - const setter = useSelector(selectPoolsDetailsSetSecondTokenInputValue); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsMarketOrGlvTokenInputValue() { - const value = useSelector(selectPoolsDetailsMarketOrGlvTokenInputValue); - const setter = useSelector(selectPoolsDetailsSetMarketOrGlvTokenInputValue); - return [value, (setter || noop) as Exclude] as const; -} - -// Additional hooks for operation and mode -export function usePoolsDetailsOperation() { - const value = useSelector(selectPoolsDetailsOperation); - const setter = useSelector(selectSetOperation); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsMode() { - const value = useSelector(selectPoolsDetailsMode); - const setter = useSelector(selectSetMode); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsGlvOrMarketAddress() { - const value = useSelector(selectPoolsDetailsGlvOrMarketAddress); - const setter = useSelector(selectSetGlvOrMarketAddress); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsSelectedMarketForGlv() { - const value = useSelector(selectPoolsDetailsSelectedMarketForGlv); - const setter = useSelector(selectSetSelectedMarketForGlv); - return [value, (setter || noop) as Exclude] as const; -} - -export function usePoolsDetailsIsMarketForGlvSelectedManually() { - const value = useSelector(selectPoolsDetailsIsMarketForGlvSelectedManually); - const setter = useSelector(selectPoolsDetailsSetIsMarketForGlvSelectedManually); - return [value, (setter || noop) as Exclude] as const; -} diff --git a/src/context/PoolsDetailsContext/hooks.tsx b/src/context/PoolsDetailsContext/hooks.tsx new file mode 100644 index 0000000000..3101d2a336 --- /dev/null +++ b/src/context/PoolsDetailsContext/hooks.tsx @@ -0,0 +1,102 @@ +import noop from "lodash/noop"; + +import { useSelector } from "context/SyntheticsStateContext/utils"; + +import { + selectPoolsDetailsFirstTokenAddress, + selectPoolsDetailsFirstTokenInputValue, + selectPoolsDetailsFocusedInput, + selectPoolsDetailsGlvOrMarketAddress, + selectPoolsDetailsIsMarketForGlvSelectedManually, + selectPoolsDetailsMarketOrGlvTokenInputValue, + selectPoolsDetailsMode, + selectPoolsDetailsOperation, + selectPoolsDetailsPaySource, + selectPoolsDetailsSecondTokenAddress, + selectPoolsDetailsSecondTokenInputValue, + selectPoolsDetailsSelectedMarketForGlv, + selectPoolsDetailsSetFirstTokenInputValue, + selectPoolsDetailsSetIsMarketForGlvSelectedManually, + selectPoolsDetailsSetMarketOrGlvTokenInputValue, + selectPoolsDetailsSetSecondTokenInputValue, + selectSetFirstTokenAddress, + selectSetFocusedInput, + selectSetGlvOrMarketAddress, + selectSetMode, + selectSetOperation, + selectSetPaySource, + selectSetSecondTokenAddress, + selectSetSelectedMarketForGlv, +} from "./selectors"; + +export function usePoolsDetailsFocusedInput() { + const value = useSelector(selectPoolsDetailsFocusedInput); + const setter = useSelector(selectSetFocusedInput); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsPaySource() { + const value = useSelector(selectPoolsDetailsPaySource); + const setter = useSelector(selectSetPaySource); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsFirstTokenAddress() { + const value = useSelector(selectPoolsDetailsFirstTokenAddress); + const setter = useSelector(selectSetFirstTokenAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSecondTokenAddress() { + const value = useSelector(selectPoolsDetailsSecondTokenAddress); + const setter = useSelector(selectSetSecondTokenAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsFirstTokenInputValue() { + const value = useSelector(selectPoolsDetailsFirstTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetFirstTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSecondTokenInputValue() { + const value = useSelector(selectPoolsDetailsSecondTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetSecondTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsMarketOrGlvTokenInputValue() { + const value = useSelector(selectPoolsDetailsMarketOrGlvTokenInputValue); + const setter = useSelector(selectPoolsDetailsSetMarketOrGlvTokenInputValue); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsOperation() { + const value = useSelector(selectPoolsDetailsOperation); + const setter = useSelector(selectSetOperation); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsMode() { + const value = useSelector(selectPoolsDetailsMode); + const setter = useSelector(selectSetMode); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsGlvOrMarketAddress() { + const value = useSelector(selectPoolsDetailsGlvOrMarketAddress); + const setter = useSelector(selectSetGlvOrMarketAddress); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsSelectedMarketForGlv() { + const value = useSelector(selectPoolsDetailsSelectedMarketForGlv); + const setter = useSelector(selectSetSelectedMarketForGlv); + return [value, (setter || noop) as Exclude] as const; +} + +export function usePoolsDetailsIsMarketForGlvSelectedManually() { + const value = useSelector(selectPoolsDetailsIsMarketForGlvSelectedManually); + const setter = useSelector(selectPoolsDetailsSetIsMarketForGlvSelectedManually); + return [value, (setter || noop) as Exclude] as const; +} diff --git a/src/context/PoolsDetailsContext/selectors.tsx b/src/context/PoolsDetailsContext/selectors.tsx new file mode 100644 index 0000000000..124a7b0f22 --- /dev/null +++ b/src/context/PoolsDetailsContext/selectors.tsx @@ -0,0 +1,440 @@ +import mapValues from "lodash/mapValues"; +import noop from "lodash/noop"; + +import { + selectChainId, + selectDepositMarketTokensData, + selectGlvInfo, + selectMarketsInfoData, + selectSrcChainId, + selectTokensData, +} from "context/SyntheticsStateContext/selectors/globalSelectors"; +import { makeSelectFindSwapPath } from "context/SyntheticsStateContext/selectors/tradeSelectors"; +import { SyntheticsState } from "context/SyntheticsStateContext/SyntheticsStateContextProvider"; +import { createSelector } from "context/SyntheticsStateContext/utils"; +import { isGlvInfo } from "domain/synthetics/markets/glv"; +import { ERC20Address, getTokenData, Token, TokenBalanceType } from "domain/tokens"; +import { parseValue } from "lib/numbers"; +import { EMPTY_ARRAY, getByKey } from "lib/objects"; +import { MARKETS } from "sdk/configs/markets"; +import { convertTokenAddress, getToken, GM_STUB_ADDRESS } from "sdk/configs/tokens"; +import { isMarketTokenAddress } from "sdk/utils/markets"; + +import { Mode, Operation } from "components/GmSwap/GmSwapBox/types"; + +const FALLBACK_STRING_SETTER = noop as (value: string) => void; +const FALLBACK_BOOLEAN_SETTER = noop as (value: boolean) => void; + +export const selectPoolsDetailsGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.glvOrMarketAddress; +export const selectPoolsDetailsSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.selectedMarketForGlv; +export const selectPoolsDetailsOperation = (s: SyntheticsState) => s.poolsDetails?.operation ?? Operation.Deposit; +export const selectPoolsDetailsMode = (s: SyntheticsState) => s.poolsDetails?.mode ?? Mode.Single; +const selectPoolsDetailsWithdrawalMarketTokensData = (s: SyntheticsState) => s.poolsDetails?.withdrawalMarketTokensData; +export const selectPoolsDetailsFocusedInput = (s: SyntheticsState) => s.poolsDetails?.focusedInput ?? "market"; +export const selectPoolsDetailsPaySource = (s: SyntheticsState) => s.poolsDetails?.paySource ?? "settlementChain"; +export const selectPoolsDetailsFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.firstTokenAddress; +export const selectPoolsDetailsSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.secondTokenAddress; +export const selectPoolsDetailsFirstTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.firstTokenInputValue ?? ""; +export const selectPoolsDetailsSecondTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.secondTokenInputValue ?? ""; +export const selectPoolsDetailsMarketOrGlvTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.marketOrGlvTokenInputValue ?? ""; +export const selectPoolsDetailsIsMarketForGlvSelectedManually = (s: SyntheticsState) => + s.poolsDetails?.isMarketForGlvSelectedManually ?? false; +// const selectPoolsDetailsMarketTokenMultichainBalances = (s: SyntheticsState) => +// s.poolsDetails?.marketTokensBalancesResult.tokenBalances; +const PLATFORM_TOKEN_DECIMALS = 18; + +export const selectPoolsDetailsMarketOrGlvTokenAmount = createSelector((q) => { + const marketOrGlvTokenInputValue = q(selectPoolsDetailsMarketOrGlvTokenInputValue); + + return parseValue(marketOrGlvTokenInputValue || "0", PLATFORM_TOKEN_DECIMALS)!; +}); + +export const selectPoolsDetailsGlvTokenAmount = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + const marketOrGlvTokenAmount = q(selectPoolsDetailsMarketOrGlvTokenAmount); + + if (!glvInfo) { + return 0n; + } + + return marketOrGlvTokenAmount; +}); + +export const selectPoolsDetailsFirstTokenAmount = createSelector((q) => { + const firstToken = q(selectPoolsDetailsFirstToken); + + if (!firstToken) { + return 0n; + } + + const firstTokenInputValue = q(selectPoolsDetailsFirstTokenInputValue); + + return parseValue(firstTokenInputValue || "0", firstToken.decimals)!; +}); + +export const selectPoolsDetailsSecondTokenAmount = createSelector((q) => { + const secondToken = q(selectPoolsDetailsSecondToken); + + if (!secondToken) { + return 0n; + } + + const secondTokenInputValue = q(selectPoolsDetailsSecondTokenInputValue); + + return parseValue(secondTokenInputValue || "0", secondToken.decimals)!; +}); + +// Setters +export const selectSetGlvOrMarketAddress = (s: SyntheticsState) => s.poolsDetails?.setGlvOrMarketAddress; +export const selectSetSelectedMarketForGlv = (s: SyntheticsState) => s.poolsDetails?.setSelectedMarketForGlv; +export const selectSetOperation = (s: SyntheticsState) => s.poolsDetails?.setOperation; +export const selectSetMode = (s: SyntheticsState) => s.poolsDetails?.setMode; +export const selectSetFocusedInput = (s: SyntheticsState) => s.poolsDetails?.setFocusedInput; +export const selectSetPaySource = (s: SyntheticsState) => s.poolsDetails?.setPaySource; +export const selectSetFirstTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setFirstTokenAddress; +export const selectSetSecondTokenAddress = (s: SyntheticsState) => s.poolsDetails?.setSecondTokenAddress; +export const selectPoolsDetailsSetFirstTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setFirstTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetSecondTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setSecondTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetMarketOrGlvTokenInputValue = (s: SyntheticsState) => + s.poolsDetails?.setMarketOrGlvTokenInputValue ?? FALLBACK_STRING_SETTER; +export const selectPoolsDetailsSetIsMarketForGlvSelectedManually = (s: SyntheticsState) => + s.poolsDetails?.setIsMarketForGlvSelectedManually ?? FALLBACK_BOOLEAN_SETTER; + +export const selectPoolsDetailsGlvInfo = createSelector((q) => { + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + if (!glvOrMarketAddress) return undefined; + + return q((state) => { + const glvInfo = selectGlvInfo(state); + const info = getByKey(glvInfo, glvOrMarketAddress); + return isGlvInfo(info) ? info : undefined; + }); +}); + +export const selectPoolsDetailsGlvTokenAddress = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + return glvInfo?.glvTokenAddress; +}); + +export const selectPoolsDetailsGlvTokenData = createSelector((q) => { + const glvInfo = q(selectPoolsDetailsGlvInfo); + return glvInfo?.glvToken; +}); + +export const selectPoolsDetailsMarketOrGlvTokenData = createSelector((q) => { + const glvTokenData = q(selectPoolsDetailsGlvTokenData); + if (glvTokenData) { + return glvTokenData; + } + + return q(selectPoolsDetailsMarketTokenData); +}); + +export const selectPoolsDetailsMarketTokenAddress = createSelector((q) => { + const chainId = q(selectChainId); + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + const selectedMarketForGlv = q(selectPoolsDetailsSelectedMarketForGlv); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + const glvInfo = q(selectPoolsDetailsGlvInfo); + + // If it's a GLV but no market is selected, return undefined + if (glvInfo !== undefined && selectedMarketForGlv === undefined) { + return undefined; + } + + const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; + + if (isGlv) { + if (firstTokenAddress && MARKETS[chainId][firstTokenAddress]) { + return firstTokenAddress; + } + + return selectedMarketForGlv; + } + + return glvOrMarketAddress; +}); + +export const selectPoolsDetailsMarketInfo = createSelector((q) => { + const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); + + return q((state) => { + return getByKey(selectMarketsInfoData(state), marketTokenAddress); + }); +}); + +export const selectPoolsDetailsFlags = createSelector((q) => { + const operation = q(selectPoolsDetailsOperation); + const mode = q(selectPoolsDetailsMode); + + return { + isPair: mode === Mode.Pair, + isDeposit: operation === Operation.Deposit, + isWithdrawal: operation === Operation.Withdrawal, + isSingle: mode === Mode.Single, + }; +}); + +export const selectPoolsDetailsMarketTokensData = createSelector((q) => { + const { isDeposit } = q(selectPoolsDetailsFlags); + + if (isDeposit) { + return q(selectDepositMarketTokensData); + } + + return q(selectPoolsDetailsWithdrawalMarketTokensData); +}); +// TODO MLTCH with balance source chain +// export const + +export const selectPoolsDetailsMarketTokenData = createSelector((q) => { + const marketTokensData = q(selectPoolsDetailsMarketTokensData); + + if (!marketTokensData) { + return undefined; + } + const marketTokenAddress = q(selectPoolsDetailsMarketTokenAddress); + + return getTokenData(marketTokensData, marketTokenAddress); +}); + +export const selectPoolsDetailsLongTokenAddress = createSelector((q): ERC20Address | undefined => { + const chainId = q(selectChainId); + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + + if (!glvOrMarketAddress) { + return undefined; + } + + if (MARKETS[chainId][glvOrMarketAddress]) { + return MARKETS[chainId][glvOrMarketAddress].longTokenAddress as ERC20Address; + } + + const glvInfo = q(selectPoolsDetailsGlvInfo); + + if (!glvInfo) { + return undefined; + } + + return glvInfo.longTokenAddress as ERC20Address; +}); + +export const selectPoolsDetailsShortTokenAddress = createSelector((q) => { + const chainId = q(selectChainId); + const glvOrMarketAddress = q(selectPoolsDetailsGlvOrMarketAddress); + + if (!glvOrMarketAddress) { + return undefined; + } + + if (MARKETS[chainId][glvOrMarketAddress]) { + return MARKETS[chainId][glvOrMarketAddress].shortTokenAddress; + } + + const glvInfo = q(selectPoolsDetailsGlvInfo); + + if (!glvInfo) { + return undefined; + } + + return glvInfo.shortTokenAddress; +}); + +export const selectPoolsDetailsWithdrawalReceiveTokenAddress = createSelector((q) => { + const { isPair, isWithdrawal } = q(selectPoolsDetailsFlags); + + if (isPair || !isWithdrawal) { + return undefined; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return undefined; + } + + const chainId = q(selectChainId); + + return convertTokenAddress(chainId, firstTokenAddress, "wrapped"); +}); +/** + * Either undefined meaning no swap needed or a swap from either: + * - long token to short token + * - short token to long token + * Allowing user to sell to single token + */ + +export const selectPoolsDetailsWithdrawalFindSwapPath = createSelector((q) => { + const receiveTokenAddress = q(selectPoolsDetailsWithdrawalReceiveTokenAddress); + + if (!receiveTokenAddress) { + return undefined; + } + + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + + if (!longTokenAddress) { + return undefined; + } + + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + + if (!shortTokenAddress) { + return undefined; + } + + // if we want long token in the end, we need to swap short to long + if (longTokenAddress === receiveTokenAddress) { + return q(makeSelectFindSwapPath(shortTokenAddress, receiveTokenAddress)); + } + + // if we want short token in the end, we need to swap long to short + if (shortTokenAddress === receiveTokenAddress) { + return q(makeSelectFindSwapPath(longTokenAddress, receiveTokenAddress)); + } + + throw new Error("Weird state"); +}); + +export const selectPoolsDetailsIsMarketTokenDeposit = createSelector((q) => { + const { isDeposit } = q(selectPoolsDetailsFlags); + + if (!isDeposit) { + return false; + } + + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + + if (!firstTokenAddress) { + return false; + } + + const chainId = q(selectChainId); + + return isMarketTokenAddress(chainId, firstTokenAddress); +}); + +export const selectPoolsDetailsLongTokenAmount = createSelector((q) => { + const chainId = q(selectChainId); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const longTokenAddress = q(selectPoolsDetailsLongTokenAddress); + const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); + + let longTokenAmount = 0n; + if ( + firstTokenAddress !== undefined && + convertTokenAddress(chainId, firstTokenAddress, "wrapped") === longTokenAddress + ) { + longTokenAmount += firstTokenAmount; + } + if ( + secondTokenAddress !== undefined && + convertTokenAddress(chainId, secondTokenAddress, "wrapped") === longTokenAddress + ) { + longTokenAmount += secondTokenAmount; + } + + return longTokenAmount; +}); + +export const selectPoolsDetailsShortTokenAmount = createSelector((q) => { + const chainId = q(selectChainId); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + const shortTokenAddress = q(selectPoolsDetailsShortTokenAddress); + const firstTokenAmount = q(selectPoolsDetailsFirstTokenAmount); + const secondTokenAmount = q(selectPoolsDetailsSecondTokenAmount); + + let shortTokenAmount = 0n; + if ( + firstTokenAddress !== undefined && + convertTokenAddress(chainId, firstTokenAddress, "wrapped") === shortTokenAddress + ) { + shortTokenAmount += firstTokenAmount; + } + if ( + secondTokenAddress !== undefined && + convertTokenAddress(chainId, secondTokenAddress, "wrapped") === shortTokenAddress + ) { + shortTokenAmount += secondTokenAmount; + } + + return shortTokenAmount; +}); + +export const selectPoolsDetailsFirstToken = createSelector((q): Token | undefined => { + const chainId = q(selectChainId); + const firstTokenAddress = q(selectPoolsDetailsFirstTokenAddress); + if (!firstTokenAddress) { + return undefined; + } + + if (MARKETS[chainId][firstTokenAddress]) { + return getToken(chainId, GM_STUB_ADDRESS); + } + + return getToken(chainId, firstTokenAddress); +}); + +export const selectPoolsDetailsSecondToken = createSelector((q): Token | undefined => { + const chainId = q(selectChainId); + const secondTokenAddress = q(selectPoolsDetailsSecondTokenAddress); + if (!secondTokenAddress) { + return undefined; + } + + if (MARKETS[chainId][secondTokenAddress]) { + return getToken(chainId, GM_STUB_ADDRESS); + } + + return getToken(chainId, secondTokenAddress); +}); + +export const selectPoolsDetailsMultichainTokensArray = (s: SyntheticsState) => + s.poolsDetails?.multichainTokensResult?.tokenChainDataArray || EMPTY_ARRAY; + +export const selectPoolsDetailsTradeTokensDataWithSourceChainBalances = createSelector((q) => { + const srcChainId = q(selectSrcChainId); + const paySource = q(selectPoolsDetailsPaySource); + const rawTradeTokensData = q(selectTokensData); + const tokenChainDataArray = q(selectPoolsDetailsMultichainTokensArray); + + if (paySource !== "sourceChain") { + return rawTradeTokensData; + } + + return mapValues(rawTradeTokensData, (token) => { + const sourceChainToken = tokenChainDataArray.find( + (t) => t.address === token.address && t.sourceChainId === srcChainId + ); + + if (!sourceChainToken) { + return token; + } + + return { + ...token, + balanceType: TokenBalanceType.SourceChain, + balance: sourceChainToken.sourceChainBalance, + sourceChainBalance: sourceChainToken.sourceChainBalance, + }; + }); +}); + +export const selectPoolsDetailsMarketAndTradeTokensData = createSelector((q) => { + const marketTokensData = q(selectPoolsDetailsMarketTokensData); + const tradeTokensData = q(selectPoolsDetailsTradeTokensDataWithSourceChainBalances); + + return { + ...marketTokensData, + ...tradeTokensData, + }; +}); diff --git a/src/domain/multichain/paySourceToTokenBalanceType.tsx b/src/domain/multichain/paySourceToTokenBalanceType.tsx new file mode 100644 index 0000000000..52ea60d56a --- /dev/null +++ b/src/domain/multichain/paySourceToTokenBalanceType.tsx @@ -0,0 +1,12 @@ +import type { GmPaySource } from "domain/synthetics/markets/types"; +import { TokenBalanceType } from "domain/tokens"; + +export function paySourceToTokenBalanceType(paySource: GmPaySource): TokenBalanceType { + switch (paySource) { + case "gmxAccount": + return TokenBalanceType.GmxAccount; + case "sourceChain": + return TokenBalanceType.SourceChain; + } + return TokenBalanceType.Wallet; +} diff --git a/src/domain/multichain/sendQuoteFromNative.ts b/src/domain/multichain/sendQuoteFromNative.ts new file mode 100644 index 0000000000..caba150ede --- /dev/null +++ b/src/domain/multichain/sendQuoteFromNative.ts @@ -0,0 +1,8 @@ +import type { MessagingFee } from "domain/multichain/types"; + +export function sendQuoteFromNative(nativeFee: bigint): MessagingFee { + return { + nativeFee, + lzTokenFee: 0n, + }; +} diff --git a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts index 572517fd7b..e640c45880 100644 --- a/src/domain/synthetics/markets/createSourceChainDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainDepositTxn.ts @@ -5,6 +5,7 @@ import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { sendQuoteFromNative } from "domain/multichain/sendQuoteFromNative"; import { SendParam, TransferRequests } from "domain/multichain/types"; import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateDepositParams, RawCreateDepositParams } from "domain/synthetics/markets"; @@ -13,11 +14,7 @@ import { WalletSigner } from "lib/wallets"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; -import { - estimateSourceChainDepositFees, - sendQuoteFromNative, - SourceChainDepositFees, -} from "./feeEstimation/estimateSourceChainDepositFees"; +import { estimateSourceChainDepositFees, SourceChainDepositFees } from "./feeEstimation/estimateSourceChainDepositFees"; import { signCreateDeposit } from "./signCreateDeposit"; export async function createSourceChainDepositTxn({ diff --git a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts index 46ba316fff..7b72faed02 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvDepositTxn.ts @@ -5,6 +5,7 @@ import type { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId, IStargateAbi } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { sendQuoteFromNative } from "domain/multichain/sendQuoteFromNative"; import { SendParam, TransferRequests } from "domain/multichain/types"; import { GlobalExpressParams } from "domain/synthetics/express"; import type { CreateGlvDepositParams, RawCreateGlvDepositParams } from "domain/synthetics/markets"; @@ -13,7 +14,6 @@ import type { WalletSigner } from "lib/wallets"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; -import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; import { estimateSourceChainGlvDepositFees, SourceChainGlvDepositFees, diff --git a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts index 5be0e14f53..1ddf6081aa 100644 --- a/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainGlvWithdrawalTxn.ts @@ -5,6 +5,7 @@ import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { sendQuoteFromNative } from "domain/multichain/sendQuoteFromNative"; import { SendParam, TransferRequests } from "domain/multichain/types"; import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateGlvWithdrawalParams, RawCreateGlvWithdrawalParams } from "domain/synthetics/markets"; @@ -15,7 +16,6 @@ import { abis } from "sdk/abis"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; -import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; import { estimateSourceChainGlvWithdrawalFees, SourceChainGlvWithdrawalFees, diff --git a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts index 479791bd9f..b5fc8980f5 100644 --- a/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createSourceChainWithdrawalTxn.ts @@ -5,6 +5,7 @@ import { SettlementChainId, SourceChainId } from "config/chains"; import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; +import { sendQuoteFromNative } from "domain/multichain/sendQuoteFromNative"; import { SendParam, TransferRequests } from "domain/multichain/types"; import { GlobalExpressParams, RelayParamsPayload } from "domain/synthetics/express"; import { CreateWithdrawalParams, RawCreateWithdrawalParams } from "domain/synthetics/markets"; @@ -14,7 +15,6 @@ import { abis } from "sdk/abis"; import { toastCustomOrStargateError } from "components/GmxAccountModal/toastCustomOrStargateError"; -import { sendQuoteFromNative } from "./feeEstimation/estimateSourceChainDepositFees"; import { estimateSourceChainWithdrawalFees, SourceChainWithdrawalFees, diff --git a/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts index 1ff05341ee..fc9216e93e 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateDepositPlatformTokenTransferOutFees.ts @@ -1,13 +1,10 @@ -import { maxUint256, zeroHash } from "viem"; - import type { SettlementChainId, SourceChainId } from "config/chains"; -import { getMultichainTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getMultichainTokenId, RANDOM_WALLET } from "config/multichain"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; -import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; -import { abis } from "sdk/abis"; import { expandDecimals } from "sdk/utils/numbers"; +import { stargateTransferFees } from "./stargateTransferFees"; + export async function estimateDepositPlatformTokenTransferOutFees({ fromChainId, toChainId, @@ -20,11 +17,9 @@ export async function estimateDepositPlatformTokenTransferOutFees({ platformTokenReturnTransferGasLimit: bigint; platformTokenReturnTransferNativeFee: bigint; }> { - const settlementChainClient = getPublicClientWithRpc(fromChainId); + const marketTokenId = getMultichainTokenId(fromChainId, marketOrGlvAddress); - const settlementChainMarketTokenId = getMultichainTokenId(fromChainId, marketOrGlvAddress); - - if (!settlementChainMarketTokenId) { + if (!marketTokenId) { throw new Error("Settlement chain market token ID not found"); } @@ -32,49 +27,21 @@ export async function estimateDepositPlatformTokenTransferOutFees({ dstChainId: toChainId, account: RANDOM_WALLET.address, srcChainId: fromChainId, - amountLD: expandDecimals(1, settlementChainMarketTokenId.decimals), + amountLD: expandDecimals(1, marketTokenId.decimals), isToGmx: false, // TODO MLTCH check that all gm and glv transfers are manual gas isManualGas: true, }); - const primaryStargateQuoteSend = await settlementChainClient.readContract({ - address: settlementChainMarketTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [returnTransferSendParams, false], + const { quoteSend: primaryStargateQuoteSend, returnTransferGasLimit } = await stargateTransferFees({ + chainId: fromChainId, + stargateAddress: marketTokenId.stargate, + sendParams: returnTransferSendParams, + tokenAddress: marketTokenId.address, }); const returnTransferNativeFee = primaryStargateQuoteSend.nativeFee; - // The txn of stargate itself what will it take - const returnTransferGasLimit = await settlementChainClient - .estimateContractGas({ - address: settlementChainMarketTokenId.stargate, - abi: abis.IStargate, - functionName: "send", - account: RANDOM_WALLET.address, - args: [returnTransferSendParams, primaryStargateQuoteSend, RANDOM_WALLET.address], - value: primaryStargateQuoteSend.nativeFee, // + tokenAmount if native - stateOverride: [ - { - address: RANDOM_WALLET.address, - balance: maxUint256, - }, - { - address: settlementChainMarketTokenId.address, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }, - ], - }) - .then(applyGasLimitBuffer); - return { platformTokenReturnTransferGasLimit: returnTransferGasLimit, platformTokenReturnTransferNativeFee: returnTransferNativeFee, diff --git a/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts index f28e097b40..2b053ff5ba 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateGlvWithdrawalPlatformTokenTransferInFees.ts @@ -1,12 +1,11 @@ import { SettlementChainId, SourceChainId } from "config/chains"; -import { getMappedTokenId, RANDOM_WALLET } from "config/multichain"; +import { RANDOM_WALLET } from "config/multichain"; +import { getMappedTokenId } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; -import { abis } from "sdk/abis"; import { getContract } from "sdk/configs/contracts"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { convertTokenAddress, getWrappedToken } from "sdk/configs/tokens"; @@ -18,6 +17,7 @@ import { getRawRelayerParams } from "../../express"; import { GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express/types"; import { signCreateWithdrawal } from "../signCreateWithdrawal"; import { CreateGlvWithdrawalParams } from "../types"; +import { stargateTransferFees } from "./stargateTransferFees"; export async function estimateGlvWithdrawalPlatformTokenTransferInFees({ chainId, @@ -143,37 +143,24 @@ export async function estimateGlvWithdrawalPlatformTokenTransferInFees({ composeGas, }); - const sourceChainClient = getPublicClientWithRpc(srcChainId); - const sourceChainTokenId = getMappedTokenId(chainId, params.addresses.market, srcChainId); - if (!sourceChainTokenId) { - throw new Error("Source chain token ID not found"); - } + const tokenId = getMappedTokenId(chainId, params.addresses.market, srcChainId); - const platformTokenTransferInQuoteSend = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [returnTransferSendParams, false], - }); + if (!tokenId) { + throw new Error("Token ID not found"); + } - const platformTokenTransferInNativeFee = platformTokenTransferInQuoteSend.nativeFee; - - // The txn of stargate itself what will it take - const platformTokenTransferInGasLimit = await sourceChainClient - .estimateContractGas({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "send", - account: params.addresses.receiver, - args: [returnTransferSendParams, platformTokenTransferInQuoteSend, params.addresses.receiver], - value: platformTokenTransferInQuoteSend.nativeFee, - // No need to override state because we are using the users account on source chain - }) - .then(applyGasLimitBuffer); + const { quoteSend: platformTokenTransferInQuoteSend, returnTransferGasLimit: platformTokenTransferInGasLimit } = + await stargateTransferFees({ + chainId: srcChainId, + stargateAddress: tokenId.stargate, + sendParams: returnTransferSendParams, + tokenAddress: params.addresses.market, + disableOverrides: true, + }); return { - platformTokenTransferInGasLimit: platformTokenTransferInGasLimit, - platformTokenTransferInNativeFee: platformTokenTransferInNativeFee, + platformTokenTransferInGasLimit, + platformTokenTransferInNativeFee: platformTokenTransferInQuoteSend.nativeFee, platformTokenTransferInComposeGas: composeGas, relayParamsPayload: returnRelayParamsPayload, }; diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts index c03778ed38..2f015c42c8 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainDepositFees.ts @@ -1,18 +1,16 @@ // import { getPublicClient } from "@wagmi/core"; -import { maxUint256, zeroAddress, zeroHash } from "viem"; +import { zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; -import { getMappedTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getMappedTokenId, RANDOM_WALLET } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; -import { MessagingFee, SendParam } from "domain/multichain/types"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { SendParam } from "domain/multichain/types"; import { adjustForDecimals } from "lib/numbers"; import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; -import { abis } from "sdk/abis"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { MARKETS } from "sdk/configs/markets"; import { convertTokenAddress, getToken, getWrappedToken } from "sdk/configs/tokens"; @@ -26,6 +24,7 @@ import { signCreateDeposit } from "../signCreateDeposit"; import { CreateDepositParams, RawCreateDepositParams } from "../types"; import { estimateDepositPlatformTokenTransferOutFees } from "./estimateDepositPlatformTokenTransferOutFees"; import { estimatePureDepositGasLimit } from "./estimatePureDepositGasLimit"; +import { stargateTransferFees } from "./stargateTransferFees"; export type SourceChainDepositFees = { /** @@ -156,7 +155,6 @@ async function estimateSourceChainDepositInitialTxFees({ initialTransferComposeGas: bigint; relayParamsPayload: RelayParamsPayload; }> { - const sourceChainClient = getPublicClientWithRpc(srcChainId); const settlementNativeWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; const unwrappedPayTokenAddress = convertTokenAddress(chainId, tokenAddress, "native"); const wrappedPayTokenAddress = convertTokenAddress(chainId, tokenAddress, "wrapped"); @@ -274,51 +272,21 @@ async function estimateSourceChainDepositInitialTxFees({ action, }); - const initialQuoteOft = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteOFT", - args: [sendParams], - }); + const additionalValue = unwrappedPayTokenAddress === zeroAddress ? amountLD : 0n; - const initialQuoteSend = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [sendParams, false], + const { + quoteSend: initialQuoteSend, + quoteOft: initialQuoteOft, + returnTransferGasLimit: initialStargateTxnGasLimit, + } = await stargateTransferFees({ + chainId: srcChainId, + stargateAddress: sourceChainTokenId.stargate, + sendParams, + tokenAddress: sourceChainTokenId.address, + useSendToken: true, + additionalValue, }); - let value = initialQuoteSend.nativeFee; - if (unwrappedPayTokenAddress === zeroAddress) { - value += amountLD; - } - - const initialStargateTxnGasLimit = await sourceChainClient - .estimateContractGas({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "sendToken", - args: [sendParams, initialQuoteSend, RANDOM_WALLET.address], - value, - stateOverride: [ - { - address: RANDOM_WALLET.address, - balance: maxUint256, - }, - { - address: sourceChainTokenId.address, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }, - ], - }) - .then(applyGasLimitBuffer); - return { initialTxNativeFee: initialQuoteSend.nativeFee, initialTxGasLimit: initialStargateTxnGasLimit, @@ -327,10 +295,3 @@ async function estimateSourceChainDepositInitialTxFees({ relayParamsPayload: returnRelayParamsPayload, }; } - -export function sendQuoteFromNative(nativeFee: bigint): MessagingFee { - return { - nativeFee, - lzTokenFee: 0n, - }; -} diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts index 159ee56346..b4ca46bf06 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainGlvDepositFees.ts @@ -1,17 +1,13 @@ -import { maxUint256, zeroHash } from "viem"; - import { SettlementChainId, SourceChainId } from "config/chains"; import { getContract } from "config/contracts"; -import { getMappedTokenId, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getMappedTokenId, RANDOM_WALLET } from "config/multichain"; import { MultichainAction, MultichainActionType } from "domain/multichain/codecs/CodecUiHelper"; import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; import { SendParam } from "domain/multichain/types"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { expandDecimals } from "lib/numbers"; import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; -import { abis } from "sdk/abis"; import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express"; import { MARKETS } from "sdk/configs/markets"; import { getToken, getWrappedToken } from "sdk/configs/tokens"; @@ -19,12 +15,13 @@ import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions"; import { buildReverseSwapStrategy } from "sdk/utils/swap/buildSwapStrategy"; import { nowInSeconds } from "sdk/utils/time"; -import { estimateDepositPlatformTokenTransferOutFees } from "./estimateDepositPlatformTokenTransferOutFees"; -import { estimatePureGlvDepositGasLimit } from "./estimatePureGlvDepositGasLimit"; import { getRawRelayerParams, GlobalExpressParams, RawRelayParamsPayload, RelayParamsPayload } from "../../express"; import { convertToUsd, getMidPrice } from "../../tokens"; import { signCreateGlvDeposit } from "../signCreateGlvDeposit"; import { CreateGlvDepositParams, RawCreateGlvDepositParams } from "../types"; +import { estimateDepositPlatformTokenTransferOutFees } from "./estimateDepositPlatformTokenTransferOutFees"; +import { estimatePureGlvDepositGasLimit } from "./estimatePureGlvDepositGasLimit"; +import { stargateTransferFees } from "./stargateTransferFees"; export type SourceChainGlvDepositFees = { /** @@ -158,8 +155,6 @@ async function estimateSourceChainGlvDepositInitialTxFees({ relayParamsPayload: RelayParamsPayload; initialTxReceivedAmount: bigint; }> { - const sourceChainClient = getPublicClientWithRpc(srcChainId); - const settlementWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; const marketConfig = MARKETS[chainId][params.addresses.market]; if (marketConfig.longTokenAddress !== tokenAddress && marketConfig.shortTokenAddress !== tokenAddress) { @@ -259,46 +254,18 @@ async function estimateSourceChainGlvDepositInitialTxFees({ action, }); - const initialQuoteOft = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteOFT", - args: [sendParams], - }); - - const initialQuoteSend = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [sendParams, false], + const { + quoteSend: initialQuoteSend, + quoteOft: initialQuoteOft, + returnTransferGasLimit: initialStargateTxnGasLimit, + } = await stargateTransferFees({ + chainId: srcChainId, + stargateAddress: sourceChainTokenId.stargate, + sendParams, + tokenAddress: sourceChainTokenId.address, + useSendToken: true, }); - const initialStargateTxnGasLimit = await sourceChainClient - .estimateContractGas({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "sendToken", - args: [sendParams, initialQuoteSend, RANDOM_WALLET.address], - value: initialQuoteSend.nativeFee, - stateOverride: [ - { - address: RANDOM_WALLET.address, - balance: maxUint256, - }, - { - address: sourceChainTokenId.address, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }, - ], - }) - .then(applyGasLimitBuffer); - return { initialTxNativeFee: initialQuoteSend.nativeFee, initialTxGasLimit: initialStargateTxnGasLimit, diff --git a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts index cd0a4b7dcf..a4dec1c316 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateSourceChainWithdrawalFees.ts @@ -1,14 +1,11 @@ // import { getPublicClient } from "@wagmi/core"; -import { maxUint256, zeroAddress, zeroHash } from "viem"; +import { zeroAddress } from "viem"; import { SettlementChainId, SourceChainId } from "config/chains"; -import { getStargatePoolAddress, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT, RANDOM_WALLET } from "config/multichain"; +import { getStargatePoolAddress, RANDOM_WALLET } from "config/multichain"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { SendParam } from "domain/multichain/types"; -import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { expandDecimals } from "lib/numbers"; -import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; -import { abis } from "sdk/abis"; import { convertTokenAddress, getToken } from "sdk/configs/tokens"; import { GlobalExpressParams, RelayParamsPayload } from "../../express"; @@ -16,6 +13,7 @@ import { convertToUsd, getMidPrice } from "../../tokens"; import { CreateWithdrawalParams, RawCreateWithdrawalParams } from "../types"; import { estimatePureWithdrawalGasLimit } from "./estimatePureWithdrawalGasLimit"; import { estimateWithdrawalPlatformTokenTransferInFees } from "./estimateWithdrawalPlatformTokenTransferInFees"; +import { stargateTransferFees } from "./stargateTransferFees"; export type SourceChainWithdrawalFees = { /** @@ -125,151 +123,90 @@ export async function estimateSourceChainWithdrawalFees({ }; } -export async function estimateSourceChainWithdrawalReturnTokenTransferFees({ +async function estimateSingleTokenReturnTransfer({ chainId, srcChainId, - outputLongTokenAddress, - outputShortTokenAddress, + tokenAddress, }: { chainId: SettlementChainId; srcChainId: SourceChainId; - outputLongTokenAddress: string; - outputShortTokenAddress: string; + tokenAddress: string; }): Promise<{ - longTokenTransferGasLimit: bigint; - longTokenTransferNativeFee: bigint; - shortTokenTransferGasLimit: bigint; - shortTokenTransferNativeFee: bigint; + transferGasLimit: bigint; + transferNativeFee: bigint; }> { - const settlementChainClient = getPublicClientWithRpc(chainId); - - let longTokenTransferGasLimit = 0n; - let longTokenTransferNativeFee = 0n; - - const outputLongToken = getToken(chainId, outputLongTokenAddress); - const outputLongTokenUnwrappedAddress = convertTokenAddress(chainId, outputLongTokenAddress, "native"); - const outputLongTokenStargate = getStargatePoolAddress(chainId, outputLongTokenUnwrappedAddress); + const token = getToken(chainId, tokenAddress); + const unwrappedAddress = convertTokenAddress(chainId, tokenAddress, "native"); + const stargateAddress = getStargatePoolAddress(chainId, unwrappedAddress); - if (!outputLongTokenStargate) { - throw new Error(`Output long token stargate not found: ${outputLongTokenAddress}`); + if (!stargateAddress) { + throw new Error(`Stargate not found for token: ${tokenAddress}`); } - const someAmount = expandDecimals(1, outputLongToken.decimals) / 100n; + const tokenAmount = expandDecimals(1, token.decimals) / 100n; + const additionalValue = unwrappedAddress === zeroAddress ? tokenAmount : 0n; const sendParams: SendParam = getMultichainTransferSendParams({ dstChainId: srcChainId, account: RANDOM_WALLET.address, srcChainId, - amountLD: someAmount, + amountLD: tokenAmount, isToGmx: false, }); - const quoteSend = await settlementChainClient.readContract({ - address: outputLongTokenStargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [sendParams, false], + const { quoteSend, returnTransferGasLimit } = await stargateTransferFees({ + chainId, + stargateAddress, + sendParams, + tokenAddress, + useSendToken: true, + additionalValue, }); - let longNativeValue = quoteSend.nativeFee; - if (outputLongTokenUnwrappedAddress === zeroAddress) { - longNativeValue += someAmount; - } - - longTokenTransferGasLimit = await settlementChainClient - .estimateContractGas({ - address: outputLongTokenStargate, - abi: abis.IStargate, - functionName: "sendToken", - args: [sendParams, quoteSend, RANDOM_WALLET.address], - value: longNativeValue, - stateOverride: [ - { - address: RANDOM_WALLET.address, - balance: maxUint256, - }, - { - address: outputLongTokenAddress, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }, - ], - }) - .then(applyGasLimitBuffer); - - let shortTokenTransferGasLimit = 0n; - let shortTokenTransferNativeFee = 0n; - if (outputShortTokenAddress !== outputLongTokenAddress) { - const outputShortToken = getToken(chainId, outputShortTokenAddress); - const outputShortTokenUnwrappedAddress = convertTokenAddress(chainId, outputShortTokenAddress, "native"); - const outputShortTokenStargate = getStargatePoolAddress(chainId, outputShortTokenUnwrappedAddress); - - if (!outputShortTokenStargate) { - throw new Error("Output short token stargate not found"); - } + return { + transferGasLimit: returnTransferGasLimit, + transferNativeFee: quoteSend.nativeFee, + }; +} - const someAmount = expandDecimals(1, outputShortToken.decimals) / 100n; +export async function estimateSourceChainWithdrawalReturnTokenTransferFees({ + chainId, + srcChainId, + outputLongTokenAddress, + outputShortTokenAddress, +}: { + chainId: SettlementChainId; + srcChainId: SourceChainId; + outputLongTokenAddress: string; + outputShortTokenAddress: string; +}): Promise<{ + longTokenTransferGasLimit: bigint; + longTokenTransferNativeFee: bigint; + shortTokenTransferGasLimit: bigint; + shortTokenTransferNativeFee: bigint; +}> { + const shouldEstimateShort = outputShortTokenAddress !== outputLongTokenAddress; - const secondarySendParams: SendParam = getMultichainTransferSendParams({ - dstChainId: srcChainId, - account: RANDOM_WALLET.address, + // Run estimations in parallel + const [longResult, shortResult] = await Promise.all([ + estimateSingleTokenReturnTransfer({ + chainId, srcChainId, - amountLD: someAmount, - isToGmx: false, - }); - - // console.log({ outputShortTokenStargate , }); - - const secondaryQuoteSend = await settlementChainClient.readContract({ - address: outputShortTokenStargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [secondarySendParams, false], - }); - - let secondaryNativeValue = secondaryQuoteSend.nativeFee; - if (outputShortTokenUnwrappedAddress === zeroAddress) { - secondaryNativeValue += someAmount; - } - - shortTokenTransferGasLimit = await settlementChainClient - .estimateContractGas({ - address: outputShortTokenStargate, - abi: abis.IStargate, - functionName: "sendToken", - args: [secondarySendParams, secondaryQuoteSend, RANDOM_WALLET.address], - value: secondaryNativeValue, - stateOverride: [ - { - address: RANDOM_WALLET.address, - balance: maxUint256, - }, - { - address: outputShortTokenAddress, - code: OVERRIDE_ERC20_BYTECODE, - state: [ - { - slot: RANDOM_SLOT, - value: zeroHash, - }, - ], - }, - ], - }) - .then(applyGasLimitBuffer); - - shortTokenTransferNativeFee = secondaryQuoteSend.nativeFee; - } + tokenAddress: outputLongTokenAddress, + }), + shouldEstimateShort + ? estimateSingleTokenReturnTransfer({ + chainId, + srcChainId, + tokenAddress: outputShortTokenAddress, + }) + : Promise.resolve(null), + ]); return { - longTokenTransferGasLimit, - longTokenTransferNativeFee, - shortTokenTransferGasLimit, - shortTokenTransferNativeFee, + longTokenTransferGasLimit: longResult.transferGasLimit, + longTokenTransferNativeFee: longResult.transferNativeFee, + shortTokenTransferGasLimit: shortResult?.transferGasLimit ?? 0n, + shortTokenTransferNativeFee: shortResult?.transferNativeFee ?? 0n, }; } diff --git a/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts b/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts index c0e2d556e5..0ae81527c2 100644 --- a/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts +++ b/src/domain/synthetics/markets/feeEstimation/estimateWithdrawalPlatformTokenTransferInFees.ts @@ -4,6 +4,7 @@ import { MultichainAction, MultichainActionType } from "domain/multichain/codecs import { estimateMultichainDepositNetworkComposeGas } from "domain/multichain/estimateMultichainDepositNetworkComposeGas"; import { getMultichainTransferSendParams } from "domain/multichain/getSendParams"; import { getTransferRequests } from "domain/multichain/getTransferRequests"; +import { sendQuoteFromNative } from "domain/multichain/sendQuoteFromNative"; import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; import { abis } from "sdk/abis"; @@ -127,6 +128,10 @@ export async function estimateWithdrawalPlatformTokenTransferInFees({ srcChainId, tokenAddress: params.addresses.market, settlementChainPublicClient: getPublicClientWithRpc(chainId), + }).catch(() => { + // eslint-disable-next-line no-console + console.warn("[multichain-lp] Failed to estimate compose gas on settlement chain"); + return applyGasLimitBuffer(5889082n); }); const returnTransferSendParams = getMultichainTransferSendParams({ @@ -147,12 +152,18 @@ export async function estimateWithdrawalPlatformTokenTransferInFees({ throw new Error("Source chain token ID not found"); } - const platformTokenTransferInQuoteSend = await sourceChainClient.readContract({ - address: sourceChainTokenId.stargate, - abi: abis.IStargate, - functionName: "quoteSend", - args: [returnTransferSendParams, false], - }); + const platformTokenTransferInQuoteSend = await sourceChainClient + .readContract({ + address: sourceChainTokenId.stargate, + abi: abis.IStargate, + functionName: "quoteSend", + args: [returnTransferSendParams, false], + }) + .catch(() => { + // eslint-disable-next-line no-console + console.warn("[multichain-lp] Failed to quote send on source chain"); + return sendQuoteFromNative(366102683193600n); + }); // No need to quote OFT because we are using our own contracts that do not apply any fees @@ -170,6 +181,11 @@ export async function estimateWithdrawalPlatformTokenTransferInFees({ // No need to override state because we are using the users account on source chain // where tokens already are an initial state }) + .catch(() => { + // eslint-disable-next-line no-console + console.warn("[multichain-lp] Failed to estimate contract gas on source chain"); + return 525841n; + }) .then(applyGasLimitBuffer); return { diff --git a/src/domain/synthetics/markets/feeEstimation/stargateTransferFees.ts b/src/domain/synthetics/markets/feeEstimation/stargateTransferFees.ts new file mode 100644 index 0000000000..88464abd19 --- /dev/null +++ b/src/domain/synthetics/markets/feeEstimation/stargateTransferFees.ts @@ -0,0 +1,96 @@ +import { maxUint256, zeroHash } from "viem"; + +import type { SettlementChainId, SourceChainId } from "config/chains"; +import { RANDOM_WALLET, OVERRIDE_ERC20_BYTECODE, RANDOM_SLOT } from "config/multichain"; +import { SendParam } from "domain/multichain/types"; +import { applyGasLimitBuffer } from "lib/gas/estimateGasLimit"; +import { getPublicClientWithRpc } from "lib/wallets/rainbowKitConfig"; +import { abis } from "sdk/abis"; + +export async function stargateTransferFees({ + chainId, + stargateAddress, + sendParams, + tokenAddress, + disableOverrides = false, + useSendToken = false, + additionalValue = 0n, +}: { + chainId: SettlementChainId | SourceChainId; + /** + * From chain stargate address + */ + stargateAddress: string; + sendParams: SendParam; + /** + * From chain token address + */ + tokenAddress: string; + /** + * Disable state overrides (useful when estimating from real user account) + */ + disableOverrides?: boolean; + /** + * Use sendToken function instead of send + */ + useSendToken?: boolean; + /** + * Additional value to add to nativeFee (e.g., for native token transfers) + */ + additionalValue?: bigint; +}) { + const client = getPublicClientWithRpc(chainId); + + // Read quotes in parallel + const [quoteSend, quoteOft] = await Promise.all([ + client.readContract({ + address: stargateAddress, + abi: abis.IStargate, + functionName: "quoteSend", + args: [sendParams, false], + }), + client.readContract({ + address: stargateAddress, + abi: abis.IStargate, + functionName: "quoteOFT", + args: [sendParams], + }), + ]); + + const value = quoteSend.nativeFee + additionalValue; + + const returnTransferGasLimit = await client + .estimateContractGas({ + address: stargateAddress, + abi: abis.IStargate, + functionName: useSendToken ? "sendToken" : "send", + account: RANDOM_WALLET.address, + args: [sendParams, quoteSend, RANDOM_WALLET.address], + value, + stateOverride: disableOverrides + ? undefined + : [ + { + address: RANDOM_WALLET.address, + balance: maxUint256, + }, + { + address: tokenAddress, + code: OVERRIDE_ERC20_BYTECODE, + state: [ + { + slot: RANDOM_SLOT, + value: zeroHash, + }, + ], + }, + ], + }) + .then(applyGasLimitBuffer); + + return { + quoteSend, + quoteOft, + returnTransferGasLimit, + }; +} diff --git a/src/domain/synthetics/markets/types.ts b/src/domain/synthetics/markets/types.ts index 2847201c6e..a5d4571eb3 100644 --- a/src/domain/synthetics/markets/types.ts +++ b/src/domain/synthetics/markets/types.ts @@ -151,3 +151,9 @@ export type CreateGlvWithdrawalParams = { }; export type RawCreateGlvWithdrawalParams = Omit; + +/** + * GM or GLV pay source + */ + +export type GmPaySource = "settlementChain" | "gmxAccount" | "sourceChain"; diff --git a/src/domain/synthetics/tokens/utils.ts b/src/domain/synthetics/tokens/utils.ts index 6857a726a5..483841e72a 100644 --- a/src/domain/synthetics/tokens/utils.ts +++ b/src/domain/synthetics/tokens/utils.ts @@ -1,5 +1,7 @@ +import { ContractsChainId, SettlementChainId, SourceChainId } from "config/chains"; import { USD_DECIMALS } from "config/factors"; -import { InfoTokens, SignedTokenPermit, Token, TokenInfo } from "domain/tokens"; +import { getMappedTokenId } from "config/multichain"; +import { InfoTokens, SignedTokenPermit, Token, TokenBalanceType, TokenInfo } from "domain/tokens"; import { formatAmount } from "lib/numbers"; import { convertTokenAddress, NATIVE_TOKEN_ADDRESS } from "sdk/configs/tokens"; import { nowInSeconds } from "sdk/utils/time"; @@ -117,3 +119,19 @@ export function adaptToV1TokenInfo(tokenData: TokenData): TokenInfo { maxPrice: tokenData.prices?.maxPrice, }; } + +export function getBalanceByBalanceType(tokenData: TokenData, tokenBalanceType: TokenBalanceType): bigint | undefined { + switch (tokenBalanceType) { + case TokenBalanceType.Wallet: + return tokenData.walletBalance; + case TokenBalanceType.GmxAccount: + return tokenData.gmxAccountBalance; + case TokenBalanceType.SourceChain: + return tokenData.sourceChainBalance; + } +} + +export function getSourceChainDecimals(chainId: ContractsChainId, srcChainId: SourceChainId, tokenAddress: string) { + const tokenId = getMappedTokenId(chainId as SettlementChainId, tokenAddress, srcChainId as SourceChainId); + return tokenId?.decimals; +} diff --git a/src/domain/synthetics/trade/utils/validation.ts b/src/domain/synthetics/trade/utils/validation.ts index a8fb80c3ae..7135fda587 100644 --- a/src/domain/synthetics/trade/utils/validation.ts +++ b/src/domain/synthetics/trade/utils/validation.ts @@ -16,6 +16,7 @@ import { getOpenInterestUsd, getSellableMarketToken, } from "domain/synthetics/markets"; +import type { GmPaySource } from "domain/synthetics/markets/types"; import { PositionInfo, willPositionCollateralBeSufficientForPosition } from "domain/synthetics/positions"; import { TokenData, TokensData, TokensRatio, getIsEquivalentTokens } from "domain/synthetics/tokens"; import { DUST_USD, isAddressZero } from "lib/legacy"; @@ -33,8 +34,6 @@ import { } from "sdk/types/trade"; import { bigMath } from "sdk/utils/bigmath"; -import type { GmPaySource } from "components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/types"; - import { getMaxUsdBuyableAmountInMarketWithGm, getSellableInfoGlvInMarket, isGlvInfo } from "../../markets/glv"; export type ValidationTooltipName = "maxLeverage"; diff --git a/src/domain/synthetics/trade/utils/withdrawal.ts b/src/domain/synthetics/trade/utils/withdrawal.ts index bdd259036b..43204f3720 100644 --- a/src/domain/synthetics/trade/utils/withdrawal.ts +++ b/src/domain/synthetics/trade/utils/withdrawal.ts @@ -83,6 +83,7 @@ export function getWithdrawalAmounts(p: { values.longTokenUsd = bigMath.mulDiv(values.marketTokenUsd, longPoolUsd, totalPoolUsd); values.shortTokenUsd = bigMath.mulDiv(values.marketTokenUsd, shortPoolUsd, totalPoolUsd); + // TODO MLTCH: add atomic swap fees const longSwapFeeUsd = p.forShift ? 0n : applyFactor(values.longTokenUsd, p.marketInfo.swapFeeFactorForBalanceWasNotImproved); @@ -138,32 +139,50 @@ export function getWithdrawalAmounts(p: { )!; } } else { - if (strategy === "byLongCollateral" && longPoolUsd > 0) { - values.longTokenAmount = longTokenAmount; - values.longTokenUsd = convertToUsd(longTokenAmount, longToken.decimals, longToken.prices.maxPrice)!; - values.shortTokenUsd = bigMath.mulDiv(values.longTokenUsd, shortPoolUsd, longPoolUsd); - values.shortTokenAmount = convertToTokenAmount( - values.shortTokenUsd, - shortToken.decimals, - shortToken.prices.maxPrice - )!; - } else if (strategy === "byShortCollateral" && shortPoolUsd > 0) { - values.shortTokenAmount = shortTokenAmount; - values.shortTokenUsd = convertToUsd(shortTokenAmount, shortToken.decimals, shortToken.prices.maxPrice)!; - values.longTokenUsd = bigMath.mulDiv(values.shortTokenUsd, longPoolUsd, shortPoolUsd); - values.longTokenAmount = convertToTokenAmount( - values.longTokenUsd, - longToken.decimals, - longToken.prices.maxPrice - )!; - } else if (strategy === "byCollaterals") { - values.longTokenAmount = longTokenAmount; - values.longTokenUsd = convertToUsd(longTokenAmount, longToken.decimals, longToken.prices.maxPrice)!; - values.shortTokenAmount = shortTokenAmount; - values.shortTokenUsd = convertToUsd(shortTokenAmount, shortToken.decimals, shortToken.prices.maxPrice)!; - - values.uiFeeUsd = applyFactor(values.longTokenUsd + values.shortTokenUsd, uiFeeFactor); - values.marketTokenUsd += values.uiFeeUsd; + if (wrappedReceiveTokenAddress) { + if (strategy === "byLongCollateral" && longPoolUsd > 0 && wrappedReceiveTokenAddress === longToken.address) { + values.longTokenAmount = longTokenAmount; + values.longTokenUsd = convertToUsd(longTokenAmount, longToken.decimals, longToken.prices.maxPrice)!; + values.shortTokenUsd = 0n; + values.shortTokenAmount = 0n; + } else if ( + strategy === "byShortCollateral" && + shortPoolUsd > 0 && + wrappedReceiveTokenAddress === shortToken.address + ) { + values.shortTokenAmount = shortTokenAmount; + values.shortTokenUsd = convertToUsd(shortTokenAmount, shortToken.decimals, shortToken.prices.maxPrice)!; + values.longTokenUsd = 0n; + values.longTokenAmount = 0n; + } + } else { + if (strategy === "byLongCollateral" && longPoolUsd > 0) { + values.longTokenAmount = longTokenAmount; + values.longTokenUsd = convertToUsd(longTokenAmount, longToken.decimals, longToken.prices.maxPrice)!; + values.shortTokenUsd = bigMath.mulDiv(values.longTokenUsd, shortPoolUsd, longPoolUsd); + values.shortTokenAmount = convertToTokenAmount( + values.shortTokenUsd, + shortToken.decimals, + shortToken.prices.maxPrice + )!; + } else if (strategy === "byShortCollateral" && shortPoolUsd > 0) { + values.shortTokenAmount = shortTokenAmount; + values.shortTokenUsd = convertToUsd(shortTokenAmount, shortToken.decimals, shortToken.prices.maxPrice)!; + values.longTokenUsd = bigMath.mulDiv(values.shortTokenUsd, longPoolUsd, shortPoolUsd); + values.longTokenAmount = convertToTokenAmount( + values.longTokenUsd, + longToken.decimals, + longToken.prices.maxPrice + )!; + } else if (strategy === "byCollaterals") { + values.longTokenAmount = longTokenAmount; + values.longTokenUsd = convertToUsd(longTokenAmount, longToken.decimals, longToken.prices.maxPrice)!; + values.shortTokenAmount = shortTokenAmount; + values.shortTokenUsd = convertToUsd(shortTokenAmount, shortToken.decimals, shortToken.prices.maxPrice)!; + + values.uiFeeUsd = applyFactor(values.longTokenUsd + values.shortTokenUsd, uiFeeFactor); + values.marketTokenUsd += values.uiFeeUsd; + } } values.marketTokenUsd = values.marketTokenUsd + values.longTokenUsd + values.shortTokenUsd; diff --git a/src/domain/tokens/useMaxAvailableAmount.ts b/src/domain/tokens/useMaxAvailableAmount.ts index 3c17b36a0f..4366de3cf2 100644 --- a/src/domain/tokens/useMaxAvailableAmount.ts +++ b/src/domain/tokens/useMaxAvailableAmount.ts @@ -1,9 +1,11 @@ import { MAX_METAMASK_MOBILE_DECIMALS } from "config/ui"; import { TokenData } from "domain/synthetics/tokens"; -import { getMinResidualAmount } from "domain/tokens"; +import { getBalanceByBalanceType, getSourceChainDecimals } from "domain/synthetics/tokens/utils"; +import { getMinResidualAmount, TokenBalanceType } from "domain/tokens"; import { useChainId } from "lib/chains"; -import { absDiffBps, formatAmountFree } from "lib/numbers"; +import { absDiffBps, formatAmountFree, formatBalanceAmount } from "lib/numbers"; import useIsMetamaskMobile from "lib/wallets/useIsMetamaskMobile"; +import { SourceChainId } from "sdk/configs/chains"; export function useMaxAvailableAmount({ fromToken, @@ -12,6 +14,8 @@ export function useMaxAvailableAmount({ fromTokenInputValue, minResidualAmount, isLoading, + tokenBalanceType = TokenBalanceType.Wallet, + srcChainId, }: { fromToken: TokenData | undefined; nativeToken: TokenData | undefined; @@ -19,22 +23,27 @@ export function useMaxAvailableAmount({ fromTokenInputValue: string; minResidualAmount?: bigint; isLoading: boolean; + tokenBalanceType?: TokenBalanceType; + srcChainId?: SourceChainId; }): { + formattedBalance: string; formattedMaxAvailableAmount: string; showClickMax: boolean; } { const { chainId } = useChainId(); const isMetamaskMobile = useIsMetamaskMobile(); - if (fromToken === undefined || fromToken.balance === undefined || fromToken.balance === 0n || isLoading) { - return { formattedMaxAvailableAmount: "", showClickMax: false }; + const fromTokenBalance = fromToken ? getBalanceByBalanceType(fromToken, tokenBalanceType) : undefined; + + if (fromToken === undefined || fromTokenBalance === undefined || fromTokenBalance === 0n || isLoading) { + return { formattedBalance: "", formattedMaxAvailableAmount: "", showClickMax: false }; } const minNativeTokenBalance = getMinResidualAmount({ chainId, decimals: nativeToken?.decimals, price: nativeToken?.prices.maxPrice }) ?? 0n; const minResidualBalance = (fromToken.isNative ? minNativeTokenBalance : 0n) + (minResidualAmount ?? 0n); - let maxAvailableAmount = fromToken.balance - minResidualBalance; + let maxAvailableAmount = fromTokenBalance - minResidualBalance; if (maxAvailableAmount < 0) { maxAvailableAmount = 0n; @@ -46,11 +55,25 @@ export function useMaxAvailableAmount({ isMetamaskMobile ? MAX_METAMASK_MOBILE_DECIMALS : undefined ); + const formattedBalance = + srcChainId && tokenBalanceType === TokenBalanceType.SourceChain + ? formatBalanceAmount( + fromTokenBalance, + getSourceChainDecimals(chainId, srcChainId, fromToken.address) ?? fromToken.decimals, + undefined, + { + isStable: fromToken.isStable, + } + ) + : formatBalanceAmount(fromTokenBalance, fromToken.decimals, undefined, { + isStable: fromToken.isStable, + }); + const isFromTokenInputValueNearMax = absDiffBps(fromTokenAmount, maxAvailableAmount) < 100n; /* 1% */ const showClickMax = fromToken.isNative ? !isFromTokenInputValueNearMax : fromTokenInputValue !== formattedMaxAvailableAmount && maxAvailableAmount > 0n; - return { formattedMaxAvailableAmount, showClickMax }; + return { formattedBalance, formattedMaxAvailableAmount, showClickMax }; } diff --git a/src/locales/de/messages.po b/src/locales/de/messages.po index 7ff4910b05..7387aa8361 100644 --- a/src/locales/de/messages.po +++ b/src/locales/de/messages.po @@ -2605,6 +2605,8 @@ msgstr "Dieser Tausch wird durch mehrere GM-Pools geleitet, um die niedrigstmög #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/en/messages.po b/src/locales/en/messages.po index 70a6613ddc..7789c4ba49 100644 --- a/src/locales/en/messages.po +++ b/src/locales/en/messages.po @@ -2605,6 +2605,8 @@ msgstr "This swap is routed through several GM pools for the lowest possible fee #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/es/messages.po b/src/locales/es/messages.po index be48a6ed2d..9f8cd5135c 100644 --- a/src/locales/es/messages.po +++ b/src/locales/es/messages.po @@ -2605,6 +2605,8 @@ msgstr "Este intercambio se enruta a través de varias reservas GM para las comi #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/fr/messages.po b/src/locales/fr/messages.po index cce0004437..de3603800a 100644 --- a/src/locales/fr/messages.po +++ b/src/locales/fr/messages.po @@ -2605,6 +2605,8 @@ msgstr "Cet échange est acheminé via plusieurs pools GM pour les frais et l'im #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/ja/messages.po b/src/locales/ja/messages.po index 53d1c11c85..90ba26e2f1 100644 --- a/src/locales/ja/messages.po +++ b/src/locales/ja/messages.po @@ -2605,6 +2605,8 @@ msgstr "このスワップは最低の手数料と価格インパクトのため #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/ko/messages.po b/src/locales/ko/messages.po index 684f1be684..11ae1f4b34 100644 --- a/src/locales/ko/messages.po +++ b/src/locales/ko/messages.po @@ -2605,6 +2605,8 @@ msgstr "이 스왑은 가능한 최저 수수료와 가격 영향을 위해 여 #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/pseudo/messages.po b/src/locales/pseudo/messages.po index 161aecf9cb..cdcdac0770 100644 --- a/src/locales/pseudo/messages.po +++ b/src/locales/pseudo/messages.po @@ -2605,6 +2605,8 @@ msgstr "" #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "" diff --git a/src/locales/ru/messages.po b/src/locales/ru/messages.po index c86ad985b2..1683bcfb08 100644 --- a/src/locales/ru/messages.po +++ b/src/locales/ru/messages.po @@ -2605,6 +2605,8 @@ msgstr "Этот обмен маршрутизируется через неск #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/locales/zh/messages.po b/src/locales/zh/messages.po index 8f0b51c377..ad5cbb21e7 100644 --- a/src/locales/zh/messages.po +++ b/src/locales/zh/messages.po @@ -2605,6 +2605,8 @@ msgstr "此交换通过多个 GM 池路由,以实现最低费用和价格影 #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx #: src/components/OrderItem/TwapOrdersList/TwapOrdersList.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx +#: src/components/TokenSelector/MultichainMarketTokenSelector.tsx msgid "{0}" msgstr "{0}" diff --git a/src/pages/PoolsDetails/PoolsDetails.tsx b/src/pages/PoolsDetails/PoolsDetails.tsx index 5070e9fc16..ab5155f248 100644 --- a/src/pages/PoolsDetails/PoolsDetails.tsx +++ b/src/pages/PoolsDetails/PoolsDetails.tsx @@ -6,7 +6,7 @@ import { usePoolsDetailsMode, usePoolsDetailsOperation, usePoolsDetailsSelectedMarketForGlv, -} from "context/PoolsDetailsContext/PoolsDetailsContext"; +} from "context/PoolsDetailsContext/hooks"; import { selectDepositMarketTokensData, selectGlvAndMarketsInfoData, From 1226c0c805bbe8c3761a9c066ec2200f00b9067a Mon Sep 17 00:00:00 2001 From: midas-myth Date: Wed, 29 Oct 2025 14:21:42 +0100 Subject: [PATCH 38/38] Enhance deposit and withdrawal transaction handling: Introduce flags for deposit and withdrawal states, refactor transaction parameter handling, and improve transfer request validation. Update related hooks and selectors for better clarity and functionality. --- .../lpTxn/useDepositTransactions.tsx | 76 ++++++++------- .../useMultichainDepositExpressTxnParams.tsx | 38 +++++--- ...seMultichainWithdrawalExpressTxnParams.tsx | 27 +++--- .../lpTxn/useWithdrawalTransactions.tsx | 97 ++++++++++--------- src/domain/multichain/getTransferRequests.tsx | 13 ++- .../markets/createMultichainGlvDepositTxn.ts | 4 +- .../createMultichainGlvWithdrawalTxn.ts | 4 +- .../markets/createMultichainWithdrawalTxn.ts | 4 +- 8 files changed, 147 insertions(+), 116 deletions(-) diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx index c1f6b585d2..d4c5762075 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useDepositTransactions.tsx @@ -4,6 +4,7 @@ import { useCallback, useMemo } from "react"; import { SettlementChainId } from "config/chains"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { + selectPoolsDetailsFlags, selectPoolsDetailsGlvInfo, selectPoolsDetailsLongTokenAddress, selectPoolsDetailsMarketInfo, @@ -78,6 +79,7 @@ export const useDepositTransactions = ({ const { setPendingDeposit } = useSyntheticsEvents(); const { setPendingTxns } = usePendingTxns(); const blockTimestampData = useSelector(selectBlockTimestampData); + const { isDeposit } = useSelector(selectPoolsDetailsFlags); const glvInfo = useSelector(selectPoolsDetailsGlvInfo); const marketInfo = useSelector(selectPoolsDetailsMarketInfo); @@ -101,7 +103,11 @@ export const useDepositTransactions = ({ const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; - const transferRequests = useMemo((): TransferRequests => { + const transferRequests = useMemo((): TransferRequests | undefined => { + if (!isDeposit) { + return undefined; + } + const vaultAddress = isGlv ? getContract(chainId, "GlvVault") : getContract(chainId, "DepositVault"); if (paySource === "sourceChain") { @@ -139,6 +145,7 @@ export const useDepositTransactions = ({ chainId, initialLongTokenAddress, initialShortTokenAddress, + isDeposit, isGlv, longTokenAmount, paySource, @@ -151,43 +158,28 @@ export const useDepositTransactions = ({ const tokenAddress = longTokenAmount! > 0n ? longTokenAddress! : shortTokenAddress!; const tokenAmount = longTokenAmount! > 0n ? longTokenAmount! : shortTokenAmount!; - const gmParams = useMemo((): CreateDepositParams | undefined => { - if (!rawParams || !technicalFees) { + const params = useMemo((): CreateDepositParams | CreateGlvDepositParams | undefined => { + if (!rawParams || !technicalFees || !isDeposit) { return undefined; } const executionFee = paySource === "sourceChain" - ? (technicalFees as SourceChainDepositFees).executionFee + ? (technicalFees as SourceChainDepositFees | SourceChainGlvDepositFees).executionFee : (technicalFees as ExecutionFee).feeTokenAmount; return { ...(rawParams as RawCreateDepositParams), executionFee, }; - }, [rawParams, technicalFees, paySource]); - - const glvParams = useMemo((): CreateGlvDepositParams | undefined => { - if (!rawParams || !technicalFees) { - return undefined; - } - - const executionFee = - paySource === "sourceChain" - ? (technicalFees as SourceChainGlvDepositFees).executionFee - : (technicalFees as ExecutionFee).feeTokenAmount; - - return { - ...(rawParams as RawCreateGlvDepositParams), - executionFee, - }; - }, [paySource, rawParams, technicalFees]); + }, [rawParams, technicalFees, isDeposit, paySource]); const multichainDepositExpressTxnParams = useMultichainDepositExpressTxnParams({ transferRequests, paySource, - gmParams, - glvParams, + params, + isGlv, + isDeposit, }); const getDepositMetricData = useCallback(() => { @@ -198,7 +190,7 @@ export const useDepositTransactions = ({ shortTokenAddress, selectedMarketForGlv, isDeposit: true, - executionFeeTokenAmount: glvParams?.executionFee, + executionFeeTokenAmount: params?.executionFee, executionFeeTokenDecimals: getWrappedToken(chainId)!.decimals, glvAddress: glvInfo!.glvTokenAddress, glvToken: glvInfo!.glvToken, @@ -218,7 +210,7 @@ export const useDepositTransactions = ({ shortTokenAddress, marketToken, isDeposit: true, - executionFeeTokenAmount: gmParams?.executionFee, + executionFeeTokenAmount: params?.executionFee, executionFeeTokenDecimals: getWrappedToken(chainId)!.decimals, marketInfo, longTokenAmount, @@ -230,10 +222,9 @@ export const useDepositTransactions = ({ }, [ chainId, glvInfo, - glvParams?.executionFee, + params?.executionFee, glvTokenAmount, glvTokenUsd, - gmParams?.executionFee, isFirstBuy, isGlv, longTokenAddress, @@ -250,11 +241,15 @@ export const useDepositTransactions = ({ const onCreateGmDeposit = useCallback( async function onCreateGmDeposit() { + if (!isDeposit) { + return Promise.reject(); + } + const metricData = getDepositMetricData(); sendOrderSubmittedMetric(metricData.metricId); - if (!tokensData || !account || !signer || !rawParams) { + if (!tokensData || !account || !signer || !rawParams || !transferRequests) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); return Promise.resolve(); @@ -293,7 +288,7 @@ export const useDepositTransactions = ({ signer, transferRequests, asyncExpressTxnResult: multichainDepositExpressTxnParams, - params: gmParams!, + params: params as CreateDepositParams, }); } else if (paySource === "settlementChain") { promise = createDepositTxn({ @@ -307,7 +302,7 @@ export const useDepositTransactions = ({ skipSimulation: shouldDisableValidation, tokensData, metricId: metricData.metricId, - params: gmParams!, + params: params as CreateDepositParams, setPendingTxns, setPendingDeposit, }); @@ -321,11 +316,13 @@ export const useDepositTransactions = ({ .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); }, [ + isDeposit, getDepositMetricData, tokensData, account, signer, rawParams, + transferRequests, chainId, paySource, longTokenAmount, @@ -334,9 +331,8 @@ export const useDepositTransactions = ({ longTokenAddress, shortTokenAddress, srcChainId, - transferRequests, multichainDepositExpressTxnParams, - gmParams, + params, blockTimestampData, shouldDisableValidation, setPendingTxns, @@ -350,6 +346,10 @@ export const useDepositTransactions = ({ const onCreateGlvDeposit = useCallback( async function onCreateGlvDeposit() { + if (!isDeposit) { + return Promise.reject(); + } + const metricData = getDepositMetricData(); sendOrderSubmittedMetric(metricData.metricId); @@ -360,7 +360,8 @@ export const useDepositTransactions = ({ marketTokenAmount === undefined || !tokensData || !signer || - (isGlv && !rawParams) + (isGlv && !rawParams) || + !transferRequests ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -401,13 +402,13 @@ export const useDepositTransactions = ({ signer, transferRequests, expressTxnParams, - params: glvParams!, + params: params as CreateGlvDepositParams, }); } else if (paySource === "settlementChain") { promise = createGlvDepositTxn({ chainId, signer, - params: glvParams!, + params: params as CreateGlvDepositParams, longTokenAddress: longTokenAddress!, shortTokenAddress: shortTokenAddress!, longTokenAmount: longTokenAmount ?? 0n, @@ -431,6 +432,7 @@ export const useDepositTransactions = ({ .catch(makeUserAnalyticsOrderFailResultHandler(chainId, metricData.metricId)); }, [ + isDeposit, getDepositMetricData, account, marketInfo, @@ -439,17 +441,17 @@ export const useDepositTransactions = ({ signer, isGlv, rawParams, + transferRequests, chainId, paySource, longTokenAmount, shortTokenAmount, technicalFees, srcChainId, - transferRequests, tokenAddress, tokenAmount, multichainDepositExpressTxnParams.promise, - glvParams, + params, longTokenAddress, shortTokenAddress, shouldDisableValidation, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx index 10a53ab15d..8bde2991d9 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainDepositExpressTxnParams.tsx @@ -12,32 +12,42 @@ import { nowInSeconds } from "sdk/utils/time"; export function useMultichainDepositExpressTxnParams({ transferRequests, paySource, - gmParams, - glvParams, + params, + isGlv, + isDeposit, }: { - transferRequests: TransferRequests; + transferRequests: TransferRequests | undefined; paySource: GmPaySource; - gmParams: CreateDepositParams | undefined; - glvParams: CreateGlvDepositParams | undefined; + params: CreateDepositParams | CreateGlvDepositParams | undefined; + isGlv: boolean; + isDeposit: boolean; }) { const { chainId, srcChainId } = useChainId(); const { signer } = useWallet(); + const enabled = + paySource === "gmxAccount" && + Boolean(params) && + isDeposit && + transferRequests !== undefined && + signer !== undefined; + const multichainDepositExpressTxnParams = useArbitraryRelayParamsAndPayload({ isGmxAccount: paySource === "gmxAccount", - enabled: paySource === "gmxAccount" && Boolean(glvParams || gmParams), - executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, + enabled, + executionFeeAmount: params?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { - if ((!gmParams && !glvParams) || !signer) { + if (!enabled) { throw new Error("Invalid params"); } - if (glvParams) { + if (isGlv) { + const glvParams = params as CreateGlvDepositParams; const txnData = await buildAndSignMultichainGlvDepositTxn({ emptySignature: true, - account: glvParams!.addresses.receiver, + account: glvParams.addresses.receiver, chainId, - params: glvParams!, + params: glvParams, srcChainId, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, @@ -53,12 +63,12 @@ export function useMultichainDepositExpressTxnParams({ txnData, }; } - + const gmParams = params as CreateDepositParams; const txnData = await buildAndSignMultichainDepositTxn({ emptySignature: true, - account: gmParams!.addresses.receiver, + account: gmParams.addresses.receiver, chainId, - params: gmParams!, + params: gmParams, srcChainId, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx index ab34708874..e925fe8fa7 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useMultichainWithdrawalExpressTxnParams.tsx @@ -12,38 +12,42 @@ import { nowInSeconds } from "sdk/utils/time"; export function useMultichainWithdrawalExpressTxnParams({ transferRequests, paySource, - gmParams, - glvParams, + params, + isGlv, + isWithdrawal, }: { transferRequests: TransferRequests | undefined; paySource: GmPaySource; - gmParams: CreateWithdrawalParams | undefined; - glvParams: CreateGlvWithdrawalParams | undefined; + params: CreateWithdrawalParams | CreateGlvWithdrawalParams | undefined; + isGlv: boolean; + isWithdrawal: boolean; }) { const { chainId, srcChainId } = useChainId(); const { signer } = useWallet(); const enabled = paySource === "gmxAccount" && - Boolean(glvParams || gmParams) && + isWithdrawal && + Boolean(params) && transferRequests !== undefined && signer !== undefined; const multichainWithdrawalExpressTxnParams = useArbitraryRelayParamsAndPayload({ isGmxAccount: paySource === "gmxAccount", enabled, - executionFeeAmount: glvParams ? glvParams.executionFee : gmParams?.executionFee, + executionFeeAmount: params?.executionFee, expressTransactionBuilder: async ({ relayParams, gasPaymentParams }) => { if (!enabled) { throw new Error("Invalid params"); } - if (glvParams) { + if (isGlv) { + const glvParams = params as CreateGlvWithdrawalParams; const txnData = await buildAndSignMultichainGlvWithdrawalTxn({ emptySignature: true, - account: glvParams!.addresses.receiver, + account: glvParams.addresses.receiver, chainId, - params: glvParams!, + params: glvParams, srcChainId, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, @@ -60,11 +64,12 @@ export function useMultichainWithdrawalExpressTxnParams({ }; } + const gmParams = params as CreateWithdrawalParams; const txnData = await buildAndSignMultichainWithdrawalTxn({ emptySignature: true, - account: gmParams!.addresses.receiver, + account: gmParams.addresses.receiver, chainId, - params: gmParams!, + params: gmParams, srcChainId, relayerFeeAmount: gasPaymentParams.relayerFeeAmount, relayerFeeTokenAddress: gasPaymentParams.relayerFeeTokenAddress, diff --git a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx index 16bc5e8275..826b63d147 100644 --- a/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx +++ b/src/components/GmSwap/GmSwapBox/GmDepositWithdrawalBox/lpTxn/useWithdrawalTransactions.tsx @@ -4,6 +4,7 @@ import { useCallback, useMemo } from "react"; import { isSettlementChain } from "config/multichain"; import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext"; import { + selectPoolsDetailsFlags, selectPoolsDetailsGlvInfo, selectPoolsDetailsLongTokenAddress, selectPoolsDetailsMarketInfo, @@ -20,7 +21,6 @@ import { CreateGlvWithdrawalParams, CreateWithdrawalParams, createWithdrawalTxn, - RawCreateGlvWithdrawalParams, RawCreateWithdrawalParams, } from "domain/synthetics/markets"; import { createGlvWithdrawalTxn } from "domain/synthetics/markets/createGlvWithdrawalTxn"; @@ -71,6 +71,7 @@ export const useWithdrawalTransactions = ({ const globalExpressParams = useSelector(selectExpressGlobalParams); const longTokenAddress = useSelector(selectPoolsDetailsLongTokenAddress); const shortTokenAddress = useSelector(selectPoolsDetailsShortTokenAddress); + const { isWithdrawal } = useSelector(selectPoolsDetailsFlags); const glvInfo = useSelector(selectPoolsDetailsGlvInfo); const isGlv = glvInfo !== undefined && selectedMarketForGlv !== undefined; @@ -81,6 +82,10 @@ export const useWithdrawalTransactions = ({ const executionFeeTokenDecimals = getWrappedToken(chainId)!.decimals; const transferRequests = useMemo((): TransferRequests | undefined => { + if (!isWithdrawal) { + return undefined; + } + if (isGlv) { if (!glvTokenAddress) { return undefined; @@ -105,47 +110,32 @@ export const useWithdrawalTransactions = ({ amount: marketTokenAmount, }, ]); - }, [chainId, glvTokenAddress, glvTokenAmount, isGlv, marketTokenAddress, marketTokenAmount]); + }, [chainId, glvTokenAddress, glvTokenAmount, isGlv, isWithdrawal, marketTokenAddress, marketTokenAmount]); const rawParams = useSelector(selectPoolsDetailsParams); - const gmParams = useMemo((): CreateWithdrawalParams | undefined => { - if (!rawParams || !technicalFees) { + const params = useMemo((): CreateWithdrawalParams | CreateGlvWithdrawalParams | undefined => { + if (!rawParams || !technicalFees || !isWithdrawal) { return undefined; } const executionFee = paySource === "sourceChain" - ? (technicalFees as SourceChainWithdrawalFees).executionFee + ? (technicalFees as SourceChainWithdrawalFees | SourceChainGlvWithdrawalFees).executionFee : (technicalFees as ExecutionFee).feeTokenAmount; return { ...(rawParams as RawCreateWithdrawalParams), executionFee, }; - }, [rawParams, technicalFees, paySource]); - - const glvParams = useMemo((): CreateGlvWithdrawalParams | undefined => { - if (!rawParams || !technicalFees) { - return undefined; - } - - const executionFee = - paySource === "sourceChain" - ? (technicalFees as SourceChainGlvWithdrawalFees).executionFee - : (technicalFees as ExecutionFee).feeTokenAmount; - - return { - ...(rawParams as RawCreateGlvWithdrawalParams), - executionFee, - }; - }, [paySource, rawParams, technicalFees]); + }, [rawParams, technicalFees, isWithdrawal, paySource]); const multichainWithdrawalExpressTxnParams = useMultichainWithdrawalExpressTxnParams({ transferRequests, paySource, - gmParams, - glvParams, + params, + isGlv, + isWithdrawal, }); const getWithdrawalMetricData = useCallback(() => { @@ -157,7 +147,7 @@ export const useWithdrawalTransactions = ({ shortTokenAddress, selectedMarketForGlv, isDeposit: false, - executionFeeTokenAmount: glvParams?.executionFee, + executionFeeTokenAmount: params?.executionFee, executionFeeTokenDecimals, glvAddress: glvInfo.glvTokenAddress, glvToken: glvInfo.glvToken, @@ -176,7 +166,7 @@ export const useWithdrawalTransactions = ({ marketToken, isDeposit: false, - executionFeeTokenAmount: gmParams?.executionFee, + executionFeeTokenAmount: params?.executionFee, executionFeeTokenDecimals, marketInfo, longTokenAmount, @@ -188,28 +178,31 @@ export const useWithdrawalTransactions = ({ return metricData; }, [ + glvInfo, + selectedMarketForGlv, chainId, - glvParams?.executionFee, - gmParams?.executionFee, + longTokenAddress, + shortTokenAddress, + params?.executionFee, executionFeeTokenDecimals, - glvInfo, + longTokenAmount, + shortTokenAmount, + marketTokenAmount, glvTokenAmount, + selectedMarketInfoForGlv?.name, glvTokenUsd, isFirstBuy, - longTokenAddress, - longTokenAmount, - marketInfo, marketToken, - marketTokenAmount, + marketInfo, marketTokenUsd, - selectedMarketForGlv, - selectedMarketInfoForGlv?.name, - shortTokenAddress, - shortTokenAmount, ]); const onCreateGlvWithdrawal = useCallback( async function onCreateWithdrawal() { + if (!isWithdrawal) { + return Promise.reject(); + } + const metricData = getWithdrawalMetricData(); if ( @@ -221,7 +214,8 @@ export const useWithdrawalTransactions = ({ !transferRequests || !tokensData || !signer || - !glvParams + !params || + !isGlv ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -240,7 +234,7 @@ export const useWithdrawalTransactions = ({ srcChainId, signer, transferRequests, - params: glvParams, + params: params as CreateGlvWithdrawalParams, tokenAmount: glvTokenAmount!, fees: technicalFees as SourceChainGlvWithdrawalFees, }); @@ -253,7 +247,7 @@ export const useWithdrawalTransactions = ({ promise = createMultichainGlvWithdrawalTxn({ chainId, signer, - params: glvParams, + params: params as CreateGlvWithdrawalParams, expressTxnParams, transferRequests, srcChainId, @@ -262,7 +256,7 @@ export const useWithdrawalTransactions = ({ promise = createGlvWithdrawalTxn({ chainId, signer, - params: glvParams, + params: params as CreateGlvWithdrawalParams, executionGasLimit: (technicalFees as ExecutionFee).gasLimit, tokensData, setPendingTxns, @@ -279,20 +273,22 @@ export const useWithdrawalTransactions = ({ .catch(makeTxnErrorMetricsHandler(metricData.metricId)); }, [ + isWithdrawal, getWithdrawalMetricData, account, marketInfo, marketToken, longTokenAmount, shortTokenAmount, + transferRequests, tokensData, signer, - glvParams, + params, + isGlv, paySource, chainId, srcChainId, globalExpressParams, - transferRequests, glvTokenAmount, technicalFees, multichainWithdrawalExpressTxnParams.promise, @@ -304,6 +300,10 @@ export const useWithdrawalTransactions = ({ const onCreateGmWithdrawal = useCallback( async function onCreateWithdrawal() { + if (!isWithdrawal) { + return Promise.reject(); + } + const metricData = getWithdrawalMetricData(); if ( @@ -315,7 +315,8 @@ export const useWithdrawalTransactions = ({ !transferRequests || !tokensData || !signer || - !gmParams + !params || + isGlv ) { helperToast.error(t`Error submitting order`); sendTxnValidationErrorMetric(metricData.metricId); @@ -347,7 +348,7 @@ export const useWithdrawalTransactions = ({ promise = createMultichainWithdrawalTxn({ chainId, signer, - params: gmParams, + params: params as CreateWithdrawalParams, expressTxnParams, transferRequests, srcChainId, @@ -358,7 +359,7 @@ export const useWithdrawalTransactions = ({ signer, marketTokenAmount: marketTokenAmount!, executionGasLimit: (technicalFees as ExecutionFee).gasLimit, - params: gmParams, + params: params as CreateWithdrawalParams, tokensData, skipSimulation: shouldDisableValidation, setPendingTxns, @@ -374,6 +375,7 @@ export const useWithdrawalTransactions = ({ .catch(makeTxnErrorMetricsHandler(metricData.metricId)); }, [ + isWithdrawal, getWithdrawalMetricData, account, marketInfo, @@ -383,7 +385,8 @@ export const useWithdrawalTransactions = ({ transferRequests, tokensData, signer, - gmParams, + params, + isGlv, paySource, chainId, srcChainId, diff --git a/src/domain/multichain/getTransferRequests.tsx b/src/domain/multichain/getTransferRequests.tsx index e612803db7..d892a91c92 100644 --- a/src/domain/multichain/getTransferRequests.tsx +++ b/src/domain/multichain/getTransferRequests.tsx @@ -6,22 +6,33 @@ export function getTransferRequests( token: string | undefined; amount: bigint | undefined; }[] -): TransferRequests { +): TransferRequests | undefined { + if (transfers.length === 0) { + return undefined; + } + const requests: TransferRequests = { tokens: [], receivers: [], amounts: [], }; + let allZero = true; + for (const transfer of transfers) { if (!transfer.token || transfer.amount === undefined || transfer.amount <= 0n) { continue; } + allZero = false; requests.tokens.push(transfer.token); requests.receivers.push(transfer.to); requests.amounts.push(transfer.amount); } + if (allZero) { + return undefined; + } + return requests; } diff --git a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts index e6b9fe2db1..e6613c4bcc 100644 --- a/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvDepositTxn.ts @@ -53,7 +53,7 @@ export async function buildAndSignMultichainGlvDepositTxn({ }); } - const depositData = encodeFunctionData({ + const glvDepositData = encodeFunctionData({ abi: abis.MultichainGlvRouter, functionName: "createGlvDeposit", args: [ @@ -69,7 +69,7 @@ export async function buildAndSignMultichainGlvDepositTxn({ }); return { - callData: depositData, + callData: glvDepositData, to: getContract(chainId, "MultichainGlvRouter"), feeToken: relayerFeeTokenAddress, feeAmount: relayerFeeAmount, diff --git a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts index 41a962f7d0..72afabcdea 100644 --- a/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainGlvWithdrawalTxn.ts @@ -53,7 +53,7 @@ export async function buildAndSignMultichainGlvWithdrawalTxn({ }); } - const depositData = encodeFunctionData({ + const glvWithdrawalData = encodeFunctionData({ abi: abis.MultichainGlvRouter, functionName: "createGlvWithdrawal", args: [ @@ -69,7 +69,7 @@ export async function buildAndSignMultichainGlvWithdrawalTxn({ }); return { - callData: depositData, + callData: glvWithdrawalData, to: getContract(chainId, "MultichainGlvRouter"), feeToken: relayerFeeTokenAddress, feeAmount: relayerFeeAmount, diff --git a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts index 4ba4e5d4e8..780f963d47 100644 --- a/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts +++ b/src/domain/synthetics/markets/createMultichainWithdrawalTxn.ts @@ -53,7 +53,7 @@ export async function buildAndSignMultichainWithdrawalTxn({ }); } - const depositData = encodeFunctionData({ + const withdrawalData = encodeFunctionData({ abi: abis.MultichainGmRouter, functionName: "createWithdrawal", args: [ @@ -69,7 +69,7 @@ export async function buildAndSignMultichainWithdrawalTxn({ }); return { - callData: depositData, + callData: withdrawalData, to: getContract(chainId, "MultichainGmRouter"), feeToken: relayerFeeTokenAddress, feeAmount: relayerFeeAmount,