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AAOE,cAE1C,IAAK,UACH,OAAO3E,OAASoF,SAAQC,aACtB,OAAQD,GACN,IAAK,eACL,IAAK,sBACH,MAAO,CAACX,OAAOE,cACjB,IAAK,cACH,MAAO,KAAKrE,OAAOmE,OAAOC,UAAUY,SAAS,MAE/C,QACE,IACE,MAAM3C,QAAeyjD,EAAc7gD,KAAKH,EAAQC,GAEhD,OADAG,QAAQC,IAAI,eAAgB,CAAEL,SAAQC,SAAQ1C,WACvCA,CACT,CAAE,MAAO+C,GAEP,MADAF,QAAQC,IAAI,eAAgB,CAAEL,SAAQC,SAAQK,UACxCA,CACR,EAEJ,EAEJ,QACE,OAAOoO,EAAOyyC,GAEpB,SAEFt9C,CACN,CACF,E","sources":["webpack://@snx-v3/liquidity/../lib/constants/constants.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPythERC7412Wrapper.ts","webpack://@snx-v3/liquidity/../lib/icons/Logo.tsx","webpack://@snx-v3/liquidity/../lib/icons/EthereumIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/FailedIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/OptimismIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/WalletIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/LogoIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/BaseIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/ArbitrumIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/DiscordIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/XIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/GithubIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/WarpcastIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/YoutubeIcon.tsx","webpack://@snx-v3/liquidity/../lib/icons/Sparkles.tsx","webpack://@snx-v3/liquidity/../lib/icons/SNXChainIcon.tsx","webpack://@snx-v3/liquidity/../lib/useBlockchain/magic.ts","webpack://@snx-v3/liquidity/../lib/useBlockchain/useBlockchain.tsx","webpack://@snx-v3/liquidity/../lib/theme/theme.ts","webpack://@snx-v3/liquidity/../lib/theme/fonts.tsx","webpack://@snx-v3/liquidity/../lib/TermsModal/TermsModal.tsx","webpack://@snx-v3/liquidity/./src/onboard.ts","webpack://@snx-v3/liquidity/../lib/useParams/useParams.ts","webpack://@snx-v3/liquidity/../lib/format/format.ts","webpack://@snx-v3/liquidity/../lib/format/currency.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importAccountProxy.ts","webpack://@snx-v3/liquidity/../lib/contracts/useAccountProxy/useAccountProxy.ts","webpack://@snx-v3/liquidity/../lib/useTransferAccountId/useTransferAccountId.ts","webpack://@snx-v3/liquidity/../lib/Permissions/TransferOwnershipModal.tsx","webpack://@snx-v3/liquidity/../lib/etherscanLink/etherscanLink.ts","webpack://@snx-v3/liquidity/../lib/Address/Address.tsx","webpack://@snx-v3/liquidity/../lib/contracts/importers/importCoreProxy.ts","webpack://@snx-v3/liquidity/../lib/contracts/useCoreProxy/useCoreProxy.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importTrustedMulticallForwarder.ts","webpack://@snx-v3/liquidity/../lib/contracts/useTrustedMulticallForwarder/useTrustedMulticallForwarder.ts","webpack://@snx-v3/liquidity/../lib/useManagePermissions/useManagePermissions.ts","webpack://@snx-v3/liquidity/../lib/Permissions/AccountPermissions.ts","webpack://@snx-v3/liquidity/../lib/tsHelpers/contractsHash.ts","webpack://@snx-v3/liquidity/../lib/tsHelpers/stringToHash.ts","webpack://@snx-v3/liquidity/../lib/useAccountInfo/useAccountPermissions.ts","webpack://@snx-v3/liquidity/../lib/Permissions/PermissionsInfo.tsx","webpack://@snx-v3/liquidity/../lib/Permissions/PermissionModal.tsx","webpack://@snx-v3/liquidity/../lib/Permissions/PermissionRow.tsx","webpack://@snx-v3/liquidity/../lib/Permissions/PermissionTableLoading.tsx","webpack://@snx-v3/liquidity/../lib/Permissions/PermissionTable.tsx","webpack://@snx-v3/liquidity/../lib/Permissions/DelegationIcon.tsx","webpack://@snx-v3/liquidity/../lib/useAccounts/useAccounts.ts","webpack://@snx-v3/liquidity/../lib/Permissions/Permissions.tsx","webpack://@snx-v3/liquidity/./src/AccountSettingsPage.tsx","webpack://@snx-v3/liquidity/../lib/Pools/PoolCardsLoading.tsx","webpack://@snx-v3/liquidity/../lib/formatters/number.ts","webpack://@snx-v3/liquidity/../lib/TokenIcon/TokenIcon.tsx","webpack://@snx-v3/liquidity/../lib/Tooltip/Tooltip.tsx","webpack://@snx-v3/liquidity/../lib/useApr/useApr.ts","webpack://@snx-v3/liquidity/../lib/isBaseAndromeda/isBaseAndromeda.ts","webpack://@snx-v3/liquidity/../lib/useApr/useStataUSDCApr.ts","webpack://@snx-v3/liquidity/../lib/contracts/useSynthTokens/useSynthTokens.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importSynthTokens.ts","webpack://@snx-v3/liquidity/../lib/useIsAndromedaStataUSDC/useIsAndromedaStataUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importStaticAaveUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/useStaticAaveUSDC/useStaticAaveUSDC.ts","webpack://@snx-v3/liquidity/../lib/useStaticAaveUSDCRate/useStaticAaveUSDCRate.ts","webpack://@snx-v3/liquidity/../lib/useTokenBalance/useTokenBalance.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/useUSDC/useUSDC.ts","webpack://@snx-v3/liquidity/../lib/Pools/PoolRow.tsx","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPythFeeds.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPythVerifier.ts","webpack://@snx-v3/liquidity/../lib/usePoolsList/usePoolsList.ts","webpack://@snx-v3/liquidity/../lib/useCollateralPriceUpdates/useCollateralPriceUpdates.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importExtras.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importSNX.ts","webpack://@snx-v3/liquidity/../lib/contracts/useSNX/useSNX.ts","webpack://@snx-v3/liquidity/../lib/contracts/useSystemToken/useSystemToken.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importSystemToken.ts","webpack://@snx-v3/liquidity/../lib/useCollateralTypes/useCollateralTypes.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importCollateralTokens.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importSpotMarketProxy.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importUSDProxy.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPositionManager.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importClosePosition.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPositionManagerAndromedaUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importPositionManagerAndromedaStataUSDC.ts","webpack://@snx-v3/liquidity/../lib/parseContractError/parseContractError.ts","webpack://@snx-v3/liquidity/../lib/tsHelpers/notNill.ts","webpack://@snx-v3/liquidity/../lib/withERC7412/withERC7412.ts","webpack://@snx-v3/liquidity/../lib/useOraclePrice/useOraclePrice.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importOracleManagerProxy.ts","webpack://@snx-v3/liquidity/../lib/Pools/PoolsList.tsx","webpack://@snx-v3/liquidity/../lib/Positions/PositionNotConnected.tsx","webpack://@snx-v3/liquidity/../lib/Positions/PositionTableHeader.tsx","webpack://@snx-v3/liquidity/../lib/Amount/Amount.tsx","webpack://@snx-v3/liquidity/../lib/Positions/LockedCollateral.tsx","webpack://@snx-v3/liquidity/../lib/useLocks/useLocks.ts","webpack://@snx-v3/liquidity/../lib/CRatioBar/CRatioBar.utils.ts","webpack://@snx-v3/liquidity/../lib/CRatioBar/CRatioAmount.tsx","webpack://@snx-v3/liquidity/../lib/CRatioBar/CRatioBadge.tsx","webpack://@snx-v3/liquidity/../lib/CRatioBar/LineWithText.tsx","webpack://@snx-v3/liquidity/../lib/CRatioBar/CRatioBar.tsx","webpack://@snx-v3/liquidity/../lib/calculations/calculations.ts","webpack://@snx-v3/liquidity/../lib/CRatioBar/CRatioChangeStat.tsx","webpack://@snx-v3/liquidity/../lib/DebtAmount/DebtAmount.tsx","webpack://@snx-v3/liquidity/../lib/useAccountCollateralUnlockDate/useAccountCollateralUnlockDate.ts","webpack://@snx-v3/liquidity/../lib/useWithdrawTimer/useWithdrawTimer.ts","webpack://@snx-v3/liquidity/../lib/Positions/PositionsRow.tsx","webpack://@snx-v3/liquidity/../lib/useLiquidityPositions/useLiquidityPositions.ts","webpack://@snx-v3/liquidity/../lib/Positions/PositionEmpty.tsx","webpack://@snx-v3/liquidity/../lib/SynthSkeleton/SynthSkeleton.tsx","webpack://@snx-v3/liquidity/../lib/Positions/PositionsRowLoading.tsx","webpack://@snx-v3/liquidity/../lib/Positions/TableDivider.tsx","webpack://@snx-v3/liquidity/../lib/Positions/PositionsList.tsx","webpack://@snx-v3/liquidity/../lib/ContractError/ContractError.tsx","webpack://@snx-v3/liquidity/../lib/txnReducer/txnReducer.ts","webpack://@snx-v3/liquidity/../lib/contracts/useAllErrors/useAllErrors.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importAllErrors.ts","webpack://@snx-v3/liquidity/../lib/contracts/useClosePosition/useClosePosition.ts","webpack://@snx-v3/liquidity/../lib/contracts/usePositionManager/usePositionManager.ts","webpack://@snx-v3/liquidity/../lib/useContractErrorParser/useContractErrorParser.ts","webpack://@snx-v3/liquidity/../lib/contracts/usePositionManagerAndromedaStataUSDC/usePositionManagerAndromedaStataUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/usePositionManagerAndromedaUSDC/usePositionManagerAndromedaUSDC.ts","webpack://@snx-v3/liquidity/../lib/contracts/useRewardsDistributors/useRewardsDistributors.ts","webpack://@snx-v3/liquidity/../lib/contracts/importers/importRewardsDistributors.ts","webpack://@snx-v3/liquidity/../lib/useRewards/useRewards.ts","webpack://@snx-v3/liquidity/../lib/contracts/useSpotMarketProxy/useSpotMarketProxy.ts","webpack://@snx-v3/liquidity/../lib/useClaimAllRewards/useClaimAllRewards.tsx","webpack://@snx-v3/liquidity/../lib/WithdrawIncrease/WithdrawIncrease.tsx","webpack://@snx-v3/liquidity/../lib/Rewards/AllRewardsModal.tsx","webpack://@snx-v3/liquidity/../lib/Rewards/RewardsLoading.tsx","webpack://@snx-v3/liquidity/../lib/Rewards/RewardsRow.tsx","webpack://@snx-v3/liquidity/../lib/Rewards/Rewards.tsx","webpack://@snx-v3/liquidity/../lib/StatsBox/StatsBox.tsx","webpack://@snx-v3/liquidity/../lib/StatsTotalLocked/StatsTotalLocked.tsx","webpack://@snx-v3/liquidity/../lib/useClaimedRewards/useClaimedRewards.ts","webpack://@snx-v3/liquidity/../lib/useCollateralPrices/useCollateralPrices.ts","webpack://@snx-v3/liquidity/../lib/usePythPrice/usePythPrice.ts","webpack://@snx-v3/liquidity/../lib/useIssuedDebt/useIssuedDebt.ts","webpack://@snx-v3/liquidity/../lib/StatsTotalPnl/StatsTotalPnl.tsx","webpack://@snx-v3/liquidity/../lib/Synths/StataUSDC.tsx","webpack://@snx-v3/liquidity/../lib/Synths/SynthRow.tsx","webpack://@snx-v3/liquidity/../lib/useSynthBalances/useSynthBalances.ts","webpack://@snx-v3/liquidity/../lib/useUnwrapAllSynths/useUnwrapAllSynths.tsx","webpack://@snx-v3/liquidity/../lib/Synths/SynthsLoading.tsx","webpack://@snx-v3/liquidity/../lib/Synths/SynthsUnwrapModal.tsx","webpack://@snx-v3/liquidity/../lib/Synths/Synths.tsx","webpack://@snx-v3/liquidity/./src/DashboardPage.tsx","webpack://@snx-v3/liquidity/./src/Footer.tsx","webpack://@snx-v3/liquidity/./src/NetworkController.tsx","webpack://@snx-v3/liquidity/./src/Header.tsx","webpack://@snx-v3/liquidity/../lib/BorderBox/BorderBox.tsx","webpack://@snx-v3/liquidity/../lib/ManagePositionContext/ManagePositionContext.tsx","webpack://@snx-v3/liquidity/../lib/NumberInput/NumberInput.tsx","webpack://@snx-v3/liquidity/../lib/useLiquidityPosition/useLiquidityPosition.ts","webpack://@snx-v3/liquidity/../lib/useTokenPrice/useTokenPrice.ts","webpack://@snx-v3/liquidity/../lib/Multistep/statusColor.ts","webpack://@snx-v3/liquidity/../lib/Multistep/StepIcon.tsx","webpack://@snx-v3/liquidity/../lib/Multistep/Step.tsx","webpack://@snx-v3/liquidity/../lib/Multistep/Multistep.tsx","webpack://@snx-v3/liquidity/../lib/Manage/LiquidityPositionUpdated.tsx","webpack://@snx-v3/liquidity/../lib/ChangeStat/ChangeStat.tsx","webpack://@snx-v3/liquidity/../lib/Manage/DebtStats.tsx","webpack://@snx-v3/liquidity/../lib/zod/zod.ts","webpack://@snx-v3/liquidity/../lib/useVaultsData/useVaultsData.ts","webpack://@snx-v3/liquidity/../lib/Manage/PositionTitle.tsx","webpack://@snx-v3/liquidity/../lib/getStatsUrl/getStatsUrl.ts","webpack://@snx-v3/liquidity/../lib/Manage/StataDepositBanner.tsx","webpack://@snx-v3/liquidity/../lib/validatePosition/validatePosition.ts","webpack://@snx-v3/liquidity/../lib/Manage/CollateralStats.tsx","webpack://@snx-v3/liquidity/../lib/Manage/PnlStats.tsx","webpack://@snx-v3/liquidity/../lib/Manage/ManageStats.tsx","webpack://@snx-v3/liquidity/../lib/ClosePosition/ClosePositionOneStep.tsx","webpack://@snx-v3/liquidity/../lib/contracts/usePythVerifier/usePythVerifier.ts","webpack://@snx-v3/liquidity/../lib/contracts/usePythFeeds/usePythFeeds.ts","webpack://@snx-v3/liquidity/../lib/useAllowance/useAllowance.ts","webpack://@snx-v3/liquidity/../lib/useApprove/useApprove.ts","webpack://@snx-v3/liquidity/../lib/useBorrow/useBorrow.tsx","webpack://@snx-v3/liquidity/../lib/contracts/importers/importDebtRepayer.ts","webpack://@snx-v3/liquidity/../lib/contracts/useDebtRepayer/useDebtRepayer.ts","webpack://@snx-v3/liquidity/../lib/useRepay/useRepay.tsx","webpack://@snx-v3/liquidity/../lib/useUndelegate/useUndelegate.tsx","webpack://@snx-v3/liquidity/../lib/useUndelegateBaseAndromeda/useUndelegateBaseAndromeda.tsx","webpack://@snx-v3/liquidity/../lib/ClosePosition/ClosePositionTransactions.tsx","webpack://@snx-v3/liquidity/../lib/ClosePosition/ClosePosition.tsx","webpack://@snx-v3/liquidity/../lib/CollateralAlert/UnsupportedCollateralAlert.tsx","webpack://@snx-v3/liquidity/../lib/ManageAction/actions.tsx","webpack://@snx-v3/liquidity/../lib/Borrow/BorrowModal.tsx","webpack://@snx-v3/liquidity/../lib/Borrow/Borrow.tsx","webpack://@snx-v3/liquidity/../lib/Claim/Claim.tsx","webpack://@snx-v3/liquidity/../lib/ClaimModal/ClaimSuccessBanner.tsx","webpack://@snx-v3/liquidity/../lib/ClaimModal/ClaimModal.tsx","webpack://@snx-v3/liquidity/../lib/ClaimModal/index.ts","webpack://@snx-v3/liquidity/../lib/TransactionSummary/TransactionSummary.tsx","webpack://@snx-v3/liquidity/../lib/useEthBalance/useEthBalance.ts","webpack://@snx-v3/liquidity/../lib/Deposit/Deposit.tsx","webpack://@snx-v3/liquidity/../lib/useTransferableSynthetix/useTransferableSynthetix.ts","webpack://@snx-v3/liquidity/../lib/DepositModal/DepositMachine.ts","webpack://@snx-v3/liquidity/../lib/useDeposit/useDeposit.tsx","webpack://@snx-v3/liquidity/../lib/useWrapEth/useWrapEth.ts","webpack://@snx-v3/liquidity/../lib/DepositModal/DepositModal.tsx","webpack://@snx-v3/liquidity/../lib/contracts/usePositionManagerForCollateral/usePositionManagerForCollateral.ts","webpack://@snx-v3/liquidity/../lib/DepositModalAndromeda/DepositModalAndromeda.tsx","webpack://@snx-v3/liquidity/../lib/Repay/RepayModal.tsx","webpack://@snx-v3/liquidity/../lib/Repay/Repay.tsx","webpack://@snx-v3/liquidity/../lib/useClearDebt/useClearDebt.tsx","webpack://@snx-v3/liquidity/../lib/Repay/RepayAndromedaDebt.tsx","webpack://@snx-v3/liquidity/../lib/useRepayBaseAndromeda/useRepayBaseAndromeda.tsx","webpack://@snx-v3/liquidity/../lib/useGetUSDTokens/useGetUSDTokens.ts","webpack://@snx-v3/liquidity/../lib/RepayModal/RepayMachine.ts","webpack://@snx-v3/liquidity/../lib/RepayModal/RepayModal.tsx","webpack://@snx-v3/liquidity/../lib/usePoolConfiguration/usePoolConfiguration.ts","webpack://@snx-v3/liquidity/../lib/Undelegate/UndelegateModal.tsx","webpack://@snx-v3/liquidity/../lib/Undelegate/Undelegate.tsx","webpack://@snx-v3/liquidity/../lib/UndelegateModal/UndelegateMachine.ts","webpack://@snx-v3/liquidity/../lib/UndelegateModal/UndelegateModal.tsx","webpack://@snx-v3/liquidity/../lib/UndelegateModal/index.ts","webpack://@snx-v3/liquidity/../lib/useWithdraw/useWithdraw.tsx","webpack://@snx-v3/liquidity/../lib/Withdraw/WithdrawModal.tsx","webpack://@snx-v3/liquidity/../lib/Withdraw/Withdraw.tsx","webpack://@snx-v3/liquidity/../lib/Withdraw/WithdrawModalAndromeda.tsx","webpack://@snx-v3/liquidity/../lib/Withdraw/WithdrawAndromeda.tsx","webpack://@snx-v3/liquidity/../lib/ManageAction/ManageAction.tsx","webpack://@snx-v3/liquidity/./src/ManagePage.tsx","webpack://@snx-v3/liquidity/./src/Router.tsx","webpack://@snx-v3/liquidity/./src/theme.ts","webpack://@snx-v3/liquidity/./src/App.tsx","webpack://@snx-v3/liquidity/./src/index.tsx","webpack://@snx-v3/liquidity/../../tools/devtools-formatters/index.js","webpack://@snx-v3/liquidity/../../tools/magic-wallet/index.js"],"sourcesContent":["import Wei from '@synthetixio/wei';\nimport { ethers } from 'ethers';\n\nexport const LOCAL_STORAGE_KEYS = {\n SHOW_TESTNETS: 'SHOW_TESTNETS',\n};\nexport const ZEROWEI = new Wei(0);\n\nexport const D6 = ethers.utils.parseUnits('1', 6);\nexport const D18 = ethers.utils.parseUnits('1', 18);\nexport const D27 = ethers.utils.parseUnits('1', 27);\n\nexport const DEFAULT_QUERY_STALE_TIME = 300_000; // 5min\n\nexport const INFURA_KEY = process.env.INFURA_KEY || '8678fe160b1f4d45ad3f3f71502fc57b';\n\nexport const getSubgraphUrl = (networkName = 'optimism-mainnet') => {\n switch (networkName) {\n case 'mainnet':\n return 'https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-mainnet/api';\n case 'sepolia':\n return 'https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-sepolia/api';\n case 'optimism-mainnet':\n return 'https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-optimism-mainnet/api';\n case 'arbitrum':\n return `https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-arbitrum-mainnet/api`;\n case 'base-sepolia':\n return 'https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-base-sepolia-andromeda/api';\n case 'base':\n return 'https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-base-mainnet-andromeda/api';\n default:\n return `https://subgraph.satsuma-prod.com/ce5e03f52f3b/synthetix/synthetix-${networkName}/api`;\n }\n};\n\nexport const getAprUrl = (networkId = 8453) => {\n switch (networkId) {\n case 1:\n return 'https://api.synthetix.io/v3/mainnet/sc-pool-apy-all';\n case 8453:\n return 'https://api.synthetix.io/v3/base/sc-pool-apy-all';\n case 42161:\n return 'https://api.synthetix.io/v3/arbitrum/sc-pool-apy-all';\n default:\n return `https://api.synthetix.io/v3/base/sc-pool-apy-all`;\n }\n};\n\nexport const getClaimedRewardsURL = (networkId = 8453) => {\n switch (networkId) {\n case 1:\n return 'https://api.synthetix.io/v3/mainnet/rewards-claimed';\n case 8453:\n return 'https://api.synthetix.io/v3/base/rewards-claimed';\n default:\n return '';\n }\n};\n\nexport const getIssuedDebtUrl = (networkId = 8453) => {\n switch (networkId) {\n case 1:\n return 'https://api.synthetix.io/v3/mainnet/issued-debt';\n case 8453:\n return 'https://api.synthetix.io/v3/base/issued-debt';\n default:\n return '';\n }\n};\n\nexport const SESSION_STORAGE_KEYS = {\n TERMS_CONDITIONS_ACCEPTED: 'TERMS_CONDITIONS_ACCEPTED',\n};\n\nexport const offchainMainnetEndpoint =\n process.env.PYTH_MAINNET_ENDPOINT ||\n 'https://hermes-mainnet.rpc.extrnode.com/9b85d7db-f562-48e2-ab56-79c01f212582';\n\nexport const offchainTestnetEndpoint =\n process.env.PYTH_TESTNET_ENDPOINT ||\n 'https://hermes-mainnet.rpc.extrnode.com/9b85d7db-f562-48e2-ab56-79c01f212582';\n\nexport const tokenOverrides: {\n [key: `${number}-${string}`]: {\n [key: string]:\n | {\n symbol: string;\n displaySymbol: string;\n name: string;\n }\n | undefined;\n };\n} = {\n '8453-andromeda': {\n '0x4EA71A20e655794051D1eE8b6e4A3269B13ccaCc': {\n symbol: 'stataUSDC',\n displaySymbol: 'Static aUSDC',\n name: 'Static aUSDC',\n },\n },\n '1-main': {\n '0x10A5F7D9D65bCc2734763444D4940a31b109275f': {\n symbol: 'sUSD',\n displaySymbol: 'V2 sUSD',\n name: 'V2 sUSD',\n },\n '0xb2F30A7C980f052f02563fb518dcc39e6bf38175': {\n symbol: 'sUSD',\n displaySymbol: 'V3 sUSD',\n name: 'V3 sUSD',\n },\n },\n};\n\n// We only have 1 pool and UI does not support more than one pool\n// Will need to refactor when we add new pools\nexport const POOL_ID = '1';\n","export async function importPythERC7412Wrapper(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/PythERC7412Wrapper.readable.json'),\n ]);\n return { address: meta.contracts.PythERC7412Wrapper, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/PythERC7412Wrapper.readable.json'),\n ]);\n return { address: meta.contracts.PythERC7412Wrapper, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/PythERC7412Wrapper.readable.json'),\n ]);\n return { address: meta.contracts.PythERC7412Wrapper, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/PythERC7412Wrapper.readable.json'),\n ]);\n return { address: meta.contracts.PythERC7412Wrapper, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/PythERC7412Wrapper.readable.json'),\n ]);\n return { address: meta.contracts.PythERC7412Wrapper, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for PythERC7412Wrapper`);\n }\n }\n}\n","import { Icon, IconProps } from '@chakra-ui/react';\n\ninterface LogoProps extends IconProps {\n withText?: boolean;\n}\n\nexport const Logo = ({\n color = '#00D1FF',\n width = '126px',\n height = '22px',\n withText = true,\n}: LogoProps) => {\n return (\n \n \n {withText && (\n \n \n \n \n \n \n \n \n \n \n \n )}\n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const EthereumIcon = ({\n width = '24px',\n height = '24px',\n fill = `#627EEA`,\n ...props\n}: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const FailedIcon = ({ w = '94px', h = '94px' }: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const OptimismIcon = ({\n width = '24px',\n height = '24px',\n color = 'white',\n fill = '#FF0420',\n ...props\n}: IconProps) => {\n return (\n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const WalletIcon = ({\n width = '20px',\n height = '20ox',\n color = 'whiteAlpha.700',\n ...props\n}: IconProps) => {\n return (\n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const LogoIcon = ({ color = 'cyan.400', width = '29', height = '21' }: IconProps) => {\n return (\n \n \n \n );\n};\n","import { Image } from '@chakra-ui/react';\nimport icon from './BaseIcon.svg';\n\nexport function BaseIcon({ ...props }) {\n return \"Base\";\n}\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const ArbitrumIcon = ({ width = '24px', height = '24px', ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\ninterface DiscordIcon extends IconProps {\n fill?: string;\n}\n\nexport const DiscordIcon = ({ width = '15px', height = '15px', ...props }: DiscordIcon) => {\n return (\n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const XIcon = ({ ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const GithubIcon = ({ ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const WarpcastIcon = ({ ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const YoutubeIcon = ({ ...props }: IconProps) => {\n return (\n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const Sparkles = ({ ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n );\n};\n","import { Icon, IconProps } from '@chakra-ui/react';\n\nexport const SNXChainIcon = ({ ...props }: IconProps) => {\n return (\n \n \n \n \n \n \n );\n};\n","import { ethers } from 'ethers';\n\nexport class MagicProvider extends ethers.providers.JsonRpcProvider {\n // @ts-ignore\n readonly magicWallet: string;\n // @ts-ignore\n readonly chainId: number;\n\n constructor() {\n if (!window.$chainId) {\n throw new Error('Empty window.$chainId');\n }\n if (!window.$magicWallet) {\n throw new Error('Empty window.$magicWallet');\n }\n super('http://127.0.0.1:8545', { chainId: window.$chainId, name: 'Anvil' });\n Object.defineProperty(this, 'magicWallet', {\n enumerable: true,\n value: window.$magicWallet,\n writable: false,\n });\n Object.defineProperty(this, 'chainId', {\n enumerable: true,\n value: window.$chainId,\n writable: false,\n });\n }\n\n async listAccounts(): Promise> {\n return [this.magicWallet];\n }\n\n async send(method: string, params: Array): Promise {\n if (method === 'eth_chainId') {\n return `0x${Number(this.chainId).toString(16)}`;\n }\n if (method === 'eth_accounts') {\n return [this.magicWallet];\n }\n try {\n // if (method === 'eth_getTransactionReceipt') {\n // // mine extra block before getting receipt\n // await super.send('evm_mine', []);\n // }\n const result = await super.send(method, params);\n // eslint-disable-next-line no-console\n console.log('MAGIC.send', { method, params, result });\n return result;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log('MAGIC.send ERROR', { method, params, error });\n throw error;\n }\n }\n}\n","import { IconProps } from '@chakra-ui/react';\nimport { INFURA_KEY } from '@snx-v3/constants';\nimport { importPythERC7412Wrapper } from '@snx-v3/contracts';\nimport {\n ArbitrumIcon,\n BaseIcon,\n EthereumIcon,\n FailedIcon,\n LogoIcon,\n OptimismIcon,\n SNXChainIcon,\n} from '@snx-v3/icons';\nimport { useQuery } from '@tanstack/react-query';\nimport { useConnectWallet, useSetChain } from '@web3-onboard/react';\nimport { ethers } from 'ethers';\nimport React, { useCallback } from 'react';\nimport { MagicProvider } from './magic';\nimport SynthetixIcon from './SynthetixIcon.svg';\nimport SynthetixLogo from './SynthetixLogo.svg';\n\nexport function getMagicProvider(): ethers.providers.JsonRpcProvider | undefined {\n if (window.$magicWallet && window.$chainId) {\n return new MagicProvider();\n }\n}\n\nexport type Network = {\n id: number;\n preset: string;\n hexId: string;\n token: string;\n name: string;\n rpcUrl: string;\n label: string;\n isSupported: boolean;\n publicRpcUrl: string;\n isTestnet: boolean;\n};\n\nexport const UNSUPPORTED_NETWORK: Network = {\n id: 0,\n preset: 'main',\n hexId: `0x${Number(0).toString(16)}`,\n token: 'ETH',\n name: 'unsupported',\n rpcUrl: '',\n publicRpcUrl: '',\n label: 'Unsupported',\n isSupported: false,\n isTestnet: false,\n};\n\ninterface NetworkIconProps extends IconProps {\n networkId?: Network['id'];\n size?: string;\n}\n\nexport const NetworkIcon = ({ networkId, size = '24px', ...props }: NetworkIconProps) => {\n switch (networkId) {\n case 1:\n return ;\n case 10:\n return ;\n case 11155111:\n return ;\n case 84531:\n return ;\n case 84532:\n return ;\n case 13370:\n return ;\n case 8453:\n return ;\n case 11155420:\n return ;\n case 421614:\n return ;\n case 42161:\n return ;\n case 2192:\n return ;\n case 13001:\n return ;\n default: {\n return ;\n }\n }\n};\n\nexport const BASE_ANDROMEDA: Network = {\n id: 8453,\n preset: 'andromeda',\n hexId: `0x${Number(8453).toString(16)}`,\n token: 'ETH',\n name: 'base',\n rpcUrl: `https://base-mainnet.infura.io/v3/${INFURA_KEY}`,\n label: 'Base',\n isSupported: true,\n publicRpcUrl: 'https://base.publicnode.com',\n isTestnet: false,\n};\n\nexport const MAINNET: Network = {\n id: 1,\n preset: 'main',\n hexId: `0x${Number(1).toString(16)}`,\n token: 'ETH',\n name: 'mainnet',\n rpcUrl: `https://mainnet.infura.io/v3/${INFURA_KEY}`,\n label: 'Ethereum',\n isSupported: true,\n publicRpcUrl: 'https://ethereum.publicnode.com',\n isTestnet: false,\n};\n\nexport const OPTIMISM: Network = {\n id: 10,\n preset: 'main',\n hexId: `0x${Number(10).toString(16)}`,\n token: 'ETH',\n name: 'optimism-mainnet',\n rpcUrl: `https://optimism-mainnet.infura.io/v3/${INFURA_KEY}`,\n label: 'Optimism',\n isSupported: true,\n publicRpcUrl: 'https://mainnet.optimism.io',\n isTestnet: false,\n};\n\nexport const SEPOLIA: Network = {\n id: 11155111,\n preset: 'main',\n hexId: `0x${Number(11155111).toString(16)}`,\n token: 'ETH',\n name: 'sepolia',\n rpcUrl: `https://sepolia.infura.io/v3/${INFURA_KEY}`,\n label: 'Sepolia Testnet',\n isSupported: true,\n publicRpcUrl: 'https://ethereum-sepolia.publicnode.com',\n isTestnet: true,\n};\n\nexport const BASE_SEPOLIA: Network = {\n id: 84532,\n preset: 'andromeda',\n hexId: `0x${Number(84532).toString(16)}`,\n token: 'ETH',\n name: 'base-sepolia',\n rpcUrl: `https://base-sepolia.infura.io/v3/${INFURA_KEY}`,\n label: 'Base Sepolia',\n isSupported: true,\n publicRpcUrl: 'https://sepolia.base.org',\n isTestnet: true,\n};\n\nexport const CANNON: Network = {\n id: 13370,\n preset: 'main',\n hexId: `0x${Number(13370).toString(16)}`,\n token: 'ETH',\n name: 'cannon',\n rpcUrl: `http://127.0.0.1:8545`,\n label: 'Cannon',\n isSupported: false, // hidden by default but if wallet switched to Cannon it will be visible\n publicRpcUrl: 'http://127.0.0.1:8545',\n isTestnet: true,\n};\n\nexport const OPTIMISM_SEPOLIA: Network = {\n id: 11155420,\n preset: 'main',\n hexId: `0x${Number(11155420).toString(16)}`,\n token: 'ETH',\n name: 'optimism-sepolia',\n rpcUrl: `https://optimism-sepolia.infura.io/v3/${INFURA_KEY}`,\n label: 'Optimism Sepolia',\n isSupported: false,\n publicRpcUrl: 'https://sepolia.optimism.io/',\n isTestnet: true,\n};\n\nexport const ARBITRUM_SEPOLIA: Network = {\n id: 421614,\n preset: 'main',\n hexId: `0x${Number(421614).toString(16)}`,\n token: 'ETH',\n name: 'arbitrum-sepolia',\n rpcUrl: `https://arbitrum-sepolia.infura.io/v3/${INFURA_KEY}`,\n label: 'Arbitrum Sepolia',\n isSupported: true,\n publicRpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',\n isTestnet: true,\n};\n\nexport const ARBITRUM: Network = {\n id: 42161,\n preset: 'main',\n hexId: `0x${Number(42161).toString(16)}`,\n token: 'ETH',\n name: 'arbitrum',\n rpcUrl: `https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,\n label: 'Arbitrum',\n isSupported: true,\n publicRpcUrl: 'https://arb1.arbitrum.io/rpc',\n isTestnet: false,\n};\n\nexport const SNAX: Network = {\n id: 2192,\n preset: 'main',\n hexId: `0x${Number(2192).toString(16)}`,\n token: 'ETH',\n name: 'SNAX',\n rpcUrl: 'https://mainnet.snaxchain.io/',\n label: 'Snaxchain',\n isSupported: true,\n publicRpcUrl: 'https://mainnet.snaxchain.io/',\n isTestnet: false,\n};\n\nexport const SNAXTESTNET: Network = {\n id: 13001,\n preset: 'main',\n hexId: `0x${Number(13001).toString(16)}`,\n token: 'ETH',\n name: 'SNAX',\n rpcUrl: 'https://testnet.snaxchain.io/',\n label: 'Snaxchain',\n isSupported: true,\n publicRpcUrl: 'https://testnet.snaxchain.io/',\n isTestnet: true,\n};\n\nexport const NETWORKS: Network[] = [\n BASE_ANDROMEDA,\n MAINNET,\n OPTIMISM,\n SEPOLIA,\n BASE_SEPOLIA,\n CANNON,\n OPTIMISM_SEPOLIA,\n ARBITRUM_SEPOLIA,\n ARBITRUM,\n SNAX,\n SNAXTESTNET,\n];\n\nexport async function deploymentHasERC7412(chainId: number, preset: string) {\n return importPythERC7412Wrapper(chainId, preset).then(\n () => true,\n () => false\n );\n}\n\nexport const DEFAULT_NETWORK =\n NETWORKS.find(\n (network) =>\n `${network.id}-${network.preset}` === window.localStorage.getItem('DEFAULT_NETWORK')\n ) ?? NETWORKS[1];\n\nexport const appMetadata = {\n name: 'Synthetix',\n icon: SynthetixIcon,\n logo: SynthetixLogo,\n description: 'Synthetix | The derivatives liquidity protocol.',\n recommendedInjectedWallets: [\n { name: 'MetaMask', url: 'https://metamask.io' },\n { name: 'Brave Wallet', url: 'https://brave.com/wallet' },\n ],\n gettingStartedGuide: 'https://synthetix.io',\n explore: 'https://blog.synthetix.io',\n};\n\nexport function useProviderForChain(customNetwork?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork ?? currentNetwork;\n const isDefaultChain =\n customNetwork?.id === currentNetwork?.id && customNetwork?.preset === currentNetwork?.preset;\n const { data: provider } = useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'ProviderForChain', { isDefaultChain }],\n enabled: Boolean(network),\n queryFn: () => {\n if (!network) throw 'OMFG';\n if (isDefaultChain) {\n const provider = getMagicProvider();\n if (provider) {\n return provider;\n }\n }\n return new ethers.providers.JsonRpcProvider(network.rpcUrl);\n },\n });\n\n return provider;\n}\n\nexport function useWallet() {\n const [{ wallet }, connect, disconnect] = useConnectWallet();\n\n if (!wallet) {\n return {\n activeWallet: undefined,\n walletsInfo: undefined,\n connect,\n disconnect,\n };\n }\n\n const activeWallet = wallet?.accounts[0];\n\n return {\n activeWallet: activeWallet,\n walletsInfo: wallet,\n connect,\n disconnect,\n };\n}\n\nexport function useNetwork() {\n const [{ connectedChain }, setChain] = useSetChain();\n\n const setNetwork = useCallback(\n async (networkId: number) => {\n const newNetwork = NETWORKS.find((n) => n.id === networkId);\n if (!newNetwork) return;\n return await setChain({ chainId: newNetwork?.hexId });\n },\n [setChain]\n );\n\n // Hydrate the network info\n const network = NETWORKS.find((n) => n.hexId === connectedChain?.id);\n\n if (!network) {\n return {\n network: undefined,\n setNetwork,\n };\n }\n\n return {\n network,\n setNetwork,\n };\n}\n\nexport function useSigner() {\n const { network } = useNetwork();\n const [{ wallet }] = useConnectWallet();\n const activeWallet = wallet?.accounts?.[0];\n const { data: signer } = useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'Signer', activeWallet?.address],\n enabled: Boolean(wallet && activeWallet),\n queryFn: () => {\n if (!(wallet && activeWallet)) throw 'OMFG';\n const provider =\n getMagicProvider() ?? new ethers.providers.Web3Provider(wallet.provider, 'any');\n return provider.getSigner(activeWallet.address);\n },\n });\n return signer;\n}\n\nexport function useProvider() {\n const { network } = useNetwork();\n return useProviderForChain(network);\n}\n","import {\n ComponentMultiStyleConfig,\n ComponentStyleConfig,\n defineStyle,\n extendTheme,\n} from '@chakra-ui/react';\nimport { mode } from '@chakra-ui/theme-tools';\n\nconst gradients = {\n 'green-cyan': {\n 500: 'linear(to-tr, green.500, cyan.500)',\n 600: 'linear(to-tr, green.600, cyan.600)',\n 700: 'linear(to-tr, green.700, cyan.800)',\n },\n\n grey: {\n 900: 'linear(to-tr, grey.900, blackAlpha.900)',\n },\n dark: {\n 500: 'linear(to-tr, #171923, #141414)',\n },\n\n 'pink-purple': {\n 500: 'linear(to-tr, pink.500, purple.500)',\n 600: 'linear(to-tr, pink.600, purple.600)',\n 700: 'linear(to-tr, pink.700, purple.800)',\n },\n\n 'pink-blue': {\n 500: 'linear(to-tr, pink.500, blue.500)',\n 600: 'linear(to-tr, pink.600, blue.600)',\n 700: 'linear(to-tr, pink.700, blue.800)',\n },\n 'pink-cyan': {\n 500: 'linear(to-tr, pink.500, cyan.500)',\n 600: 'linear(to-tr, pink.600, cyan.600)',\n 700: 'linear(to-tr, pink.700, cyan.800)',\n },\n\n orange: {\n 500: 'linear(to-tr, orange.500, orange.300)',\n 600: 'linear(to-tr, orange.600, orange.400)',\n 700: 'linear(to-tr, orange.700, orange.500)',\n },\n};\n\n// adapted from https://github.com/chakra-ui/chakra-ui/blob/main/packages/components/theme/src/components/button.ts#L90\nconst variantSolid = defineStyle((props) => {\n const { colorScheme: c } = props;\n\n if (c === 'gray') {\n const bg = mode(`gray.100`, `whiteAlpha.200`)(props);\n\n return {\n borderRadius: 'base',\n color: mode(`black`, `whiteAlpha.900`)(props),\n bg,\n _hover: {\n bg: mode(`gray.200`, `whiteAlpha.300`)(props),\n _disabled: {\n bg,\n },\n },\n _active: { bg: mode(`gray.300`, `whiteAlpha.400`)(props) },\n };\n }\n\n if (c === 'cyan') {\n return {\n borderRadius: 'base',\n bgGradient: gradients['green-cyan'][500],\n color: 'black',\n _hover: {\n bgGradient: gradients['green-cyan'][600],\n _disabled: {\n background: gradients['green-cyan'][500],\n },\n },\n _active: {\n bgGradient: gradients['green-cyan'][700],\n },\n };\n }\n\n const bg = `${c}.500`;\n const color = 'white';\n const hoverBg = `${c}.600`;\n const activeBg = `${c}.700`;\n const background = mode(bg, `${c}.600`)(props);\n\n return {\n borderRadius: 'base',\n bg: background,\n color: mode(color, `white`)(props),\n _hover: {\n bg: mode(hoverBg, `${c}.500`)(props),\n _disabled: {\n bg: background,\n },\n },\n _active: { bg: mode(activeBg, `${c}.400`)(props) },\n };\n});\n\nconst Button: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n variants: {\n solid: variantSolid,\n outline: (props) => {\n if (props.colorScheme === 'gray' || props.colorScheme === 'grey') {\n return {\n color: 'white',\n borderColor: 'gray.900',\n _hover: { bg: 'whiteAlpha.200' },\n _active: { bg: 'whiteAlpha.400' },\n borderRadius: 'base',\n };\n }\n return {\n color: 'cyan.500', // needed for storybook for some reason\n border: '1px solid', // needed for storybook for some reason\n borderColor: 'cyan.500', // needed for storybook for some reason\n _hover: { bg: 'rgb(0, 209, 255, 0.12)' }, // cyan.500 0.12 opacity\n _active: { bg: 'rgb(0, 209, 255, 0.24)' }, // cyan.500 0.24 opacity\n borderRadius: 'base',\n };\n },\n ghost: {\n color: 'cyan.500', // needed for storybook for some reason\n _hover: { bg: 'rgb(0, 209, 255, 0.12)' }, // cyan.500 0.12 opacity\n _active: { bg: 'rgb(0, 209, 255, 0.24)' }, // cyan.500 0.24 opacity\n borderRadius: 'base',\n },\n },\n};\n\nconst Menu: ComponentMultiStyleConfig = {\n parts: ['button', 'list', 'item'],\n baseStyle: {\n button: {\n borderRadius: 'base',\n color: 'white',\n span: {\n display: 'flex',\n alignItems: 'center',\n px: 2,\n },\n height: '100%',\n },\n list: {\n mt: 2,\n bgColor: 'navy.900',\n padding: 0,\n border: 'none',\n borderRadius: 'md',\n py: 0,\n },\n item: {\n bgColor: 'blackAlpha.300',\n color: 'whiteAlpha.900',\n p: 3,\n _hover: {\n bgColor: 'whiteAlpha.400',\n },\n _active: {\n bgColor: 'navy.900',\n },\n _first: {\n borderTopLeftRadius: 'md',\n borderTopRightRadius: 'md',\n },\n _last: {\n borderBottomLeftRadius: 'md',\n borderBottomRightRadius: 'md',\n },\n _focus: {\n bgColor: 'blackAlpha.400',\n },\n },\n },\n};\n\nconst Input: ComponentStyleConfig = {\n defaultProps: {\n focusBorderColor: 'cyan.500',\n errorBorderColor: 'red.500',\n },\n};\n\nconst Select: ComponentStyleConfig = {\n defaultProps: {\n focusBorderColor: 'cyan.500',\n iconColor: 'cyan.500',\n errorBorderColor: 'red.500',\n },\n};\n\nconst NumberInput: ComponentStyleConfig = {\n defaultProps: {\n focusBorderColor: 'cyan.500',\n errorBorderColor: 'red.500',\n },\n};\n\nconst Textarea: ComponentStyleConfig = {\n defaultProps: {\n focusBorderColor: 'cyan.500',\n colorScheme: 'cyan',\n errorBorderColor: 'red.500',\n },\n};\n\nconst Alert: ComponentStyleConfig = {\n defaultProps: {\n variant: 'left-accent',\n },\n variants: {\n 'left-accent': (props) => {\n return {\n container: {\n bg: `${props.colorScheme}.900`,\n borderInlineStartColor: `${props.colorScheme}.500`,\n },\n };\n },\n solid: (props) => {\n return {\n icon: { color: 'white' },\n container: { bg: `${props.colorScheme}.500`, color: 'white' },\n };\n },\n },\n};\n\nconst Skeleton: ComponentStyleConfig = {\n defaultProps: {\n startColor: 'gray.900',\n endColor: 'gray.800',\n },\n};\n\nconst Checkbox: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n baseStyle: {\n control: {\n borderColor: 'cyan.500',\n _checked: {\n bg: 'cyan.500',\n borderColor: 'cyan.500',\n _hover: {\n bg: 'cyan.600',\n borderColor: 'cyan.600',\n },\n },\n _invalid: {\n borderColor: 'red.500',\n },\n _disabled: {\n _hover: {\n borderColor: 'transparent',\n },\n },\n _hover: {\n borderColor: 'cyan.600',\n },\n },\n },\n};\n\nconst Radio: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n baseStyle: {\n control: {\n borderColor: 'cyan.500',\n _checked: {\n bg: 'cyan.500',\n borderColor: 'cyan.500',\n _hover: {\n bg: 'cyan.600',\n borderColor: 'cyan.600',\n },\n },\n _invalid: {\n borderColor: 'red.500',\n },\n _disabled: {\n _hover: {\n borderColor: 'transparent',\n },\n },\n _hover: {\n borderColor: 'cyan.600',\n },\n },\n },\n};\n\nconst Badge: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n variants: {\n subtle: (props) => ({\n color: `${props.colorScheme}.500`,\n border: '0px',\n display: 'flex',\n alignItems: 'center',\n }),\n solid: (props) => ({\n background: `${props.colorScheme}.500`,\n color: 'black',\n }),\n outline: (props) => ({\n borderColor: `${props.colorScheme}.500`,\n color: `${props.colorScheme}.500`,\n boxShadow: 'unset',\n }),\n },\n};\n\nconst Tag: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n variant: 'solid',\n },\n variants: {\n solid: (props) => ({\n container: {\n background: `${props.colorScheme}.500`,\n color: 'black',\n },\n }),\n },\n};\n\nconst Accordion: ComponentStyleConfig = {\n baseStyle: {\n container: {\n borderColor: 'gray.900',\n borderWidth: '1px',\n borderRadius: 'base',\n },\n },\n};\n\nconst Progress: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n variant: 'solid',\n borderRadius: 'full',\n },\n variants: {\n solid: (props) => ({\n filledTrack: {\n background: `${props.colorScheme}.500`,\n borderRadius: 'full',\n },\n track: {\n borderRadius: 'full',\n },\n }),\n },\n};\n\nconst Tabs: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n variants: {\n 'solid-rounded': (props) => ({\n tab: {\n _selected: {\n background: `${props.colorScheme}.500`,\n color: 'black',\n },\n color: `${props.colorScheme}.500`,\n },\n }),\n 'soft-rounded': {\n tab: {\n _selected: {\n background: 'whiteAlpha.300',\n color: 'cyan.500',\n },\n color: 'cyan.500',\n },\n },\n },\n};\n\nconst Tooltip: ComponentStyleConfig = {\n baseStyle: {\n textAlign: 'center',\n bg: 'gray.900',\n color: 'white.500',\n '--popper-arrow-bg': 'var(--chakra-colors-gray-900)',\n },\n};\n\nconst Switch: ComponentStyleConfig = {\n defaultProps: {\n colorScheme: 'cyan',\n },\n baseStyle: {\n track: {\n _checked: {\n background: 'cyan.500',\n },\n },\n },\n};\n\nconst Spinner: ComponentStyleConfig = {\n baseStyle: {\n color: 'cyan.500',\n },\n};\n\nexport const theme = extendTheme({\n useSystemColorMode: false,\n initialColorMode: 'dark',\n colors: {\n gray: {\n 50: '#F6F6F6',\n 100: '#F1F1F1',\n 200: '#DDDDDF',\n 300: '#C3C3C9',\n 400: '#AAAAB2',\n 500: '#91919B',\n 600: '#7A7A85',\n 700: '#63636E',\n 800: '#4D4D57',\n 900: '#303037',\n },\n red: {\n 50: '#FFEDEF',\n 100: '#FFC4CB',\n 200: '#FF9BA7',\n 300: '#FF7384',\n 400: '#FF4A60',\n 500: '#E4364B',\n 600: '#C53030',\n 700: '#9B2C2C',\n 800: '#822727',\n 900: '#63171B',\n },\n orange: {\n 50: '#FFF3EB',\n 100: '#FFD8BE',\n 200: '#FFBE92',\n 300: '#FFA365',\n 400: '#FF9A54',\n 500: '#FC8738',\n 600: '#DC732D',\n 700: '#96420A',\n 800: '#743002',\n 900: '#522100',\n },\n yellow: {\n 50: '#FFFBEF',\n 100: '#FFF2CA',\n 200: '#FFF5A8',\n 300: '#FFF889',\n 400: '#FFF458',\n 500: '#FAE527',\n 600: '#EAD516',\n 700: '#B5932B',\n 800: '#776017',\n 900: '#55430D',\n },\n green: {\n 50: '#EDFFF9',\n 100: '#C3FFEC',\n 200: '#9AE6B4',\n 300: '#72FFD3',\n 400: '#47FAC2',\n 500: '#34EDB3',\n 600: '#2BD39F',\n 700: '#11946B',\n 800: '#077250',\n 900: '#015037',\n },\n blue: {\n 50: '#EDF6FF',\n 100: '#C4E2FF',\n 200: '#9CCFFF',\n 300: '#73BBFF',\n 400: '#479EF0',\n 500: '#3182CE',\n 600: '#1F68AC',\n 700: '#11508A',\n 800: '#073968',\n 900: '#012546',\n },\n cyan: {\n 50: '#E5FAFF',\n 100: '#B7F2FF',\n 200: '#8AEAFF',\n 300: '#5CE1FF',\n 400: '#2ED9FF',\n 500: '#00D1FF',\n 600: '#00B0D6',\n 700: '#008EAD',\n 800: '#006D85',\n 900: '#004B5C',\n },\n purple: {\n 50: '#F0EEFF',\n 100: '#CFC9FF',\n 200: '#AEA4FF',\n 300: '#8D7EFF',\n 400: '#6B59FF',\n 500: '#5744EA',\n 600: '#402FC8',\n 700: '#2D1EA6',\n 800: '#1D1084',\n 900: '#10104E',\n },\n pink: {\n 50: '#FDE8FF',\n 100: '#F9B6FF',\n 200: '#F583FF',\n 300: '#F471FF',\n 400: '#EB46FF',\n 500: '#EE2EFF',\n 600: '#BE02CE',\n 700: '#8D0099',\n 800: '#6E0077',\n 900: '#4E0055',\n },\n navy: {\n 50: '#522ED1',\n 100: '#401FB7',\n 200: '#3719A6',\n 300: '#2F1298',\n 400: '#1F0777',\n 500: '#150942',\n 600: '#0E052F',\n 700: '#0B0B22',\n 800: '#0A0A25',\n 900: '#06061B',\n },\n error: '#FF4A60', // red.400,\n success: '#34EDB3', //green.500\n warning: '#FC8738', // orange.500\n },\n shadows: {\n outline: '0 0 0 3px rgba(0, 209, 255, 1)',\n },\n fonts: {\n heading:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n body: 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n display:\n '\"GT America Condensed\", Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n mono: '\"GT America Mono\", SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace',\n },\n components: {\n Popover: {\n variants: {\n responsive: {\n popper: {\n maxWidth: 'unset',\n width: 'unset',\n },\n },\n },\n },\n Button,\n Input,\n Select,\n NumberInput,\n Alert,\n Textarea,\n Skeleton,\n Checkbox,\n Radio,\n Badge,\n Tag,\n Accordion,\n Progress,\n Tabs,\n Tooltip,\n Switch,\n Spinner,\n Menu,\n },\n // To be imported and used with the bgGradient prop\n // See: https://chakra-ui.com/docs/styled-system/gradient#background-gradient-api\n gradients,\n textStyles: {\n 'heading-4xl': {\n fontSize: { base: '60px', lg: '72px' },\n fontFamily: 'heading',\n lineHeight: { base: '57.6px', lg: '72px' },\n fontWeight: 700,\n },\n 'heading-3xl': {\n fontSize: { base: '48px', md: '60px' },\n fontFamily: 'heading',\n lineHeight: { base: '57.6px', md: '72px', lg: '60px' },\n fontWeight: 700,\n },\n 'heading-2xl': {\n fontSize: { base: '36px', md: '48px' },\n fontFamily: 'heading',\n lineHeight: { base: '120%' },\n fontWeight: 700,\n },\n 'heading-xl': {\n fontSize: { base: '30px', lg: '36px' },\n fontFamily: 'heading',\n lineHeight: { base: '36px', lg: '120%' },\n fontWeight: 700,\n },\n 'heading-lg': {\n fontSize: { base: '24px', lg: '30px' },\n fontFamily: 'heading',\n lineHeight: { base: '28.8px', lg: '36px' },\n fontWeight: 700,\n },\n 'heading-md': {\n fontSize: { base: '20px', lg: '24px' },\n fontFamily: 'heading',\n lineHeight: '24px',\n fontWeight: 700,\n },\n 'heading-sm': {\n fontSize: '16px',\n fontFamily: 'heading',\n lineHeight: '19.2px',\n fontWeight: 700,\n },\n 'heading-xs': {\n fontSize: '14px',\n fontFamily: 'heading',\n lineHeight: '16.8px',\n fontWeight: 700,\n },\n },\n sizes: {\n px: '1px',\n 0.5: '0.125rem',\n 1: '0.25rem',\n 1.5: '0.375rem',\n 2: '0.5rem',\n 2.5: '0.625rem',\n 3: '0.75rem',\n 3.5: '0.875rem',\n 4: '1rem',\n 5: '1.25rem',\n 6: '1.5rem',\n 7: '1.75rem',\n 8: '2rem',\n 9: '2.25rem',\n 10: '2.5rem',\n 12: '3rem',\n 14: '3.5rem',\n 16: '4rem',\n 20: '5rem',\n 24: '6rem',\n 28: '7rem',\n 32: '8rem',\n 36: '9rem',\n 40: '10rem',\n 44: '11rem',\n 48: '12rem',\n 52: '13rem',\n 56: '14rem',\n 60: '15rem',\n 64: '16rem',\n 72: '18rem',\n 80: '20rem',\n 96: '24rem',\n max: 'max-content',\n min: 'min-content',\n full: '100%',\n '3xs': '14rem',\n '2xs': '16rem',\n xs: '20rem',\n sm: '24rem',\n md: '28rem',\n lg: '32rem',\n xl: '36rem',\n '2xl': '42rem',\n '3xl': '48rem',\n '4xl': '56rem',\n '5xl': '64rem',\n '6xl': '72rem',\n '7xl': '80rem',\n '8xl': '90rem',\n container: {\n sm: '640px',\n md: '768px',\n lg: '1024px',\n xl: '1280px',\n },\n },\n styles: {\n global: {\n body: {\n bg: 'navy.900',\n },\n },\n },\n});\n","import { Global } from '@emotion/react';\n\nexport const Fonts = () => (\n \n);\n","import {\n Box,\n Button,\n Link,\n ListItem,\n Modal,\n ModalBody,\n ModalContent,\n ModalHeader,\n ModalOverlay,\n Text,\n UnorderedList,\n} from '@chakra-ui/react';\nimport { SESSION_STORAGE_KEYS } from '@snx-v3/constants';\nimport { theme } from '@snx-v3/theme';\nimport { useState } from 'react';\nimport { Link as ReactRouterLink } from 'react-router-dom';\n\ninterface TermsModalProps {\n defaultOpen: boolean;\n}\n\nexport const TermsModal = ({ defaultOpen = true }: TermsModalProps) => {\n const [isOpen, setOpen] = useState(defaultOpen);\n const [enabled, setEnabled] = useState(false);\n\n const onSubmit = () => {\n if (enabled) {\n localStorage.setItem(SESSION_STORAGE_KEYS.TERMS_CONDITIONS_ACCEPTED, JSON.stringify(true));\n setOpen(false);\n }\n };\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n {}}>\n \n \n \n Synthetix Terms of Service\n \n \n \n By clicking “I Agree” below, you agree to be bound by the terms of this Agreement. As\n such, you fully understand that:\n \n {\n const div = e.currentTarget;\n const scrollTopWithTolerance = div.scrollTop + 10;\n if (scrollTopWithTolerance >= div.scrollHeight - div.offsetHeight) {\n setEnabled(true);\n } else {\n setEnabled(false);\n }\n }}\n as=\"div\"\n my={2}\n py={3}\n height=\"350px\"\n overflow=\"auto\"\n overflowX=\"scroll\"\n sx={{\n '::-webkit-scrollbar': {\n display: 'block',\n },\n '::-webkit-scrollbar-track': {\n backgroundColor: 'transparent',\n },\n '::-webkit-scrollbar-track-piece': {\n backgroundColor: 'transparent',\n },\n '::-webkit-scrollbar-corner': {\n backgroundColor: 'transparent',\n },\n }}\n >\n \n \n \n \n Synthetix{' '}\n \n is a blockchain-based decentralized finance project. You are participating at your\n own risk.\n \n \n Synthetix is offered for use “as is” and without any guarantees regarding\n security. The protocol is made up of immutable code and can be accessed through a\n variety of user interfaces.\n \n \n No central entity operates the Synthetix protocol. Decisions related to the\n protocol are governed by a dispersed group of participants who collectively govern\n and maintain the protocol.\n \n \n Synthetix DAO does not unilaterally offer, maintain, operate, administer, or\n control any trading interfaces. The only user interfaces maintained by Synthetix\n DAO are the governance and liquidity interfaces herein.\n \n \n You can participate in the governance process by staking SNX tokens in accordance\n with the rules and parameters summarized{' '}\n \n here\n \n , and/or joining the{' '}\n \n Synthetix Discord\n {' '}\n and contributing to the conversation.\n \n \n The rules and parameters associated with the Synthetix protocol and Synthetix DAO\n governance are subject to change at any time.\n \n \n Your use of Synthetix is conditioned upon your acceptance to be bound by the\n Synthetix Term of Use, which can be found{' '}\n \n here\n \n .\n \n \n The laws that apply to your use of Synthetix may vary based upon the jurisdiction\n in which you are located. We strongly encourage you to speak with legal counsel in\n your jurisdiction if you have any questions regarding your use of Synthetix.\n \n \n By entering into this agreement, you are not agreeing to enter into a partnership.\n You understand that Synthetix is a decentralized protocol provided on an “as is”\n basis.\n \n \n You hereby release all present and future claims against Synthetix DAO related to\n your use of the protocol, the SNX token, SNX DAO governance, and any other facet\n of the protocol.\n \n \n You agree to indemnify and hold harmless SNX DAO and its affiliates for any costs\n arising out of or relating to your use of the Synthetix protocol.\n \n \n You are not accessing the protocol from Burma (Myanmar), Cuba, Iran, Sudan, Syria,\n the Western Balkans, Belarus, Côte d’Ivoire, Democratic Republic of the Congo,\n Iraq, Lebanon, Liberia, Libya, North Korea, Russia, certain sanctioned areas of\n Ukraine, Somalia, Venezuela, Yemen, or Zimbabwe (collectively, “Prohibited\n Jurisdictions”), or any other jurisdiction listed as a Specially Designated\n National by the United States Office of Foreign Asset Control (“OFAC”).\n \n \n \n \n \n \n I agree\n \n \n \n );\n};\n","import { appMetadata, NETWORKS } from '@snx-v3/useBlockchain';\nimport coinbaseModule from '@web3-onboard/coinbase';\nimport type { ChainWithDecimalId } from '@web3-onboard/common';\nimport gnosisModule from '@web3-onboard/gnosis';\nimport injectedModule, { ProviderLabel } from '@web3-onboard/injected-wallets';\nimport ledgerModule from '@web3-onboard/ledger';\nimport { init } from '@web3-onboard/react';\nimport trezorModule from '@web3-onboard/trezor';\nimport walletConnectModule from '@web3-onboard/walletconnect';\n\n// Filter networks to only supported ones\nexport const chains: ChainWithDecimalId[] = Object.values(\n NETWORKS.reduce((result, network) => {\n if (!network.isSupported) {\n return result;\n }\n if (network.id in result) {\n // We cannot have duplicate chains, but we can have multiple deployments per chain\n return result;\n }\n return Object.assign(result, {\n [network.id]: {\n id: network.id,\n token: network.token,\n label: network.label,\n rpcUrl: network.rpcUrl,\n publicRpcUrl: network.publicRpcUrl,\n },\n });\n }, {})\n);\n\nexport const onboard = init({\n theme: 'dark',\n connect: {\n autoConnectLastWallet: true,\n autoConnectAllPreviousWallet: true,\n },\n wallets: window.$magicWallet\n ? [injectedModule()]\n : [\n coinbaseModule(),\n injectedModule({ displayUnavailable: [ProviderLabel.MetaMask, ProviderLabel.Trust] }),\n trezorModule({\n appUrl: 'https://liquidity.synthetix.io',\n email: 'info@synthetix.io',\n }),\n ledgerModule({\n projectId: 'd6eac005846a1c3be1f8eea3a294eed9',\n walletConnectVersion: 2,\n }),\n walletConnectModule({\n version: 2,\n projectId: 'd6eac005846a1c3be1f8eea3a294eed9',\n dappUrl: 'liquidity.synthetix.io',\n }),\n gnosisModule(),\n ],\n chains,\n appMetadata: {\n ...appMetadata,\n name: 'Synthetix Liquidity',\n },\n accountCenter: {\n desktop: {\n enabled: false,\n },\n mobile: {\n enabled: false,\n },\n },\n notify: {\n enabled: false,\n },\n});\n","import React from 'react';\nimport { createSearchParams, useSearchParams } from 'react-router-dom';\nimport { z } from 'zod';\n\nexport const HomePageSchema = z.object({\n page: z.literal('home').optional(),\n accountId: z.string().optional(),\n showAll: z.string().optional(),\n});\nexport type HomePageSchemaType = z.infer;\n\nexport const SettingsPageSchema = z.object({\n page: z.literal('settings'),\n accountId: z.string().optional(),\n});\nexport type SettingsPageSchemaType = z.infer;\n\nexport const ManageActionSchema = z.union([\n z.literal('deposit'),\n z.literal('repay'),\n z.literal('claim'),\n z.literal('undelegate'),\n z.literal('withdraw'),\n z.literal('withdraw-debt'),\n z.literal('close'),\n z.literal('locked'),\n]);\nexport type ManageActionType = z.infer;\n\nexport const PositionPageSchema = z.object({\n page: z.literal('position'),\n collateralSymbol: z.string(),\n manageAction: ManageActionSchema,\n accountId: z.string().optional(),\n});\nexport type PositionPageSchemaType = z.infer;\n\nconst AllowedQueriesSchema = z.union([HomePageSchema, SettingsPageSchema, PositionPageSchema]);\ntype AllowedQueriesType = z.infer;\n\nexport function searchParamsToObject(searchParams: URLSearchParams) {\n const params = Object.fromEntries(Array.from(searchParams));\n\n for (const schema of [HomePageSchema, SettingsPageSchema, PositionPageSchema]) {\n const parsed = schema.safeParse(params);\n if (parsed.success) {\n return parsed.data;\n }\n }\n console.error('Route cannot be matched', params);\n return {}; // Go to homepage\n}\n\nexport function sortObject(params: AllowedQueriesType): AllowedQueriesType {\n return Object.fromEntries(Object.entries(params).sort(([a], [b]) => a.localeCompare(b)));\n}\n\nexport function cleanObject(params: AllowedQueriesType): AllowedQueriesType {\n const cleaned = Object.entries(params).filter(([, value]) => value !== undefined);\n return Object.fromEntries(cleaned);\n}\n\nexport function makeParams(newParams: AllowedQueriesType) {\n return createSearchParams(sortObject(cleanObject(newParams)));\n}\n\nexport function makeSearch(newParams: AllowedQueriesType) {\n return makeParams(newParams).toString();\n}\n\nexport function useParams(): [T, (newParams: AllowedQueriesType) => void] {\n const [searchParams, setSearchParams] = useSearchParams();\n\n const params = React.useMemo(() => searchParamsToObject(searchParams) as T, [searchParams]);\n\n const setParams = React.useCallback(\n (newParams: AllowedQueriesType): void => {\n setSearchParams(makeParams(newParams));\n },\n [setSearchParams]\n );\n\n return [params, setParams];\n}\n","import { ethers } from 'ethers';\nimport { wei, WeiSource } from '@synthetixio/wei';\n\nexport const formatValue = (value: ethers.BigNumberish, decimals = 18) =>\n parseFloat(ethers.utils.formatUnits(value, decimals));\n\nexport const parseUnits = (value: WeiSource, decimals = 18) => wei(value, decimals).toBN();\n\nexport const compareAddress = (add1: string | null = '', add2: string | null = '') =>\n !!add1 && !!add2 && add1.toLowerCase() === add2.toLowerCase();\n\nexport const prettyString = (text: string, startLength = 6, endLength = 4) => {\n if (text.length <= startLength + endLength) {\n return text;\n }\n return `${text.substring(0, startLength)}...${text.substring(text.length - endLength)}`;\n};\n\nexport function renderAccountId(accountId?: ethers.BigNumber) {\n if (!accountId) {\n return '---';\n }\n const hex = accountId.toHexString();\n // auto-generated 0x80000000000000000000000000000008 value\n if (hex.length === 34) {\n return `${hex.slice(0, 5)}...${hex.slice(-6)}`;\n }\n return `#${accountId}`;\n}\n","import { Wei } from '@synthetixio/wei';\nimport numbro from 'numbro';\n\nexport function currency(value?: Wei) {\n try {\n if (!value) {\n return '-';\n }\n if (value.eq(0)) {\n return '0.00';\n }\n if (value.abs().lt(0.01)) {\n return value.toString();\n }\n const number = value.toNumber();\n const m2 = numbro(number).format({\n thousandSeparated: false,\n mantissa: 2,\n });\n const m0 = numbro(number).format({\n thousandSeparated: false,\n mantissa: 0,\n });\n // Strip unnecessary .00\n return parseFloat(m2) === parseFloat(m0)\n ? numbro(number).format({\n thousandSeparated: true,\n mantissa: 0,\n })\n : numbro(number).format({\n thousandSeparated: true,\n mantissa: 2,\n });\n } catch {\n return `${value}`;\n }\n}\n","export async function importAccountProxy(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/AccountProxy.readable.json'),\n ]);\n return { address: meta.contracts.AccountProxy, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for AccountProxy`);\n }\n }\n}\n","import { importAccountProxy } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useAccountProxy(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'AccountProxy'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importAccountProxy(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useProvider, useSigner, useWallet } from '@snx-v3/useBlockchain';\nimport { useMutation } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useTransferAccountId');\n\nexport function useTransferAccountId(to: string, accountId: ethers.BigNumber) {\n const { data: AccountProxy } = useAccountProxy();\n const { activeWallet } = useWallet();\n const signer = useSigner();\n const provider = useProvider();\n const walletAddress = activeWallet?.address;\n\n return useMutation({\n mutationFn: async () => {\n if (!AccountProxy) throw new Error('AccountProxy not defined');\n if (!(walletAddress && signer && provider)) throw new Error('Wallet is not connected');\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const txn = await AccountProxyContract.transferFrom(walletAddress, to, accountId);\n log('txn', txn);\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n });\n}\n","import {\n Alert,\n AlertDescription,\n AlertIcon,\n Button,\n Divider,\n Flex,\n Input,\n Modal,\n ModalBody,\n ModalCloseButton,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalOverlay,\n Spinner,\n Text,\n} from '@chakra-ui/react';\nimport { renderAccountId } from '@snx-v3/format';\nimport { useTransferAccountId } from '@snx-v3/useTransferAccountId';\nimport { ethers } from 'ethers';\nimport { useMemo, useState } from 'react';\n\nexport function TransferOwnershipModal({\n isOpen,\n onClose,\n accountId,\n refetch,\n owner,\n}: {\n isOpen: boolean;\n onClose: () => void;\n accountId: ethers.BigNumber;\n owner: string;\n refetch: () => void;\n}) {\n const [to, setTo] = useState('');\n const { isPending, mutateAsync: submit } = useTransferAccountId(to, accountId);\n\n const isTargetValid = useMemo(\n () => ethers.utils.isAddress(to) && to.toLowerCase() !== owner.toLowerCase(),\n [owner, to]\n );\n return (\n \n \n \n Transfer Ownership\n \n \n \n \n Account {renderAccountId(accountId)}\n \n \n Will be transferred from:\n \n \n \n Will be transferred to:\n \n {\n setTo(e.target.value.trim());\n }}\n value={to}\n />\n \n \n \n \n \n This action cannot be undone\n \n \n\n {isPending ? (\n \n ) : (\n \n submit().then(() => {\n setTo('');\n refetch();\n onClose();\n })\n }\n isDisabled={!isTargetValid}\n >\n Confirm\n \n )}\n \n \n \n );\n}\n","export function etherscanLink({\n chain,\n address,\n isTx = false,\n}: {\n chain: string;\n address: string;\n isTx?: boolean;\n}): string {\n switch (chain) {\n case 'sepolia':\n return `https://sepolia.etherscan.io/${isTx ? 'tx' : 'address'}/${address}`;\n case 'arbitrum':\n return `https://arbiscan.io/${isTx ? 'tx' : 'address'}/${address}`;\n case 'optimism':\n return `https://optimistic.etherscan.io/${isTx ? 'tx' : 'address'}/${address}`;\n case 'base':\n return `https://basescan.org/${isTx ? 'tx' : 'address'}/${address}`;\n case 'base-sepolia':\n return `https://sepolia.basescan.org/${isTx ? 'tx' : 'address'}/${address}`;\n case 'mainnet':\n default:\n return `https://etherscan.io/${isTx ? 'tx' : 'address'}/${address}`;\n }\n}\n\nexport function transactionLink({\n chainId,\n txnHash,\n}: {\n chainId?: number;\n txnHash?: string | null;\n}) {\n switch (chainId) {\n case 1:\n return `https://etherscan.io/tx/${txnHash}`;\n case 11155420:\n return `https://sepolia.etherscan.io/tx/${txnHash}`;\n case 42161:\n return `https://arbiscan.io/tx/${txnHash}`;\n case 421614:\n return `https://sepolia.arbiscan.io/tx/${txnHash}`;\n case 10:\n return `https://optimistic.etherscan.io/tx/${txnHash}`;\n case 8453:\n return `https://basescan.org/tx/${txnHash}`;\n case 84532:\n return `https://sepolia.basescan.org/tx/${txnHash}`;\n }\n}\n","import { CopyIcon, ExternalLinkIcon } from '@chakra-ui/icons';\nimport { Flex, Tooltip } from '@chakra-ui/react';\nimport { etherscanLink } from '@snx-v3/etherscanLink';\nimport { prettyString } from '@snx-v3/format';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { FC, useMemo } from 'react';\n\ninterface AddressProps {\n address: string;\n}\n\nexport const Address: FC = ({ address }) => {\n const { network } = useNetwork();\n const link = useMemo(\n () =>\n etherscanLink({\n chain: network?.name || '',\n address,\n }),\n [address, network?.name]\n );\n return (\n \n {prettyString(address)}\n {\n navigator.clipboard.writeText(address);\n }}\n cursor=\"pointer\"\n _hover={{\n color: 'cyan',\n }}\n />\n \n \n \n \n );\n};\n","export async function importCoreProxy(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/CoreProxy.readable.json'),\n ]);\n return { address: meta.contracts.CoreProxy, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for CoreProxy`);\n }\n }\n}\n","import { importCoreProxy } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useCoreProxy(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'CoreProxy'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw 'OMFG';\n return importCoreProxy(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","export async function importTrustedMulticallForwarder(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/TrustedMulticallForwarder.readable.json'),\n ]);\n return { address: meta.contracts.TrustedMulticallForwarder, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for Multicall3`);\n }\n }\n}\n","import { importTrustedMulticallForwarder } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useTrustedMulticallForwarder(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'Multicall3'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importTrustedMulticallForwarder(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useTrustedMulticallForwarder } from '@snx-v3/useTrustedMulticallForwarder';\nimport { useMutation } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useManagePermissions');\n\ntype Permissions = Array;\nconst getPermissionDiff = (\n existing: Permissions,\n selected: Permissions\n): {\n grants: Permissions;\n revokes: Permissions;\n} => {\n let grants: Permissions = [],\n revokes: Permissions = [];\n existing.concat(selected).forEach((permission) => {\n if (!existing.includes(permission)) {\n grants = [...grants, permission];\n }\n if (!selected.includes(permission)) {\n revokes = [...revokes, permission];\n }\n });\n return { grants, revokes };\n};\n\nexport const useManagePermissions = ({\n accountId,\n target,\n existing = [],\n selected = [],\n}: {\n accountId: ethers.BigNumber;\n target: string;\n existing: Permissions;\n selected: Permissions;\n}) => {\n const { data: CoreProxy } = useCoreProxy();\n const { data: Multicall3 } = useTrustedMulticallForwarder();\n const signer = useSigner();\n const provider = useProvider();\n\n return useMutation({\n mutationFn: async () => {\n if (!(CoreProxy && Multicall3 && signer && provider)) {\n throw 'OMFG';\n }\n\n const { grants, revokes } = getPermissionDiff(existing, selected);\n\n try {\n const CoreProxyInterface = new ethers.utils.Interface(CoreProxy.abi);\n\n const grantCalls = grants.map((permission) => ({\n target: CoreProxy.address,\n callData: CoreProxyInterface.encodeFunctionData('grantPermission', [\n accountId,\n ethers.utils.formatBytes32String(permission),\n target,\n ]),\n allowFailure: false,\n requireSuccess: true,\n }));\n\n const revokeCalls = revokes.map((permission) => ({\n target: CoreProxy.address,\n callData: CoreProxyInterface.encodeFunctionData('revokePermission', [\n accountId,\n ethers.utils.formatBytes32String(permission),\n target,\n ]),\n allowFailure: false,\n requireSuccess: true,\n }));\n\n const Multicall3Contract = new ethers.Contract(Multicall3.address, Multicall3.abi, signer);\n const txn = await Multicall3Contract.aggregate3([...grantCalls, ...revokeCalls]);\n log('txn', txn);\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n } catch (error: any) {\n throw error;\n }\n },\n });\n};\n","export const permissionsList = ['ADMIN', 'BURN', 'DELEGATE', 'MINT', 'REWARDS', 'WITHDRAW'];\n","import { stringToHash } from './stringToHash';\n\nexport function contractsHash(Contracts: ({ address: string } | undefined)[]) {\n // If any of the contracts are undefined - treat all as undefined.\n // We only care when we have all contracts ready\n if (Contracts.some((Contract) => Contract === undefined)) {\n return '~';\n }\n return stringToHash(\n Contracts.map((Contract) => Contract?.address.toLowerCase() || '')\n .sort()\n .join()\n );\n}\n","export function stringToHash(s: string | undefined) {\n return (s || '').split('').reduce(function (a, b) {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n}\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport function useAccountPermissions(accountId?: ethers.BigNumber) {\n const { data: CoreProxy } = useCoreProxy();\n const { network } = useNetwork();\n const provider = useProvider();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'AccountPermissions',\n { accountId },\n { contractsHash: contractsHash([CoreProxy]) },\n ],\n enabled: Boolean(provider && CoreProxy && accountId),\n queryFn: async function () {\n if (!(provider && CoreProxy && accountId)) throw 'OMFG';\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n const permissions = await CoreProxyContract.getAccountPermissions(accountId);\n return permissions.reduce(\n (\n acc: { [key: string]: string[] },\n { user, permissions }: { user: string; permissions: string[] }\n ) => ({\n ...acc,\n [user.toLowerCase()]: permissions.map((r: string) => ethers.utils.parseBytes32String(r)),\n }),\n {}\n );\n },\n });\n}\n\nexport function useAccountOwner(accountId?: ethers.BigNumber) {\n const { data: AccountProxy } = useAccountProxy();\n const { network } = useNetwork();\n const provider = useProvider();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'AccountOwner',\n { accountId },\n { contractsHash: contractsHash([AccountProxy]) },\n ],\n enabled: Boolean(provider && AccountProxy && accountId),\n queryFn: async function () {\n if (!(provider && AccountProxy && accountId)) throw 'OMFG';\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n provider\n );\n return (await AccountProxyContract.ownerOf(accountId)) as string;\n },\n });\n}\n","/* eslint-disable react/no-unescaped-entities */\nimport { InfoIcon } from '@chakra-ui/icons';\nimport { Text, Tooltip } from '@chakra-ui/react';\n\nexport function PermissionsInfo() {\n return (\n \n \n ADMIN: Full control over the account, except for transferring ownership
\n WITHDRAW: Ability to withdraw collateral from the account\n
\n REWARDS: Ability to claim rewards on behalf of the account\n
\n MINT: Ability to mint snxUSD using the account's collateral\n
\n DELEGATE: Ability to delegate the account's collateral to pools\n
\n \n }\n >\n \n \n );\n}\n","import {\n Badge,\n Button,\n Divider,\n Flex,\n Input,\n Modal,\n ModalBody,\n ModalCloseButton,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalOverlay,\n Spinner,\n Text,\n} from '@chakra-ui/react';\nimport { useAccountOwner, useAccountPermissions } from '@snx-v3/useAccountPermissions';\nimport { useManagePermissions } from '@snx-v3/useManagePermissions';\nimport { ethers, utils } from 'ethers';\nimport { useEffect, useMemo, useState } from 'react';\nimport { permissionsList } from './AccountPermissions';\nimport { PermissionsInfo } from './PermissionsInfo';\n\nexport function PermissionModal({\n accountId,\n isOpen,\n onClose,\n refetch,\n existingPermissions,\n target,\n}: {\n accountId: ethers.BigNumber;\n target?: string;\n existingPermissions?: string[];\n isOpen: boolean;\n onClose: () => void;\n refetch: () => void;\n}) {\n const [address, setAddress] = useState(target || '');\n const [selectedPermissions, setSelectedPermissions] = useState([\n ...(existingPermissions || []),\n ]);\n const { mutateAsync: submit, isPending } = useManagePermissions({\n target: address,\n accountId,\n existing: existingPermissions || [],\n selected: selectedPermissions,\n });\n\n const { data: permissionData } = useAccountPermissions(accountId);\n const { data: accountOwner } = useAccountOwner(accountId);\n\n useEffect(() => {\n if (!isOpen) {\n setSelectedPermissions([...(existingPermissions || [])]);\n }\n }, [existingPermissions, isOpen]);\n\n const isAddressValid = useMemo(() => {\n return (\n utils.isAddress(address) &&\n accountOwner?.toLowerCase() !== address.toLowerCase() &&\n (!!target || (permissionData && !permissionData[address.toLowerCase()]))\n );\n }, [accountOwner, address, permissionData, target]);\n\n const isFormValid = useMemo(() => {\n return selectedPermissions.length > 0 && isAddressValid;\n }, [isAddressValid, selectedPermissions.length]);\n\n return (\n \n \n \n {target ? 'Edit' : 'New'} Permission\n \n \n \n \n {!target && (\n <>\n \n Address\n \n {\n setAddress(e.target.value.trim());\n }}\n value={address}\n isInvalid={!isAddressValid && !!address}\n />\n \n )}\n \n Select Permissions \n \n \n {permissionsList.map((permission) => {\n const isActive = selectedPermissions.includes(permission);\n return (\n \n setSelectedPermissions((state) => {\n if (state.includes(permission)) {\n return state.filter((s) => s !== permission);\n }\n return [...state, permission];\n })\n }\n variant=\"outline\"\n key={permission}\n color={isActive ? 'cyan' : 'gray'}\n textTransform=\"capitalize\"\n cursor=\"pointer\"\n bg=\"gray.900\"\n colorScheme={isActive ? 'cyan' : 'gray'}\n >\n {permission}\n \n );\n })}\n \n \n \n \n {isPending ? (\n \n ) : (\n {\n submit().then(() => {\n setAddress('');\n setSelectedPermissions([]);\n refetch();\n onClose();\n });\n }}\n isDisabled={!isFormValid}\n >\n {target ? 'Update ' : 'Add new '} permissions\n \n )}\n \n \n \n );\n}\n","import { DeleteIcon, EditIcon } from '@chakra-ui/icons';\nimport { Badge, Flex, IconButton, Td, Text, Tr, useDisclosure } from '@chakra-ui/react';\nimport { Address } from '@snx-v3/Address';\nimport { useManagePermissions } from '@snx-v3/useManagePermissions';\nimport { ethers } from 'ethers';\nimport { useEffect } from 'react';\nimport { permissionsList } from './AccountPermissions';\nimport { PermissionModal } from './PermissionModal';\n\nexport function PermissionRow({\n address,\n currentPermissions,\n accountId,\n refetch,\n isOwner,\n}: {\n address: string;\n currentPermissions: string[];\n accountId: ethers.BigNumber;\n refetch: () => void;\n isOwner: boolean;\n}) {\n const {\n isOpen: isPermissionOpen,\n onClose: onPermissionClose,\n onOpen: onPermissionOpen,\n } = useDisclosure();\n\n const {\n mutate: removePermissions,\n isPending,\n isSuccess,\n } = useManagePermissions({\n accountId,\n target: address,\n selected: [],\n existing: currentPermissions,\n });\n\n useEffect(() => {\n if (isSuccess) {\n refetch();\n onPermissionClose();\n }\n }, [isSuccess, onPermissionClose, refetch]);\n\n return (\n \n \n \n
\n \n \n \n \n {permissionsList.map((permission) => {\n const isActive = currentPermissions.includes(permission);\n return (\n \n {permission}\n \n );\n })}\n \n \n\n \n {isOwner && (\n <>\n \n }\n mr=\"2\"\n />\n {\n removePermissions();\n }}\n size=\"sm\"\n aria-label=\"delete\"\n icon={}\n />\n \n )}\n \n \n );\n}\n","import { Skeleton, Td, Text, Tr } from '@chakra-ui/react';\nimport { prettyString } from '@snx-v3/format';\nimport { ethers } from 'ethers';\n\nexport function PermissionTableLoading() {\n const rows = Array.from({ length: 2 }, (_, i) => i);\n return (\n <>\n {rows.map((row) => {\n return (\n \n \n \n \n {prettyString(ethers.constants.AddressZero)}{' '}\n \n \n \n \n -\n \n \n -\n \n \n );\n })}\n \n );\n}\n","/* eslint-disable react/no-unescaped-entities */\nimport {\n Badge,\n Button,\n Flex,\n Heading,\n Skeleton,\n Table,\n TableContainer,\n Tbody,\n Td,\n Text,\n Th,\n Thead,\n Tr,\n useDisclosure,\n} from '@chakra-ui/react';\nimport { Address } from '@snx-v3/Address';\nimport { renderAccountId } from '@snx-v3/format';\nimport { useAccountOwner, useAccountPermissions } from '@snx-v3/useAccountPermissions';\nimport { useWallet } from '@snx-v3/useBlockchain';\nimport { ethers } from 'ethers';\nimport { useMemo } from 'react';\nimport { PermissionModal } from './PermissionModal';\nimport { PermissionRow } from './PermissionRow';\nimport { PermissionsInfo } from './PermissionsInfo';\nimport { PermissionTableLoading } from './PermissionTableLoading';\nimport { TransferOwnershipModal } from './TransferOwnershipModal';\n\nexport function PermissionTable({\n accountId,\n refetchAccounts,\n}: {\n accountId: ethers.BigNumber;\n refetchAccounts: () => void;\n}) {\n const {\n isOpen: isPermissionOpen,\n onClose: onPermissionClose,\n onOpen: onPermissionOpen,\n } = useDisclosure();\n const {\n isOpen: isTransferOpen,\n onClose: onTransferClose,\n onOpen: onTransferOpen,\n } = useDisclosure();\n\n const { activeWallet } = useWallet();\n const { data: permissions, isLoading, refetch } = useAccountPermissions(accountId);\n const {\n data: accountOwner,\n isLoading: loadingOwner,\n refetch: refetchAccountOwner,\n } = useAccountOwner(accountId);\n\n const isOwner = useMemo(\n () => !!(accountOwner && accountOwner?.toLowerCase() === activeWallet?.address.toLowerCase()),\n [accountOwner, activeWallet?.address]\n );\n return (\n <>\n \n \n \n Account {renderAccountId(accountId)}\n \n {isOwner && (\n {\n onPermissionOpen();\n }}\n >\n + New Permission\n \n )}\n \n \n \n \n \n Address\n \n \n Permissions\n \n \n \n \n \n\n \n \n \n \n \n \n\n {isLoading && }\n\n {!isLoading &&\n permissions &&\n Object.keys(permissions)\n .filter((target) => permissions[target]?.length > 0)\n .map((target) => (\n \n ))}\n \n
\n \n {accountOwner && (\n \n
\n \n )}\n \n
\n \n OWNER\n \n \n {isOwner && (\n {\n onTransferOpen();\n }}\n >\n Transfer Ownership\n \n )}\n
\n \n\n \n {accountOwner ? (\n {\n refetch();\n refetchAccountOwner();\n refetchAccounts();\n }}\n />\n ) : null}\n \n );\n}\n","export const DelegationIcon = () => {\n return (\n \n \n \n \n \n \n );\n};\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useWallet } from '@snx-v3/useBlockchain';\nimport { useTrustedMulticallForwarder } from '@snx-v3/useTrustedMulticallForwarder';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useAccounts');\n\nexport function useAccounts() {\n const { activeWallet } = useWallet();\n const { network } = useNetwork();\n const provider = useProvider();\n const { data: AccountProxy } = useAccountProxy();\n const { data: Multicall3 } = useTrustedMulticallForwarder();\n const walletAddress = activeWallet?.address;\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'Accounts',\n { walletAddress },\n { contractsHash: contractsHash([AccountProxy, Multicall3]) },\n ],\n enabled: Boolean(provider && walletAddress && AccountProxy && Multicall3),\n queryFn: async function (): Promise {\n if (!(provider && walletAddress && AccountProxy && Multicall3)) throw 'OMFG';\n\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n provider\n );\n const Multicall3Contract = new ethers.Contract(Multicall3.address, Multicall3.abi, provider);\n\n log('walletAddress', walletAddress);\n const numberOfAccountTokens = await AccountProxyContract.balanceOf(walletAddress);\n log('numberOfAccountTokens', numberOfAccountTokens);\n\n if (numberOfAccountTokens.eq(0)) {\n // No accounts created yet\n return [];\n }\n const accountIndexes: number[] = Array.from(Array(numberOfAccountTokens.toNumber()).keys());\n log('accountIndexes', accountIndexes);\n\n const calls = accountIndexes.map((index) => ({\n target: AccountProxy.address,\n callData: AccountProxyContract.interface.encodeFunctionData('tokenOfOwnerByIndex', [\n walletAddress,\n index,\n ]),\n }));\n\n const multicallResponse = await Multicall3Contract.callStatic.aggregate3(calls);\n log('multicallResponse', multicallResponse);\n\n const accounts = accountIndexes.map((index) => {\n const { returnData } = multicallResponse[index];\n const [tokenOfOwnerByIndex] = AccountProxyContract.interface.decodeFunctionResult(\n 'tokenOfOwnerByIndex',\n returnData\n );\n return tokenOfOwnerByIndex;\n });\n log('accounts', accounts);\n\n return accounts;\n },\n });\n}\n","import { Button, Flex, Heading, Link, Text } from '@chakra-ui/react';\nimport { useAccounts } from '@snx-v3/useAccounts';\nimport { DelegationIcon } from './DelegationIcon';\nimport { PermissionTable } from './PermissionTable';\n\nexport function Permissions() {\n const { data: accounts, refetch: refetchAccounts } = useAccounts();\n\n return (\n \n \n {accounts?.map((accountId) => (\n \n ))}\n \n \n \n \n Delegate Permissions\n \n \n Delegation enables a wallet to execute functions on behalf of another wallet/account:\n lock, borrow, withdraw, claim, but not transfer. Manage addresses and their powers below.\n \n \n \n \n \n \n );\n}\n","import { Flex, Heading } from '@chakra-ui/react';\nimport { Permissions } from '@snx-v3/Permissions';\nimport { Helmet } from 'react-helmet';\n\nexport function AccountSettingsPage() {\n return (\n <>\n \n Synthetix Account Settings\n \n \n \n \n Account Settings\n \n \n \n \n );\n}\n","import { Flex, Skeleton } from '@chakra-ui/react';\n\nexport const PoolCardsLoading = () => (\n <>\n {Array.from(Array(3).keys()).map((i) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ))}\n \n);\n","export function numberWithCommas(value: string, decimals?: number) {\n const parts = value.split('.');\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n const joinedParts = parts.join('.');\n return decimals ? joinedParts.substring(0, joinedParts.indexOf('.') + decimals + 1) : joinedParts;\n}\n\nexport const formatNumberToUsd = (value: number, options?: Intl.NumberFormatOptions) => {\n return new Intl.NumberFormat('en-EN', {\n style: 'currency',\n currency: 'USD',\n ...options,\n }).format(Number(value));\n};\n\nexport const formatNumber = (value: number, options?: Intl.NumberFormatOptions) => {\n return new Intl.NumberFormat('en-EN', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n ...options,\n }).format(Number(value));\n};\n\nexport const formatPercent = (value: number, options?: Intl.NumberFormatOptions) => {\n return new Intl.NumberFormat('en-EN', {\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n style: 'percent',\n ...options,\n }).format(Number(value));\n};\n","import { Image, type ImageProps } from '@chakra-ui/react';\n\nexport function TokenIcon({\n symbol,\n width = 30,\n height = 30,\n ...props\n}: ImageProps & {\n symbol?: string;\n width?: number;\n height?: number;\n}) {\n const src = `https://assets.synthetix.io/collateral/${\n symbol ? symbol.toUpperCase() : 'UNKNOWN'\n }.svg`;\n\n return (\n \n );\n}\n\nexport const SynthIcon = ({\n symbol,\n width = 30,\n height = 30,\n ...props\n}: ImageProps & {\n symbol?: string;\n width?: number;\n height?: number;\n}) => {\n const src = `https://assets.synthetix.io/synths/${symbol ?? 'UNKNOWN'}.svg`;\n return (\n \n );\n};\n","import { Tooltip as ChakraTooltip, type TooltipProps } from '@chakra-ui/react';\n\nexport const Tooltip = ({ ...props }: TooltipProps) => {\n return ;\n};\n","import { getAprUrl } from '@snx-v3/constants';\nimport { ARBITRUM, BASE_ANDROMEDA, MAINNET, Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport type PositionAPR = {\n poolId: number;\n collateralType: string;\n apr28d: number;\n apr28dPnl: number;\n apr28dRewards: number;\n apr28dPerformance: number;\n apr24hIncentiveRewards: number;\n};\n\nconst supportedAprNetworks = [BASE_ANDROMEDA.id, ARBITRUM.id, MAINNET.id];\n\nexport async function fetchApr(networkId?: number) {\n try {\n const isSupported = networkId && supportedAprNetworks.includes(networkId);\n if (!isSupported) {\n throw new Error(`APR endpoint not supported for network ${networkId}`);\n }\n const response = await fetch(getAprUrl(networkId));\n const data: PositionAPR[] = await response.json();\n\n // Math.max(...data.map(({ apr28d }: { apr28d: number }) => apr28d)) * 100\n return data;\n } catch (error) {\n console.error(error);\n return [];\n }\n}\n\nexport function useApr(customNetwork?: Network) {\n const { network } = useNetwork();\n const chain = customNetwork || network;\n\n return useQuery({\n queryKey: ['apr', chain?.id],\n queryFn: async () => {\n try {\n return await fetchApr(chain?.id);\n } catch (error) {\n return;\n }\n },\n staleTime: 60000,\n enabled: Boolean(chain?.id),\n });\n}\n","export const isBaseAndromeda = (id?: number | string, preset?: string) =>\n (id?.toString() === '8453' || '84532') && preset === 'andromeda';\n\nexport function getSpotMarketId(collateralSymbol?: string) {\n switch (collateralSymbol?.toLowerCase()) {\n case 'usdc':\n case 'susdc':\n return USDC_BASE_MARKET;\n\n case 'statausdc':\n case 'sstatausdc':\n case 'stataUSDC':\n return STATA_BASE_MARKET;\n\n default:\n return USDC_BASE_MARKET;\n }\n}\n\nexport const USDC_BASE_MARKET = '1';\nexport const STATA_BASE_MARKET = '3';\n","import { calculateCompoundedRate } from '@aave/math-utils';\nimport { isBaseAndromeda } from '@snx-v3/isBaseAndromeda';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useStataUSDCApr(networkId?: number, preset?: string) {\n return useQuery({\n enabled: isBaseAndromeda(networkId, preset),\n queryKey: ['useStataUSDCAPR', networkId],\n queryFn: async () => {\n const subgraphResponse = await fetch(\n 'https://gateway.thegraph.com/api/f55095f3203bcba72cbee045322be46c/subgraphs/id/GQFbb95cE6d8mV989mL5figjaGaKCQB3xqYrr1bRyXqF',\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ query }),\n }\n );\n\n const data = await subgraphResponse.json();\n const stataStats = data.data.reserves.filter(\n (reserve: Record) =>\n reserve.underlyingAsset === '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'\n )[0];\n try {\n return Number(\n calculateCompoundedRate({\n rate: stataStats.liquidityRate,\n duration: 31536000, // seconds per year\n })\n .toNumber()\n .toPrecision(2)\n .split('e')[0]\n );\n } catch (_) {\n return 0;\n }\n },\n });\n}\n\nconst query = `\n query {\n reserves {\n underlyingAsset\n liquidityRate\n }\n }\n`;\n","import { importSynthTokens } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useSynthTokens(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'SynthTokens'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importSynthTokens(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","export async function importSynthTokens(\n chainId?: number,\n preset?: string\n): Promise<\n {\n synthMarketId: string;\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n\n // undefined for some synths (like Synthetic USDe on Mainnet)\n token?: {\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n };\n }[]\n> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '11155111-main': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '10-main': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '8453-andromeda': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '84532-andromeda': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '42161-main': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/synthTokens.json'),\n ]);\n return synthTokens;\n }\n case '421614-main': {\n const [{ default: synthTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/synthTokens.json'),\n ]);\n return synthTokens;\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for SynthTokens`);\n }\n }\n}\n","import { Network } from '@snx-v3/useBlockchain';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport React from 'react';\n\nexport function useIsAndromedaStataUSDC({\n tokenAddress,\n customNetwork,\n}: {\n tokenAddress?: string;\n customNetwork?: Network;\n}) {\n const { data: synthTokens } = useSynthTokens(customNetwork);\n return React.useMemo(() => {\n if (!synthTokens) {\n return false;\n }\n if (!tokenAddress) {\n return false;\n }\n const addr = tokenAddress?.toLowerCase();\n const isAndromedaStataUSDC = synthTokens.some(\n (synthToken) =>\n synthToken.symbol === 'sStataUSDC' && addr === synthToken.address.toLowerCase()\n );\n return isAndromedaStataUSDC;\n }, [tokenAddress, synthTokens]);\n}\n","const abi = [\n 'constructor(address pool, address rewardsController)',\n 'error ECDSAInvalidSignature()',\n 'error ECDSAInvalidSignatureLength(uint256 length)',\n 'error ECDSAInvalidSignatureS(bytes32 s)',\n 'error SafeERC20FailedOperation(address token)',\n 'event Approval(address indexed owner, address indexed spender, uint256 amount)',\n 'event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares)',\n 'event Initialized(uint8 version)',\n 'event Initialized(address indexed aToken, string staticATokenName, string staticATokenSymbol)',\n 'event RewardTokenRegistered(address indexed reward, uint256 startIndex)',\n 'event Transfer(address indexed from, address indexed to, uint256 amount)',\n 'event Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)',\n 'function DOMAIN_SEPARATOR() view returns (bytes32)',\n 'function INCENTIVES_CONTROLLER() view returns (address)',\n 'function METADEPOSIT_TYPEHASH() view returns (bytes32)',\n 'function METAWITHDRAWAL_TYPEHASH() view returns (bytes32)',\n 'function PERMIT_TYPEHASH() view returns (bytes32)',\n 'function POOL() view returns (address)',\n 'function STATIC__ATOKEN_LM_REVISION() view returns (uint256)',\n 'function aToken() view returns (address)',\n 'function allowance(address, address) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n 'function asset() view returns (address)',\n 'function balanceOf(address) view returns (uint256)',\n 'function claimRewards(address receiver, address[] rewards)',\n 'function claimRewardsOnBehalf(address onBehalfOf, address receiver, address[] rewards)',\n 'function claimRewardsToSelf(address[] rewards)',\n 'function collectAndUpdateRewards(address reward) returns (uint256)',\n 'function convertToAssets(uint256 shares) view returns (uint256)',\n 'function convertToShares(uint256 assets) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n 'function deposit(uint256 assets, address receiver, uint16 referralCode, bool depositToAave) returns (uint256)',\n 'function deposit(uint256 assets, address receiver) returns (uint256)',\n 'function getClaimableRewards(address user, address reward) view returns (uint256)',\n 'function getCurrentRewardsIndex(address reward) view returns (uint256)',\n 'function getTotalClaimableRewards(address reward) view returns (uint256)',\n 'function getUnclaimedRewards(address user, address reward) view returns (uint256)',\n 'function initialize(address newAToken, string staticATokenName, string staticATokenSymbol)',\n 'function isRegisteredRewardToken(address reward) view returns (bool)',\n 'function maxDeposit(address) view returns (uint256)',\n 'function maxMint(address) view returns (uint256)',\n 'function maxRedeem(address owner) view returns (uint256)',\n 'function maxWithdraw(address owner) view returns (uint256)',\n 'function metaDeposit(address depositor, address receiver, uint256 assets, uint16 referralCode, bool depositToAave, uint256 deadline, tuple(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) permit, tuple(uint8 v, bytes32 r, bytes32 s) sigParams) returns (uint256)',\n 'function metaWithdraw(address owner, address receiver, uint256 shares, uint256 assets, bool withdrawFromAave, uint256 deadline, tuple(uint8 v, bytes32 r, bytes32 s) sigParams) returns (uint256, uint256)',\n 'function mint(uint256 shares, address receiver) returns (uint256)',\n 'function name() view returns (string)',\n 'function nonces(address) view returns (uint256)',\n 'function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)',\n 'function previewDeposit(uint256 assets) view returns (uint256)',\n 'function previewMint(uint256 shares) view returns (uint256)',\n 'function previewRedeem(uint256 shares) view returns (uint256)',\n 'function previewWithdraw(uint256 assets) view returns (uint256)',\n 'function rate() view returns (uint256)',\n 'function redeem(uint256 shares, address receiver, address owner) returns (uint256)',\n 'function redeem(uint256 shares, address receiver, address owner, bool withdrawFromAave) returns (uint256, uint256)',\n 'function refreshRewardTokens()',\n 'function rewardTokens() view returns (address[])',\n 'function symbol() view returns (string)',\n 'function totalAssets() view returns (uint256)',\n 'function totalSupply() view returns (uint256)',\n 'function transfer(address to, uint256 amount) returns (bool)',\n 'function transferFrom(address from, address to, uint256 amount) returns (bool)',\n 'function withdraw(uint256 assets, address receiver, address owner) returns (uint256)',\n];\n\nexport async function importStaticAaveUSDC(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '8453-andromeda': {\n const [{ default: meta }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n ]);\n\n return {\n address: meta.contracts.CollateralToken_stataBasUSDC,\n abi,\n };\n }\n // CollateralToken_stataBasUSDC.readable.json\n case '84532-andromeda': {\n const [{ default: meta }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n ]);\n\n return {\n address: meta.contracts.CollateralToken_stataUSDC,\n abi,\n };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for Extras`);\n }\n }\n}\n","import { importStaticAaveUSDC } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useStaticAaveUSDC(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'StaticAaveUSDC'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importStaticAaveUSDC(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useStaticAaveUSDC } from '@snx-v3/useStaticAaveUSDC';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport function useStaticAaveUSDCRate(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n const { data: StaticAaveUSDC } = useStaticAaveUSDC(targetNetwork);\n const provider = useProviderForChain(targetNetwork);\n return useQuery({\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'StaticAaveUSDC Rate',\n { contractsHash: contractsHash([StaticAaveUSDC]) },\n ],\n enabled: Boolean(provider && StaticAaveUSDC),\n queryFn: async function () {\n if (!(provider && StaticAaveUSDC)) throw new Error('OMFG');\n const StaticAaveUSDCContract = new ethers.Contract(\n StaticAaveUSDC.address,\n StaticAaveUSDC.abi,\n provider\n );\n const rate = await StaticAaveUSDCContract.rate();\n\n // IMPORTANT: 27 decimals!\n return rate;\n },\n });\n}\n","import { Network, useNetwork, useProviderForChain, useWallet } from '@snx-v3/useBlockchain';\nimport { wei } from '@synthetixio/wei';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport const tokenAbi = [\n 'function balanceOf(address) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n];\n\nexport const useTokenBalance = (tokenAddress?: string, customNetwork?: Network) => {\n const { activeWallet } = useWallet();\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n const provider = useProviderForChain(targetNetwork);\n const walletAddress = activeWallet?.address;\n return useQuery({\n enabled: Boolean(walletAddress && tokenAddress && provider && targetNetwork),\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'TokenBalance',\n { accountAddress: walletAddress, tokenAddress },\n ],\n queryFn: async () => {\n if (!(walletAddress && tokenAddress && provider && targetNetwork)) {\n throw 'OMFG';\n }\n\n const TokenContract = new ethers.Contract(tokenAddress, tokenAbi, provider);\n const [balance, decimals] = await Promise.all([\n TokenContract.balanceOf(walletAddress),\n TokenContract.decimals(),\n ]);\n return { balance, decimals };\n },\n select: ({ balance, decimals }) => wei(balance, decimals),\n refetchInterval: 120_000,\n });\n};\n\nexport const useTokenBalances = (tokenAddresses: string[], customNetwork?: Network) => {\n const { activeWallet } = useWallet();\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n const provider = useProviderForChain(targetNetwork);\n const walletAddress = activeWallet?.address;\n\n const queryClient = useQueryClient();\n return useQuery({\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'TokenBalance',\n {\n accountAddress: walletAddress,\n tokenAddresses: tokenAddresses.map((a) => a.slice(2, 6).toLowerCase()).sort(),\n },\n ],\n enabled: Boolean(walletAddress && tokenAddresses.length && provider && targetNetwork),\n\n queryFn: async () => {\n if (!(walletAddress && tokenAddresses.length && provider && targetNetwork)) {\n throw 'OMFG';\n }\n\n return await Promise.all(\n tokenAddresses.map(async (tokenAddress) => {\n const TokenContract = new ethers.Contract(tokenAddress, tokenAbi, provider);\n const [balance, decimals] = await Promise.all([\n TokenContract.balanceOf(walletAddress),\n TokenContract.decimals(),\n ]);\n queryClient.setQueryData(\n [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'TokenBalance',\n {\n accountAddress: walletAddress,\n tokenAddresses: tokenAddresses.map((a) => a.slice(2, 6).toLowerCase()).sort(),\n },\n ],\n { balance, decimals }\n );\n return { balance, decimals };\n })\n );\n },\n select: (balances) => balances.map(({ balance, decimals }) => wei(balance, decimals)),\n refetchInterval: 120_000,\n });\n};\n","const abi = [\n 'error InsufficientAllowance(uint256 required, uint256 existing)',\n 'error InsufficientBalance(uint256 required, uint256 existing)',\n 'event Approval(address indexed owner, address indexed spender, uint256 amount)',\n 'event Transfer(address indexed from, address indexed to, uint256 amount)',\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n 'function balanceOf(address owner) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n 'function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)',\n 'function increaseAllowance(address spender, uint256 addedValue) returns (bool)',\n 'function name() view returns (string)',\n 'function symbol() view returns (string)',\n 'function totalSupply() view returns (uint256)',\n 'function transfer(address to, uint256 amount) returns (bool)',\n 'function transferFrom(address from, address to, uint256 amount) returns (bool)',\n];\n\nexport async function importUSDC(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n return { address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi };\n }\n case '11155111-main': {\n return { address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', abi };\n }\n case '10-main': {\n return { address: '0x0b2c639c533813f4aa9d7837caf62653d097ff85', abi };\n }\n case '8453-andromeda': {\n return { address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', abi };\n }\n case '84532-andromeda': {\n return { address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', abi };\n }\n case '42161-main': {\n return { address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', abi };\n }\n case '421614-main': {\n return { address: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for USDC`);\n }\n }\n}\n","import { importUSDC } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useUSDC(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'USDC'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importUSDC(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { Button, Fade, Flex, Link, Text } from '@chakra-ui/react';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { formatNumber, formatNumberToUsd } from '@snx-v3/formatters';\nimport { Sparkles } from '@snx-v3/icons';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useApr } from '@snx-v3/useApr';\nimport { useStataUSDCApr } from '@snx-v3/useApr/useStataUSDCApr';\nimport { Network, NetworkIcon, useNetwork, useWallet } from '@snx-v3/useBlockchain';\nimport { CollateralType } from '@snx-v3/useCollateralTypes';\nimport { useIsAndromedaStataUSDC } from '@snx-v3/useIsAndromedaStataUSDC';\nimport { makeSearch, useParams } from '@snx-v3/useParams';\nimport { useStaticAaveUSDCRate } from '@snx-v3/useStaticAaveUSDCRate';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { wei } from '@synthetixio/wei';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\ninterface CollateralTypeWithDeposited extends CollateralType {\n collateralDeposited: string;\n}\n\nexport function PoolRow({\n pool: _pool,\n network,\n collateralType,\n collateralPrices,\n}: {\n collateralType: CollateralTypeWithDeposited;\n pool: {\n name: string;\n id: string;\n };\n network: Network;\n collateralPrices?: {\n symbol: string;\n price: ethers.BigNumber;\n }[];\n}) {\n const [params, setParams] = useParams();\n\n const { data: synthTokens } = useSynthTokens();\n const wrapperToken = React.useMemo(() => {\n if (synthTokens && collateralType) {\n return synthTokens.find((synth) => synth.address === collateralType.tokenAddress)?.token\n ?.address;\n }\n }, [collateralType, synthTokens]);\n\n const { data: stataUSDCApr } = useStataUSDCApr(network.id, network.preset);\n\n // TODO: This will need refactoring\n const balanceAddress =\n network?.preset === 'andromeda' ? wrapperToken : collateralType?.tokenAddress;\n\n const { data: stataUSDCRate } = useStaticAaveUSDCRate();\n const { data: tokenBalance } = useTokenBalance(balanceAddress, network);\n\n const { data: USDCToken } = useUSDC(network);\n const { data: usdcBalance } = useTokenBalance(USDCToken?.address, network);\n\n const { network: currentNetwork, setNetwork } = useNetwork();\n const { connect } = useWallet();\n\n const isAndromedaStataUSDC = useIsAndromedaStataUSDC({\n tokenAddress: collateralType?.tokenAddress,\n customNetwork: network,\n });\n\n const balance = React.useMemo(() => {\n if (!isAndromedaStataUSDC || !stataUSDCRate) {\n return tokenBalance || ZEROWEI;\n }\n\n return ((usdcBalance || ZEROWEI).div(wei(stataUSDCRate, 27)) || ZEROWEI).add(\n tokenBalance || ZEROWEI\n );\n }, [isAndromedaStataUSDC, stataUSDCRate, tokenBalance, usdcBalance]);\n\n const price = wei(\n collateralPrices?.find(\n (price) => price.symbol.toUpperCase() === collateralType.symbol.toUpperCase()\n )?.price ?? 0\n );\n\n const { data: apr, isPending: isPendingApr } = useApr(network);\n const positionApr = React.useMemo(() => {\n if (apr && collateralType) {\n return apr.find(\n (item) => item.collateralType.toLowerCase() === collateralType.tokenAddress.toLowerCase()\n );\n }\n }, [apr, collateralType]);\n\n const onClick = async (e: React.MouseEvent) => {\n e.preventDefault();\n try {\n if (!currentNetwork) {\n await connect();\n return;\n }\n if (currentNetwork.id !== network.id) {\n if (!(await setNetwork(network.id))) {\n return;\n }\n }\n setParams({\n page: 'position',\n collateralSymbol: collateralType.symbol,\n manageAction: 'deposit',\n accountId: params.accountId,\n });\n } catch (error) {\n console.error(error);\n }\n };\n\n const buttonText = !currentNetwork ? 'Connect Wallet' : 'Deposit';\n\n const order = React.useMemo(\n () =>\n wei(collateralType.collateralDeposited, Number(collateralType.decimals), true)\n .mul(price)\n .toNumber()\n .toFixed(0),\n [collateralType.collateralDeposited, collateralType.decimals, price]\n );\n\n return (\n \n \n \n \n \n \n \n \n \n {collateralType.displaySymbol}\n \n \n {network.name} Network\n \n \n \n\n \n \n {balance ? formatNumberToUsd(balance.mul(price).toNumber()) : '-'}\n \n \n {balance ? formatNumber(balance.toNumber()) : ''} {collateralType.displaySymbol}\n \n \n\n \n \n {price\n ? formatNumberToUsd(\n wei(collateralType.collateralDeposited, Number(collateralType.decimals), true)\n .mul(price)\n .toNumber(),\n {\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n }\n )\n : 0}\n \n \n\n \n \n {isPendingApr ? (\n '~'\n ) : positionApr ? (\n <>\n {(\n positionApr.apr28dPerformance * 100 +\n (isAndromedaStataUSDC && stataUSDCApr ? stataUSDCApr : 0) +\n positionApr.apr24hIncentiveRewards * 100\n )\n .toFixed(2)\n .concat('%')}\n\n \n \n Performance:\n {(positionApr.apr28dPerformance * 100).toFixed(2).concat('%')}\n \n {positionApr.apr24hIncentiveRewards > 0 && (\n \n Rewards: \n \n {(positionApr.apr24hIncentiveRewards * 100).toFixed(2).concat('%')}\n \n \n )}\n {isAndromedaStataUSDC && stataUSDCApr ? (\n \n AAVE yield: \n {stataUSDCApr.toFixed(2).concat('%')}\n \n ) : null}\n \n }\n >\n \n \n \n \n \n ) : (\n '-'\n )}\n \n \n \n \n {buttonText}\n \n \n \n \n );\n}\n","function filterDeprecated(feedId: string) {\n return ![\n //\n '0x5c6c0d2386e3352356c3ab84434fafb5ea067ac2678a38a338c4a69ddc4bdb0c', // FTM\n ].includes(feedId);\n}\n\nexport async function importPythFeeds(chainId?: number, preset?: string): Promise {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '11155111-main': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '10-main': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '8453-andromeda': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '84532-andromeda': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '42161-main': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n case '421614-main': {\n const [{ default: pythFeeds }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/pythFeeds.json'),\n ]);\n return pythFeeds.filter(filterDeprecated);\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for pythFeeds`);\n }\n }\n}\n","// [\n// \"constructor()\",\n// \"error InsufficientFee()\",\n// \"error InvalidArgument()\",\n// \"error InvalidGovernanceDataSource()\",\n// \"error InvalidGovernanceMessage()\",\n// \"error InvalidGovernanceTarget()\",\n// \"error InvalidUpdateData()\",\n// \"error InvalidUpdateDataSource()\",\n// \"error InvalidWormholeAddressToSet()\",\n// \"error InvalidWormholeVaa()\",\n// \"error NoFreshUpdate()\",\n// \"error OldGovernanceMessage()\",\n// \"error PriceFeedNotFound()\",\n// \"error PriceFeedNotFoundWithinRange()\",\n// \"error StalePrice()\",\n// \"event AdminChanged(address previousAdmin, address newAdmin)\",\n// \"event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber)\",\n// \"event BeaconUpgraded(address indexed beacon)\",\n// \"event ContractUpgraded(address oldImplementation, address newImplementation)\",\n// \"event DataSourcesSet(tuple(uint16 chainId, bytes32 emitterAddress)[] oldDataSources, tuple(uint16 chainId, bytes32 emitterAddress)[] newDataSources)\",\n// \"event FeeSet(uint256 oldFee, uint256 newFee)\",\n// \"event GovernanceDataSourceSet(tuple(uint16 chainId, bytes32 emitterAddress) oldDataSource, tuple(uint16 chainId, bytes32 emitterAddress) newDataSource, uint64 initialSequence)\",\n// \"event Initialized(uint8 version)\",\n// \"event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)\",\n// \"event PriceFeedUpdate(bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf)\",\n// \"event Upgraded(address indexed implementation)\",\n// \"event ValidPeriodSet(uint256 oldValidPeriod, uint256 newValidPeriod)\",\n// \"event WormholeAddressSet(address oldWormholeAddress, address newWormholeAddress)\",\n// \"function chainId() view returns (uint16)\",\n// \"function executeGovernanceInstruction(bytes encodedVM)\",\n// \"function getEmaPrice(bytes32 id) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getEmaPriceNoOlderThan(bytes32 id, uint256 age) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getEmaPriceUnsafe(bytes32 id) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getPrice(bytes32 id) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getPriceNoOlderThan(bytes32 id, uint256 age) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getPriceUnsafe(bytes32 id) view returns (tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price)\",\n// \"function getUpdateFee(bytes[] updateData) view returns (uint256 feeAmount)\",\n// \"function getUpdateFee(uint256 updateDataSize) view returns (uint256 feeAmount)\",\n// \"function getValidTimePeriod() view returns (uint256)\",\n// \"function governanceDataSource() view returns (tuple(uint16 chainId, bytes32 emitterAddress))\",\n// \"function governanceDataSourceIndex() view returns (uint32)\",\n// \"function hashDataSource(tuple(uint16 chainId, bytes32 emitterAddress) ds) pure returns (bytes32)\",\n// \"function initialize(address wormhole, uint16[] dataSourceEmitterChainIds, bytes32[] dataSourceEmitterAddresses, uint16 governanceEmitterChainId, bytes32 governanceEmitterAddress, uint64 governanceInitialSequence, uint256 validTimePeriodSeconds, uint256 singleUpdateFeeInWei)\",\n// \"function isValidDataSource(uint16 dataSourceChainId, bytes32 dataSourceEmitterAddress) view returns (bool)\",\n// \"function isValidGovernanceDataSource(uint16 governanceChainId, bytes32 governanceEmitterAddress) view returns (bool)\",\n// \"function lastExecutedGovernanceSequence() view returns (uint64)\",\n// \"function latestPriceInfoPublishTime(bytes32 priceId) view returns (uint64)\",\n// \"function owner() view returns (address)\",\n// \"function parseAuthorizeGovernanceDataSourceTransferPayload(bytes encodedPayload) pure returns (tuple(bytes claimVaa) sgds)\",\n// \"function parseGovernanceInstruction(bytes encodedInstruction) pure returns (tuple(uint8 module, uint8 action, uint16 targetChainId, bytes payload) gi)\",\n// \"function parsePriceFeedUpdates(bytes[] updateData, bytes32[] priceIds, uint64 minPublishTime, uint64 maxPublishTime) payable returns (tuple(bytes32 id, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) emaPrice)[] priceFeeds)\",\n// \"function parsePriceFeedUpdatesUnique(bytes[] updateData, bytes32[] priceIds, uint64 minPublishTime, uint64 maxPublishTime) payable returns (tuple(bytes32 id, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) emaPrice)[] priceFeeds)\",\n// \"function parseRequestGovernanceDataSourceTransferPayload(bytes encodedPayload) pure returns (tuple(uint32 governanceDataSourceIndex) sgdsClaim)\",\n// \"function parseSetDataSourcesPayload(bytes encodedPayload) pure returns (tuple(tuple(uint16 chainId, bytes32 emitterAddress)[] dataSources) sds)\",\n// \"function parseSetFeePayload(bytes encodedPayload) pure returns (tuple(uint256 newFee) sf)\",\n// \"function parseSetValidPeriodPayload(bytes encodedPayload) pure returns (tuple(uint256 newValidPeriod) svp)\",\n// \"function parseSetWormholeAddressPayload(bytes encodedPayload) pure returns (tuple(address newWormholeAddress) sw)\",\n// \"function parseUpgradeContractPayload(bytes encodedPayload) pure returns (tuple(address newImplementation) uc)\",\n// \"function priceFeedExists(bytes32 id) view returns (bool)\",\n// \"function proxiableUUID() view returns (bytes32)\",\n// \"function pythUpgradableMagic() pure returns (uint32)\",\n// \"function queryPriceFeed(bytes32 id) view returns (tuple(bytes32 id, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) price, tuple(int64 price, uint64 conf, int32 expo, uint256 publishTime) emaPrice) priceFeed)\",\n// \"function renounceOwnership()\",\n// \"function singleUpdateFeeInWei() view returns (uint256)\",\n// \"function transferOwnership(address newOwner)\",\n// \"function updatePriceFeeds(bytes[] updateData) payable\",\n// \"function updatePriceFeedsIfNecessary(bytes[] updateData, bytes32[] priceIds, uint64[] publishTimes) payable\",\n// \"function upgradeTo(address newImplementation)\",\n// \"function upgradeToAndCall(address newImplementation, bytes data) payable\",\n// \"function validDataSources() view returns (tuple(uint16 chainId, bytes32 emitterAddress)[])\",\n// \"function validTimePeriodSeconds() view returns (uint256)\",\n// \"function version() pure returns (string)\",\n// \"function wormhole() view returns (address)\"\n// ]\nconst abi = ['function updatePriceFeeds(bytes[] updateData) payable'];\n\nexport async function importPythVerifier(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n\n switch (deployment) {\n case '1-main': {\n return {\n address: '0x4305FB66699C3B2702D4d05CF36551390A4c69C6',\n abi,\n };\n }\n case '11155111-main': {\n return {\n address: '0xDd24F84d36BF92C65F92307595335bdFab5Bbd21',\n abi,\n };\n }\n case '10-main': {\n return {\n address: '0xff1a0f4744e8582DF1aE09D5611b887B6a12925C',\n abi,\n };\n }\n case '8453-andromeda': {\n return {\n address: '0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a',\n abi,\n };\n }\n case '84532-andromeda': {\n return {\n address: '0xA2aa501b19aff244D90cc15a4Cf739D2725B5729',\n abi,\n };\n }\n case '42161-main': {\n return {\n address: '0xff1a0f4744e8582DF1aE09D5611b887B6a12925C',\n abi,\n };\n }\n case '421614-main': {\n return {\n address: '0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF',\n abi,\n };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for Extras`);\n }\n }\n}\n","import { getSubgraphUrl, POOL_ID } from '@snx-v3/constants';\nimport { ARBITRUM, BASE_ANDROMEDA, MAINNET, NETWORKS } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nconst supportedNetworks = [MAINNET.id, BASE_ANDROMEDA.id, ARBITRUM.id];\n\nexport const networksOffline = NETWORKS.filter(\n (n) => supportedNetworks.includes(n.id) && n.isSupported\n).map((n) => n);\n\nasync function fetchPoolsList() {\n const urls = networksOffline.map((network) => getSubgraphUrl(network.name));\n\n // Fetch all the pools from the subgraphs\n const responses = await Promise.all(\n urls.map((url) =>\n fetch(url, { method: 'POST', body: JSON.stringify({ query: PoolsListData }) }).then((res) =>\n res.json()\n )\n )\n );\n\n return responses.map((response, i) => ({\n network: networksOffline[i],\n poolInfo: (response?.data?.vaults ?? []) as PoolInfo[],\n }));\n}\n\nconst gql = (data: TemplateStringsArray) => data[0];\n\nconst PoolsListData = gql`\n query PoolsListData {\n vaults(where: { pool: \"1\" }) {\n collateral_type {\n id\n oracle_node_id\n total_amount_deposited\n }\n pool {\n name\n id\n }\n }\n }\n`;\n\ninterface PoolInfo {\n collateral_type: {\n id: string;\n oracle_node_id: string;\n total_amount_deposited: string;\n };\n pool: {\n name: string;\n id: string;\n };\n}\n\nexport function usePoolsList() {\n return useQuery({\n queryKey: ['poolsList'],\n queryFn: async () => {\n return fetchPoolsList();\n },\n staleTime: 60000 * 10,\n });\n}\n\nexport function usePool(networkId?: number) {\n const { data, isPending } = usePoolsList();\n\n return {\n data: data?.find((p) => p?.network?.id === networkId && p?.poolInfo?.[0]?.pool?.id === POOL_ID),\n isPending,\n };\n}\n","import { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js';\nimport { offchainMainnetEndpoint } from '@snx-v3/constants';\nimport {\n importExtras,\n importPythERC7412Wrapper,\n importPythFeeds,\n importPythVerifier,\n importTrustedMulticallForwarder,\n} from '@snx-v3/contracts';\nimport { parseUnits } from '@snx-v3/format';\nimport { Network, useNetwork, useProvider, useWallet } from '@snx-v3/useBlockchain';\nimport { networksOffline } from '@snx-v3/usePoolsList';\nimport { wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nconst priceService = new EvmPriceServiceConnection(offchainMainnetEndpoint);\n\nfunction getAllPriceIdsEntries(extras: any) {\n return Array.from(\n new Set(\n Object.entries(extras).filter(\n ([key, value]) =>\n String(value).length === 66 &&\n (key.startsWith('pyth_feed_id_') || (key.startsWith('pyth') && key.endsWith('FeedId')))\n )\n )\n );\n}\n\nexport async function getPythFeedIds(network: Network) {\n return await importPythFeeds(network.id, network.preset);\n}\n\nasync function getPythFeedIdsFromCollateralList(\n collateralList: {\n symbol: string;\n }[]\n) {\n const extras = await Promise.all(\n networksOffline.map((network) => importExtras(network.id, network.preset))\n );\n\n // Go over extras and find everything that starts with pyth and ends with FeedId, store in array\n const priceIds = extras.map(getAllPriceIdsEntries).flat();\n\n const deduped = Array.from(\n new Set(\n priceIds\n .map(([key, priceId]) => {\n if (key.startsWith('pyth_feed_id_')) {\n return {\n symbol: key.replace('pyth_feed_id_', '').toUpperCase(),\n priceId,\n };\n }\n if (key.startsWith('pyth') && key.endsWith('FeedId')) {\n return {\n symbol: key.replace('pyth', '').replace('FeedId', '').toUpperCase(),\n priceId,\n };\n }\n return { symbol: null, priceId: null };\n })\n .filter(({ symbol, priceId }) => symbol && priceId)\n )\n );\n\n // Find the corresponding price feed id for each symbol\n return collateralList.map((collateral) => {\n const symbol = collateral.symbol === 'WETH' ? 'ETH' : collateral.symbol;\n const id = deduped.find((x) => x.symbol?.toUpperCase() === symbol.toUpperCase());\n return {\n ...collateral,\n priceId: id?.priceId,\n };\n });\n}\n\nexport const getPriceUpdates = async (priceIds: string[], network: Network) => {\n if (!priceIds.length) {\n return null;\n }\n const unique = Array.from(new Set(priceIds));\n const signedOffchainData = await priceService.getPriceFeedsUpdateData(unique);\n const PythVerfier = await importPythVerifier(network.id, network.preset);\n\n return {\n to: PythVerfier.address,\n data: new ethers.utils.Interface(PythVerfier.abi).encodeFunctionData('updatePriceFeeds', [\n signedOffchainData,\n ]),\n value: unique.length,\n };\n};\n\ninterface Collaterals {\n symbol: string;\n oracleId: string;\n id: string;\n}\n\nexport const useOfflinePrices = (collaterals?: Collaterals[]) => {\n return useQuery({\n queryKey: ['offline-prices', collaterals?.map((collateral) => collateral.id).join('-')],\n enabled: Boolean(collaterals && collaterals.length > 0),\n queryFn: async (): Promise<{ symbol: string; price: ethers.BigNumber }[]> => {\n if (!collaterals) {\n throw 'useOfflinePrices is missing required data';\n }\n\n const stables = ['sUSDC', 'USDC'];\n const filteredCollaterals = collaterals.filter((item) => !stables.includes(item.symbol));\n\n const returnData = [\n {\n symbol: 'sUSDC',\n price: wei(1).toBN(),\n },\n {\n symbol: 'USDC',\n price: wei(1).toBN(),\n },\n {\n symbol: 'USDx',\n price: wei(1).toBN(),\n },\n ];\n\n if (!filteredCollaterals.length) {\n return returnData;\n }\n\n const collateralsWithPriceId = await getPythFeedIdsFromCollateralList(filteredCollaterals);\n const prices = await priceService.getLatestPriceFeeds(\n collateralsWithPriceId.map((x) => x.priceId) as string[]\n );\n prices?.forEach((item) => {\n const col = collateralsWithPriceId.find(({ priceId }) => priceId === `0x${item.id}`);\n const price = item.getPriceUnchecked();\n if (col) {\n returnData.push({\n symbol: col.symbol,\n price: parseUnits(price.price, 18 + price.expo),\n });\n }\n });\n return returnData;\n },\n refetchInterval: 60_000,\n });\n};\n\nexport const useCollateralPriceUpdates = (customNetwork?: Network) => {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork || currentNetwork;\n const provider = useProvider();\n const { activeWallet } = useWallet();\n const walletAddress = activeWallet?.address;\n\n return useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'PriceUpdates', { walletAddress }],\n enabled: Boolean(network && provider && activeWallet),\n queryFn: async () => {\n const stalenessTolerance = 1600;\n if (!(network && provider && activeWallet)) {\n throw 'OMG';\n }\n\n try {\n const { address: multicallAddress, abi: multiCallAbi } =\n await importTrustedMulticallForwarder(network.id, network.preset);\n\n const multicallInterface = new ethers.utils.Interface(multiCallAbi);\n const pythInterface = new ethers.utils.Interface([\n 'function getLatestPrice(bytes32 priceId, uint256 stalenessTolerance) external view returns (int256)',\n ]);\n\n const pythFeedIds = (await getPythFeedIds(network)) as string[];\n if (window.localStorage.getItem('DEBUG') === 'true') {\n // eslint-disable-next-line no-console\n console.log('[useCollateralPriceUpdates]', { pythFeedIds });\n }\n\n if (pythFeedIds.length === 0) {\n return null;\n }\n\n const { address } = await importPythERC7412Wrapper(network.id, network.preset);\n\n const txs = [\n ...pythFeedIds.map((priceId) => ({\n target: address,\n callData: pythInterface.encodeFunctionData('getLatestPrice', [\n priceId,\n stalenessTolerance,\n ]),\n value: 0,\n requireSuccess: false,\n })),\n ];\n\n const getPricesTx = multicallInterface.encodeFunctionData('aggregate3Value', [txs]);\n\n const result = await provider.call({\n data: getPricesTx,\n to: multicallAddress,\n });\n\n const decodedMultiCall: { success: boolean }[] = multicallInterface.decodeFunctionResult(\n 'aggregate3Value',\n result || ''\n )[0];\n\n const outdatedPriceIds: string[] = [];\n\n decodedMultiCall.forEach(({ success }, i) => {\n if (!success) {\n outdatedPriceIds.push(pythFeedIds[i]);\n }\n });\n if (window.localStorage.getItem('DEBUG') === 'true') {\n // eslint-disable-next-line no-console\n console.log('[useCollateralPriceUpdates]', { outdatedPriceIds });\n }\n\n if (outdatedPriceIds.length) {\n const priceUpdateTx = (await getPriceUpdates(outdatedPriceIds, network).catch(\n () => undefined\n )) as any;\n if (priceUpdateTx) {\n return {\n ...priceUpdateTx,\n from: walletAddress,\n };\n }\n }\n\n return null;\n } catch (error) {\n return null;\n }\n },\n refetchInterval: 120_000,\n });\n};\n","export async function importExtras(\n chainId?: number,\n preset?: string\n): Promise<{\n [key: string]: string;\n}> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/extras.json'),\n ]);\n return extras;\n }\n case '11155111-main': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/extras.json'),\n ]);\n return extras;\n }\n case '10-main': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/extras.json'),\n ]);\n return extras;\n }\n case '8453-andromeda': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/extras.json'),\n ]);\n return extras;\n }\n case '84532-andromeda': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/extras.json'),\n ]);\n return extras;\n }\n case '42161-main': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/extras.json'),\n ]);\n return extras;\n }\n case '421614-main': {\n const [{ default: extras }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/extras.json'),\n ]);\n return extras;\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for Extras`);\n }\n }\n}\n","const abi = [\n // ERC20\n 'error InsufficientAllowance(uint256 required, uint256 existing)',\n 'error InsufficientBalance(uint256 required, uint256 existing)',\n 'event Approval(address indexed owner, address indexed spender, uint256 amount)',\n 'event Transfer(address indexed from, address indexed to, uint256 amount)',\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n 'function balanceOf(address owner) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n 'function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)',\n 'function increaseAllowance(address spender, uint256 addedValue) returns (bool)',\n 'function name() view returns (string)',\n 'function symbol() view returns (string)',\n 'function totalSupply() view returns (uint256)',\n 'function transfer(address to, uint256 amount) returns (bool)',\n 'function transferFrom(address from, address to, uint256 amount) returns (bool)',\n\n // SNX\n 'function transferableSynthetix(address account) view returns (uint256 transferable)',\n 'function collateral(address account) view returns (uint256 collateral)',\n];\n\nexport async function importSNX(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n ]);\n return { address: meta.contracts.CollateralToken_SNX, abi };\n }\n case '11155111-main': {\n const [{ default: meta }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n ]);\n return { address: meta.contracts.CollateralToken_SNX, abi };\n }\n case '10-main': {\n const [{ default: meta }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n ]);\n return { address: meta.contracts.CollateralToken_SNX, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for SNX`);\n }\n }\n}\n","import { importSNX } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useSNX(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'SNX'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importSNX(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { tokenOverrides } from '@snx-v3/constants';\nimport { importSystemToken } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useSystemToken(customNetwork?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork || currentNetwork;\n\n return useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'SystemToken'],\n enabled: Boolean(network),\n queryFn: async function (): Promise<{\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n displaySymbol: string;\n }> {\n if (!network) throw new Error('OMFG');\n const systemToken = await importSystemToken(network.id, network.preset);\n return {\n ...systemToken,\n displaySymbol:\n tokenOverrides[`${network.id}-${network.preset}`]?.[systemToken.address]?.displaySymbol ??\n systemToken.symbol,\n };\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","export async function importSystemToken(\n chainId?: number,\n preset?: string\n): Promise<{\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n}> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/systemToken.json'),\n ]);\n return systemToken;\n }\n case '11155111-main': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/systemToken.json'),\n ]);\n return systemToken;\n }\n case '10-main': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/systemToken.json'),\n ]);\n return systemToken;\n }\n case '8453-andromeda': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/systemToken.json'),\n ]);\n return systemToken;\n }\n case '84532-andromeda': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/systemToken.json'),\n ]);\n return systemToken;\n }\n case '42161-main': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/systemToken.json'),\n ]);\n return systemToken;\n }\n case '421614-main': {\n const [{ default: systemToken }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/systemToken.json'),\n ]);\n return systemToken;\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for SystemToken`);\n }\n }\n}\n","import { tokenOverrides } from '@snx-v3/constants';\nimport { importCollateralTokens } from '@snx-v3/contracts';\nimport { contractsHash } from '@snx-v3/tsHelpers';\nimport { MAINNET, Network, OPTIMISM, useNetwork } from '@snx-v3/useBlockchain';\nimport { useSNX } from '@snx-v3/useSNX';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { wei, Wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport type CollateralType = {\n address: string;\n symbol: string;\n displaySymbol: string;\n name: string;\n decimals: number;\n depositingEnabled: boolean;\n issuanceRatioD18: Wei;\n liquidationRatioD18: Wei;\n liquidationRewardD18: Wei;\n minDelegationD18: Wei;\n oracleNodeId: string;\n tokenAddress: string;\n oracle: {\n constPrice?: Wei;\n externalContract?: string;\n stalenessTolerance?: string;\n pythFeedId?: string;\n };\n};\n\nasync function loadCollateralTypes(chainId: number, preset: string) {\n return (await importCollateralTokens(chainId, preset)).map((config) => ({\n address: config.address,\n symbol: config.symbol,\n displaySymbol: config.symbol,\n name: config.name,\n decimals: config.decimals,\n depositingEnabled: config.depositingEnabled,\n issuanceRatioD18: wei(config.issuanceRatioD18, 18, true),\n liquidationRatioD18: wei(config.liquidationRatioD18, 18, true),\n liquidationRewardD18: wei(config.liquidationRewardD18, 18, true),\n minDelegationD18: wei(config.minDelegationD18, 18, true),\n oracleNodeId: config.oracleNodeId,\n tokenAddress: config.tokenAddress,\n oracle: {\n constPrice: config.oracle.constPrice ? wei(config.oracle.constPrice, 18, true) : undefined,\n externalContract: config.oracle.externalContract,\n stalenessTolerance: config.oracle.stalenessTolerance,\n pythFeedId: config.oracle.pythFeedId,\n },\n }));\n}\n\nexport function useCollateralTypes(includeDelegationOff = false, customNetwork?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork ?? currentNetwork;\n const { data: systemToken } = useSystemToken(customNetwork);\n const { data: MainnetSNX } = useSNX(MAINNET);\n const { data: OptimismSNX } = useSNX(OPTIMISM);\n\n return useQuery({\n enabled: Boolean(network?.id && network?.preset && systemToken && MainnetSNX && OptimismSNX),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'CollateralTypes',\n { includeDelegationOff },\n { contractsHash: contractsHash([systemToken, MainnetSNX, OptimismSNX]) },\n ],\n queryFn: async () => {\n if (!(network?.id && network?.preset && systemToken && MainnetSNX && OptimismSNX))\n throw Error('useCollateralTypes should not be enabled when contracts missing');\n\n const collateralTypes = (await loadCollateralTypes(network.id, network.preset))\n .map((collateralType) => {\n if (network?.preset === 'andromeda' && collateralType.symbol === 'sUSDC') {\n return {\n ...collateralType,\n symbol: 'USDC',\n displaySymbol: 'USDC',\n name: 'USD Coin',\n };\n }\n if (network?.preset === 'andromeda' && collateralType.symbol === 'sStataUSDC') {\n return {\n ...collateralType,\n symbol: 'stataUSDC',\n displaySymbol: 'Static aUSDC',\n name: 'Static aUSDC',\n };\n }\n\n return {\n ...collateralType,\n displaySymbol:\n tokenOverrides[`${network.id}-${network.preset}`]?.[collateralType.address]\n ?.displaySymbol ??\n collateralType.displaySymbol ??\n collateralType.symbol,\n };\n })\n .filter((collateralType) => collateralType.tokenAddress !== systemToken.address);\n\n return collateralTypes\n .filter(\n (collateralType) =>\n collateralType.depositingEnabled ||\n (network.id === MAINNET.id && collateralType.address === MainnetSNX.address) ||\n (network.id === OPTIMISM.id && collateralType.address === OptimismSNX.address)\n )\n .filter(\n (collateralType) =>\n // Return collateral types that have minDelegationD18 < MaxUint256\n // When minDelegationD18 === MaxUint256, delegation is effectively disabled\n includeDelegationOff || collateralType.minDelegationD18.lt(ethers.constants.MaxUint256)\n );\n },\n // one hour in ms\n staleTime: 3_600_000,\n });\n}\n\nexport function useCollateralType(collateralSymbol?: string, networkOverride?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = networkOverride || currentNetwork;\n const { data: collateralTypes } = useCollateralTypes(true, networkOverride);\n\n return useQuery({\n enabled: Boolean(network && collateralTypes && collateralSymbol),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'CollateralType',\n { collateralSymbol },\n { contractsHash: contractsHash(collateralTypes ?? []) },\n ],\n queryFn: async () => {\n if (!(network && collateralTypes && collateralSymbol)) {\n throw new Error('OMFG');\n }\n\n const collateralType = collateralTypes.find(\n (collateral) => `${collateral.symbol}`.toLowerCase() === `${collateralSymbol}`.toLowerCase()\n );\n if (!collateralType) {\n throw new Error('Unsupported collateral');\n }\n return collateralType;\n },\n // one hour in ms\n staleTime: 3_600_000,\n throwOnError: false,\n });\n}\n","export async function importCollateralTokens(\n chainId?: number,\n preset?: string\n): Promise<\n {\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n depositingEnabled: boolean;\n issuanceRatioD18: string;\n liquidationRatioD18: string;\n liquidationRewardD18: string;\n oracleNodeId: string;\n tokenAddress: string;\n minDelegationD18: string;\n oracle: {\n constPrice?: string;\n externalContract?: string;\n stalenessTolerance?: string;\n pythFeedId?: string;\n };\n }[]\n> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '11155111-main': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '10-main': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '8453-andromeda': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '84532-andromeda': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '42161-main': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n case '421614-main': {\n const [{ default: collateralTokens }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/collateralTokens.json'),\n ]);\n return collateralTokens;\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for CollateralTokens`);\n }\n }\n}\n","export async function importSpotMarketProxy(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/SpotMarketProxy.readable.json'),\n ]);\n return { address: meta.contracts.SpotMarketProxy, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for SpotMarketProxy`);\n }\n }\n}\n","export async function importUSDProxy(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/USDProxy.readable.json'),\n ]);\n return { address: meta.contracts.USDProxy, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for USDProxy`);\n }\n }\n}\n","const abi = [\n 'function clearDebt(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType)',\n 'function closePosition(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType)',\n 'function decreasePosition(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType, uint256 amount)',\n 'function increasePosition(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType, uint256 amount)',\n 'function onERC721Received(address, address, uint256, bytes) pure returns (bytes4)',\n 'function repay(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType, uint256 debtAmount)',\n 'function setupPosition(address coreProxyAddress, address accountProxyAddress, uint128 accountId, uint128 poolId, address collateralType, uint256 amount)',\n 'error NotEnoughAllowance(address walletAddress, address tokenAddress, uint256 requiredAllowance, uint256 availableAllowance)',\n 'error NotEnoughBalance(address walletAddress, address tokenAddress, uint256 requiredAmount, uint256 availableAmount)',\n];\n\nexport async function importPositionManager(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n // https://etherscan.io/address/0x21e9D735Db12221a787317954bDdD7144353b5D7#code\n return { address: '0x21e9D735Db12221a787317954bDdD7144353b5D7', abi };\n }\n case '11155111-main': {\n // https://sepolia.etherscan.io/address/0xfaa4d64521db83195b5b3ff502812b267dde4a53#code\n return { address: '0xfaa4d64521db83195b5b3ff502812b267dde4a53', abi };\n }\n case '42161-main': {\n // https://arbiscan.io/address/0x42c7720912fdc1cdff1f73ff0eee5f0af8522491#code\n return { address: '0x42c7720912fdc1cdff1f73ff0eee5f0af8522491', abi };\n }\n case '421614-main': {\n // https://sepolia.arbiscan.io/address/0xa86339a1ce701b0c708a56cae3d5142f675e1540#code\n return { address: '0xa86339a1ce701b0c708a56cae3d5142f675e1540', abi };\n }\n case '10-main': {\n // https://optimistic.etherscan.io/address/0x8D99de5C3528883fcb9cCFa8E13ffF6330e45CDB#code\n return { address: '0x8D99de5C3528883fcb9cCFa8E13ffF6330e45CDB', abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for ClosePosition`);\n }\n }\n}\n","import { importPositionManager } from './importPositionManager';\n\nexport async function importClosePosition(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n return importPositionManager(chainId, preset);\n}\n","const abi = [\n 'constructor(address CoreProxy_, address AccountProxy_, address SpotMarketProxy_, address $USDC_, address $synthUSDC_, uint128 synthIdUSDC_, uint128 poolId_)',\n 'function $USDC() view returns (address)',\n 'function $synthUSDC() view returns (address)',\n 'function AccountProxy() view returns (address)',\n 'function CoreProxy() view returns (address)',\n 'function SpotMarketProxy() view returns (address)',\n 'function clearDebt(uint128 accountId)',\n 'function closePosition(uint128 accountId)',\n 'function decreasePosition(uint128 accountId, uint256 usdcAmount)',\n 'function getAccounts() view returns (uint128[] accountIds)',\n 'function increasePosition(uint128 accountId, uint256 usdcAmount)',\n 'function onERC721Received(address, address, uint256, bytes) pure returns (bytes4)',\n 'function poolId() view returns (uint128)',\n 'function repay(uint128 accountId, uint256 debtAmount)',\n 'function setupPosition(uint256 usdcAmount)',\n 'function synthIdUSDC() view returns (uint128)',\n 'function withdraw(uint128 accountId)',\n 'error AccountExists()',\n 'error NotEnoughAllowance(address walletAddress, address tokenAddress, uint256 requiredAllowance, uint256 availableAllowance)',\n 'error NotEnoughBalance(address walletAddress, address tokenAddress, uint256 requiredAmount, uint256 availableAmount)',\n];\n\nexport async function importPositionManagerAndromedaUSDC(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '8453-andromeda': {\n // https://basescan.org/address/0xe7527c762a706c1b78721f6947c75460db5bcd45#code\n return { address: '0xe7527c762a706c1b78721f6947c75460db5bcd45', abi };\n }\n case '84532-andromeda': {\n // https://sepolia.basescan.org/address/0x71f6fab9522e2427a16b0466eb64dabb50294064#code\n return { address: '0x71f6fab9522e2427a16b0466eb64dabb50294064', abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for PositionManagerAndromedaStataUSDC`);\n }\n }\n}\n","const abi = [\n 'constructor(address CoreProxy_, address AccountProxy_, address SpotMarketProxy_, address $USDC_, address $stataUSDC_, address $synthUSDC_, address $synthStataUSDC_, uint128 synthIdUSDC_, uint128 synthIdStataUSDC_, uint128 poolId_)',\n 'function $USDC() view returns (address)',\n 'function $stataUSDC() view returns (address)',\n 'function $synthStataUSDC() view returns (address)',\n 'function $synthUSDC() view returns (address)',\n 'function AccountProxy() view returns (address)',\n 'function CoreProxy() view returns (address)',\n 'function SpotMarketProxy() view returns (address)',\n 'function clearDebt(uint128 accountId)',\n 'function closePosition(uint128 accountId)',\n 'function decreasePosition(uint128 accountId, uint256 usdcAmount)',\n 'function getAccounts() view returns (uint128[] accountIds)',\n 'function increasePosition(uint128 accountId, uint256 usdcAmount)',\n 'function onERC721Received(address, address, uint256, bytes) pure returns (bytes4)',\n 'function poolId() view returns (uint128)',\n 'function repay(uint128 accountId, uint256 debtAmount)',\n 'function setupPosition(uint256 usdcAmount)',\n 'function synthIdStataUSDC() view returns (uint128)',\n 'function synthIdUSDC() view returns (uint128)',\n 'function withdraw(uint128 accountId)',\n 'error AccountExists()',\n 'error NotEnoughAllowance(address walletAddress, address tokenAddress, uint256 requiredAllowance, uint256 availableAllowance)',\n 'error NotEnoughBalance(address walletAddress, address tokenAddress, uint256 requiredAmount, uint256 availableAmount)',\n];\n\nexport async function importPositionManagerAndromedaStataUSDC(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '8453-andromeda': {\n // https://basescan.org/address/0x3b7820430e1cb6d2f3072a389138fb572468b5ae#code\n return { address: '0x3b7820430e1cb6d2f3072a389138fb572468b5ae', abi };\n }\n case '84532-andromeda': {\n // https://sepolia.basescan.org/address/0x3114ab72576b154a2896114999ed7c2399b92783#code\n return { address: '0x3114ab72576b154a2896114999ed7c2399b92783', abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for PositionManagerAndromedaStataUSDC`);\n }\n }\n}\n","import {\n importAllErrors,\n importClosePosition,\n importPositionManager,\n importPositionManagerAndromedaStataUSDC,\n importPositionManagerAndromedaUSDC,\n} from '@snx-v3/contracts';\nimport { ethers } from 'ethers';\n\nconst ERC721_ERRORS: `error ${string}`[] = [\n 'error CannotSelfApprove(address addr)',\n 'error InvalidTransferRecipient(address addr)',\n 'error InvalidOwner(address addr)',\n 'error TokenDoesNotExist(uint256 id)',\n 'error TokenAlreadyMinted(uint256 id)',\n];\n\nexport type ContractErrorType = {\n data: string;\n name: string;\n signature: string;\n args: Record;\n};\n\nexport const PYTH_ERRORS: `error ${string}`[] = [\n // Function arguments are invalid (e.g., the arguments lengths mismatch)\n // Signature: 0xa9cb9e0d\n 'error InvalidArgument()',\n // Update data is coming from an invalid data source.\n // Signature: 0xe60dce71\n 'error InvalidUpdateDataSource()',\n // Update data is invalid (e.g., deserialization error)\n // Signature: 0xe69ffece\n 'error InvalidUpdateData()',\n // Insufficient fee is paid to the method.\n // Signature: 0x025dbdd4\n 'error InsufficientFee()',\n // There is no fresh update, whereas expected fresh updates.\n // Signature: 0xde2c57fa\n 'error NoFreshUpdate()',\n // There is no price feed found within the given range or it does not exists.\n // Signature: 0x45805f5d\n 'error PriceFeedNotFoundWithinRange()',\n // Price feed not found or it is not pushed on-chain yet.\n // Signature: 0x14aebe68\n 'error PriceFeedNotFound()',\n // Requested price is stale.\n // Signature: 0x19abf40e\n 'error StalePrice()',\n // Given message is not a valid Wormhole VAA.\n // Signature: 0x2acbe915\n 'error InvalidWormholeVaa()',\n // Governance message is invalid (e.g., deserialization error).\n // Signature: 0x97363b35\n 'error InvalidGovernanceMessage()',\n // Governance message is not for this contract.\n // Signature: 0x63daeb77\n 'error InvalidGovernanceTarget()',\n // Governance message is coming from an invalid data source.\n // Signature: 0x360f2d87\n 'error InvalidGovernanceDataSource()',\n // Governance message is old.\n // Signature: 0x88d1b847\n 'error OldGovernanceMessage()',\n // The wormhole address to set in SetWormholeAddress governance is invalid.\n // Signature: 0x13d3ed82\n 'error InvalidWormholeAddressToSet()',\n];\n\nconst PANIC_REASONS: { [key: string]: string } = {\n '00': 'Generic compiler inserted panics.',\n '01': 'Assert evaluates to false.',\n '11': 'Arithmetic operation results in underflow or overflow.',\n '12': 'Division by zero.',\n '21': 'Cannot convert value into an enum type.',\n '22': 'Storage byte array is incorrectly encoded.',\n '31': \"Call to 'pop' on an empty array.\",\n '32': 'Array index is out of bounds.',\n '41': 'Allocation of too much memory.',\n '51': 'Call to a zero-initialized variable of internal function type.',\n};\n\nexport function extractErrorData(error: Error | any) {\n return (\n error.cause?.cause?.cause?.error?.data ||\n error.cause?.cause?.cause?.data ||\n error.cause?.cause?.error?.data ||\n error.cause?.cause?.data ||\n error.cause?.data ||\n error?.error?.error?.error?.data ||\n error?.error?.error?.data ||\n error?.error?.data?.data ||\n error?.error?.data ||\n error?.data?.data ||\n error?.data\n );\n}\n\nexport function dedupeErrors(abiErrors: `error ${string}`[]) {\n const unique = new Set();\n const uniqueAbiErrors: string[] = [];\n abiErrors.forEach((errorLine) => {\n const fragment = ethers.utils.Fragment.from(errorLine);\n const sighash = fragment.format(ethers.utils.FormatTypes.sighash);\n if (!unique.has(sighash)) {\n uniqueAbiErrors.push(fragment.format(ethers.utils.FormatTypes.full));\n unique.add(sighash);\n }\n });\n return uniqueAbiErrors;\n}\n\nexport function combineErrors(contracts: ({ abi: string[] } | undefined)[]) {\n const abiErrors: `error ${string}`[] = [];\n contracts.forEach((contract) => {\n if (contract) {\n contract.abi.forEach((line) => {\n if (line.startsWith('error ')) {\n abiErrors.push(line as `error ${string}`);\n }\n });\n }\n });\n return abiErrors;\n}\n\nexport function parseErrorData({\n errorData,\n abi,\n}: {\n errorData?: any;\n abi?: `error ${string}`[];\n}): ContractErrorType | void {\n if (`${errorData}`.startsWith('0x08c379a0')) {\n const content = `0x${errorData.substring(10)}`;\n // reason: string; for standard revert error string\n const reason = ethers.utils.defaultAbiCoder.decode(['string'], content);\n console.error(reason);\n return {\n data: errorData,\n signature: content,\n name: `Revert ${reason[0]}`,\n args: { reason: reason[0] },\n };\n }\n if (`${errorData}`.startsWith('0x4e487b71')) {\n const content = `0x${errorData.substring(10)}`;\n const code = errorData.slice(-2);\n if (code in PANIC_REASONS) {\n console.error(`Panic ${PANIC_REASONS[code]}`);\n return {\n data: errorData,\n signature: content,\n name: `Panic ${PANIC_REASONS[code]}`,\n args: { code },\n };\n }\n console.error(`Panic ${code}`);\n return {\n data: errorData,\n signature: content,\n name: `Panic ${code}`,\n args: { code },\n };\n }\n\n try {\n const AllErrorsInterface = new ethers.utils.Interface(\n dedupeErrors([...(abi ? abi : []), ...PYTH_ERRORS, ...ERC721_ERRORS])\n );\n\n const errorParsed = AllErrorsInterface.parseError(errorData);\n const errorArgs = Object.fromEntries(\n Object.entries(errorParsed.args)\n .filter(([key]) => `${parseInt(key)}` !== key)\n .map(([key, value]) => {\n if (value instanceof ethers.BigNumber) {\n // Guess wei\n const unwei = parseFloat(ethers.utils.formatEther(value.toString()));\n if (unwei > 0.001) {\n // must be wei\n return [key, unwei];\n }\n\n // Guess date\n if (\n value.toNumber() > new Date(2000, 1, 1).getTime() / 1000 &&\n value.toNumber() < new Date(2100, 1, 1).getTime() / 1000\n ) {\n return [key, new Date(value.toNumber() * 1000)];\n }\n\n // Just a number\n return [key, parseFloat(value.toString())];\n }\n\n // Not a number\n return [key, value];\n })\n );\n\n return {\n data: errorData,\n name: errorParsed.name,\n signature: errorParsed.signature,\n args: errorArgs,\n };\n } catch (error) {\n console.error(`Error parsing failure: ${error}`);\n }\n}\n\nexport function parseContractError({\n error,\n abi,\n}: {\n error?: any;\n abi?: `error ${string}`[];\n}): ContractErrorType | void {\n const errorData = extractErrorData(error);\n if (!errorData) {\n console.error({ error }); // intentional logging as object so we can inspect all properties\n return;\n }\n return parseErrorData({ errorData, abi });\n}\n\nexport async function importAllContractErrors(chainId?: number, preset?: string) {\n return chainId && preset\n ? combineErrors(\n await Promise.all([\n importAllErrors(chainId, preset).catch(() => undefined),\n importClosePosition(chainId, preset).catch(() => undefined),\n importPositionManager(chainId, preset).catch(() => undefined),\n importPositionManagerAndromedaUSDC(chainId, preset).catch(() => undefined),\n importPositionManagerAndromedaStataUSDC(chainId, preset).catch(() => undefined),\n ])\n )\n : [];\n}\n","// This is a type guard function that checks if a value is not null and not undefined.\n// This is useful when filtering an array that might have null or undefined values.\nexport const notNil = (x: T | null | undefined): x is T => x !== null && x !== undefined;\n","/* eslint-disable no-console */\nimport { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js';\nimport { offchainMainnetEndpoint, offchainTestnetEndpoint } from '@snx-v3/constants';\nimport {\n importAccountProxy,\n importClosePosition,\n importCoreProxy,\n importPositionManager,\n importPositionManagerAndromedaStataUSDC,\n importPositionManagerAndromedaUSDC,\n importPythERC7412Wrapper,\n importPythVerifier,\n importSpotMarketProxy,\n importTrustedMulticallForwarder,\n importUSDProxy,\n} from '@snx-v3/contracts';\nimport { extractErrorData } from '@snx-v3/parseContractError';\nimport { notNil } from '@snx-v3/tsHelpers';\nimport { deploymentHasERC7412, Network } from '@snx-v3/useBlockchain';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nasync function fetchOffchainData({\n priceIds,\n isTestnet,\n}: {\n priceIds: string[];\n isTestnet: boolean;\n}) {\n const priceService = new EvmPriceServiceConnection(\n isTestnet ? offchainTestnetEndpoint : offchainMainnetEndpoint\n );\n const signedOffchainData = await priceService.getPriceFeedsUpdateData(priceIds);\n return signedOffchainData;\n}\n\n// simulate w/ wETH contract because it will have eth balance\n// This is useful when we do read/static calls but still need an balance for the price update\n// TODO: this probably need to be network aware, maybe look into a different solution even.\nexport const getDefaultFromAddress = (chainName: string) => {\n switch (chainName) {\n case 'cannon':\n return '0x4200000000000000000000000000000000000006'; // TODO, unclear what to put here\n case 'mainnet':\n return '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';\n case 'sepolia':\n return '0x7b79995e5f793a07bc00c21412e50ecae098e7f9';\n case 'arbitrum':\n return '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1';\n case 'arbitrum-sepolia':\n return '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73';\n case 'optimism-mainnet':\n case 'base':\n case 'base-sepolia':\n return '0x4200000000000000000000000000000000000006';\n\n default:\n throw new Error(`Unsupported chain ${chainName}`);\n }\n};\n\nfunction dedupedFunctions(abi: string[]) {\n const deduped = new Set();\n const readableAbi: string[] = [];\n abi\n .filter((line: string) => line.startsWith('function '))\n .forEach((line: string) => {\n const fragment = ethers.utils.Fragment.from(line);\n if (fragment) {\n const minimal = fragment.format(ethers.utils.FormatTypes.sighash);\n if (!deduped.has(minimal)) {\n readableAbi.push(fragment.format(ethers.utils.FormatTypes.full));\n deduped.add(minimal);\n }\n }\n });\n return readableAbi;\n}\n\nexport async function logMulticall({\n network,\n calls,\n label,\n}: {\n network: Network;\n calls: (ethers.PopulatedTransaction & { requireSuccess?: boolean })[];\n label: string;\n}) {\n const log = debug(`snx:withERC7412:${label}`);\n if (!log.enabled) {\n return;\n }\n const AllInterface = new ethers.utils.Interface(\n dedupedFunctions(\n (\n await Promise.all([\n importCoreProxy(network.id, network.preset).catch(() => ({ abi: [] })),\n importSpotMarketProxy(network.id, network.preset).catch(() => ({ abi: [] })),\n importAccountProxy(network.id, network.preset).catch(() => ({ abi: [] })),\n importUSDProxy(network.id, network.preset).catch(() => ({ abi: [] })),\n importClosePosition(network.id, network.preset).catch(() => ({ abi: [] })),\n importPythERC7412Wrapper(network.id, network.preset).catch(() => ({ abi: [] })),\n importPythVerifier(network.id, network.preset).catch(() => ({ abi: [] })),\n importPositionManager(network.id, network.preset).catch(() => ({ abi: [] })),\n importPositionManagerAndromedaUSDC(network.id, network.preset).catch(() => ({ abi: [] })),\n importPositionManagerAndromedaStataUSDC(network.id, network.preset).catch(() => ({\n abi: [],\n })),\n ])\n ).flatMap((c) => (c ? c.abi : []))\n )\n );\n log(\n 'multicall calls',\n calls.map(({ data, value, ...rest }) => {\n try {\n // @ts-ignore\n const { name, args } = AllInterface.parseTransaction({ data, value });\n if (Object.keys(args).filter(([key]) => `${key}` !== `${parseInt(key)}`).length > 0) {\n const namedArgs = Object.fromEntries(\n Object.entries(args).filter(([key]) => `${key}` !== `${parseInt(key)}`)\n );\n return { $: name, ...namedArgs };\n }\n\n const unnamedArgs = Object.entries(args)\n .filter(([key]) => `${key}` === `${parseInt(key)}`)\n .map(([, value]) => value);\n return { $: name, ...unnamedArgs };\n } catch {\n return { $: 'unknown', data, value, ...rest };\n }\n })\n );\n}\n\nasync function getMulticallTransaction(\n network: Network,\n calls: (ethers.PopulatedTransaction & { requireSuccess?: boolean })[],\n from: string,\n provider: ethers.providers.BaseProvider\n) {\n const Multicall3Contract = await importTrustedMulticallForwarder(network.id, network.preset);\n const Multicall3Interface = new ethers.utils.Interface(Multicall3Contract.abi);\n\n const multicallTxn = {\n from: from ? from : getDefaultFromAddress(network.name),\n to: Multicall3Contract.address,\n data: Multicall3Interface.encodeFunctionData('aggregate3Value', [\n calls.map((call) => ({\n target: call.to,\n callData: call.data,\n value: call.value ? ethers.BigNumber.from(call.value) : ethers.BigNumber.from(0),\n requireSuccess: call.requireSuccess ?? true,\n })),\n ]),\n value: calls.reduce(\n (totalValue, call) => (call.value ? totalValue.add(call.value) : totalValue),\n ethers.BigNumber.from(0)\n ),\n };\n const gasLimit = await provider.estimateGas(multicallTxn);\n return { multicallTxn, gasLimit, _calls: calls };\n}\n\n/**\n * If a tx requires ERC7412 pattern, wrap your tx with this function.\n */\nexport const withERC7412 = async (\n provider: ethers.providers.BaseProvider,\n network: Network,\n calls: (ethers.PopulatedTransaction & { requireSuccess?: boolean })[],\n label: string,\n from: string\n) => {\n const log = debug(`snx:withERC7412:${label}`);\n\n if (!(await deploymentHasERC7412(network.id, network.preset))) {\n await logMulticall({ network, calls, label });\n return await getMulticallTransaction(network, calls, from, provider);\n }\n\n const PythVerfier = await importPythVerifier(network.id, network.preset);\n\n while (true) {\n try {\n await logMulticall({ network, calls, label });\n return await getMulticallTransaction(network, calls, from, provider);\n } catch (error: Error | any) {\n console.error(error);\n let errorData = extractErrorData(error);\n if (!errorData && error.transaction) {\n try {\n log('Error is missing revert data, trying provider.call, instead of estimate gas...');\n // Some wallets swallows the revert reason when calling estimate gas,try to get the error by using provider.call\n // provider.call wont actually revert, instead the error data is just returned\n const lookedUpError = await provider.call(error.transaction);\n errorData = lookedUpError;\n } catch (newError: any) {\n // console.error(newError);\n log('provider.call(error.transaction) failed, trying to extract error', newError);\n errorData = extractErrorData(error);\n }\n }\n if (!errorData) {\n throw error;\n }\n log('errorData', errorData);\n\n // Collect all the price IDs that require updates\n const missingPriceUpdates: string[] = errorData\n // Signature of OracleDataRequired\n .split('cf2cabdf')\n // Skip all the data before the first signature of OracleDataRequired\n .slice(1)\n // Full OracleDataRequired without signature is 512 bytes\n .map((s: string) => s.slice(0, 512))\n // Price feed is the last and has 64 bytes, prefix with 0x\n .map((s: string) => `0x${s.slice(-64)}`);\n if (missingPriceUpdates.length < 1) {\n // some other kind of error that's not related to price\n throw error;\n }\n\n const missingPriceUpdatesUnique = Array.from(new Set(missingPriceUpdates));\n log('missingPriceUpdates', missingPriceUpdatesUnique);\n\n const signedOffchainData = await fetchOffchainData({\n priceIds: missingPriceUpdatesUnique,\n isTestnet: network.isTestnet,\n });\n\n const extraPriceUpdateTxn = {\n from,\n to: PythVerfier.address,\n data: new ethers.utils.Interface(PythVerfier.abi).encodeFunctionData('updatePriceFeeds', [\n signedOffchainData,\n ]),\n value: ethers.BigNumber.from(missingPriceUpdatesUnique.length),\n requireSuccess: false,\n };\n log('extraPriceUpdateTxn', extraPriceUpdateTxn);\n\n // Update calls to include price update txn\n // And carry on with our while(true)\n calls = [extraPriceUpdateTxn, ...calls];\n }\n }\n};\n\n/**\n * This can be used to do reads plus decoding. The return type will be whatever the type of the decode function is. And the arguments passed will have the multicall decoded and price updates removed\n */\nexport async function erc7412Call(\n network: Network,\n provider: ethers.providers.BaseProvider,\n calls: (ethers.PopulatedTransaction & { requireSuccess?: boolean })[],\n decode: (x: { success: boolean; returnData: string }[]) => T,\n label: string\n) {\n const log = debug(`snx:withERC7412:${label}`);\n\n const TrustedMulticallForwarder = await importTrustedMulticallForwarder(\n network.id,\n network.preset\n );\n\n const from = getDefaultFromAddress(network.name);\n\n const {\n _calls: newCalls,\n multicallTxn: erc7412Tx,\n gasLimit,\n } = await withERC7412(\n provider,\n network,\n calls.filter(notNil).map((call) => (call.from ? call : { ...call, from })), // fill missing \"from\"\n label,\n from\n );\n\n const res = await provider.call({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n if (res === '0x') {\n throw new Error(`[${label}] Call returned 0x`);\n }\n\n const decodedMulticall: { success: boolean; returnData: string }[] = new ethers.utils.Interface(\n TrustedMulticallForwarder.abi\n ).decodeFunctionResult('aggregate3Value', res)[0];\n log('multicall response', decodedMulticall);\n\n const PythVerifier = await importPythVerifier(network.id, network.preset);\n const decodedMulticallWithoutPriceUpdates = decodedMulticall\n // Remove the price updates\n .filter((_, i) => newCalls?.[i]?.to?.toLowerCase() !== PythVerifier.address?.toLowerCase());\n\n if (calls.length !== decodedMulticallWithoutPriceUpdates.length) {\n throw new Error(`[${label}] Unexpected multicall response`);\n }\n const decoded = decode(decodedMulticallWithoutPriceUpdates);\n log(`multicall decoded`, decoded);\n return decoded;\n}\n","import { importOracleManagerProxy } from '@snx-v3/contracts';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { erc7412Call, getDefaultFromAddress } from '@snx-v3/withERC7412';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport async function fetchOraclePrice({\n targetNetwork,\n provider,\n nodeId,\n}: {\n targetNetwork: Network;\n provider: ethers.providers.BaseProvider;\n nodeId: string;\n}): Promise<{ price: Wei; timestamp: Date }> {\n const OracleManagerProxyContract = await importOracleManagerProxy(\n targetNetwork.id,\n targetNetwork.preset\n );\n const OracleManagerProxy = new ethers.Contract(\n OracleManagerProxyContract.address,\n OracleManagerProxyContract.abi,\n provider\n );\n\n const processCall = await OracleManagerProxy.populateTransaction.process(nodeId);\n processCall.from = getDefaultFromAddress(targetNetwork?.name || '');\n const calls = [processCall];\n\n return await erc7412Call(\n targetNetwork,\n provider,\n calls,\n (decodedMulticall) => {\n const result = OracleManagerProxy.interface.decodeFunctionResult(\n 'process',\n decodedMulticall[0].returnData\n );\n if (result?.node) {\n return {\n price: wei(result.node.price),\n timestamp: new Date(Number(result.node.timestamp.mul(1000).toString())),\n };\n } else {\n return {\n price: wei(result.price),\n timestamp: new Date(Number(result.timestamp.mul(1000).toString())),\n };\n }\n },\n 'useOraclePrice'\n );\n}\n\nexport function useOraclePrice(nodeId?: string, customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n const provider = useProviderForChain(targetNetwork);\n\n return useQuery({\n refetchInterval: 120_000,\n enabled: Boolean(targetNetwork && provider && nodeId),\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'oracle-price', { nodeId }],\n queryFn: async () => {\n if (!(targetNetwork && provider && nodeId)) {\n throw new Error('OMG');\n }\n return fetchOraclePrice({\n targetNetwork,\n provider,\n nodeId,\n });\n },\n });\n}\n","export async function importOracleManagerProxy(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/meta.json'),\n import('@synthetixio/v3-contracts/1-main/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '11155111-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/meta.json'),\n import('@synthetixio/v3-contracts/11155111-main/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '10-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/meta.json'),\n import('@synthetixio/v3-contracts/10-main/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '8453-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/8453-andromeda/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '84532-andromeda': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/meta.json'),\n import('@synthetixio/v3-contracts/84532-andromeda/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '42161-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/meta.json'),\n import('@synthetixio/v3-contracts/42161-main/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n case '421614-main': {\n const [{ default: meta }, { default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/meta.json'),\n import('@synthetixio/v3-contracts/421614-main/OracleManagerProxy.readable.json'),\n ]);\n return { address: meta.contracts.OracleManagerProxy, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for OracleManagerProxy`);\n }\n }\n}\n","import { Flex } from '@chakra-ui/react';\nimport { BASE_ANDROMEDA, MAINNET } from '@snx-v3/useBlockchain';\nimport { useOfflinePrices } from '@snx-v3/useCollateralPriceUpdates';\nimport { CollateralType, useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { useOraclePrice } from '@snx-v3/useOraclePrice';\nimport { usePoolsList } from '@snx-v3/usePoolsList';\nimport React from 'react';\nimport { PoolCardsLoading } from './PoolCardsLoading';\nimport { PoolRow } from './PoolRow';\n\nfunction HeaderText({ ...props }) {\n return (\n \n );\n}\n\nexport function PoolsList() {\n const { data: poolsList, isPending: isPendingPoolsList } = usePoolsList();\n const { data: baseCollateralTypes, isPending: isPendingBaseCollateralTypes } = useCollateralTypes(\n false,\n BASE_ANDROMEDA\n );\n const { data: mainnetCollateralTypes, isPending: isPendingMainnetCollateralTypes } =\n useCollateralTypes(false, MAINNET);\n\n const allCollaterals: CollateralType[] = React.useMemo(() => {\n // We want to filter out assets that don't have a pyth price feed\n return [...(baseCollateralTypes ?? []), ...(mainnetCollateralTypes ?? [])].filter(\n (item) => item.symbol !== 'stataUSDC'\n );\n }, [baseCollateralTypes, mainnetCollateralTypes]);\n\n const { data: collateralPrices, isPending: isPendingCollateralPrices } = useOfflinePrices(\n allCollaterals.map((item) => ({\n id: item.tokenAddress,\n oracleId: item.oracleNodeId,\n symbol: item.symbol,\n }))\n );\n\n // Fetch stata price from oracle manager\n const stata = baseCollateralTypes?.find((item) => item.symbol === 'stataUSDC');\n\n const { data: stataPrice, isPending: isStataPriceLoading } = useOraclePrice(\n stata?.oracleNodeId,\n BASE_ANDROMEDA\n );\n\n const isPending =\n isPendingPoolsList ||\n isPendingCollateralPrices ||\n isPendingBaseCollateralTypes ||\n isPendingMainnetCollateralTypes ||\n isStataPriceLoading;\n\n const filteredPools = React.useMemo(() => {\n if (!poolsList) {\n return [];\n }\n\n return poolsList.map(({ network, poolInfo }) => {\n const collateralDeposited = poolInfo.map(({ collateral_type }) => ({\n collateralDeposited: collateral_type.total_amount_deposited,\n tokenAddress: collateral_type.id,\n }));\n\n let collaterals: typeof baseCollateralTypes = [];\n\n if (network.id === BASE_ANDROMEDA.id) {\n collaterals = baseCollateralTypes;\n } else if (network.id === MAINNET.id) {\n collaterals = mainnetCollateralTypes;\n }\n\n const collateralTypes = collaterals?.map((item) => ({\n ...item,\n collateralDeposited:\n collateralDeposited.find(\n ({ tokenAddress }) => tokenAddress.toLowerCase() === item.tokenAddress.toLowerCase()\n )?.collateralDeposited || '0',\n }));\n\n return {\n network,\n poolInfo,\n collateralDeposited,\n collateralTypes,\n };\n });\n }, [poolsList, baseCollateralTypes, mainnetCollateralTypes]);\n\n const allCollateralPrices = React.useMemo(() => {\n if (stata && stataPrice) {\n return collateralPrices?.concat({ symbol: 'stataUSDC', price: stataPrice?.price.toBN() });\n }\n }, [stata, collateralPrices, stataPrice]);\n\n return (\n \n \n \n Collateral / Network\n \n Wallet Balance\n TVL\n APR\n \n \n\n {isPending ? : null}\n {!isPending && filteredPools && allCollateralPrices ? (\n \n {filteredPools.flatMap(\n ({ network, poolInfo, collateralTypes }) =>\n collateralTypes?.map((collateralType) => (\n \n ))\n )}\n \n ) : null}\n \n );\n}\n","import { Button, Flex, Text } from '@chakra-ui/react';\nimport { useWallet } from '@snx-v3/useBlockchain';\n\nexport const PositionsNotConnected = () => {\n const { connect } = useWallet();\n return (\n \n \n Please connect wallet to view active positions\n \n {\n connect();\n }}\n >\n Connect Wallet\n \n \n );\n};\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Flex, Text, Th, Thead, Tr } from '@chakra-ui/react';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useNetwork } from '@snx-v3/useBlockchain';\n\nexport function PositionTableHeader() {\n const { network } = useNetwork();\n return (\n \n \n \n Collateral\n \n \n \n \n Locked\n \n \n Unlocked assets can be locked into a position at any time or withdrawn after 24h\n since last activity\n \n }\n >\n \n \n \n \n \n \n Unlocked\n \n \n \n \n \n APR\n \n \n \n APR is averaged over the trailing 28 days and is comprised of both performance\n and rewards\n \n \n }\n >\n \n \n \n \n \n \n \n {network?.preset === 'andromeda' ? 'PNL' : 'Debt'}\n \n \n Debt consists of:\n
\n - Your portion of the pool's total debt, which fluctuates based on trader\n performance and market conditions\n
- The amount you've borrowed against your collateral without\n incurring interest\n \n )\n }\n >\n \n \n
\n \n {network?.preset === 'andromeda' ? null : (\n \n \n \n C-Ratio\n \n \n \n C-ratio is a dynamic number that represents a ratio between your locked\n collateral and your debt\n \n \n }\n >\n \n \n \n \n )}\n \n {' '}\n \n \n \n );\n}\n","import { Text, TextProps } from '@chakra-ui/react';\nimport { currency } from '@snx-v3/format';\nimport { wei, Wei } from '@synthetixio/wei';\nimport { constants } from 'ethers';\nimport React from 'react';\n\nexport function Amount({\n value,\n prefix = '',\n suffix = '',\n 'data-cy': testId,\n ...props\n}: {\n prefix?: string;\n value?: Wei;\n suffix?: string;\n 'data-cy'?: string;\n} & TextProps) {\n const isMaxUint = value && wei(constants.MaxInt256).lte(value);\n const formattedValue = React.useMemo(() => currency(value), [value]);\n\n return (\n \n {prefix}\n {isMaxUint ? 'Infinite' : formattedValue}\n {!isMaxUint && suffix}\n \n );\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Skeleton, Table, Tbody, Td, Text, Th, Thead, Tr } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLocks } from '@snx-v3/useLocks';\nimport { PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { wei } from '@synthetixio/wei';\nimport { intlFormat } from 'date-fns';\nimport React from 'react';\n\nexport const LockedCollateral: React.FC<{\n onClose: () => void;\n}> = ({ onClose }) => {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: locks, isPending: isPendingLocks } = useLocks(\n params?.accountId,\n collateralType?.address\n );\n\n return (\n
\n \n \n Escrowed SNX\n \n \n\n {collateralType?.symbol === 'SNX' && (\n \n All SNX rewards on V2 are subject to a 12-month escrow time-lock. Escrowed SNX is\n automatically locked and will continue to earn rewards. After a 12-month lock,\n this SNX can be unlocked and withdrawn.\n \n )}\n\n \n \n \n \n Unlocking Date\n \n \n {collateralType?.displaySymbol ?? params.collateralSymbol} Amount\n \n \n \n {collateralType && !isPendingLocks && locks ? (\n \n {locks.map((lock) => (\n \n \n \n \n ))}\n \n ) : null}\n
\n \n {intlFormat(lock.expirationDate, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })}\n \n \n \n \n \n
\n\n {isPendingLocks ? : null}\n {!isPendingLocks && !locks?.length ? (\n \n No Escrowed {collateralType?.displaySymbol ?? params.collateralSymbol}\n \n ) : null}\n\n \n
\n );\n};\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useQuery } from '@tanstack/react-query';\nimport { BigNumber, ethers } from 'ethers';\n\nexport function useLocks(accountId?: string, collateralType?: string, customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n const { data: CoreProxy } = useCoreProxy(targetNetwork);\n const provider = useProviderForChain(targetNetwork);\n\n return useQuery({\n enabled: Boolean(provider && CoreProxy && accountId && collateralType),\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'Locks',\n { contractsHash: contractsHash([CoreProxy]), accountId, collateralType },\n ],\n queryFn: async () => {\n if (!(provider && CoreProxy && accountId && collateralType)) throw 'OMFG';\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n\n const locks: {\n amountD18: BigNumber;\n lockExpirationTime: BigNumber;\n }[] = await CoreProxyContract.getLocks(accountId, collateralType, 0, 100);\n\n return locks.map((lock) => ({\n timestamp: lock.lockExpirationTime,\n expirationDate: new Date(lock.lockExpirationTime.toNumber() * 1000),\n amount: lock.amountD18,\n }));\n },\n });\n}\n","export const getHealthVariant = ({\n targetCratio,\n liquidationCratio,\n cRatio,\n}: {\n liquidationCratio: number | undefined;\n targetCratio: number | undefined;\n cRatio: number | undefined;\n}) => {\n if (!liquidationCratio || !targetCratio || !cRatio) {\n return 'success';\n }\n if (cRatio <= 0) {\n return 'success';\n }\n if (cRatio < liquidationCratio) {\n return 'error';\n }\n if (cRatio < targetCratio) {\n return 'warning';\n }\n return 'success';\n};\n\nexport const ratioIsMaxUInt = (ratio: number) => ratio >= Number.MAX_SAFE_INTEGER;\n\nexport const getProgressSize = ({\n targetCratio,\n liquidationCratio,\n cRatio,\n}: {\n liquidationCratio: number | undefined;\n targetCratio: number | undefined;\n cRatio: number | undefined;\n}) => {\n if (!liquidationCratio || !targetCratio || !cRatio) {\n return 0;\n }\n\n if (cRatio < 0) {\n return 0;\n }\n\n if (cRatio >= targetCratio) {\n return 75 + (25 * (cRatio - targetCratio)) / liquidationCratio;\n }\n\n if (cRatio >= liquidationCratio) {\n return 25 + (50 * (cRatio - liquidationCratio)) / (targetCratio - liquidationCratio);\n }\n\n return (25 * cRatio) / liquidationCratio;\n};\n","import { Amount } from '@snx-v3/Amount';\nimport { wei } from '@synthetixio/wei';\nimport { FC } from 'react';\nimport { ratioIsMaxUInt } from './CRatioBar.utils';\n\nexport const CRatioAmount: FC<{\n value: number;\n}> = ({ value }) => {\n if (!value || value < 0) {\n return <>N/A;\n }\n\n if (ratioIsMaxUInt(value)) {\n return <>Infinite;\n }\n\n return ;\n};\n","import { Badge } from '@chakra-ui/react';\nimport { FC } from 'react';\nimport { getHealthVariant } from './CRatioBar.utils';\n\nconst badgeColors = {\n success: {\n colorScheme: 'green',\n bg: 'green.900',\n label: 'HEALTHY',\n },\n error: {\n colorScheme: 'red',\n bg: 'red.900',\n label: 'Unhealthy',\n },\n warning: {\n colorScheme: 'orange',\n bg: 'orange.900',\n label: 'MANAGE',\n },\n};\n\nexport const CRatioBadge: FC<{\n liquidationCratio: number;\n targetCratio: number;\n cRatio: number;\n}> = ({ liquidationCratio, targetCratio, cRatio }) => {\n const variant = getHealthVariant({\n targetCratio,\n liquidationCratio,\n cRatio,\n });\n return (\n \n {badgeColors[variant].label}\n \n );\n};\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Box, Text, Tooltip } from '@chakra-ui/react';\nimport { FC } from 'react';\n\nexport const LineWithText: FC<{\n left: string;\n text: string;\n tooltipText: string;\n}> = ({ left, text, tooltipText }) => {\n return (\n <>\n \n \n {text}{' '}\n \n \n \n \n \n \n \n );\n};\n","import { InfoIcon, TriangleDownIcon, TriangleUpIcon } from '@chakra-ui/icons';\nimport { Box, Flex, Progress, Text, Tooltip } from '@chakra-ui/react';\nimport { CRatioAmount } from './CRatioAmount';\nimport { CRatioBadge } from './CRatioBadge';\nimport { getHealthVariant, getProgressSize, ratioIsMaxUInt } from './CRatioBar.utils';\nimport { LineWithText } from './LineWithText';\n\nexport function CRatioBar({\n newCRatio,\n currentCRatio,\n targetCratio,\n liquidationCratio,\n hasChanges,\n}: {\n liquidationCratio: number;\n targetCratio: number;\n currentCRatio: number;\n newCRatio: number;\n hasChanges: boolean;\n}) {\n const variant = hasChanges\n ? getHealthVariant({\n targetCratio: targetCratio,\n liquidationCratio: liquidationCratio,\n cRatio: newCRatio,\n })\n : getHealthVariant({\n targetCratio: targetCratio,\n liquidationCratio: liquidationCratio,\n cRatio: currentCRatio,\n });\n\n const newBarSize = getProgressSize({\n cRatio: newCRatio,\n targetCratio: targetCratio,\n liquidationCratio: liquidationCratio,\n });\n\n const currentBarSize = getProgressSize({\n cRatio: currentCRatio,\n targetCratio: targetCratio,\n liquidationCratio: liquidationCratio,\n });\n\n return (\n \n \n C-Ratio{' '}\n \n \n \n \n \n \n\n {hasChanges ? (\n <>\n \n \n {!newCRatio || newCRatio < 0\n ? 'N/A'\n : ratioIsMaxUInt(newCRatio)\n ? 'Infinite'\n : `${newCRatio.toFixed(2)} %`}\n \n \n ) : null}\n\n {(hasChanges ? newCRatio || 0 : currentCRatio) !== 0 ? (\n \n ) : null}\n \n\n \n <>\n \n \n \n\n \n = 100 && newBarSize > 100)\n ? `update-${variant}`\n : variant\n }\n top={0}\n bottom={0}\n height=\"12px\"\n position=\"absolute\"\n margin=\"auto\"\n left=\"0\"\n width=\"100%\"\n value={Math.min(newBarSize, currentBarSize)}\n />\n = newBarSize ? `update-${variant}` : variant}\n top={0}\n bottom={0}\n height=\"12px\"\n position=\"absolute\"\n margin=\"auto\"\n width=\"100%\"\n left={`${Math.min(newBarSize, currentBarSize)}%`}\n display={newCRatio === 0 ? 'none' : 'block'}\n value={Math.abs(newBarSize - currentBarSize)}\n />\n \n\n \n {currentCRatio > 0 ? (\n <>\n \n \n \n ) : null}\n \n \n \n );\n}\n","import { ZEROWEI } from '@snx-v3/constants';\nimport { Wei } from '@synthetixio/wei';\n\nexport function calculateCRatio(debt?: Wei, collateralValue?: Wei) {\n if (debt && collateralValue && !debt.eq(0) && !collateralValue.eq(0)) {\n return collateralValue.div(debt);\n }\n return ZEROWEI;\n}\n","import { Flex, Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { calculateCRatio } from '@snx-v3/calculations';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport Wei from '@synthetixio/wei';\nimport { FC } from 'react';\n\nexport const CRatioChangeStat: FC<{\n collateralChange: Wei;\n currentCollateral?: Wei;\n debtChange: Wei;\n currentDebt?: Wei;\n size?: 'sm' | 'lg';\n collateralPrice?: Wei;\n}> = ({ size, currentCollateral, currentDebt, collateralChange, debtChange, collateralPrice }) => (\n \n \n {!currentCollateral || !currentDebt || !collateralPrice ? (\n ' N/A'\n ) : currentCollateral.gt(0) && currentDebt.eq(0) ? (\n 'Infinite'\n ) : (\n \n )}\n \n\n {collateralPrice && (!collateralChange?.eq(0) || !debtChange.eq(0)) ? (\n <>\n \n\n \n {(currentCollateral || ZEROWEI).add(collateralChange).gt(0) &&\n (currentDebt || ZEROWEI).add(debtChange).eq(0) ? (\n 'Infinite'\n ) : (\n \n )}\n \n \n ) : null}\n \n);\n","import { Text, TextProps } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { Wei } from '@synthetixio/wei';\n\nexport function getDebtColor(debt?: Wei) {\n if (!debt) {\n return 'gray.50';\n }\n if (debt.gt(0)) {\n return 'white.500';\n }\n if (debt.lt(0)) {\n return 'green.500';\n }\n return 'white.500';\n}\n\nexport function PnlAmount({ debt, ...props }: TextProps & { debt?: Wei }) {\n return (\n \n \n \n );\n}\n\nexport function DebtAmount({ debt, ...props }: TextProps & { debt?: Wei }) {\n return (\n \n \n \n );\n}\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport function useAccountCollateralUnlockDate({ accountId }: { accountId?: string }) {\n const { data: CoreProxy } = useCoreProxy();\n const { network } = useNetwork();\n const provider = useProvider();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'AccountCollateralUnlockDate',\n { accountId },\n { contractsHash: contractsHash([CoreProxy]) },\n ],\n enabled: Boolean(provider && CoreProxy && accountId),\n queryFn: async function () {\n if (!(provider && CoreProxy && accountId)) throw 'OMFG';\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n const [lastInteraction, accountTimeoutWithdraw] = await Promise.all([\n CoreProxyContract.getAccountLastInteraction(accountId),\n CoreProxyContract.getConfigUint(ethers.utils.formatBytes32String('accountTimeoutWithdraw')),\n ]);\n const collateralUnlock = lastInteraction.add(accountTimeoutWithdraw);\n return new Date(collateralUnlock.toNumber() * 1000);\n },\n });\n}\n","import { useEffect } from 'react';\nimport { useAccountCollateralUnlockDate } from '@snx-v3/useAccountCollateralUnlockDate';\nimport { useTimer } from 'react-timer-hook';\n\nexport function useWithdrawTimer(accountId: string | undefined) {\n const { data: accountCollateralUnlockDate, isLoading: isLoadingDate } =\n useAccountCollateralUnlockDate({\n accountId,\n });\n const { minutes, hours, seconds, isRunning, restart } = useTimer({\n expiryTimestamp: new Date(),\n autoStart: false,\n });\n\n useEffect(() => {\n if (accountCollateralUnlockDate && !isLoadingDate) {\n restart(accountCollateralUnlockDate, true);\n }\n }, [accountCollateralUnlockDate, isLoadingDate, restart]);\n\n return {\n minutes,\n hours,\n seconds,\n isRunning: isRunning && !![minutes, hours, seconds].find((a) => a > 0),\n accountCollateralUnlockDate,\n };\n}\n","import { TimeIcon } from '@chakra-ui/icons';\nimport {\n Box,\n Button,\n Collapse,\n Fade,\n Flex,\n Image,\n Link,\n Td,\n Text,\n Tooltip,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { CRatioAmount, CRatioBadge } from '@snx-v3/CRatioBar';\nimport { DebtAmount, PnlAmount } from '@snx-v3/DebtAmount';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useApr } from '@snx-v3/useApr';\nimport { useStataUSDCApr } from '@snx-v3/useApr/useStataUSDCApr';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useIsAndromedaStataUSDC } from '@snx-v3/useIsAndromedaStataUSDC';\nimport { type LiquidityPositionType } from '@snx-v3/useLiquidityPosition';\nimport { makeSearch, useParams } from '@snx-v3/useParams';\nimport { useWithdrawTimer } from '@snx-v3/useWithdrawTimer';\nimport React from 'react';\nimport lockIcon from './lock.svg';\n\nexport function PositionRow({ liquidityPosition }: { liquidityPosition: LiquidityPositionType }) {\n const [params, setParams] = useParams();\n const { network } = useNetwork();\n\n const isAndromedaStataUSDC = useIsAndromedaStataUSDC({\n tokenAddress: liquidityPosition.collateralType.tokenAddress,\n customNetwork: network,\n });\n\n const { minutes, hours, isRunning } = useWithdrawTimer(params.accountId);\n const { data: stataUSDCApr } = useStataUSDCApr(network?.id, network?.preset);\n\n const collateralAmount = liquidityPosition\n ? liquidityPosition.collateralAmount.add(liquidityPosition.totalLocked)\n : undefined;\n\n const collateralValue = liquidityPosition\n ? liquidityPosition.collateralValue.add(\n liquidityPosition.totalLocked.mul(liquidityPosition.collateralPrice)\n )\n : undefined;\n\n const { data: apr, isPending: isPendingApr } = useApr(network);\n const positionApr = React.useMemo(\n () =>\n apr?.find(\n (item) =>\n item.collateralType.toLowerCase() ===\n liquidityPosition?.collateralType?.tokenAddress.toLowerCase()\n ),\n [apr, liquidityPosition?.collateralType?.tokenAddress]\n );\n\n return (\n <>\n \n \n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: liquidityPosition.collateralType.symbol,\n manageAction: liquidityPosition.debt.gt(0) ? 'repay' : 'claim',\n accountId: params.accountId,\n });\n }}\n alignItems=\"center\"\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n whiteSpace=\"nowrap\"\n >\n \n \n \n {liquidityPosition.collateralType.symbol}\n \n \n {liquidityPosition.collateralType.displaySymbol}\n \n \n \n \n \n \n \n \n \n {liquidityPosition.totalLocked.gt(0) ? (\n \n }\n >\n \n \n ) : null}\n \n \n \n \n \n \n \n \n \n \n\n {liquidityPosition.availableCollateral.gt(0) && isRunning && (\n \n \n \n )}\n \n \n {' '}\n {liquidityPosition.availableCollateral.gt(0) && !isRunning ? (\n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: liquidityPosition.collateralType.symbol,\n manageAction: 'withdraw',\n accountId: params.accountId,\n });\n }}\n color=\"cyan.500\"\n fontFamily=\"heading\"\n fontSize=\"0.75rem\"\n lineHeight=\"1rem\"\n >\n Withdraw\n \n ) : null}\n \n \n \n \n \n \n \n {isPendingApr\n ? '~'\n : positionApr\n ? (\n positionApr.apr28d * 100 +\n (isAndromedaStataUSDC && stataUSDCApr ? stataUSDCApr : 0)\n )\n .toFixed(2)\n .concat('%')\n : '-'}\n \n \n \n \n\n \n \n {network?.preset === 'andromeda' ? (\n \n ) : (\n \n )}\n \n {liquidityPosition.debt.gt(0) ? (\n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: liquidityPosition.collateralType.symbol,\n manageAction: 'repay',\n accountId: params.accountId,\n });\n }}\n >\n Repay Debt\n \n ) : null}\n {liquidityPosition.debt.lt(0) ? (\n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: liquidityPosition.collateralType.symbol,\n manageAction: 'claim',\n accountId: params.accountId,\n });\n }}\n >\n Claim Credit\n \n ) : null}\n \n \n \n {network?.preset === 'andromeda' ? null : (\n \n \n \n \n \n \n \n \n \n \n )}\n \n \n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: liquidityPosition.collateralType.symbol,\n manageAction: 'deposit',\n accountId: params.accountId,\n });\n }}\n fontSize=\"sm\"\n lineHeight=\"1.25rem\"\n height=\"2rem\"\n fontWeight={700}\n pt=\"5px\"\n pb=\"5px\"\n pl=\"12px\"\n pr=\"12px\"\n borderWidth=\"1px\"\n borderColor=\"gray.900\"\n borderRadius=\"4px\"\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n Manage\n \n \n \n \n );\n}\n","import { calculateCRatio } from '@snx-v3/calculations';\nimport { POOL_ID } from '@snx-v3/constants';\nimport { contractsHash } from '@snx-v3/tsHelpers';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { type LiquidityPositionType } from '@snx-v3/useLiquidityPosition';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { erc7412Call } from '@snx-v3/withERC7412';\nimport { wei } from '@synthetixio/wei';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useLiquidityPositions');\n\nexport const useLiquidityPositions = ({\n accountId,\n network: customNetwork,\n}: {\n accountId?: string;\n network?: Network;\n}) => {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork || currentNetwork;\n const provider = useProviderForChain(network);\n\n const { data: CoreProxy } = useCoreProxy(network);\n const { data: collateralTypes } = useCollateralTypes(false, network);\n const { data: systemToken } = useSystemToken(network);\n\n const queryClient = useQueryClient();\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'LiquidityPositions',\n { accountId },\n {\n contractsHash: contractsHash([CoreProxy]),\n collateralTypes: contractsHash([systemToken, ...(collateralTypes || [])]),\n },\n ],\n enabled: Boolean(\n network && provider && CoreProxy && systemToken && accountId && collateralTypes\n ),\n queryFn: async (): Promise => {\n if (!(network && provider && CoreProxy && systemToken && accountId && collateralTypes)) {\n throw 'OMFG';\n }\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n\n const getAccountAvailableSystemTokenCallPromised =\n CoreProxyContract.populateTransaction.getAccountAvailableCollateral(\n accountId,\n systemToken.address\n );\n const getPositionCollateralCallsPromised = collateralTypes.map((collateralType) =>\n CoreProxyContract.populateTransaction.getPositionCollateral(\n accountId,\n POOL_ID,\n collateralType.tokenAddress\n )\n );\n const getPositionDebtCallsPromised = collateralTypes.map((collateralType) =>\n CoreProxyContract.populateTransaction.getPositionDebt(\n accountId,\n POOL_ID,\n collateralType.tokenAddress\n )\n );\n const getCollateralPriceCallsPromised = collateralTypes.map((collateralType) =>\n CoreProxyContract.populateTransaction.getCollateralPrice(collateralType.tokenAddress)\n );\n const getAccountCollateralCallPromised = collateralTypes.map((collateralType) =>\n CoreProxyContract.populateTransaction.getAccountCollateral(\n accountId,\n collateralType.tokenAddress\n )\n );\n const calls = await Promise.all([\n getAccountAvailableSystemTokenCallPromised,\n ...getPositionCollateralCallsPromised,\n ...getPositionDebtCallsPromised,\n ...getCollateralPriceCallsPromised,\n ...getAccountCollateralCallPromised,\n ]);\n\n return await erc7412Call(\n network,\n provider,\n calls,\n (decodedMulticall) => {\n const [accountAvailableSystemToken] = CoreProxyContract.interface.decodeFunctionResult(\n 'getAccountAvailableCollateral',\n decodedMulticall[0].returnData\n );\n\n const liquidityPositions = collateralTypes.map((collateralType, i) => {\n const [positionCollateral] = CoreProxyContract.interface.decodeFunctionResult(\n 'getPositionCollateral',\n decodedMulticall[1 + 0 * collateralTypes.length + i].returnData\n );\n\n const [positionDebt] = CoreProxyContract.interface.decodeFunctionResult(\n 'getPositionDebt',\n decodedMulticall[1 + 1 * collateralTypes.length + i].returnData\n );\n\n const [collateralPriceRaw] = CoreProxyContract.interface.decodeFunctionResult(\n 'getCollateralPrice',\n decodedMulticall[1 + 2 * collateralTypes.length + i].returnData\n );\n\n const [totalDepositedBigNumber, totalAssignedBigNumber, totalLockedBigNumber] =\n CoreProxyContract.interface.decodeFunctionResult(\n 'getAccountCollateral',\n decodedMulticall[1 + 3 * collateralTypes.length + i].returnData\n );\n\n const totalDeposited = wei(totalDepositedBigNumber);\n const totalAssigned = wei(totalAssignedBigNumber);\n const totalLocked = wei(totalLockedBigNumber);\n\n log({\n collateralType,\n positionCollateral,\n positionDebt,\n collateralPriceRaw,\n totalDeposited,\n totalAssigned,\n totalLocked,\n });\n\n const availableCollateral = wei(totalDeposited.sub(totalAssigned).sub(totalLocked));\n const availableSystemToken = wei(accountAvailableSystemToken);\n\n const collateralPrice = wei(collateralPriceRaw);\n const collateralAmount = wei(positionCollateral);\n const collateralValue = collateralAmount.mul(collateralPrice);\n const debt = wei(positionDebt);\n const cRatio = calculateCRatio(debt, collateralValue);\n\n return {\n collateralType,\n collateralPrice,\n availableCollateral,\n availableSystemToken,\n collateralAmount,\n collateralValue,\n debt,\n cRatio,\n totalDeposited,\n totalAssigned,\n totalLocked,\n };\n });\n log(liquidityPositions);\n\n liquidityPositions.forEach((liquidityPosition) => {\n queryClient.setQueryData(\n [\n `${network?.id}-${network?.preset}`,\n 'LiquidityPosition',\n { accountId },\n { tokenAddress: liquidityPosition.collateralType.tokenAddress },\n {\n contractsHash: contractsHash([CoreProxy]),\n collateralTypes: contractsHash([systemToken, liquidityPosition.collateralType]),\n },\n ],\n liquidityPosition\n );\n });\n return liquidityPositions;\n },\n 'useLiquidityPositions'\n );\n },\n });\n};\n","import { Button, Flex, Link, Text } from '@chakra-ui/react';\nimport { makeSearch, useParams } from '@snx-v3/useParams';\n\nexport const PositionsEmpty = () => {\n const [params, setParams] = useParams();\n return (\n \n \n You can open a new position by choosing a vault for collateral type\n \n {\n e.preventDefault();\n setParams({ accountId: params.accountId });\n }}\n size=\"sm\"\n data-cy=\"all pools button\"\n >\n Explore all Vaults\n \n \n );\n};\n","import { Skeleton, SkeletonCircle, SkeletonProps } from '@chakra-ui/react';\nimport React from 'react';\n\ninterface SynthSkeletonProps extends SkeletonProps {\n children: React.ReactNode;\n}\n\nexport const SynthSkeleton = ({ children, ...props }: SynthSkeletonProps) => {\n return (\n \n {children}\n \n );\n};\n\nexport const SynthCircle = ({ children, ...props }: SkeletonProps) => {\n return (\n \n {children}\n \n );\n};\n","import { Badge, Button, Flex, Td, Text, Tr } from '@chakra-ui/react';\nimport { SynthCircle, SynthSkeleton } from '@snx-v3/SynthSkeleton';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\n\nexport function PositionsRowLoading() {\n return (\n \n \n \n \n \n \n \n \n \n sUSDC\n \n \n \n \n Synthetic USDC\n \n \n \n \n \n\n \n \n \n \n $100,000\n \n \n \n \n 200 SNX\n \n \n \n \n\n \n \n \n \n $100,000\n \n \n \n \n 200 SNX\n \n \n \n \n \n \n \n \n $20,000\n \n \n \n \n Claim Credit\n \n \n \n \n \n \n \n \n 5000%\n \n \n \n \n HEALTHY\n \n \n \n \n \n \n \n \n Manage\n \n \n \n \n \n );\n}\n","import { Td, Tr } from '@chakra-ui/react';\n\nexport const TableDivider = () => {\n return (\n \n \n \n \n \n \n \n \n \n );\n};\n","import { Flex, Heading, Table, TableContainer, Tbody, Text, Tr } from '@chakra-ui/react';\nimport { POOL_ID } from '@snx-v3/constants';\nimport { NetworkIcon, useNetwork, useWallet } from '@snx-v3/useBlockchain';\nimport { useLiquidityPositions } from '@snx-v3/useLiquidityPositions';\nimport { useParams } from '@snx-v3/useParams';\nimport React from 'react';\nimport { PositionsEmpty } from './PositionEmpty';\nimport { PositionsNotConnected } from './PositionNotConnected';\nimport { PositionRow } from './PositionsRow';\nimport { PositionsRowLoading } from './PositionsRowLoading';\nimport { PositionTableHeader } from './PositionTableHeader';\nimport { TableDivider } from './TableDivider';\n\nexport const PositionsList = () => {\n const [params] = useParams();\n const { network } = useNetwork();\n const { activeWallet } = useWallet();\n const walletAddress = activeWallet?.address;\n\n const { data: liquidityPositions, isPending: isPendingLiquidityPositions } =\n useLiquidityPositions({ accountId: params.accountId });\n\n const filteredLiquidityPositions = React.useMemo(\n () =>\n liquidityPositions\n ? liquidityPositions.filter((liquidityPosition) => {\n if (liquidityPosition.collateralAmount.gt(0)) {\n // there is some amount delegated\n return true;\n }\n\n if (liquidityPosition.availableCollateral.gt(0)) {\n // there is some amount deposited and available to withdraw\n return true;\n }\n\n if (\n network?.preset === 'andromeda' &&\n liquidityPosition.collateralType.displaySymbol === 'USDC' &&\n liquidityPosition.availableSystemToken.gt(0)\n ) {\n // special case for USDC on Andromeda to allow withdrawals of snxUSD\n return true;\n }\n\n return false;\n })\n : [],\n [liquidityPositions, network?.preset]\n );\n\n return (\n \n {!walletAddress ? : null}\n {(walletAddress && !params.accountId) ||\n (!isPendingLiquidityPositions && !filteredLiquidityPositions.length) ? (\n \n ) : null}\n {params.accountId &&\n (isPendingLiquidityPositions || filteredLiquidityPositions.length > 0) ? (\n <>\n \n {network ? (\n <>\n \n {network.label} Network\n \n ) : null}\n \n\n \n \n \n \n {isPendingLiquidityPositions ? (\n \n ) : (\n <>\n {filteredLiquidityPositions?.map((liquidityPosition, i) => {\n return (\n \n \n \n );\n })}\n \n )}\n \n
\n \n ) : null}\n \n );\n};\n","import { Button, Collapse, Text } from '@chakra-ui/react';\nimport { ContractErrorType } from '@snx-v3/parseContractError';\nimport format from 'date-fns/format';\nimport React from 'react';\n\nconst defaultOpen = window?.localStorage?.CONTRACT_ERROR_OPEN === 'true';\n\nexport function ContractError({ contractError }: { contractError: ContractErrorType }) {\n const [isOpen, setIsOpen] = React.useState(defaultOpen);\n\n return (\n <>\n {!isOpen ? (\n setIsOpen(true)}\n color=\"inherit\"\n fontWeight=\"normal\"\n fontStyle=\"italic\"\n >\n details...\n \n ) : null}\n \n \n {contractError.name}\n \n \n {Object.entries(contractError.args)\n .map(\n ([key, val]) =>\n `${key}: ${val instanceof Date ? format(val, 'yyyy-MM-dd HH:mm:ss') : val}`\n )\n .join('\\n')}\n \n \n \n );\n}\n","export type TransactionStatus = 'unsent' | 'prompting' | 'pending' | 'success' | 'error';\n\ntype TxnState = {\n error: Error | null;\n modalOpen: boolean;\n txnStatus: TransactionStatus;\n txnHash: string | null;\n};\n\nexport const initialState: TxnState = {\n error: null,\n modalOpen: false,\n txnStatus: 'unsent',\n txnHash: null,\n};\n\nexport type Actions =\n | { type: 'prompting' }\n | { type: 'pending'; payload: { txnHash: string } }\n | { type: 'success' }\n | { type: 'error'; payload: { error: Error } }\n | { type: 'settled' };\n\nexport function reducer(state: TxnState, action: Actions): TxnState {\n switch (action.type) {\n case 'prompting':\n return {\n ...state,\n txnStatus: 'prompting',\n modalOpen: true,\n error: null,\n };\n\n case 'pending':\n return {\n ...state,\n txnStatus: 'pending',\n txnHash: action.payload.txnHash,\n };\n\n case 'success':\n return {\n ...state,\n txnStatus: 'success',\n };\n\n case 'error':\n return {\n ...state,\n txnStatus: 'error',\n error: action.payload.error,\n };\n\n case 'settled':\n return {\n ...state,\n modalOpen: false,\n txnStatus: 'unsent',\n error: null,\n txnHash: null,\n };\n\n default:\n return state;\n }\n}\n","import { importAllErrors } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useAllErrors(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'AllErrors'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importAllErrors(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","export async function importAllErrors(\n chainId?: number,\n preset?: string\n): Promise<{ address: undefined; abi: string[] }> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '11155111-main': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '10-main': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '8453-andromeda': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '84532-andromeda': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '42161-main': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n case '421614-main': {\n const [{ default: abi }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/AllErrors.readable.json'),\n ]);\n return { address: undefined, abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for AllErrors`);\n }\n }\n}\n","import { importClosePosition } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useClosePosition(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'ClosePosition'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw 'OMFG';\n return importClosePosition(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { importPositionManager } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePositionManager(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'PositionManager'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw 'OMFG';\n return importPositionManager(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { combineErrors, parseContractError } from '@snx-v3/parseContractError';\nimport { useAllErrors } from '@snx-v3/useAllErrors';\nimport { useClosePosition } from '@snx-v3/useClosePosition';\nimport { usePositionManager } from '@snx-v3/usePositionManager';\nimport { usePositionManagerAndromedaStataUSDC } from '@snx-v3/usePositionManagerAndromedaStataUSDC';\nimport { usePositionManagerAndromedaUSDC } from '@snx-v3/usePositionManagerAndromedaUSDC';\nimport { useStaticAaveUSDC } from '@snx-v3/useStaticAaveUSDC';\nimport { useCallback } from 'react';\n\nexport function useContractErrorParser() {\n const { data: AllErrors } = useAllErrors();\n const { data: ClosePosition } = useClosePosition();\n const { data: StaticAaveUSDC } = useStaticAaveUSDC();\n const { data: PositionManager } = usePositionManager();\n const { data: PositionManagerAndromedaStataUSDC } = usePositionManagerAndromedaStataUSDC();\n const { data: PositionManagerAndromedaUSDC } = usePositionManagerAndromedaUSDC();\n\n return useCallback(\n (error: any) => {\n return parseContractError({\n error,\n abi: combineErrors([\n AllErrors,\n ClosePosition,\n StaticAaveUSDC,\n PositionManager,\n PositionManagerAndromedaStataUSDC,\n PositionManagerAndromedaUSDC,\n ]),\n });\n },\n [\n AllErrors,\n ClosePosition,\n PositionManager,\n PositionManagerAndromedaStataUSDC,\n PositionManagerAndromedaUSDC,\n StaticAaveUSDC,\n ]\n );\n}\n","import { importPositionManagerAndromedaStataUSDC } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePositionManagerAndromedaStataUSDC(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'PositionManagerAndromedaStataUSDC',\n ],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw 'OMFG';\n return importPositionManagerAndromedaStataUSDC(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { importPositionManagerAndromedaUSDC } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePositionManagerAndromedaUSDC(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [\n `${targetNetwork?.id}-${targetNetwork?.preset}`,\n 'PositionManagerAndromedaStataUSDC',\n ],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw 'OMFG';\n return importPositionManagerAndromedaUSDC(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { importRewardsDistributors } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useRewardsDistributors(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'RewardsDistributors'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importRewardsDistributors(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","export async function importRewardsDistributors(\n chainId?: number,\n preset?: string\n): Promise<\n {\n address: string;\n name: string;\n poolId: string;\n\n // undefined for Pool-level distributors\n collateralType?: {\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n };\n\n payoutToken: {\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n };\n rewardManager: string;\n isRegistered: boolean;\n }[]\n> {\n if (!preset) {\n throw new Error(`Missing preset`);\n }\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '1-main': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/1-main/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '11155111-main': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/11155111-main/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '10-main': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/10-main/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '8453-andromeda': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/8453-andromeda/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '84532-andromeda': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/84532-andromeda/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '42161-main': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/42161-main/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n case '421614-main': {\n const [{ default: rewardsDistributors }] = await Promise.all([\n import('@synthetixio/v3-contracts/421614-main/rewardsDistributors.json'),\n ]);\n return rewardsDistributors;\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for RewardsDistributors`);\n }\n }\n}\n","import { POOL_ID, tokenOverrides } from '@snx-v3/constants';\nimport { contractsHash } from '@snx-v3/tsHelpers';\n// import { useAllErrors } from '@snx-v3/useAllErrors';\nimport { type Network, useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useRewardsDistributors } from '@snx-v3/useRewardsDistributors';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { useTrustedMulticallForwarder } from '@snx-v3/useTrustedMulticallForwarder';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useRewards');\n\nexport function groupRewardsBySymbol({\n network,\n rewards,\n synthTokens,\n}: {\n network: Network;\n rewards?: {\n distributor: {\n payoutToken: {\n address: string;\n symbol: string;\n };\n };\n claimableAmount: Wei;\n }[];\n synthTokens?: {\n address: string;\n token?: {\n address: string;\n symbol: string;\n };\n }[];\n}):\n | undefined\n | {\n displaySymbol: string;\n claimableAmount: Wei;\n }[] {\n if (rewards && rewards.length > 0) {\n const map = new Map();\n rewards\n .filter(({ claimableAmount }) => claimableAmount.gt(0))\n .forEach(({ distributor, claimableAmount }) => {\n const synthToken = synthTokens?.find(\n (synth) => synth.address.toLowerCase() === distributor.payoutToken.address.toLowerCase()\n );\n const token = synthToken && synthToken.token ? synthToken.token : distributor.payoutToken;\n const displaySymbol =\n tokenOverrides[`${network.id}-${network.preset}`]?.[token.address]?.symbol ??\n token.symbol;\n if (map.has(displaySymbol)) {\n map.set(displaySymbol, map.get(displaySymbol).add(claimableAmount));\n } else {\n map.set(displaySymbol, claimableAmount);\n }\n });\n return Array.from(map.entries())\n .map(([displaySymbol, claimableAmount]) => ({\n displaySymbol,\n claimableAmount,\n }))\n .sort((a, b) => a.displaySymbol.localeCompare(b.displaySymbol))\n .sort((a, b) => b.claimableAmount.toNumber() - a.claimableAmount.toNumber());\n }\n}\n\nexport function useRewards({ accountId }: { accountId?: string }) {\n const { network } = useNetwork();\n const provider = useProvider();\n const { data: synthTokens } = useSynthTokens();\n const { data: collateralTypes } = useCollateralTypes();\n const { data: Multicall3 } = useTrustedMulticallForwarder(network);\n const { data: CoreProxy } = useCoreProxy(network);\n // const { data: AllErrors } = useAllErrors(network);\n const { data: rewardsDistributors } = useRewardsDistributors(network);\n\n return useQuery({\n enabled: Boolean(\n network &&\n CoreProxy &&\n Multicall3 &&\n // AllErrors &&\n rewardsDistributors &&\n accountId &&\n collateralTypes &&\n synthTokens\n ),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'Rewards',\n { accountId },\n {\n contractsHash: contractsHash([\n CoreProxy,\n Multicall3,\n ...(rewardsDistributors ?? []),\n ...(synthTokens ?? []),\n ...(collateralTypes ?? []),\n ]),\n },\n ],\n queryFn: async () => {\n if (\n !(\n CoreProxy &&\n Multicall3 &&\n // AllErrors &&\n rewardsDistributors &&\n accountId &&\n collateralTypes &&\n synthTokens\n )\n ) {\n throw new Error('OMG');\n }\n\n const vaultDistributors = rewardsDistributors\n .map((distributor) => {\n if (distributor.collateralType) {\n return {\n method: 'getAvailableRewards',\n claimMethod: 'claimRewards',\n args: [\n ethers.BigNumber.from(accountId),\n ethers.BigNumber.from(POOL_ID),\n distributor.collateralType.address,\n distributor.address,\n ],\n distributor,\n collateralType: distributor.collateralType,\n };\n }\n })\n .filter((item) => item !== undefined);\n log('vaultDistributors', vaultDistributors);\n\n const poolDistributors = rewardsDistributors\n .filter((distributor) => !distributor.collateralType)\n .filter((distributor) => !distributor.name.includes('Liquidation Rewards'))\n .flatMap((distributor) => ({\n method: 'getAvailablePoolRewards',\n claimMethod: 'claimPoolRewards',\n args: [\n ethers.BigNumber.from(accountId),\n ethers.BigNumber.from(POOL_ID),\n ethers.constants.AddressZero,\n distributor.address,\n ],\n distributor,\n collateralType: undefined,\n }));\n log('poolDistributors', poolDistributors);\n\n const poolDistributorsPerCollateral = rewardsDistributors\n .filter((distributor) => !distributor.collateralType)\n .filter((distributor) => !distributor.name.includes('Liquidation Rewards'))\n .flatMap((distributor) =>\n collateralTypes.map((collateralType) => ({\n method: 'getAvailablePoolRewards',\n claimMethod: 'claimPoolRewards',\n args: [\n ethers.BigNumber.from(accountId),\n ethers.BigNumber.from(POOL_ID),\n collateralType.address,\n distributor.address,\n ],\n distributor,\n collateralType,\n }))\n );\n log('poolDistributorsPerCollateral', poolDistributorsPerCollateral);\n\n const liquidationRewardsDistributors = rewardsDistributors\n .filter((distributor) => !distributor.collateralType)\n .filter((distributor) => distributor.name.includes('Liquidation Rewards'))\n .flatMap((distributor) =>\n collateralTypes.map((collateralType) => ({\n method: 'getAvailableRewards',\n claimMethod: 'claimRewards',\n args: [\n ethers.BigNumber.from(accountId),\n ethers.BigNumber.from(POOL_ID),\n collateralType.address,\n distributor.address,\n ],\n distributor,\n collateralType,\n }))\n );\n log('liquidationRewardsDistributors', liquidationRewardsDistributors);\n\n const multicall = [\n ...vaultDistributors,\n ...poolDistributors,\n ...poolDistributorsPerCollateral,\n ...liquidationRewardsDistributors,\n ];\n log('multicall', multicall);\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n const calls = await Promise.all(\n multicall.map(async ({ method, args }) => {\n const { to, data } = await CoreProxyContract.populateTransaction[method](...args);\n return {\n target: to,\n callData: data,\n allowFailure: true,\n };\n })\n );\n log('calls', calls);\n\n const Multicall3Contract = new ethers.Contract(Multicall3.address, Multicall3.abi, provider);\n const multicallResponse = await Multicall3Contract.callStatic.aggregate3(calls);\n log('multicallResponse', multicallResponse);\n\n // const AllErrorsInterface = new ethers.utils.Interface(AllErrors.abi);\n const availableRewards = multicall\n .map(({ method, claimMethod, args, distributor, collateralType }, i) => {\n const { success, returnData } = multicallResponse[i];\n if (!success) {\n // log(\n // `${method} call error for ${distributor.name}`,\n // AllErrorsInterface.parseError(returnData)\n // );\n return;\n }\n const [amount] = CoreProxyContract.interface.decodeFunctionResult(method, returnData);\n return {\n method,\n claimMethod,\n args,\n distributor,\n collateralType,\n claimableAmount: wei(amount),\n };\n })\n .filter((info) => info !== undefined);\n log('availableRewards', availableRewards);\n return availableRewards;\n },\n });\n}\n","import { importSpotMarketProxy } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useSpotMarketProxy(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'SpotMarketProxy'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importSpotMarketProxy(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { useToast } from '@chakra-ui/react';\nimport { D18 } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useRewards } from '@snx-v3/useRewards';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:useClaimAllRewards');\n\nexport function useClaimAllRewards({ accountId }: { accountId?: string }) {\n const { data: rewards } = useRewards({ accountId });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const { network } = useNetwork();\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n const signer = useSigner();\n const { data: CoreProxy } = useCoreProxy();\n const [txnState, dispatch] = React.useReducer(reducer, initialState);\n const queryClient = useQueryClient();\n const provider = useProvider();\n const { data: synthTokens } = useSynthTokens();\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const errorParser = useContractErrorParser();\n\n const mutation = useMutation({\n mutationFn: async function () {\n if (\n !(network && provider && signer && SpotMarketProxy && CoreProxy && rewards && synthTokens)\n ) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const transactions: Promise[] = [];\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n const SpotMarketProxyContract = new ethers.Contract(\n SpotMarketProxy.address,\n SpotMarketProxy.abi,\n signer\n );\n\n rewards.forEach(({ distributor, claimableAmount, claimMethod, args }) => {\n if (claimableAmount.gt(0)) {\n transactions.push(CoreProxyContract.populateTransaction[claimMethod](...args));\n\n const synthToken = synthTokens.find(\n (synth) => synth.address.toLowerCase() === distributor.payoutToken.address.toLowerCase()\n );\n if (synthToken && synthToken.token) {\n const minAmountReceived = claimableAmount\n .toBN()\n .sub(claimableAmount.toBN().div(100))\n // Adjust precision for underlying token\n .mul(ethers.utils.parseUnits('1', synthToken.token.decimals))\n .div(D18);\n\n transactions.push(\n SpotMarketProxyContract.populateTransaction.unwrap(\n synthToken.synthMarketId,\n claimableAmount.toBN(),\n minAmountReceived\n )\n );\n }\n }\n });\n\n const calls = await Promise.all(transactions);\n log('calls', calls);\n\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useClaimAllRewards',\n walletAddress\n );\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onError(error) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n\n dispatch({ type: 'error', payload: { error } });\n\n toast.closeAll();\n toast({\n title: 'Claiming failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'Rewards',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your rewards have been claimed',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n },\n });\n\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n}\n","import { Alert, AlertIcon, Text } from '@chakra-ui/react';\nimport { useAccountCollateralUnlockDate } from '@snx-v3/useAccountCollateralUnlockDate';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\n\nexport function WithdrawIncrease() {\n return (\n \n \n This action will reset the withdrawal waiting period to 24 hours\n \n );\n}\n\nexport function DepositsIncreaseTimeout() {\n const [params] = useParams();\n const { data: accountCollateralUnlockDate } = useAccountCollateralUnlockDate({\n accountId: params.accountId,\n });\n\n return (\n \n \n {accountCollateralUnlockDate && accountCollateralUnlockDate.getTime() > Date.now() ? (\n \n All new deposits have a 24 hour withdrawal waiting period. This action will reset your\n active withdrawal waiting period to 24 hours.\n \n ) : (\n All new deposits have a 24 hour withdrawal waiting period.\n )}\n \n );\n}\n","import { CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { etherscanLink } from '@snx-v3/etherscanLink';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { groupRewardsBySymbol, useRewards } from '@snx-v3/useRewards';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { WithdrawIncrease } from '@snx-v3/WithdrawIncrease';\nimport { Wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function AllRewardsModal({\n txnStatus,\n txnHash,\n}: {\n txnStatus?: string;\n txnHash: string | null;\n}) {\n const [params] = useParams();\n const { network } = useNetwork();\n const { data: rewards } = useRewards({ accountId: params.accountId });\n const { data: synthTokens } = useSynthTokens();\n\n const [isOpen, setIsOpen] = React.useState(false);\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [cachedRewards, setCachedRewards] = React.useState<\n { displaySymbol: string; claimableAmount: Wei }[] | undefined\n >();\n\n const onClose = React.useCallback(() => {\n setIsOpen(false);\n setCachedRewards(undefined);\n }, []);\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n onClose();\n }\n }, [onClose, txnStatus]);\n\n React.useEffect(() => {\n if (isOpen && rewards && synthTokens && network) {\n const groupedRewards = groupRewardsBySymbol({ network, rewards, synthTokens });\n if (!cachedRewards) {\n setCachedRewards(groupedRewards);\n }\n }\n }, [isOpen, rewards, synthTokens, cachedRewards, network]);\n\n return (\n \n \n \n \n \n Claiming Rewards\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {cachedRewards ? (\n cachedRewards.map(({ displaySymbol, claimableAmount }) => (\n \n \n \n ))\n ) : (\n \n Claim your rewards\n \n )}\n \n \n \n {txnStatus === 'success' ? (\n \n Done\n \n ) : null}\n {txnHash && (\n \n \n View Transaction\n \n \n )}\n \n \n \n );\n}\n","import { Skeleton, SkeletonCircle, Td, Text, Tr } from '@chakra-ui/react';\n\nexport const RewardsLoading = () => (\n \n \n \n \n \n \n Loading\n \n \n \n \n Loading\n \n \n \n);\n","import { Fade, Flex, Td, Text, Tr } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport Wei from '@synthetixio/wei';\nimport React from 'react';\n\nexport function RewardsRow({\n displaySymbol,\n claimableAmount,\n}: {\n displaySymbol: string;\n claimableAmount: Wei;\n}) {\n return (\n <>\n \n \n \n \n \n \n \n \n {displaySymbol}\n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport {\n Button,\n Flex,\n Heading,\n Table,\n TableContainer,\n Tbody,\n Td,\n Text,\n Th,\n Thead,\n Tr,\n} from '@chakra-ui/react';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useClaimAllRewards } from '@snx-v3/useClaimAllRewards';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { groupRewardsBySymbol, useRewards } from '@snx-v3/useRewards';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport React from 'react';\nimport { AllRewardsModal } from './AllRewardsModal';\nimport { RewardsLoading } from './RewardsLoading';\nimport { RewardsRow } from './RewardsRow';\n\nexport function Rewards() {\n const [params] = useParams();\n const { data: rewards, isPending: isPendingRewards } = useRewards({\n accountId: params.accountId,\n });\n const { exec: claimAll, txnState } = useClaimAllRewards({ accountId: params.accountId });\n\n const { network } = useNetwork();\n\n const { data: synthTokens } = useSynthTokens();\n const groupedRewards = React.useMemo(\n () =>\n network && rewards && synthTokens\n ? groupRewardsBySymbol({ network, rewards, synthTokens })\n : undefined,\n [network, rewards, synthTokens]\n );\n\n return (\n \n \n \n \n Rewards\n \n 0)}\n _disabled={{\n bg: 'gray.900',\n backgroundImage: 'none',\n color: 'gray.500',\n opacity: 0.5,\n cursor: 'not-allowed',\n }}\n data-cy=\"claim rewards submit\"\n onClick={() => {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_claim_rewards_v3`,\n ]);\n claimAll();\n }}\n >\n Claim\n \n \n\n \n \n \n \n Token\n \n \n \n \n \n Earnings\n \n \n \n \n {!params.accountId ? (\n \n \n \n ) : null}\n\n {params.accountId && isPendingRewards ? : null}\n\n {groupedRewards && groupedRewards.length === 0 ? (\n \n \n \n ) : null}\n\n {groupedRewards && groupedRewards.length\n ? groupedRewards.map(({ displaySymbol, claimableAmount }) => (\n \n ))\n : null}\n \n
\n \n Create a Position to see your earnings\n \n
\n \n No Rewards Available\n \n
\n
\n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Fade, Flex, Text } from '@chakra-ui/react';\nimport { SynthSkeleton } from '@snx-v3/SynthSkeleton';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport React from 'react';\n\nexport function StatsBox({\n isLoading,\n title,\n label,\n value,\n}: {\n isLoading: boolean;\n title: string;\n label?: React.ReactNode;\n value?: React.ReactNode;\n}) {\n return (\n \n \n \n {title}\n \n {label && (\n \n \n \n )}\n \n \n \n \n \n {value || '$0.00'}\n \n \n \n \n \n );\n}\n","import { Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { StatsBox } from '@snx-v3/StatsBox';\nimport { useLiquidityPositions } from '@snx-v3/useLiquidityPositions';\nimport { useParams } from '@snx-v3/useParams';\nimport { wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function StatsTotalLocked() {\n const [params] = useParams();\n\n const { data: liquidityPositions, isPending: isPendingLiquidityPositions } =\n useLiquidityPositions({\n accountId: params.accountId,\n });\n\n const totalLocked = React.useMemo(\n () =>\n liquidityPositions\n ? liquidityPositions.reduce(\n (result, liquidityPosition) =>\n result.add(liquidityPosition.collateralAmount.mul(liquidityPosition.collateralPrice)),\n wei(0)\n )\n : wei(0),\n [liquidityPositions]\n );\n\n return (\n }\n label={\n <>\n All assets locked in Positions \n \n }\n />\n );\n}\n","import { getClaimedRewardsURL } from '@snx-v3/constants';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\n\nconst log = debug('snx:useClaimedRewards');\n\nexport function useClaimedRewards(accountId?: string) {\n const { network } = useNetwork();\n\n return useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'ClaimedRewards', { accountId }],\n enabled: Boolean(network && accountId),\n queryFn: async () => {\n const response = await fetch(getClaimedRewardsURL(network?.id) + `?accountId=${accountId}`);\n const claimedRewards: { total_amount_usd: string; collateral_type: string }[] =\n await response.json();\n log('claimedRewards', claimedRewards);\n return claimedRewards;\n },\n staleTime: 60_000,\n });\n}\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { erc7412Call } from '@snx-v3/withERC7412';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useCollateralPrices');\n\nexport function useCollateralPrices(collateralAddresses: Set, customNetwork?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork ?? currentNetwork;\n const provider = useProviderForChain(network);\n\n const { data: CoreProxy } = useCoreProxy(customNetwork);\n\n return useQuery({\n enabled: Boolean(network && provider && CoreProxy && collateralAddresses),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'CollateralPrices',\n {\n contractsHash: contractsHash([\n CoreProxy,\n ...Array.from(collateralAddresses).map((address) => ({ address })),\n ]),\n },\n ],\n queryFn: async () => {\n if (!(network && provider && CoreProxy && collateralAddresses)) {\n throw new Error('OMFG');\n }\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n\n const multicall = Array.from(collateralAddresses).map((address) => ({\n method: 'getCollateralPrice',\n args: [address],\n address,\n }));\n log('multicall', multicall);\n\n const calls = await Promise.all(\n multicall.map(({ method, args }) => CoreProxyContract.populateTransaction[method](...args))\n );\n log('calls', calls);\n\n const prices = await erc7412Call(\n network,\n provider,\n calls.map((txn: ethers.PopulatedTransaction & { requireSuccess?: boolean }) => {\n txn.requireSuccess = false;\n return txn;\n }),\n (decodedMulticall) => {\n return multicall.reduce((result, call, i) => {\n if (decodedMulticall[i].success) {\n const [price] = CoreProxyContract.interface.decodeFunctionResult(\n 'getCollateralPrice',\n decodedMulticall[i].returnData\n );\n result.set(call.address, price);\n }\n return result;\n }, new Map());\n },\n 'useCollateralPrices'\n );\n log('prices', prices);\n return prices;\n },\n });\n}\n","import { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js';\nimport { offchainMainnetEndpoint } from '@snx-v3/constants';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nconst priceService = new EvmPriceServiceConnection(offchainMainnetEndpoint, {\n timeout: 60_000,\n httpRetries: 5,\n verbose: true,\n});\n\nconst priceFeeds: { [key: string]: string } = {\n SNX: '0x39d020f60982ed892abbcd4a06a276a9f9b7bfbce003204c110b6e488f502da3',\n};\n\nexport async function fetchPythPrice(symbol: string, time?: number) {\n const feedId = priceFeeds[symbol];\n if (time) {\n const priceFeed = await priceService.getPriceFeed(feedId, time);\n const { price, expo } = priceFeed.getPriceUnchecked();\n return ethers.utils.parseUnits(price, 18 + expo);\n }\n const response = await priceService.getLatestPriceFeeds([feedId]);\n if (response) {\n const [priceFeed] = response;\n const { price, expo } = priceFeed.getPriceUnchecked();\n return ethers.utils.parseUnits(price, 18 + expo);\n }\n}\n\nexport function usePythPrice(symbol?: string, time?: number) {\n return useQuery({\n queryKey: ['PythPrice', symbol, { time }],\n enabled: Boolean(symbol),\n queryFn: async () => {\n if (symbol && symbol in priceFeeds) {\n return fetchPythPrice(symbol, time);\n }\n return ethers.BigNumber.from(0);\n },\n });\n}\n","import { getIssuedDebtUrl } from '@snx-v3/constants';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\n\nconst log = debug('snx:useIssuedDebt');\n\nexport function useIssuedDebt(accountId?: string) {\n const { network } = useNetwork();\n\n return useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'IssuedDebt', { accountId }],\n enabled: Boolean(network && accountId),\n queryFn: async () => {\n const response = await fetch(getIssuedDebtUrl(network?.id) + `?accountId=${accountId}`);\n const issuedDebts: { issuance: string; collateral_type: string }[] = await response.json();\n log('issuedDebt', issuedDebts);\n return issuedDebts;\n },\n staleTime: 60_000,\n });\n}\n","import { Text } from '@chakra-ui/react';\nimport { PnlAmount } from '@snx-v3/DebtAmount';\nimport { StatsBox } from '@snx-v3/StatsBox';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useClaimedRewards } from '@snx-v3/useClaimedRewards';\nimport { useCollateralPrices } from '@snx-v3/useCollateralPrices';\nimport { useLiquidityPositions } from '@snx-v3/useLiquidityPositions';\nimport { useParams } from '@snx-v3/useParams';\nimport { usePythPrice } from '@snx-v3/usePythPrice';\nimport { useRewards } from '@snx-v3/useRewards';\nimport { wei } from '@synthetixio/wei';\nimport React from 'react';\nimport { useIssuedDebt } from '@snx-v3/useIssuedDebt';\n\nexport function StatsTotalPnl() {\n const [params] = useParams();\n const { network } = useNetwork();\n\n const { data: rewards, isPending: isPendingRewards } = useRewards({\n accountId: params.accountId,\n });\n\n const { data: snxPrice, isPending: isPendingSnxPrice } = usePythPrice('SNX');\n\n const { data: claimedRewards, isPending: isPendingClaimedRewards } = useClaimedRewards(\n params.accountId\n );\n const { data: issuedDebt, isPending: isPendingIssuedDebt } = useIssuedDebt(params.accountId);\n\n const rewardsTokens = React.useMemo(() => {\n const result: Set = new Set();\n if (rewards) {\n for (const reward of rewards) {\n if (reward.claimableAmount.gt(0)) {\n result.add(reward.distributor.payoutToken.address);\n }\n }\n }\n return result;\n }, [rewards]);\n\n const { data: rewardsTokenPrices, isPending: isPendingRewardsPrices } = useCollateralPrices(\n rewardsTokens,\n network\n );\n\n const totalRewardsValue = React.useMemo(() => {\n if (rewards && rewardsTokenPrices && snxPrice) {\n return rewards.reduce((result, reward) => {\n // all rewards should have price except SNX as it is not a collateral on Base\n if (reward.distributor.payoutToken.symbol === 'SNX') {\n return result.add(reward.claimableAmount.mul(snxPrice));\n }\n if (rewardsTokenPrices.has(reward.distributor.payoutToken.address)) {\n return result.add(\n reward.claimableAmount.mul(\n rewardsTokenPrices.get(reward.distributor.payoutToken.address)\n )\n );\n }\n return result;\n }, wei(0));\n }\n }, [rewards, rewardsTokenPrices, snxPrice]);\n\n const { data: liquidityPositions, isPending: isPendingLiquidityPositions } =\n useLiquidityPositions({\n accountId: params.accountId,\n });\n\n const totalDebt = React.useMemo(() => {\n if (liquidityPositions) {\n return liquidityPositions.reduce(\n (result, liquidityPosition) => result.add(liquidityPosition.debt),\n wei(0)\n );\n }\n }, [liquidityPositions]);\n\n const totalClaimedRewards = React.useMemo(() => {\n return claimedRewards?.reduce((curr, acc) => curr.add(acc.total_amount_usd), wei(0));\n }, [claimedRewards]);\n const totalIssuedDebt = React.useMemo(() => {\n return issuedDebt?.reduce((curr, acc) => curr.add(acc.issuance), wei(0));\n }, [issuedDebt]);\n\n return (\n \n ) : undefined\n }\n label={\n \n Aggregated PNL of all of your open positions, unclaimed rewards, and previously claimed\n rewards\n \n }\n />\n );\n}\n","import { Box, Button, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useNetwork, useProvider, useSigner, useWallet } from '@snx-v3/useBlockchain';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useStaticAaveUSDC } from '@snx-v3/useStaticAaveUSDC';\nimport { wei } from '@synthetixio/wei';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:StataUSDC');\n\nexport function StataUSDC() {\n const { network } = useNetwork();\n const provider = useProvider();\n const signer = useSigner();\n const { activeWallet } = useWallet();\n const walletAddress = activeWallet?.address;\n\n const { data: StaticAaveUSDC } = useStaticAaveUSDC();\n\n const { data: stataBalance } = useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'StaticAaveUSDC Redeem'],\n enabled: Boolean(network && provider && walletAddress && StaticAaveUSDC),\n queryFn: async function () {\n if (!(network && provider && walletAddress && StaticAaveUSDC)) {\n throw new Error('OMFG');\n }\n const StaticAaveUSDCContract = new ethers.Contract(\n StaticAaveUSDC.address,\n StaticAaveUSDC.abi,\n provider\n );\n const maxRedeem = await StaticAaveUSDCContract.maxRedeem(walletAddress);\n const previewRedeem = await StaticAaveUSDCContract.previewRedeem(maxRedeem);\n return {\n maxRedeem,\n previewRedeem,\n };\n },\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const queryClient = useQueryClient();\n const errorParser = useContractErrorParser();\n const isReady = network && provider && signer && walletAddress && StaticAaveUSDC && true;\n const { mutateAsync: unwrapStaticAaveUSDC, isPending } = useMutation({\n mutationFn: async function () {\n if (!isReady) {\n throw new Error('Not ready');\n }\n const StaticAaveUSDCContract = new ethers.Contract(\n StaticAaveUSDC.address,\n StaticAaveUSDC.abi,\n signer\n );\n const maxRedeem = await StaticAaveUSDCContract.maxRedeem(walletAddress);\n log('maxRedeem', maxRedeem);\n\n const shares = maxRedeem;\n log('shares', shares);\n const receiver = walletAddress;\n log('receiver', receiver);\n const owner = walletAddress;\n log('owner', owner);\n const withdrawFromAave = true;\n log('withdrawFromAave', withdrawFromAave);\n\n const args = [\n //\n shares,\n receiver,\n owner,\n withdrawFromAave,\n ];\n const gasLimit = await StaticAaveUSDCContract.estimateGas[\n 'redeem(uint256,address,address,bool)'\n ](...args);\n const txn = await StaticAaveUSDCContract['redeem(uint256,address,address,bool)'](...args, {\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'StaticAaveUSDC Redeem',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your Static aUSDC has been unwrapped to USDC.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n },\n\n onError: (error) => {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Transaction failed',\n variant: 'left-accent',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n duration: 3_600_000,\n });\n throw Error('Transaction failed', { cause: error });\n },\n });\n\n if (!(stataBalance && stataBalance.maxRedeem.gt(0))) {\n return null;\n }\n\n return (\n \n \n \n \n \n \n Static aUSDC\n \n \n \n \n \n \n \n \n {\n window?._paq?.push(['trackEvent', 'liquidity', 'v3_staking', `submit_unwrap_stata_v3`]);\n unwrapStaticAaveUSDC();\n }}\n >\n Unwrap\n \n \n \n );\n}\n","import { Fade, Flex, Td, Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { SynthIcon } from '@snx-v3/TokenIcon';\nimport Wei from '@synthetixio/wei';\nimport React from 'react';\n\nexport function SynthRow({\n synth,\n balance,\n}: {\n synth: {\n address: string;\n symbol: string;\n name: string;\n };\n balance: Wei;\n}) {\n return (\n <>\n \n \n \n \n \n \n {synth.symbol}\n \n \n {synth.name}\n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import { contractsHash } from '@snx-v3/tsHelpers';\nimport { useNetwork, useProvider, useWallet } from '@snx-v3/useBlockchain';\nimport { useTrustedMulticallForwarder } from '@snx-v3/useTrustedMulticallForwarder';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useSynthBalances');\n\nexport function useSynthBalances() {\n const { network } = useNetwork();\n const provider = useProvider();\n const { activeWallet } = useWallet();\n const walletAddress = activeWallet?.address;\n\n const { data: synthTokens } = useSynthTokens();\n const { data: Multicall3 } = useTrustedMulticallForwarder();\n\n return useQuery({\n enabled: Boolean(network && Multicall3 && synthTokens && walletAddress),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'SynthBalances',\n { walletAddress },\n {\n contractsHash: contractsHash([Multicall3, ...(synthTokens ?? [])]),\n },\n ],\n queryFn: async () => {\n if (!(network && Multicall3 && synthTokens && walletAddress)) {\n throw new Error('OMG');\n }\n log('synthTokens', synthTokens);\n\n const TokenInterface = new ethers.utils.Interface([\n 'function balanceOf(address) view returns (uint256)',\n ]);\n const multicall = synthTokens.map((synth) => ({\n synth,\n method: 'balanceOf',\n args: [walletAddress],\n target: synth.address,\n callData: TokenInterface.encodeFunctionData('balanceOf', [walletAddress]),\n allowFailure: true,\n }));\n log('multicall', multicall);\n\n const Multicall3Contract = new ethers.Contract(Multicall3.address, Multicall3.abi, provider);\n const multicallResponse = await Multicall3Contract.callStatic.aggregate3(\n multicall.map(({ target, callData, allowFailure }) => ({\n target,\n callData,\n allowFailure,\n }))\n );\n log('multicallResponse', multicallResponse);\n\n const balances = multicall\n .map(({ method, synth }, i) => {\n const { success, returnData } = multicallResponse[i];\n if (!success) {\n log(`${method} call error for ${synth.symbol}`);\n return;\n }\n const [balance] = TokenInterface.decodeFunctionResult(method, returnData);\n return {\n synth,\n balance: wei(balance, synth.decimals),\n };\n })\n .filter((info) => info !== undefined);\n log('balances', balances);\n\n return balances;\n },\n });\n}\n","import { useToast } from '@chakra-ui/react';\nimport { D18 } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { useSynthBalances } from '@snx-v3/useSynthBalances';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:useUnwrapAllSynths');\n\nexport function useUnwrapAllSynths() {\n const { data: synthBalances } = useSynthBalances();\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const { network } = useNetwork();\n const provider = useProvider();\n const signer = useSigner();\n\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n const [txnState, dispatch] = React.useReducer(reducer, initialState);\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const errorParser = useContractErrorParser();\n\n const queryClient = useQueryClient();\n\n const mutation = useMutation({\n mutationFn: async function () {\n if (!(network && provider && signer && SpotMarketProxy && synthBalances)) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const transactions: Promise[] = [];\n\n const SpotMarketProxyContract = new ethers.Contract(\n SpotMarketProxy.address,\n SpotMarketProxy.abi,\n signer\n );\n synthBalances.forEach(({ synth, balance }) => {\n if (synth.token && balance.gt(0)) {\n const minAmountReceived = balance\n .toBN()\n .sub(balance.toBN().div(100))\n // Adjust precision for underlying token\n .mul(ethers.utils.parseUnits('1', synth.token.decimals))\n .div(D18);\n\n transactions.push(\n SpotMarketProxyContract.populateTransaction.unwrap(\n synth.synthMarketId,\n balance.toBN(),\n minAmountReceived\n )\n );\n }\n });\n\n const [calls] = await Promise.all([Promise.all(transactions)]);\n log('calls', calls);\n\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useUnwrapAllSynths',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onError(error) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n\n dispatch({ type: 'error', payload: { error } });\n\n toast.closeAll();\n toast({\n title: 'Withdrawal failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n\n dispatch({ type: 'success' });\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your synths have been unwrapped',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n },\n });\n\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n}\n","import { Skeleton, SkeletonCircle, Td, Text, Tr } from '@chakra-ui/react';\n\nexport const SynthsLoading = () => (\n \n \n \n \n \n \n \n  \n \n \n \n \n);\n","import { CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { tokenOverrides } from '@snx-v3/constants';\nimport { etherscanLink } from '@snx-v3/etherscanLink';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useSynthBalances } from '@snx-v3/useSynthBalances';\nimport { Wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function SynthsUnwrapModal({\n txnStatus,\n txnHash,\n}: {\n txnStatus?: string;\n txnHash: string | null;\n}) {\n const { network } = useNetwork();\n const { data: synthBalances } = useSynthBalances();\n\n const [isOpen, setIsOpen] = React.useState(false);\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [cachedSynths, setCachedSynths] = React.useState<\n { symbol: string; name: string; balance: Wei }[] | undefined\n >();\n\n const onClose = React.useCallback(() => {\n setIsOpen(false);\n setCachedSynths(undefined);\n }, []);\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n setCachedSynths(undefined);\n setIsOpen(false);\n }\n }, [txnStatus]);\n\n React.useEffect(() => {\n if (isOpen && synthBalances && network) {\n const filteredSynths = synthBalances\n .map(({ synth, balance }) => ({\n balance,\n symbol: synth.token ? synth.token.symbol : synth.symbol,\n name: synth.token ? synth.token.name : synth.name,\n ...tokenOverrides[`${network.id}-${network.preset}`]?.[\n synth.token ? synth.token.address : synth.address\n ],\n }))\n .filter(({ balance }) => balance.gt(0))\n .sort((a, b) => a.symbol.localeCompare(b.symbol))\n .sort((a, b) => b.balance.toNumber() - a.balance.toNumber());\n\n if (!cachedSynths) {\n setCachedSynths(filteredSynths);\n }\n }\n }, [cachedSynths, isOpen, network, synthBalances]);\n\n return (\n \n \n \n \n \n Unwrapping Synths\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {cachedSynths ? (\n cachedSynths.map(({ symbol, balance }) => {\n return (\n \n \n \n );\n })\n ) : (\n \n Unwrapping your synths\n \n )}\n \n \n {txnStatus === 'success' ? (\n \n Done\n \n ) : null}\n {txnHash && (\n \n \n View Transaction\n \n \n )}\n \n \n \n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport {\n Button,\n Flex,\n Heading,\n Table,\n TableContainer,\n Tbody,\n Td,\n Text,\n Th,\n Thead,\n Tr,\n} from '@chakra-ui/react';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useWallet } from '@snx-v3/useBlockchain';\nimport { useSynthBalances } from '@snx-v3/useSynthBalances';\nimport { useUnwrapAllSynths } from '@snx-v3/useUnwrapAllSynths';\nimport { wei } from '@synthetixio/wei';\nimport React from 'react';\nimport { SynthRow } from './SynthRow';\nimport { SynthsLoading } from './SynthsLoading';\nimport { SynthsUnwrapModal } from './SynthsUnwrapModal';\n\nexport function Synths() {\n const { activeWallet } = useWallet();\n const walletAddress = activeWallet?.address;\n\n const { data: synthBalances, isPending: isPendingSynthBalances } = useSynthBalances();\n const { exec: unwrapAll, txnState } = useUnwrapAllSynths();\n\n const filteredSynths = React.useMemo(() => {\n if (!synthBalances || !synthBalances.length) {\n return;\n }\n return synthBalances\n .filter(({ balance }) => balance.gt(wei(0.01))) // ignore the dust\n .sort((a, b) => a.synth.symbol.localeCompare(b.synth.symbol))\n .sort((a, b) => b.balance.toNumber() - a.balance.toNumber());\n }, [synthBalances]);\n\n return (\n \n \n \n \n Synths\n \n balance.gt(0)))}\n _disabled={{\n bg: 'gray.900',\n backgroundImage: 'none',\n color: 'gray.500',\n opacity: 0.5,\n cursor: 'not-allowed',\n }}\n data-cy=\"unwrap synths submit\"\n onClick={() => {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_unwrap_synths_v3`,\n ]);\n unwrapAll();\n }}\n >\n Unwrap\n \n \n \n \n \n \n Token\n \n \n Synth balance\n \n \n \n \n \n \n \n {!walletAddress ? (\n \n \n \n ) : null}\n {walletAddress && isPendingSynthBalances ? : null}\n {!isPendingSynthBalances && filteredSynths && filteredSynths.length === 0 ? (\n \n \n \n ) : null}\n\n {filteredSynths\n ? filteredSynths.map(({ synth, balance }, i) => (\n \n \n \n ))\n : null}\n \n
\n \n Please connect wallet to view synths\n \n
\n \n You do not have any synths\n \n
\n
\n );\n}\n","import { Alert, AlertIcon, Collapse, Flex, Heading, Link, Text } from '@chakra-ui/react';\nimport { PoolsList } from '@snx-v3/Pools';\nimport { PositionsList } from '@snx-v3/Positions';\nimport { Rewards } from '@snx-v3/Rewards';\nimport { StatsTotalLocked } from '@snx-v3/StatsTotalLocked';\nimport { StatsTotalPnl } from '@snx-v3/StatsTotalPnl';\nimport { StataUSDC, Synths } from '@snx-v3/Synths';\nimport { MAINNET, OPTIMISM, useNetwork } from '@snx-v3/useBlockchain';\nimport React from 'react';\nimport { Helmet } from 'react-helmet';\n\nexport function DashboardPage() {\n const { network } = useNetwork();\n return (\n <>\n \n Synthetix Liquidity V3\n \n \n \n \n \n \n \n From March 24th the liquidation ratio is being raised on legacy positions.{' '}\n \n Migrate to 420 Pool immediately.\n \n \n \n \n\n \n \n \n Stake and Earn\n \n \n Deposit SNX to earn a privileged share of protocol performance\n \n \n \n \n \n \n \n\n \n \n Positions\n \n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n Vaults\n \n \n \n \n \n );\n}\n","import { Container, Flex, Link } from '@chakra-ui/react';\nimport { DiscordIcon, GithubIcon, Logo, WarpcastIcon, XIcon, YoutubeIcon } from '@snx-v3/icons';\n\nexport const Footer = () => {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n","import { CopyIcon, SettingsIcon } from '@chakra-ui/icons';\nimport {\n Badge,\n Button,\n Flex,\n IconButton,\n Link,\n Menu,\n MenuButton,\n MenuItem,\n MenuList,\n Text,\n} from '@chakra-ui/react';\nimport { prettyString, renderAccountId } from '@snx-v3/format';\nimport { WalletIcon } from '@snx-v3/icons';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useAccounts } from '@snx-v3/useAccounts';\nimport { NetworkIcon, NETWORKS, useNetwork, useWallet } from '@snx-v3/useBlockchain';\nimport { makeSearch, useParams } from '@snx-v3/useParams';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst mainnets = NETWORKS.filter(({ isSupported, isTestnet }) => isSupported && !isTestnet);\n\nexport function NetworkController() {\n const [params, setParams] = useParams();\n\n const [toolTipLabel, setTooltipLabel] = React.useState('Copy');\n const { activeWallet, walletsInfo, connect, disconnect } = useWallet();\n const { network: currentNetwork, setNetwork } = useNetwork();\n const { data: accounts, isPending: isPendingAccounts } = useAccounts();\n\n const paramsAccountId = React.useMemo(() => {\n try {\n if (params.accountId && params.accountId.length > 0) {\n return ethers.BigNumber.from(params.accountId);\n }\n } catch {\n // malformed account id in url\n }\n }, [params.accountId]);\n\n const notConnected = !activeWallet;\n const notSupported = activeWallet && !currentNetwork;\n\n React.useEffect(() => {\n if (notConnected) {\n const { accountId: _, ...newParams } = params;\n setParams(newParams);\n return;\n }\n if (!isPendingAccounts && accounts) {\n if (accounts.length > 0 && !params.accountId) {\n setParams({ ...params, accountId: accounts[0].toString() });\n return;\n }\n if (\n accounts.length > 0 &&\n paramsAccountId &&\n !accounts.some((account) => account.eq(paramsAccountId))\n ) {\n setParams({ ...params, accountId: accounts[0].toString() });\n return;\n }\n if (!accounts.length) {\n const { accountId: _, ...newParams } = params;\n setParams(newParams);\n return;\n }\n }\n }, [accounts, isPendingAccounts, notConnected, params, paramsAccountId, setParams]);\n\n React.useEffect(() => {\n if (window.$magicWallet) {\n connect({ autoSelect: { disableModals: true, label: 'MetaMask' } });\n }\n }, [connect]);\n\n if (!activeWallet) {\n return (\n connect()}\n type=\"button\"\n size=\"sm\"\n ml={2}\n py={5}\n >\n Connect Wallet\n \n );\n }\n return (\n \n {currentNetwork ? (\n \n span': { display: 'flex', alignItems: 'center' } }}\n mr={1}\n px={3}\n >\n \n \n {currentNetwork.label}\n \n \n \n {mainnets.map(({ id, preset, label }) => (\n setNetwork(id)}\n isDisabled={window.$chainId ? window.$chainId !== id : false}\n >\n \n \n {label}\n \n \n ))}\n \n \n ) : null}\n \n \n \n \n {activeWallet.ens?.name || prettyString(activeWallet.address)}\n \n \n \n \n \n \n \n Connected with {walletsInfo?.label}\n \n {\n if (walletsInfo) {\n disconnect(walletsInfo);\n }\n }}\n size=\"xs\"\n variant=\"outline\"\n colorScheme=\"gray\"\n color=\"white\"\n >\n Disconnect\n \n \n \n \n {prettyString(activeWallet.address)}\n \n \n {\n navigator.clipboard.writeText(activeWallet.address);\n setTooltipLabel('Copied');\n setTimeout(() => {\n setTooltipLabel('Copy');\n }, 10000);\n }}\n />\n \n \n\n {accounts && accounts.length > 0 ? (\n \n \n \n {accounts.length > 1 ? 'Accounts' : 'Account'}\n \n {\n e.preventDefault();\n setParams({ page: 'settings', accountId: params.accountId });\n }}\n >\n }\n aria-label=\"account settings\"\n />\n \n \n \n {accounts?.map((accountId) => (\n {\n e.stopPropagation();\n setParams({ ...params, accountId: accountId.toString() });\n }}\n >\n {renderAccountId(accountId)}\n {paramsAccountId && accountId.eq(paramsAccountId) ? (\n \n Connected\n \n ) : null}\n \n ))}\n \n \n ) : null}\n \n \n \n \n \n );\n}\n","import { Container, Flex, Link, useDisclosure } from '@chakra-ui/react';\nimport { Logo, LogoIcon } from '@snx-v3/icons';\nimport { useEffect } from 'react';\nimport { NavLink as RouterLink, useLocation } from 'react-router-dom';\nimport { NetworkController } from './NetworkController';\n\nexport default function Header() {\n const { onClose } = useDisclosure();\n const location = useLocation();\n\n useEffect(() => {\n onClose();\n }, [location, onClose]);\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import { Flex, FlexProps } from '@chakra-ui/react';\n\nexport const BorderBox = (props: FlexProps) => (\n \n);\n","import Wei, { wei } from '@synthetixio/wei';\nimport React, { createContext, useState, PropsWithChildren, Dispatch, SetStateAction } from 'react';\n\nexport const ManagePositionContext = createContext<{\n collateralChange: Wei;\n debtChange: Wei;\n withdrawAmount: Wei;\n setDebtChange: Dispatch>;\n setCollateralChange: Dispatch>;\n setWithdrawAmount: Dispatch>;\n}>({\n collateralChange: wei(0),\n debtChange: wei(0),\n withdrawAmount: wei(0),\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setDebtChange: () => {},\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setCollateralChange: () => {},\n setWithdrawAmount: () => {},\n});\n\nexport const ManagePositionProvider: React.FC = ({ children }) => {\n const [debtChange, setDebtChange] = useState(wei(0));\n const [collateralChange, setCollateralChange] = useState(wei(0));\n const [withdrawAmount, setWithdrawAmount] = useState(wei(0));\n\n return (\n \n {children}\n \n );\n};\n","import { Input, InputProps } from '@chakra-ui/react';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\n\nexport interface NumberInputProps extends InputProps {\n 'data-cy'?: string;\n 'data-max'?: string;\n}\n\nexport const NUMBER_REGEX = /^([0-9]*[.])?[0-9]{0,18}$/;\n\nfunction cleanupNumber(value: Wei) {\n // Cleanup trailing precision zeroes\n const float = parseFloat(value.toString());\n if (float === value.toNumber()) {\n return `${float}`;\n }\n return value.toString();\n}\n\nexport function NumberInput({\n value,\n onChange,\n min,\n max,\n InputProps,\n disabled,\n}: {\n onChange?: (value: Wei) => void;\n value: Wei;\n min?: Wei;\n max?: Wei;\n InputProps?: NumberInputProps;\n disabled?: boolean;\n}) {\n const [inputValue, setInputValue] = useState(value.gt(0) ? value.toString() : '');\n\n const onInputChange = useCallback(\n (e: ChangeEvent) => {\n // Define max length here\n if (e.target.value.length > 24) return;\n\n let _value = e.target.value;\n\n if (!isNaN(Number(e.target.value))) {\n if (!!min && min.gt(Number(e.target.value))) {\n _value = min.toNumber().toString();\n }\n }\n\n setInputValue(_value);\n if (!onChange) {\n // Could be a read-only input\n return;\n }\n if (!NUMBER_REGEX.test(`${_value}`)) {\n return;\n }\n let nextValue = value;\n try {\n nextValue = wei(_value || 0);\n } catch (_err) {\n // whatever\n }\n if (!value.eq(nextValue)) {\n onChange(nextValue);\n }\n },\n [min, onChange, value]\n );\n\n const ref = useRef(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n if (!NUMBER_REGEX.test(`${inputValue}`)) {\n ref.current.setCustomValidity('Invalid number');\n return;\n }\n if (value && value.eq(0)) {\n ref.current.setCustomValidity('Value required');\n return;\n }\n if (min && min.gte(0) && value && value.lt(min)) {\n ref.current.setCustomValidity(`Value smaller than minimum of ${cleanupNumber(min)}`);\n return;\n }\n if (max && max.gte(0) && value && value.gt(max)) {\n ref.current.setCustomValidity(`Value greater than maximum of ${cleanupNumber(max)}`);\n return;\n }\n ref.current.setCustomValidity('');\n }, [inputValue, min, max, value]);\n\n useEffect(() => {\n if (value.eq(0)) {\n return setInputValue('');\n }\n return setInputValue(cleanupNumber(value));\n }, [value]);\n\n return (\n \n );\n}\n","import { calculateCRatio } from '@snx-v3/calculations';\nimport { POOL_ID } from '@snx-v3/constants';\nimport { contractsHash } from '@snx-v3/tsHelpers';\nimport { useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { CollateralType } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { erc7412Call } from '@snx-v3/withERC7412';\nimport Wei, { wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\n\nconst log = debug('snx:useLiquidityPosition');\n\nexport type LiquidityPositionType = {\n collateralType: CollateralType;\n collateralPrice: Wei;\n availableCollateral: Wei;\n availableSystemToken: Wei;\n collateralAmount: Wei;\n collateralValue: Wei;\n debt: Wei;\n cRatio: Wei;\n totalDeposited: Wei;\n totalAssigned: Wei;\n totalLocked: Wei;\n};\n\nexport const useLiquidityPosition = ({\n accountId,\n collateralType,\n}: {\n accountId?: string;\n collateralType?: CollateralType;\n}) => {\n const { data: CoreProxy } = useCoreProxy();\n const { network } = useNetwork();\n const provider = useProviderForChain(network!);\n const { data: systemToken } = useSystemToken();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'LiquidityPosition',\n { accountId },\n { tokenAddress: collateralType?.tokenAddress },\n { contractsHash: contractsHash([CoreProxy, systemToken]) },\n ],\n enabled: Boolean(\n network && provider && CoreProxy && systemToken && accountId && collateralType\n ),\n queryFn: async (): Promise => {\n if (!(network && provider && CoreProxy && systemToken && accountId && collateralType)) {\n throw 'OMFG';\n }\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n\n const getAccountAvailableSystemTokenCallPromised =\n CoreProxyContract.populateTransaction.getAccountAvailableCollateral(\n accountId,\n systemToken.address\n );\n const getPositionCollateralCallPromised =\n CoreProxyContract.populateTransaction.getPositionCollateral(\n accountId,\n POOL_ID,\n collateralType.tokenAddress\n );\n const getPositionDebtCallPromised = CoreProxyContract.populateTransaction.getPositionDebt(\n accountId,\n POOL_ID,\n collateralType.tokenAddress\n );\n const getCollateralPriceCallPromised =\n CoreProxyContract.populateTransaction.getCollateralPrice(collateralType.tokenAddress);\n\n const getAccountCollateralCallPromised =\n CoreProxyContract.populateTransaction.getAccountCollateral(\n accountId,\n collateralType.tokenAddress\n );\n\n const calls = await Promise.all([\n getAccountAvailableSystemTokenCallPromised,\n getPositionCollateralCallPromised,\n getPositionDebtCallPromised,\n getCollateralPriceCallPromised,\n getAccountCollateralCallPromised,\n ]);\n\n return await erc7412Call(\n network,\n provider,\n calls,\n (decodedMulticall) => {\n log('collateralType', collateralType);\n\n const [accountAvailableSystemToken] = CoreProxyContract.interface.decodeFunctionResult(\n 'getAccountAvailableCollateral',\n decodedMulticall[0].returnData\n );\n log('accountAvailableSystemToken', accountAvailableSystemToken);\n\n const [positionCollateral] = CoreProxyContract.interface.decodeFunctionResult(\n 'getPositionCollateral',\n decodedMulticall[1].returnData\n );\n log('positionCollateral', positionCollateral);\n\n const [positionDebt] = CoreProxyContract.interface.decodeFunctionResult(\n 'getPositionDebt',\n decodedMulticall[1 + 1].returnData\n );\n log('positionDebt', positionDebt);\n\n const [collateralPriceRaw] = CoreProxyContract.interface.decodeFunctionResult(\n 'getCollateralPrice',\n decodedMulticall[1 + 2].returnData\n );\n log('collateralPriceRaw', collateralPriceRaw);\n\n const [totalDepositedBigNumber, totalAssignedBigNumber, totalLockedBigNumber] =\n CoreProxyContract.interface.decodeFunctionResult(\n 'getAccountCollateral',\n decodedMulticall[1 + 3].returnData\n );\n\n const totalDeposited = wei(totalDepositedBigNumber);\n const totalAssigned = wei(totalAssignedBigNumber);\n const totalLocked = wei(totalLockedBigNumber);\n log('totalDeposited', totalDeposited);\n log('totalAssigned', totalAssigned);\n log('totalLocked', totalLocked);\n\n const availableCollateral = wei(totalDeposited.sub(totalAssigned).sub(totalLocked));\n const availableSystemToken = wei(accountAvailableSystemToken);\n\n const collateralPrice = wei(collateralPriceRaw);\n const collateralAmount = wei(positionCollateral);\n const collateralValue = collateralAmount.mul(collateralPrice);\n const debt = wei(positionDebt);\n const cRatio = calculateCRatio(debt, collateralValue);\n\n const liquidityPosition = {\n collateralType,\n collateralPrice,\n availableCollateral,\n availableSystemToken,\n collateralAmount,\n collateralValue,\n debt,\n cRatio,\n totalDeposited,\n totalAssigned,\n totalLocked,\n };\n\n log('liquidityPosition', liquidityPosition);\n return liquidityPosition;\n },\n 'useLiquidityPosition'\n );\n },\n });\n};\n","import { ZEROWEI } from '@snx-v3/constants';\nimport { useOfflinePrices } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { wei } from '@synthetixio/wei';\nimport { useMemo } from 'react';\n\nexport const useTokenPrice = (symbol?: string) => {\n const { data: collateralTypes } = useCollateralTypes(true);\n\n const pythCollateralPrices = collateralTypes?.filter((item) => item.symbol !== 'stataUSDC');\n\n const { data: collateralPrices } = useOfflinePrices(\n (pythCollateralPrices || []).map((item) => ({\n id: item.tokenAddress,\n oracleId: item.oracleNodeId,\n symbol: item.symbol,\n }))\n );\n\n return useMemo(() => {\n if (!collateralTypes || !collateralPrices) {\n return ZEROWEI;\n }\n const collateralPrice =\n symbol === 'stataUSDC'\n ? collateralPrices.find((price) => `${price.symbol}`.toUpperCase() === 'USDC')\n : collateralPrices.find(\n (price) => `${price.symbol}`.toUpperCase() === `${symbol}`.toUpperCase()\n );\n return collateralPrice && collateralPrice.price ? wei(collateralPrice.price) : ZEROWEI;\n }, [collateralPrices, collateralTypes, symbol]);\n};\n","import { MultistepStatus } from './MultistepStatus';\n\nexport function statusColor(status: MultistepStatus): string {\n switch (true) {\n // order matters\n case status.failed:\n return 'red.700';\n case status.disabled:\n return 'gray.900';\n case status.loading:\n return 'gray.900';\n case status.success:\n return 'green.700';\n default:\n return 'gray.900';\n }\n}\n","import { createIcon } from '@chakra-ui/icon';\nimport { Box, Spinner } from '@chakra-ui/react';\nimport { PropsWithChildren } from 'react';\nimport { MultistepStatus } from './MultistepStatus';\n\nexport const CheckIcon = createIcon({\n viewBox: '0 0 14 14',\n path: (\n \n \n \n ),\n});\n\nexport const CloseIcon = createIcon({\n d: 'M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z',\n});\n\nexport function StepIcon({ status, children }: PropsWithChildren<{ status: MultistepStatus }>) {\n switch (true) {\n case status.failed:\n return ;\n case status.success:\n return ;\n case status.loading:\n return ;\n case status.disabled:\n default:\n return (\n \n {children}\n \n );\n }\n}\n","import { Flex } from '@chakra-ui/react';\nimport { PropsWithChildren } from 'react';\nimport { MultistepStatus } from './MultistepStatus';\nimport { statusColor } from './statusColor';\nimport { StepIcon } from './StepIcon';\n\nexport function Step({ status, children }: PropsWithChildren<{ status: MultistepStatus }>) {\n return (\n \n {children}\n \n );\n}\n","import { Box, Checkbox, CheckboxProps, Flex, FlexProps, Text } from '@chakra-ui/react';\nimport { PropsWithChildren, ReactNode } from 'react';\nimport { MultistepStatus } from './MultistepStatus';\nimport { statusColor } from './statusColor';\nimport { Step } from './Step';\n\nfunction StepCheckbox({ children, ...props }: PropsWithChildren) {\n return (\n \n \n \n {children}\n \n \n \n );\n}\n\ninterface Props extends Omit {\n step: number;\n title: string | ReactNode;\n subtitle?: string | ReactNode;\n checkboxLabel?: string;\n checkboxProps?: CheckboxProps;\n status: MultistepStatus;\n children?: ReactNode | undefined;\n}\n\nexport function Multistep({\n step,\n title,\n subtitle,\n checkboxLabel,\n checkboxProps,\n status,\n children,\n ...props\n}: Props) {\n return (\n \n {step}\n \n \n {title}\n \n {subtitle ? (\n \n {subtitle}\n \n ) : null}\n {checkboxLabel ? {checkboxLabel} : null}\n {children}\n \n \n );\n}\n","import { Alert, Button, Divider, Flex, Heading, Text } from '@chakra-ui/react';\nimport { CheckIcon } from '@snx-v3/Multistep';\nimport { ReactNode } from 'react';\n\nexport function LiquidityPositionUpdated({\n title,\n subline,\n alertText,\n summary,\n onClose,\n}: {\n title?: ReactNode;\n subline?: ReactNode;\n alertText?: ReactNode;\n summary?: ReactNode;\n onClose: () => void;\n}) {\n return (\n \n {title && (\n <>\n \n {title}\n \n \n \n )}\n {subline && (\n \n {subline}\n \n )}\n \n \n \n \n \n {alertText}\n \n \n\n {summary}\n\n \n \n );\n}\n","import { ArrowForwardIcon } from '@chakra-ui/icons';\nimport { Flex, Text } from '@chakra-ui/react';\nimport Wei from '@synthetixio/wei';\nimport React from 'react';\n\nconst styles = {\n sm: {\n fontSize: '12px',\n fontWeight: '700',\n lineHeight: '14px',\n },\n md: {\n fontSize: '16px',\n fontWeight: '400',\n lineHeight: '16px',\n },\n lg: {\n fontSize: '18px',\n fontWeight: '800',\n lineHeight: '24px',\n },\n};\n\nexport function ChangeStat({\n formatFn,\n value,\n newValue,\n hasChanges,\n 'data-cy': dataCy,\n size = 'lg',\n isPending,\n}: {\n value?: Wei;\n newValue: Wei;\n hasChanges: boolean;\n 'data-cy'?: string;\n formatFn: (val?: Wei) => React.ReactNode;\n size?: 'sm' | 'md' | 'lg';\n isPending?: boolean;\n}) {\n return (\n \n \n {isPending ? '~' : formatFn(value)}\n \n {hasChanges && !isPending && (!value || !value.eq(newValue)) ? (\n \n \n \n {formatFn(newValue)}\n \n \n ) : null}\n \n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Flex, Text, Tooltip } from '@chakra-ui/react';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { DebtAmount } from '@snx-v3/DebtAmount';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { type Wei } from '@synthetixio/wei';\n\nexport function DebtStats({ newDebt, hasChanges }: { newDebt: Wei; hasChanges: boolean }) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n return (\n \n \n \n \n Debt\n \n \n Debt consists of:\n
\n - Your portion of the pool's total debt, which fluctuates based on trader\n performance and market conditions\n
- The amount you've borrowed against your collateral without incurring\n interest\n \n }\n textAlign=\"start\"\n py={2}\n px={3}\n >\n \n \n \n \n
\n \n }\n hasChanges={hasChanges}\n data-cy=\"stats debt\"\n />\n \n
\n
\n );\n}\n","import { BigNumber } from 'ethers';\nimport { z } from 'zod';\nimport { wei } from '@synthetixio/wei';\n\nexport const ZodBigNumber = z.custom((val) => BigNumber.isBigNumber(val));\n\nexport const SmallIntSchema = ZodBigNumber.transform((x) => wei(x, 0).toNumber());\nexport const WeiSchema = ZodBigNumber.transform((x) => wei(x));\n","import { POOL_ID } from '@snx-v3/constants';\nimport { contractsHash } from '@snx-v3/tsHelpers';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { erc7412Call } from '@snx-v3/withERC7412';\nimport { ZodBigNumber } from '@snx-v3/zod';\nimport { wei } from '@synthetixio/wei';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\nimport { z } from 'zod';\n\nconst VaultCollateralSchema = z\n .object({ value: ZodBigNumber, amount: ZodBigNumber })\n .transform(({ value, amount }) => ({ value: wei(value), amount: wei(amount) }));\n\nexport const useVaultsData = (customNetwork?: Network) => {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork ?? currentNetwork;\n\n const { data: collateralTypes } = useCollateralTypes(false, network);\n const { data: CoreProxy } = useCoreProxy(network);\n\n const provider = useProviderForChain(network);\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'VaultsData',\n { contractsHash: contractsHash([CoreProxy, ...(collateralTypes ?? [])]) },\n ],\n enabled: Boolean(CoreProxy && collateralTypes && network && provider),\n queryFn: async () => {\n if (!(CoreProxy && collateralTypes && network && provider)) {\n throw Error('useVaultsData should not be enabled when missing data');\n }\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n const calls = await Promise.all(\n collateralTypes.map((collateralType) =>\n CoreProxyContract.populateTransaction.getVaultCollateral(\n POOL_ID,\n collateralType.tokenAddress\n )\n )\n );\n\n return await erc7412Call(\n network,\n provider,\n calls,\n (decodedMulticall) => {\n return decodedMulticall.map(({ returnData }, i) => {\n const CoreProxyInterface = new ethers.utils.Interface(CoreProxy.abi);\n const vaultCollateral = CoreProxyInterface.decodeFunctionResult(\n 'getVaultCollateral',\n returnData\n );\n const collateral = VaultCollateralSchema.parse({ ...vaultCollateral });\n return {\n collateral,\n collateralType: collateralTypes[i],\n };\n });\n },\n 'useVaultsData'\n );\n },\n });\n};\n","import { ArrowUpIcon } from '@chakra-ui/icons';\nimport { Flex, Heading, Link, Text } from '@chakra-ui/react';\nimport { formatNumberToUsd } from '@snx-v3/formatters';\nimport { getStatsUrl } from '@snx-v3/getStatsUrl';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { NetworkIcon, useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useVaultsData } from '@snx-v3/useVaultsData';\nimport React from 'react';\n\n// import { useApr } from '@snx-v3/useApr';\n\nexport function PositionTitle() {\n const { network } = useNetwork();\n\n const [params] = useParams();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { data: vaultsData, isPending: isPendingVaultsData } = useVaultsData(network);\n\n // const { data: aprData, isPending: isAprLoading } = useApr(network);\n // const { collateral: totalCollateral, debt: totalDebt } = React.useMemo(() => {\n // const zeroValues = { collateral: { value: wei(0), amount: wei(0) }, debt: wei(0) };\n // if (!vaultsData) return zeroValues;\n //\n // return vaultsData.reduce((acc, { collateral, debt }) => {\n // acc.collateral = {\n // value: acc.collateral.value.add(collateral.value),\n // amount: acc.collateral.amount.add(collateral.amount),\n // };\n // acc.debt = acc.debt.add(debt);\n // return acc;\n // }, zeroValues);\n // }, [vaultsData]);\n\n const vaultData = React.useMemo(() => {\n if (vaultsData && collateralType) {\n return vaultsData.find(\n (item) => item.collateralType.address.toLowerCase() === collateralType.address.toLowerCase()\n );\n }\n }, [collateralType, vaultsData]);\n\n return (\n \n \n \n \n \n \n {collateralType?.displaySymbol ?? params.collateralSymbol} Liquidity Position\n \n \n \n \n {network?.label} Network\n \n \n TVL\n \n {isPendingVaultsData\n ? '~'\n : vaultData\n ? formatNumberToUsd(vaultData.collateral.value.toNumber(), {\n maximumFractionDigits: 0,\n })\n : '-'}\n \n \n \n More Stats\n \n \n \n \n \n );\n}\n","export function getStatsUrl(chainId?: number) {\n if (chainId === 1) {\n return 'https://stats.synthetix.io/all/?page=ethereum';\n }\n if (chainId === 10) {\n return 'https://stats.synthetix.io/all/?page=optimism';\n }\n if (chainId === 8453) {\n return 'https://stats.synthetix.io/all/?page=base';\n }\n if (chainId === 42161) {\n return 'https://stats.synthetix.io/all/?page=arbitrum';\n }\n return 'https://stats.synthetix.io/all/';\n}\n","import { Button, Flex, Image, Link, Text } from '@chakra-ui/react';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport CoinImage from './coin.png';\n\nexport function StataDepositBanner() {\n return (\n \n \n \n This position earns yield via Aave and Synthetix\n \n \n Deposit USDC, and we’ll wrap it into Static aUSDC for you. Watch your balance stay the\n same while the value grows, earning effortless yield through Aave and Synthetix.\n \n \n Read more about Static aUSDC\n \n \n\n \n \n );\n}\n","import { calculateCRatio } from '@snx-v3/calculations';\nimport { Wei, wei } from '@synthetixio/wei';\n\nexport const validatePosition = ({\n issuanceRatioD18,\n collateralAmount,\n collateralPrice,\n debt,\n collateralChange,\n debtChange,\n}: {\n issuanceRatioD18?: Wei;\n collateralAmount?: Wei;\n collateralPrice?: Wei;\n debt?: Wei;\n collateralChange: Wei;\n debtChange: Wei;\n}) => {\n const targetCRatio = issuanceRatioD18 ? issuanceRatioD18 : wei(1);\n const newDebt = wei(debt || 0).add(debtChange);\n const newCollateralAmount = wei(collateralAmount || 0).add(collateralChange);\n const newCollateralValue = newCollateralAmount.mul(collateralPrice || 0);\n\n const newCRatio = calculateCRatio(newDebt, newCollateralValue);\n\n const maybeMaxDebt = wei(newCollateralAmount)\n .mul(collateralPrice || 0)\n .div(targetCRatio)\n .sub(debt || 0);\n\n const maxDebt = maybeMaxDebt.gte(0) ? maybeMaxDebt : wei(0);\n\n const isValid =\n (debtChange.lte(0) && collateralChange.gte(0)) ||\n ((newCRatio.gte(targetCRatio) || newCRatio.lte(0)) &&\n (newDebt.lte(0) || newCollateralAmount.gt(0)));\n\n return {\n isValid,\n hasChanges: !collateralChange.eq(0) || !debtChange.eq(0),\n newCRatio,\n newDebt,\n newCollateralAmount,\n maxDebt,\n };\n};\n","import { Flex, Link, Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { currency } from '@snx-v3/format';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { makeSearch, type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { type Wei } from '@synthetixio/wei';\n\nexport function CollateralStats({\n newCollateralAmount,\n hasChanges,\n}: {\n newCollateralAmount: Wei;\n hasChanges: boolean;\n}) {\n const [params, setParams] = useParams();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n return (\n \n \n \n \n Collateral\n \n \n \n \n \n `${currency(val ?? ZEROWEI)} ${\n collateralType?.displaySymbol ?? params.collateralSymbol\n }`\n }\n hasChanges={hasChanges}\n data-cy=\"stats collateral\"\n />\n {liquidityPosition ? (\n currency(val ?? ZEROWEI)}\n size=\"md\"\n hasChanges={hasChanges}\n data-cy=\"stats collateral value\"\n />\n ) : null}\n \n \n\n {liquidityPosition && liquidityPosition.totalLocked.gt(0) ? (\n \n \n Escrowed\n {' '}\n {\n e.preventDefault();\n setParams({ ...params, page: 'position', manageAction: 'locked' });\n }}\n >\n \n \n \n ) : null}\n \n \n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Flex, Text } from '@chakra-ui/react';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { PnlAmount } from '@snx-v3/DebtAmount';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { type Wei } from '@synthetixio/wei';\n\nexport function PnlStats({ newDebt, hasChanges }: { newDebt: Wei; hasChanges: boolean }) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n return (\n \n \n \n \n PnL\n \n \n \n \n \n \n \n \n }\n hasChanges={hasChanges}\n data-cy=\"stats pnl\"\n />\n \n \n \n );\n}\n","import { Flex, Text } from '@chakra-ui/react';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { calculateCRatio } from '@snx-v3/calculations';\nimport { D27 } from '@snx-v3/constants';\nimport { CRatioBar } from '@snx-v3/CRatioBar';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useIsAndromedaStataUSDC } from '@snx-v3/useIsAndromedaStataUSDC';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useStaticAaveUSDCRate } from '@snx-v3/useStaticAaveUSDCRate';\nimport { validatePosition } from '@snx-v3/validatePosition';\nimport React from 'react';\nimport { CollateralStats } from './CollateralStats';\nimport { DebtStats } from './DebtStats';\nimport { PnlStats } from './PnlStats';\n\nexport function ManageStats() {\n const [params] = useParams();\n const { network } = useNetwork();\n\n const { debtChange, collateralChange } = React.useContext(ManagePositionContext);\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const isAndromedaStataUSDC = useIsAndromedaStataUSDC({\n tokenAddress: collateralType?.tokenAddress,\n });\n const { data: stataRate } = useStaticAaveUSDCRate();\n const adjustedCollateralChange = React.useMemo(() => {\n // Temporary adjustment until UI fully moves to show only USDC and avoid stata conversion\n if (isAndromedaStataUSDC && stataRate) {\n return collateralChange.div(stataRate).mul(D27);\n }\n return collateralChange;\n }, [collateralChange, isAndromedaStataUSDC, stataRate]);\n\n const cRatio = calculateCRatio(liquidityPosition?.debt, liquidityPosition?.collateralValue);\n const { newCRatio, newCollateralAmount, newDebt, hasChanges } = validatePosition({\n issuanceRatioD18: collateralType?.issuanceRatioD18,\n collateralAmount: liquidityPosition?.collateralAmount,\n collateralPrice: liquidityPosition?.collateralPrice,\n debt: liquidityPosition?.debt,\n collateralChange: adjustedCollateralChange,\n debtChange,\n });\n\n return (\n \n \n Overview\n \n \n \n {network?.preset === 'andromeda' ? (\n \n ) : (\n \n )}\n \n {network?.preset === 'andromeda' ? null : (\n \n \n \n )}\n \n );\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Flex, Link, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { POOL_ID, ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useClosePosition } from '@snx-v3/useClosePosition';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { usePythFeeds } from '@snx-v3/usePythFeeds';\nimport { usePythVerifier } from '@snx-v3/usePythVerifier';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useTrustedMulticallForwarder } from '@snx-v3/useTrustedMulticallForwarder';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:ClosePositionOneStep');\n\nexport function ClosePositionOneStep({\n onClose,\n onBack,\n}: {\n onClose: () => void;\n onBack: () => void;\n}) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, refetch: refetchLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { setCollateralChange, setDebtChange } = React.useContext(ManagePositionContext);\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const [txState, setTxState] = React.useState({ step: 0, status: 'idle' });\n\n const queryClient = useQueryClient();\n const errorParser = useContractErrorParser();\n\n const { data: CoreProxy } = useCoreProxy();\n const { data: Multicall3 } = useTrustedMulticallForwarder();\n const { data: AccountProxy } = useAccountProxy();\n const { data: ClosePosition } = useClosePosition();\n const { data: PythVerfier } = usePythVerifier();\n const { data: pythFeeds } = usePythFeeds();\n const { data: systemToken } = useSystemToken();\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const { network } = useNetwork();\n const signer = useSigner();\n const provider = useProvider();\n\n // const queryClient = useQueryClient();\n // queryClient.invalidateQueries();\n\n const { mutate: execClosePosition } = useMutation({\n mutationFn: async function () {\n log('params', params);\n log('collateralType', collateralType);\n\n setTxState({ step: 1, status: 'pending' });\n if (\n !(\n network &&\n provider &&\n signer &&\n CoreProxy &&\n Multicall3 &&\n AccountProxy &&\n ClosePosition &&\n PythVerfier &&\n pythFeeds &&\n params.accountId &&\n systemToken?.address &&\n collateralType?.tokenAddress\n )\n ) {\n throw new Error('Not ready');\n }\n\n const ClosePositionContract = new ethers.Contract(\n ClosePosition.address,\n ClosePosition.abi,\n signer\n );\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const TokenContract = new ethers.Contract(\n systemToken?.address,\n ['function approve(address spender, uint256 amount) returns (bool)'],\n signer\n );\n\n const { data: freshLiquidityPosition } = await refetchLiquidityPosition({\n throwOnError: true,\n });\n if (!freshLiquidityPosition) {\n throw new Error('Could not fetch fresh liquidity position');\n }\n const adjustedAllowance = freshLiquidityPosition.debt.lt(1)\n ? // For the case when debt fluctuates from negative/zero to slightly positive\n ethers.utils.parseEther('1')\n : // Add extra buffer for debt fluctuations\n freshLiquidityPosition.debt.mul(120).div(100).toBN();\n log('adjustedAllowance', adjustedAllowance);\n\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n ClosePosition.address,\n params.accountId\n );\n const approveUsdTx = TokenContract.populateTransaction.approve(\n ClosePosition.address,\n adjustedAllowance\n );\n const closePositionTx = ClosePositionContract.populateTransaction.closePosition(\n CoreProxy.address,\n AccountProxy.address,\n params.accountId,\n POOL_ID,\n collateralType.tokenAddress\n );\n const callsPromise = Promise.all([approveAccountTx, approveUsdTx, closePositionTx]);\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useClosePosition',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n 'AccountCollateralUnlockDate',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n\n setCollateralChange(ZEROWEI);\n setDebtChange(ZEROWEI);\n setTxState({ step: 1, status: 'success' });\n },\n\n onError: (error) => {\n setTxState({ step: 1, status: 'error' });\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Transaction failed',\n variant: 'left-accent',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n duration: 3_600_000,\n });\n throw Error('Transaction failed', { cause: error });\n },\n });\n\n if (txState.status === 'success') {\n return (\n \n Your position has been successfully closed. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={<>Position successfully closed}\n />\n );\n }\n\n return (\n \n \n \n Close Position\n \n \n \n Approve close position on behalf\n {liquidityPosition && liquidityPosition.debt && liquidityPosition.debt.gt(0) ? (\n \n \n \n ) : null}\n {liquidityPosition && liquidityPosition.debt && liquidityPosition.debt.lt(0) ? (\n \n \n \n ) : null}\n {liquidityPosition ? (\n \n ) : null}\n \n }\n status={{\n failed: txState.status === 'error',\n success: txState.status === 'success',\n loading: txState.status === 'pending',\n }}\n />\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_close_position_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n execClosePosition();\n }}\n mt=\"6\"\n >\n {txState.status === 'error' ? 'Retry' : null}\n {txState.status === 'pending' ? 'Processing...' : null}\n {txState.status === 'idle' ? 'Execute Transaction' : null}\n \n \n );\n}\n","import { importPythVerifier } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePythVerifier(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'PythVerifier'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importPythVerifier(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { importPythFeeds } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePythFeeds(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'PythFeeds'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importPythFeeds(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { useQuery } from '@tanstack/react-query';\nimport { useWallet, useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { BigNumber, Contract } from 'ethers';\n\nconst abi = ['function allowance(address, address) view returns (uint256)'];\n\nexport const useAllowance = ({\n contractAddress,\n spender,\n}: {\n contractAddress?: string;\n spender?: string;\n}) => {\n const { activeWallet } = useWallet();\n const { network } = useNetwork();\n const provider = useProvider();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'Allowance',\n { accountAddress: activeWallet?.address },\n { contractAddress, spender },\n ],\n queryFn: async () => {\n if (!(contractAddress && spender && activeWallet?.address && provider))\n throw new Error('OMG');\n const contract = new Contract(contractAddress, abi, provider);\n const allowance = await contract.allowance(activeWallet.address, spender);\n\n return BigNumber.from(allowance);\n },\n enabled: Boolean(activeWallet?.address && contractAddress && spender && provider),\n });\n};\n","import { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAllowance } from '@snx-v3/useAllowance';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:useApprove');\n\nexport const approveAbi = ['function approve(address spender, uint256 amount) returns (bool)'];\n\nexport const useApprove = ({\n contractAddress,\n amount,\n spender,\n}: {\n contractAddress?: string;\n amount?: ethers.BigNumber;\n spender?: string;\n}) => {\n const [txnState, dispatch] = React.useReducer(reducer, initialState);\n const { data: allowance, refetch: refetchAllowance } = useAllowance({ contractAddress, spender });\n const sufficientAllowance = allowance && amount && allowance.gte(amount);\n\n const { network } = useNetwork();\n const signer = useSigner();\n const provider = useProvider();\n\n const queryClient = useQueryClient();\n const isReady =\n network &&\n provider &&\n signer &&\n contractAddress &&\n spender &&\n amount &&\n // Make it boolean\n true;\n\n const mutation = useMutation({\n mutationFn: async (infiniteApproval: boolean) => {\n log(`contractAddress`, contractAddress);\n log(`spender`, spender);\n log(`amount`, amount);\n if (!isReady) {\n throw new Error('Not ready');\n }\n if (sufficientAllowance) {\n dispatch({ type: 'success' });\n return;\n }\n\n dispatch({ type: 'prompting' });\n const contract = new ethers.Contract(contractAddress, approveAbi, signer);\n const amountToApprove = infiniteApproval ? ethers.constants.MaxUint256 : amount;\n log(`amountToApprove`, amountToApprove);\n\n const gasLimitPromised = contract.estimateGas.approve(spender, amountToApprove);\n const populatedTxnPromised = contract.populateTransaction.approve(spender, amountToApprove);\n const [gasLimit, populatedTxn] = await Promise.all([gasLimitPromised, populatedTxnPromised]);\n\n const txn = await signer.sendTransaction({\n ...populatedTxn,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'Allowance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n isReady,\n mutation,\n txnState,\n isLoading: mutation.isPending,\n approve: mutation.mutateAsync,\n refetchAllowance,\n requireApproval: !sufficientAllowance,\n allowance,\n };\n};\n","import { POOL_ID } from '@snx-v3/constants';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport { useReducer } from 'react';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\n\nconst log = debug('snx:useBorrow');\n\nexport const useBorrow = ({ borrowAmount }: { borrowAmount?: Wei }) => {\n const [params] = useParams();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const [txnState, dispatch] = useReducer(reducer, initialState);\n\n const { data: CoreProxy } = useCoreProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const signer = useSigner();\n const provider = useProvider();\n const { network } = useNetwork();\n\n const queryClient = useQueryClient();\n\n const isReady =\n signer &&\n CoreProxy &&\n params.accountId &&\n collateralType?.address &&\n network &&\n provider &&\n !!borrowAmount;\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n dispatch({ type: 'prompting' });\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n\n const populatedTxnPromised = CoreProxyContract.populateTransaction.mintUsd(\n ethers.BigNumber.from(params.accountId),\n ethers.BigNumber.from(POOL_ID),\n collateralType?.address,\n borrowAmount.toBN()\n );\n\n const callsPromise = Promise.all([populatedTxnPromised]);\n const [calls] = await Promise.all([callsPromise]);\n\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useBorrow',\n walletAddress\n );\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'TransferableSynthetix',\n 'AccountCollateralUnlockDate',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n isReady,\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n};\n","const abi = [\n 'function depositDebtToRepay(address synthetixCore, address spotMarket, address accountProxy, uint128 accountId, uint128 poolId, address collateralType, uint128 spotMarketId)',\n];\n\nexport async function importDebtRepayer(\n chainId?: number,\n preset?: string\n): Promise<{ address: string; abi: string[] }> {\n const deployment = `${Number(chainId).toFixed(0)}-${preset}`;\n switch (deployment) {\n case '8453-andromeda': {\n // https://basescan.org/address/0x624f2aB0f1DFF2297b9eca320898381Fbba4E3E3#code\n return { address: '0x624f2aB0f1DFF2297b9eca320898381Fbba4E3E3', abi };\n }\n case '84532-andromeda': {\n // https://sepolia.basescan.org/address/0xe4b0233F06a308B4732282e24ce7aE0c87bdEcbc#code\n return { address: '0xe4b0233F06a308B4732282e24ce7aE0c87bdEcbc', abi };\n }\n default: {\n throw new Error(`Unsupported deployment ${deployment} for DebtRepayer`);\n }\n }\n}\n","import { importDebtRepayer } from '@snx-v3/contracts';\nimport { Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useDebtRepayer(customNetwork?: Network) {\n const { network } = useNetwork();\n const targetNetwork = customNetwork || network;\n\n return useQuery({\n queryKey: [`${targetNetwork?.id}-${targetNetwork?.preset}`, 'DebtRepayer'],\n enabled: Boolean(targetNetwork),\n queryFn: async function () {\n if (!targetNetwork) throw new Error('OMFG');\n return importDebtRepayer(targetNetwork.id, targetNetwork.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { POOL_ID } from '@snx-v3/constants';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { usePositionManager } from '@snx-v3/usePositionManager';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport { useReducer } from 'react';\n\nconst log = debug('snx:useRepay');\n\nexport function useRepay({ repayAmount }: { repayAmount?: Wei }) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const [txnState, dispatch] = useReducer(reducer, initialState);\n\n const { data: CoreProxy } = useCoreProxy();\n const { data: AccountProxy } = useAccountProxy();\n const { data: PositionManager } = usePositionManager();\n\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: systemToken } = useSystemToken();\n const { data: systemTokenBalance } = useTokenBalance(systemToken?.address);\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const signer = useSigner();\n const { network } = useNetwork();\n const provider = useProvider();\n\n const availableCollateral =\n systemTokenBalance && liquidityPosition\n ? systemTokenBalance.add(liquidityPosition.availableSystemToken)\n : undefined;\n\n const canRepay =\n liquidityPosition &&\n liquidityPosition.debt.gt(0) &&\n availableCollateral &&\n repayAmount &&\n availableCollateral.gte(repayAmount);\n\n const isReady =\n repayAmount &&\n repayAmount.gt(0) &&\n canRepay &&\n network &&\n provider &&\n signer &&\n CoreProxy &&\n AccountProxy &&\n PositionManager &&\n params.accountId &&\n systemToken?.address &&\n collateralType?.tokenAddress &&\n // Make it boolean\n true;\n\n const queryClient = useQueryClient();\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const TokenContract = new ethers.Contract(\n systemToken?.address,\n ['function approve(address spender, uint256 amount) returns (bool)'],\n signer\n );\n const PositionManagerContract = new ethers.Contract(\n PositionManager.address,\n PositionManager.abi,\n signer\n );\n\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n PositionManager.address,\n params.accountId\n );\n const approveUsdTx = TokenContract.populateTransaction.approve(\n PositionManager.address,\n repayAmount.toBN()\n );\n const repayTx = PositionManagerContract.populateTransaction.repay(\n CoreProxy.address,\n AccountProxy.address,\n params.accountId,\n POOL_ID,\n collateralType.tokenAddress,\n repayAmount.toBN()\n );\n\n const callsPromise = Promise.all([approveAccountTx, approveUsdTx, repayTx]);\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useRepay',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n isReady,\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n}\n","import { POOL_ID } from '@snx-v3/constants';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei, { wei } from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport { useReducer } from 'react';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\n\nconst log = debug('snx:useUndelegate');\n\nexport const useUndelegate = ({ undelegateAmount }: { undelegateAmount?: Wei }) => {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const collateralTypeAddress = collateralType?.tokenAddress;\n\n const [txnState, dispatch] = useReducer(reducer, initialState);\n\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: CoreProxy } = useCoreProxy();\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const signer = useSigner();\n const provider = useProvider();\n const { network } = useNetwork();\n const queryClient = useQueryClient();\n\n const canUndelegate =\n liquidityPosition &&\n liquidityPosition.collateralAmount.gt(0) &&\n undelegateAmount &&\n liquidityPosition.collateralAmount.gte(undelegateAmount);\n\n const isReady =\n canUndelegate &&\n network &&\n provider &&\n signer &&\n CoreProxy &&\n params.accountId &&\n collateralTypeAddress &&\n // Make it boolean\n true;\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n const populatedTxnPromised = CoreProxyContract.populateTransaction.delegateCollateral(\n ethers.BigNumber.from(params.accountId),\n ethers.BigNumber.from(POOL_ID),\n collateralTypeAddress,\n liquidityPosition.collateralAmount.sub(undelegateAmount).toBN(),\n wei(1).toBN()\n );\n\n const walletAddress = await signer.getAddress();\n\n const callsPromise = Promise.all([populatedTxnPromised]);\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useUndelegate',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n 'AccountCollateralUnlockDate',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n isReady,\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n};\n","import { POOL_ID } from '@snx-v3/constants';\nimport { USDC_BASE_MARKET } from '@snx-v3/isBaseAndromeda';\nimport { notNil } from '@snx-v3/tsHelpers';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:useUndelegateBaseAndromeda');\n\nexport function useUndelegateBaseAndromeda({ undelegateAmount }: { undelegateAmount?: Wei }) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const collateralTypeAddress = collateralType?.tokenAddress;\n const currentCollateral = liquidityPosition?.collateralAmount || wei(0);\n\n const [txnState, dispatch] = React.useReducer(reducer, initialState);\n const { data: CoreProxy } = useCoreProxy();\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const signer = useSigner();\n const provider = useProvider();\n const { network } = useNetwork();\n\n const { data: AccountProxy } = useAccountProxy();\n const { data: DebtRepayer } = useDebtRepayer();\n\n const queryClient = useQueryClient();\n\n const canUndelegate =\n liquidityPosition &&\n liquidityPosition.collateralAmount.gt(0) &&\n undelegateAmount &&\n liquidityPosition.collateralAmount.gte(undelegateAmount);\n\n const isReady =\n canUndelegate &&\n network &&\n provider &&\n signer &&\n CoreProxy &&\n AccountProxy &&\n DebtRepayer &&\n SpotMarketProxy &&\n params.accountId &&\n collateralTypeAddress &&\n // Make it boolean\n true;\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n\n const DebtRepayerContract = new ethers.Contract(DebtRepayer.address, DebtRepayer.abi, signer);\n\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n DebtRepayer.address,\n params.accountId\n );\n\n const depositDebtToRepay = DebtRepayerContract.populateTransaction.depositDebtToRepay(\n CoreProxy.address,\n SpotMarketProxy.address,\n AccountProxy.address,\n params.accountId,\n POOL_ID,\n collateralTypeAddress,\n USDC_BASE_MARKET\n );\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n\n const delegateTx = CoreProxyContract.populateTransaction.delegateCollateral(\n ethers.BigNumber.from(params.accountId),\n ethers.BigNumber.from(POOL_ID),\n collateralTypeAddress,\n currentCollateral.sub(undelegateAmount).toBN(),\n wei(1).toBN()\n );\n\n const callsPromise: Promise<(ethers.PopulatedTransaction & { requireSuccess?: boolean })[]> =\n Promise.all([approveAccountTx, depositDebtToRepay, delegateTx].filter(notNil));\n\n const [calls] = await Promise.all([callsPromise]);\n\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useUndelegateBase',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'AccountCollateralUnlockDate',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n isReady,\n };\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Flex, Link, Skeleton, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { parseUnits } from '@snx-v3/format';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useBorrow } from '@snx-v3/useBorrow';\nimport { useClosePosition } from '@snx-v3/useClosePosition';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useRepay } from '@snx-v3/useRepay';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useUndelegate } from '@snx-v3/useUndelegate';\nimport { useUndelegateBaseAndromeda } from '@snx-v3/useUndelegateBaseAndromeda';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nexport function ClosePositionTransactions({\n onClose,\n onBack,\n}: {\n onClose: () => void;\n onBack: () => void;\n}) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const [steps, setSteps] = React.useState<\n {\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n cb: () => Promise;\n }[]\n >([]);\n const { setCollateralChange, setDebtChange } = React.useContext(ManagePositionContext);\n const { data: systemToken } = useSystemToken();\n const { data: CoreProxy } = useCoreProxy();\n const { network } = useNetwork();\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const collateralSymbol = collateralType?.displaySymbol;\n\n const [txState, setTxState] = React.useState({\n step: 0,\n status: 'idle',\n });\n\n const { data: synthTokens } = useSynthTokens();\n const wrapperToken = React.useMemo(() => {\n if (synthTokens && collateralType) {\n return synthTokens.find((synth) => synth.address === collateralType.tokenAddress)?.token\n ?.address;\n }\n }, [collateralType, synthTokens]);\n\n const collateralAddress = network?.preset === 'andromeda' ? wrapperToken : systemToken?.address;\n const availableUSDCollateral = liquidityPosition?.availableCollateral || ZEROWEI;\n const errorParser = useContractErrorParser();\n\n //repay approval\n const {\n approve,\n requireApproval,\n isReady: isReadyApprove,\n } = useApprove({\n contractAddress: collateralAddress,\n amount:\n liquidityPosition &&\n liquidityPosition.debt.gt(0) &&\n liquidityPosition.debt.abs().sub(availableUSDCollateral).gt(0)\n ? liquidityPosition.debt.abs().sub(availableUSDCollateral).toBN()\n : ethers.BigNumber.from(0),\n spender: CoreProxy?.address,\n });\n const { exec: execRepay } = useRepay({ repayAmount: liquidityPosition?.debt });\n const { exec: undelegate } = useUndelegate({\n undelegateAmount: liquidityPosition?.collateralAmount.gt(0)\n ? liquidityPosition?.collateralAmount\n : undefined,\n });\n\n const { data: DebtRepayer } = useDebtRepayer();\n const { data: ClosePositionContract } = useClosePosition();\n const { data: USDC } = useUSDC();\n\n // repay approval for base\n const {\n approve: approveUSDC,\n requireApproval: requireApprovalUSDC,\n isLoading,\n isReady: isReadyApproveUSDC,\n } = useApprove({\n contractAddress: USDC?.address,\n // slippage for approval\n amount: liquidityPosition\n ? parseUnits(liquidityPosition.debt.abs().toString(), 6).mul(120).div(100)\n : ethers.BigNumber.from(0),\n spender: DebtRepayer?.address,\n });\n\n const { exec: undelegateBaseAndromeda } = useUndelegateBaseAndromeda({\n undelegateAmount: liquidityPosition?.collateralAmount,\n });\n\n //claim\n const { exec: execBorrow } = useBorrow({\n borrowAmount: liquidityPosition?.debt.lt(0) ? liquidityPosition?.debt.abs() : undefined,\n });\n\n const getSteps = React.useCallback(() => {\n const transactions: {\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n cb: () => Promise;\n }[] = [];\n\n if (ClosePositionContract) {\n // TODO: one step close\n // console.log(`ClosePositionContract`, ClosePositionContract);\n }\n\n if (network?.preset !== 'andromeda') {\n if (liquidityPosition?.debt.gt(0)) {\n if (requireApproval) {\n transactions.push({\n title: `Approve ${systemToken?.displaySymbol} transfer`,\n cb: () => approve(false),\n });\n }\n transactions.push({\n title: 'Repay',\n subtitle: (\n \n ),\n cb: () => execRepay(),\n });\n } else if (liquidityPosition?.debt.lt(0)) {\n transactions.push({\n title: 'Claim',\n subtitle: (\n \n ),\n cb: () => execBorrow(),\n });\n }\n\n transactions.push({\n title: 'Unlock collateral',\n subtitle: (\n \n ),\n cb: () => undelegate(),\n });\n } else {\n if (liquidityPosition?.debt.gt(0) && requireApprovalUSDC) {\n transactions.push({\n title: `Approve ${\n network?.preset === 'andromeda' ? collateralType?.symbol : systemToken?.symbol\n } transfer`,\n cb: () => approveUSDC(false),\n });\n }\n\n transactions.push({\n title: 'Unlock collateral',\n subtitle: (\n \n ),\n cb: () => undelegateBaseAndromeda(),\n });\n }\n\n return transactions;\n }, [\n ClosePositionContract,\n network?.preset,\n liquidityPosition?.debt,\n liquidityPosition?.collateralAmount,\n collateralSymbol,\n requireApproval,\n systemToken?.displaySymbol,\n systemToken?.symbol,\n approve,\n execRepay,\n execBorrow,\n undelegate,\n requireApprovalUSDC,\n collateralType?.symbol,\n approveUSDC,\n undelegateBaseAndromeda,\n ]);\n\n React.useEffect(() => {\n if (!steps.length && !isLoading) {\n setTxState({\n step: 0,\n status: 'idle',\n });\n setSteps(getSteps());\n }\n }, [getSteps, isLoading, steps.length]);\n\n const isSuccess = txState.step >= steps.length;\n\n const handleSubmit = React.useCallback(async () => {\n try {\n let i = txState.step > -1 ? txState.step : 0;\n\n for (; i < steps.length; i++) {\n setTxState({\n step: i,\n status: 'pending',\n });\n\n await steps[i].cb();\n }\n\n setTxState({\n step: steps.length,\n status: 'success',\n });\n\n setCollateralChange(ZEROWEI);\n setDebtChange(ZEROWEI);\n } catch (error) {\n setTxState((state) => ({\n step: state.step,\n status: 'error',\n }));\n\n const contractError = errorParser(error);\n\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Transaction failed',\n variant: 'left-accent',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n duration: 3_600_000,\n });\n throw Error('Transaction failed', { cause: error });\n }\n }, [txState.step, steps, setCollateralChange, setDebtChange, errorParser, toast]);\n\n if (isSuccess) {\n return (\n \n Your position has been successfully closed. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={<>Position successfully closed}\n />\n );\n }\n\n return (\n \n \n \n Close Position\n \n\n \n\n {isLoading && !steps.length && }\n {steps.map((step, i) => (\n i,\n loading: txState.step === i && txState.status === 'pending',\n }}\n />\n ))}\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_close_position_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n handleSubmit();\n }}\n mt=\"6\"\n >\n {(() => {\n switch (true) {\n case txState.status === 'error':\n return 'Retry';\n case txState.status === 'pending':\n return 'Processing...';\n default:\n return 'Execute Transaction';\n }\n })()}\n \n \n );\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport {\n Alert,\n AlertDescription,\n AlertIcon,\n Button,\n Collapse,\n Divider,\n Flex,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useClosePosition } from '@snx-v3/useClosePosition';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { useTokenPrice } from '@snx-v3/useTokenPrice';\nimport React from 'react';\nimport { ClosePositionOneStep } from './ClosePositionOneStep';\nimport { ClosePositionTransactions } from './ClosePositionTransactions';\n\nfunction ClosePositionUi({ onSubmit, onClose }: { onClose: () => void; onSubmit: () => void }) {\n const [params] = useParams();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: systemToken } = useSystemToken();\n\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n const collateralSymbol = collateralType?.displaySymbol;\n\n const { network } = useNetwork();\n const debtSymbol = network?.preset === 'andromeda' ? 'USDC' : systemToken?.symbol;\n\n const { data: systemTokenBalance, isPending: isPendingSystemTokenBalance } = useTokenBalance(\n systemToken?.address\n );\n\n const debtPrice = useTokenPrice(debtSymbol);\n const collateralPrice = useTokenPrice(collateralSymbol);\n\n const { data: ClosePositionDeployment } = useClosePosition();\n\n return (\n \n \n \n Close Position\n \n\n \n\n \n {!isPendingLiquidityPosition && liquidityPosition ? (\n <>{liquidityPosition.debt.gt(0) ? 'Repay Debt' : 'Claim Profit'}\n ) : (\n <> \n )}\n \n \n \n \n \n \n \n {network?.preset === 'andromeda' ? 'USDC' : systemToken?.displaySymbol}\n \n \n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition && liquidityPosition ? (\n <>\n {' '}\n \n Max\n \n \n ) : null}\n \n \n \n \n \n {debtPrice.gt(0) && (\n \n )}\n \n \n \n \n\n \n Unlock Collateral\n \n \n \n \n \n \n \n {collateralSymbol}\n \n \n \n {isPendingLiquidityPosition ? 'Locked: ~' : null}\n {!isPendingLiquidityPosition && liquidityPosition ? (\n <>\n {' '}\n \n Max\n \n \n ) : null}\n \n \n \n \n \n {collateralPrice.gt(0) && (\n \n )}\n \n \n \n \n\n \n \n \n \n You do not have enough {systemToken?.displaySymbol} to repay debt\n \n \n \n \n \n \n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `click_close_position_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n onSubmit();\n }}\n type=\"submit\"\n isDisabled={\n // Deployments that do not have ClosePosition contract available should skip this check\n ClosePositionDeployment &&\n !(\n !isPendingSystemTokenBalance &&\n systemTokenBalance &&\n !isPendingLiquidityPosition &&\n liquidityPosition &&\n systemTokenBalance\n .add(liquidityPosition.availableSystemToken)\n .gte(liquidityPosition.debt)\n )\n }\n >\n Close Position\n \n \n );\n}\n\nexport const ClosePosition = ({ onClose }: { onClose: () => void }) => {\n const [params] = useParams();\n\n const [transactionStep, setTransactions] = React.useState(false);\n const { setCollateralChange, setDebtChange } = React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n React.useEffect(() => {\n if (liquidityPosition) {\n setDebtChange(liquidityPosition.debt.mul(-1));\n setCollateralChange(liquidityPosition.collateralAmount.mul(-1));\n }\n\n return () => {\n setDebtChange(ZEROWEI);\n setCollateralChange(ZEROWEI);\n };\n }, [liquidityPosition, setCollateralChange, setDebtChange]);\n\n const { data: ClosePositionDeployment } = useClosePosition();\n\n if (!collateralType) {\n return null;\n }\n\n return (\n <>\n {!transactionStep ? (\n setTransactions(true)} />\n ) : null}\n {transactionStep && !ClosePositionDeployment ? (\n setTransactions(false)} onClose={onClose} />\n ) : null}\n {transactionStep && ClosePositionDeployment ? (\n setTransactions(false)} onClose={onClose} />\n ) : null}\n \n );\n};\n","import {\n Button,\n Divider,\n Link,\n Modal,\n ModalContent,\n ModalHeader,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { makeSearch, type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\n\nexport const UnsupportedCollateralAlert = ({ isOpen }: { isOpen: boolean }) => {\n const [params, setParams] = useParams();\n return (\n {}}>\n \n \n Collateral Not Supported\n \n \n This collateral is not supported on this network. Go back to home page to see your active\n positions on this network.\n \n {\n e.preventDefault();\n setParams({ accountId: params.accountId });\n }}\n mt={6}\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n Back\n \n \n \n );\n};\n","import { ManageActionType } from '@snx-v3/useParams';\nimport React from 'react';\n\ntype ManageActionButtonType = {\n title: string;\n link: ManageActionType;\n icon: (fill: 'white' | 'cyan') => React.ReactElement;\n};\n\nexport const COLLATERALACTIONS: ManageActionButtonType[] = [\n {\n title: 'Deposit and Lock',\n link: 'deposit',\n icon: (fill) => (\n \n \n \n \n ),\n },\n {\n title: 'Unlock',\n link: 'undelegate',\n icon: (fill: 'white' | 'cyan') => (\n \n \n \n \n ),\n },\n {\n title: 'Withdraw',\n link: 'withdraw',\n icon: (fill: 'white' | 'cyan') => (\n \n \n \n \n ),\n },\n];\n\nexport const DEBTACTIONS = (isBase: boolean): ManageActionButtonType[] => {\n const actions: ManageActionButtonType[] = [\n {\n title: isBase ? 'Claim' : 'Claim/Borrow',\n link: 'claim',\n icon: (fill) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ),\n },\n {\n title: 'Repay Debt',\n link: 'repay',\n icon: (fill) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ),\n },\n ];\n\n if (isBase) {\n return actions;\n }\n\n return [\n ...actions,\n {\n title: 'Withdraw',\n link: 'withdraw-debt',\n icon: (fill) => (\n \n \n \n \n ),\n },\n ];\n};\n","import { ArrowUpIcon, CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { transactionLink } from '@snx-v3/etherscanLink';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { WithdrawIncrease } from '@snx-v3/WithdrawIncrease';\nimport { Wei, wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function BorrowModal({ txnStatus, txnHash }: { txnStatus: string; txnHash: string | null }) {\n const { debtChange, setCollateralChange, setDebtChange } =\n React.useContext(ManagePositionContext);\n const { data: systemToken } = useSystemToken();\n const [isOpen, setIsOpen] = React.useState(false);\n const { network } = useNetwork();\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n setIsOpen(false);\n }\n }, [txnStatus]);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [borrowAmount, setBorrowAmount] = React.useState();\n React.useEffect(() => {\n if (debtChange && debtChange.gt(0)) {\n setBorrowAmount(debtChange.abs());\n }\n }, [debtChange]);\n\n return (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setIsOpen(false);\n }}\n >\n \n \n \n \n Borrowing Debt\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {borrowAmount ? (\n \n \n \n ) : null}\n \n \n \n {txnStatus === 'success' ? (\n setIsOpen(false)}\n >\n Done\n \n ) : null}\n \n \n {txnHash ? (\n <>\n View Transaction\n \n \n ) : (\n <>\n Signing Transaction\n \n )}\n \n \n \n \n \n );\n}\n","import { Button, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useBorrow } from '@snx-v3/useBorrow';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { validatePosition } from '@snx-v3/validatePosition';\nimport { wei } from '@synthetixio/wei';\nimport React from 'react';\nimport { BorrowModal } from './BorrowModal';\n\nexport function Borrow() {\n const [params] = useParams();\n const { debtChange, setDebtChange } = React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n const { data: systemToken } = useSystemToken();\n const { network } = useNetwork();\n\n const {\n isReady: isBorrowReady,\n txnState,\n mutation: mutationBorrow,\n } = useBorrow({\n borrowAmount: debtChange.gt(0) ? debtChange.abs() : undefined,\n });\n\n const maxClaimble = React.useMemo(() => {\n if (!liquidityPosition || liquidityPosition?.debt.gte(0)) {\n return ZEROWEI;\n } else {\n return wei(liquidityPosition.debt.abs().toBN());\n }\n }, [liquidityPosition]);\n\n const { maxDebt } = validatePosition({\n issuanceRatioD18: collateralType?.issuanceRatioD18,\n collateralAmount: liquidityPosition?.collateralAmount,\n collateralPrice: liquidityPosition?.collateralPrice,\n debt: liquidityPosition?.debt,\n collateralChange: ZEROWEI,\n debtChange: debtChange,\n });\n const maxBorrowingCapacity = network?.preset === 'andromeda' ? ZEROWEI : maxDebt.mul(99).div(100);\n const max = React.useMemo(\n () => maxClaimble.add(maxBorrowingCapacity),\n [maxClaimble, maxBorrowingCapacity]\n );\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n const onSubmit = React.useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n\n try {\n toast.closeAll();\n toast({ title: 'Borrowing...', variant: 'left-accent' });\n\n await mutationBorrow.mutateAsync();\n setDebtChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your debt has been increased.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast({\n title: 'Could not complete borrowing',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Borrow failed', { cause: error });\n }\n },\n [errorParser, mutationBorrow, setDebtChange, toast]\n );\n\n return (\n \n \n \n Borrow\n \n \n \n \n \n \n {systemToken?.displaySymbol}\n \n \n \n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition && liquidityPosition ? (\n <>\n \n  \n {\n e.preventDefault();\n setDebtChange(max);\n }}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n \n \n \n setDebtChange(val)}\n max={max}\n min={ZEROWEI}\n />\n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition &&\n liquidityPosition &&\n liquidityPosition.collateralPrice.gt(0) ? (\n \n ) : null}\n \n \n \n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_borrow_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n {debtChange.eq(0) ? 'Enter Amount' : 'Borrow'}\n \n \n );\n}\n","import { Alert, AlertIcon, Box, Button, Collapse, Flex, Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useTokenPrice } from '@snx-v3/useTokenPrice';\nimport { validatePosition } from '@snx-v3/validatePosition';\nimport { wei } from '@synthetixio/wei';\nimport { useContext, useMemo } from 'react';\n\nexport function Claim() {\n const { network } = useNetwork();\n const { debtChange, collateralChange, setDebtChange } = useContext(ManagePositionContext);\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const maxClaimble = useMemo(() => {\n if (!liquidityPosition || liquidityPosition?.debt.gte(0)) {\n return ZEROWEI;\n } else {\n return wei(liquidityPosition.debt.abs().toBN().mul(99).div(100));\n }\n }, [liquidityPosition]);\n\n const { maxDebt } = validatePosition({\n issuanceRatioD18: collateralType?.issuanceRatioD18,\n collateralAmount: liquidityPosition?.collateralAmount,\n collateralPrice: liquidityPosition?.collateralPrice,\n debt: liquidityPosition?.debt,\n collateralChange: collateralChange,\n debtChange: debtChange,\n });\n\n const maxBorrowingCapacity = network?.preset === 'andromeda' ? ZEROWEI : maxDebt.mul(99).div(100);\n const { data: systemToken } = useSystemToken();\n const max = useMemo(\n () => maxClaimble.add(maxBorrowingCapacity),\n [maxClaimble, maxBorrowingCapacity]\n );\n\n const symbol = network?.preset === 'andromeda' ? collateralType?.symbol : systemToken?.symbol;\n const price = useTokenPrice(symbol);\n\n return (\n \n \n {network?.preset === 'andromeda' ? 'Claim Profit' : 'Claim/Borrow'}\n \n \n \n \n \n \n {network?.preset === 'andromeda'\n ? collateralType?.displaySymbol\n : systemToken?.displaySymbol}\n \n \n \n {isPendingLiquidityPosition ? 'Credit: ~' : null}\n {!isPendingLiquidityPosition && maxClaimble ? (\n <>\n \n  \n setDebtChange(maxClaimble)}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n \n \n setDebtChange(val)}\n max={max}\n min={ZEROWEI}\n />\n \n {price.gt(0) && }\n \n \n \n \n \n \n \n Positive market performance has credited your position. Claim up to{' '}\n {\n if (!maxClaimble) {\n return;\n }\n setDebtChange(maxClaimble);\n }}\n cursor=\"pointer\"\n as=\"span\"\n textDecoration=\"underline\"\n >\n \n \n  without accruing debt.\n \n \n \n \n \n \n \n Assets will be available to withdraw 24 hours after your last interaction with this\n position.\n \n \n \n \n \n \n \n You can take an interest-free loan up to  \n {\n if (!maxBorrowingCapacity) {\n return;\n }\n setDebtChange(maxBorrowingCapacity.add(maxClaimble));\n }}\n cursor=\"pointer\"\n as=\"span\"\n textDecoration=\"underline\"\n >\n \n \n \n \n \n \n \n \n \n You are about to take a {' '}\n interest-free loan\n \n \n \n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `click_borrow_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n {debtChange.lte(0)\n ? 'Enter Amount'\n : debtChange.gt(maxClaimble) && network?.preset !== 'andromeda'\n ? 'Borrow'\n : 'Claim Profit'}\n \n \n );\n}\n","import { ArrowUpIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Flex, Heading, Image, Link, Text } from '@chakra-ui/react';\nimport SynthetixLogo from '@snx-v3/useBlockchain/SynthetixIcon.svg';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\n\nexport function ClaimSuccessBanner({ onClose }: { onClose: () => void }) {\n const { data: systemToken } = useSystemToken();\n return (\n \n \n What can you do with your {systemToken?.displaySymbol}?\n \n \n\n \n \n\n \n \n Trade L1 Perp\n \n \n Trade with synthetix integrators\n \n \n\n \n Coming soon\n \n \n\n \n \"Curve\"\n\n \n \n sUSD/USDC Pool\n \n \n Curve\n \n \n\n \n Deposit on Curve{' '}\n \n \n \n\n \n \n );\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Link, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useBorrow } from '@snx-v3/useBorrow';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { wei } from '@synthetixio/wei';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport { ClaimSuccessBanner } from './ClaimSuccessBanner';\n\nexport function ClaimModal({ onClose }: { onClose: () => void }) {\n const [params] = useParams();\n const { debtChange, setDebtChange } = useContext(ManagePositionContext);\n const { network } = useNetwork();\n const [showClaimBanner, setShowClaimBanner] = useState(false);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: systemToken } = useSystemToken();\n\n const maxClaimble = useMemo(() => {\n if (!liquidityPosition || liquidityPosition?.debt.gte(0)) {\n return ZEROWEI;\n } else {\n return wei(liquidityPosition.debt.abs().toBN().sub(1));\n }\n }, [liquidityPosition]);\n const isBorrow = useMemo(\n () => debtChange.gt(maxClaimble) && network?.preset !== 'andromeda',\n [debtChange, network?.preset, maxClaimble]\n );\n\n const {\n exec: execBorrow,\n txnState,\n settle: settleBorrow,\n } = useBorrow({\n borrowAmount: debtChange.gt(0) ? debtChange.abs() : undefined,\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n const execBorrowWithErrorParser = useCallback(async () => {\n try {\n await execBorrow();\n setDebtChange(ZEROWEI);\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: isBorrow ? 'Borrow' : 'Claim' + ' failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error(isBorrow ? 'Borrow' : 'Claim' + ' failed', { cause: error });\n }\n }, [execBorrow, setDebtChange, errorParser, toast, isBorrow]);\n\n const symbol =\n network?.preset === 'andromeda' ? collateralType?.displaySymbol : systemToken?.displaySymbol;\n\n if (txnState.txnStatus === 'success') {\n if (showClaimBanner) {\n return (\n {\n settleBorrow();\n onClose();\n }}\n />\n );\n } else {\n return (\n {\n if (network?.id === 1 && network?.preset === 'main') {\n setShowClaimBanner(true);\n } else {\n settleBorrow();\n onClose();\n }\n }}\n title=\"Debt successfully updated\"\n subline={\n <>\n Your debt has been updated. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={\n <>\n Debt successfully updated\n \n }\n />\n );\n }\n }\n\n return (\n
\n \n {\n settleBorrow();\n onClose();\n }}\n mr={2}\n />\n Manage Debt\n \n\n \n\n \n {network?.preset === 'andromeda' ? 'Claim' : 'Borrow'}\n \n \n }\n status={{\n failed: txnState.txnStatus === 'error',\n loading: ['prompting', 'pending'].includes(txnState.txnStatus),\n }}\n />\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_borrow_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n\n if (['unsent', 'error'].includes(txnState.txnStatus)) {\n execBorrowWithErrorParser();\n }\n }}\n width=\"100%\"\n mt=\"6\"\n data-cy=\"claim confirm button\"\n >\n {(() => {\n switch (txnState.txnStatus) {\n case 'error':\n return 'Retry';\n case 'pending':\n case 'prompting':\n return 'Processing...';\n default:\n return 'Execute Transaction';\n }\n })()}\n \n
\n );\n}\n","import { ClaimModal } from './ClaimModal';\n\nexport * from './ClaimModal';\nexport default ClaimModal;\n","import { Flex, FlexProps } from '@chakra-ui/react';\nimport { ReactNode } from 'react';\n\ninterface Props extends FlexProps {\n items: {\n label: ReactNode;\n value: ReactNode;\n }[];\n}\n\nexport const TransactionSummary = ({ items, ...props }: Props) => (\n \n {items.map(({ value, label }, i) => (\n \n \n {label}\n \n \n {value}\n \n \n ))}\n \n);\n","import { useQuery } from '@tanstack/react-query';\nimport { useWallet, useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { ZodBigNumber } from '@snx-v3/zod';\nimport { wei } from '@synthetixio/wei';\n\nconst BalanceSchema = ZodBigNumber.transform((x) => wei(x));\n\nexport function useEthBalance() {\n const { activeWallet } = useWallet();\n const provider = useProvider();\n const { network } = useNetwork();\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'EthBalance',\n { accountAddress: activeWallet?.address },\n ],\n enabled: Boolean(provider && activeWallet),\n queryFn: async () => {\n if (!(provider && activeWallet)) throw 'OMFG';\n return BalanceSchema.parse(await provider.getBalance(activeWallet.address));\n },\n });\n}\n","import {\n Alert,\n AlertDescription,\n AlertIcon,\n Button,\n Collapse,\n Flex,\n Text,\n Tooltip,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { CRatioChangeStat } from '@snx-v3/CRatioBar';\nimport { currency } from '@snx-v3/format';\nimport { formatNumber } from '@snx-v3/formatters';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { TransactionSummary } from '@snx-v3/TransactionSummary';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useEthBalance } from '@snx-v3/useEthBalance';\nimport { useIsAndromedaStataUSDC } from '@snx-v3/useIsAndromedaStataUSDC';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { useTokenPrice } from '@snx-v3/useTokenPrice';\nimport { useTransferableSynthetix } from '@snx-v3/useTransferableSynthetix';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { DepositsIncreaseTimeout } from '@snx-v3/WithdrawIncrease';\nimport { Wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function Deposit() {\n const [params] = useParams();\n\n const { collateralChange, setCollateralChange } = React.useContext(ManagePositionContext);\n const { network } = useNetwork();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n const { data: transferrableSnx } = useTransferableSynthetix();\n\n const isAndromedaStataUSDC = useIsAndromedaStataUSDC({\n tokenAddress: collateralType?.tokenAddress,\n });\n\n const { data: collateralBalance } = useTokenBalance(collateralType?.tokenAddress);\n\n const { data: ethBalance } = useEthBalance();\n\n const price = useTokenPrice(collateralType?.symbol);\n const { data: USDCToken } = useUSDC();\n const { data: usdcBalance, isPending: isPendingUsdcBalance } = useTokenBalance(\n USDCToken?.address\n );\n\n const maxAmount = React.useMemo(() => {\n if (collateralType?.symbol === 'SNX') {\n return (\n ZEROWEI\n //\n .add(transferrableSnx ? transferrableSnx.transferable : ZEROWEI)\n .add(liquidityPosition ? liquidityPosition.availableCollateral : ZEROWEI)\n );\n }\n\n if (collateralType?.symbol === 'WETH') {\n return (\n ZEROWEI\n //\n .add(ethBalance ?? ZEROWEI)\n .add(collateralBalance ?? ZEROWEI)\n .add(liquidityPosition ? liquidityPosition.availableCollateral : ZEROWEI)\n );\n }\n\n if (network?.preset === 'andromeda') {\n return (\n ZEROWEI\n //\n .add(usdcBalance ? usdcBalance : ZEROWEI)\n );\n }\n\n return (\n ZEROWEI\n //\n .add(collateralBalance ?? ZEROWEI)\n .add(liquidityPosition ? liquidityPosition.availableCollateral : ZEROWEI)\n );\n }, [\n collateralType?.symbol,\n liquidityPosition,\n transferrableSnx,\n collateralBalance,\n ethBalance,\n usdcBalance,\n network?.preset,\n ]);\n\n const overAvailableBalance = collateralChange.gt(maxAmount);\n\n return (\n \n \n Deposit and Lock Collateral\n \n \n \n \n \n \n {collateralType?.displaySymbol ?? params.collateralSymbol}\n \n \n \n {network?.preset === 'andromeda' ? (\n <>\n {isPendingUsdcBalance ? (\n 'Wallet Balance: ~'\n ) : (\n \n )}\n \n ) : null}\n\n {network?.preset !== 'andromeda' ? (\n <>\n {isPendingLiquidityPosition ? (\n 'Unlocked Balance: ~'\n ) : (\n \n )}\n\n \n\n {collateralType?.symbol === 'WETH' ? (\n \n ) : null}\n \n ) : null}\n \n }\n >\n \n {params.accountId && isPendingLiquidityPosition ? 'Balance: ~' : null}\n {(!params.accountId || (params.accountId && !isPendingLiquidityPosition)) &&\n maxAmount ? (\n <>\n \n  \n setCollateralChange(maxAmount)}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n \n \n \n {\n setCollateralChange(value);\n }}\n max={maxAmount}\n min={ZEROWEI}\n />\n \n \n \n \n \n\n \n \n \n\n \n \n \n \n Deposit USDC and it will automatically wrap into Static aUSDC\n \n \n \n\n {collateralType && (liquidityPosition || !params.accountId) ? (\n \n \n \n \n Your deposit must be{' '}\n {formatNumber(parseFloat(collateralType.minDelegationD18.toString()))}{' '}\n {collateralType.symbol} or higher\n \n \n \n ) : null}\n\n \n \n \n \n You cannot Deposit and Lock more Collateral than your Balance amount\n \n \n \n\n {collateralType && liquidityPosition ? (\n \n currency(val ?? ZEROWEI)}\n hasChanges={collateralChange.abs().gt(0)}\n size=\"sm\"\n />\n ),\n },\n ]\n : []),\n ...(liquidityPosition && network?.preset !== 'andromeda'\n ? [\n {\n label: 'C-ratio',\n value: (\n \n ),\n },\n ]\n : []),\n ]}\n />\n \n ) : null}\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `click_deposit_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n {collateralChange.lte(0) ? 'Enter Amount' : 'Deposit and Lock Collateral'}\n \n \n );\n}\n","import { useQuery } from '@tanstack/react-query';\nimport { MAINNET, useProviderForChain, useWallet } from '@snx-v3/useBlockchain';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { ethers } from 'ethers';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\n\nexport function useTransferableSynthetix() {\n const { activeWallet } = useWallet();\n const provider = useProviderForChain(MAINNET);\n const { data: snxCollateral } = useCollateralType('SNX', MAINNET);\n\n const accountAddress = activeWallet?.address;\n const snxAddress = snxCollateral?.tokenAddress;\n\n return useQuery({\n enabled: Boolean(provider && accountAddress && snxAddress),\n queryKey: [\n `${MAINNET?.id}-${MAINNET?.preset}`,\n 'TransferableSynthetix',\n { address: activeWallet?.address },\n ],\n queryFn: async function (): Promise<{ transferable: Wei; collateral?: Wei }> {\n if (!(provider && accountAddress && snxAddress)) {\n throw 'useTransferableSynthetix should not be enabled';\n }\n const contract = new ethers.Contract(\n snxAddress,\n [\n 'function balanceOf(address owner) view returns (uint256)',\n 'function transferableSynthetix(address account) view returns (uint256 transferable)',\n 'function collateral(address account) view returns (uint256 collateral)',\n ],\n provider\n );\n try {\n // Normal case for SNX case\n const [transferableSynthetix, collateral] = await Promise.all([\n contract.transferableSynthetix(accountAddress),\n contract.collateral(accountAddress),\n ]);\n\n return {\n transferable: wei(transferableSynthetix),\n collateral: wei(collateral),\n };\n } catch (e) {\n console.error(e);\n throw e;\n }\n },\n });\n}\n","import { Wei, wei } from '@synthetixio/wei';\nimport { assign, createMachine } from 'xstate';\n\nexport const Events = {\n SET_REQUIRE_APPROVAL: 'SET_REQUIRE_APPROVAL',\n SET_WRAP_AMOUNT: 'SET_WRAP_AMOUNT',\n SET_INFINITE_APPROVAL: 'SET_INFINITE_APPROVAL',\n RETRY: 'RETRY',\n RUN: 'RUN',\n SUCCESS: 'SUCCESS',\n FAILURE: 'FAILURE',\n RESET: 'RESET',\n} as const;\n\nexport const State = {\n idle: 'idle',\n wrap: 'wrap',\n approveCollateral: 'approveCollateral',\n deposit: 'deposit',\n failed: 'failed',\n success: 'success',\n} as const;\n\nconst FailedSteps = {\n [State.approveCollateral]: State.approveCollateral,\n [State.wrap]: State.wrap,\n [State.deposit]: State.deposit,\n} as const;\n\nexport const ServiceNames = {\n wrapEth: 'wrapEth',\n approveCollateral: 'approveCollateral',\n executeDeposit: 'executeDeposit',\n} as const;\n\ntype Context = {\n error: {\n error: Error;\n step: keyof typeof FailedSteps;\n } | null;\n requireApproval: boolean;\n wrapAmount: Wei;\n infiniteApproval: boolean;\n};\n\ntype EventNamesType = typeof Events;\n\ntype DepositEvents =\n | { type: EventNamesType['SET_REQUIRE_APPROVAL']; requireApproval: boolean }\n | { type: EventNamesType['SET_WRAP_AMOUNT']; wrapAmount: Wei }\n | { type: EventNamesType['SET_INFINITE_APPROVAL']; infiniteApproval: boolean }\n | { type: EventNamesType['RETRY'] }\n | { type: EventNamesType['RUN'] }\n | { type: EventNamesType['SUCCESS'] }\n | { type: EventNamesType['FAILURE'] }\n | { type: EventNamesType['RESET'] };\n\ntype StateType = typeof State;\ntype MachineState =\n | {\n value: StateType['idle'];\n context: Context & { error: null };\n }\n | {\n value: StateType['wrap'];\n context: Context & { error: null };\n }\n | {\n value: StateType['approveCollateral'];\n context: Context & { error: null };\n }\n | {\n value: StateType['deposit'];\n context: Context & { error: null };\n }\n | {\n value: StateType['failed'];\n context: Context & { error: { error: Error; step: keyof typeof FailedSteps } };\n }\n | {\n value: StateType['success'];\n context: Context & {\n error: null;\n };\n };\n\nconst initialContext = {\n wrapAmount: wei(0),\n error: null,\n requireApproval: false,\n infiniteApproval: false,\n};\n\nexport const DepositMachine = createMachine({\n id: 'DepositMachine',\n initial: State.idle,\n predictableActionArguments: true,\n context: initialContext,\n on: {\n [Events.RUN]: {\n target: State.deposit,\n actions: assign({\n wrapAmount: (_) => initialContext.wrapAmount,\n error: (_) => initialContext.error,\n requireApproval: (_) => initialContext.requireApproval,\n infiniteApproval: (_) => initialContext.infiniteApproval,\n }),\n },\n [Events.SET_REQUIRE_APPROVAL]: {\n actions: assign({ requireApproval: (_context, event) => event.requireApproval }),\n },\n [Events.SET_WRAP_AMOUNT]: {\n actions: assign({ wrapAmount: (_context, event) => event.wrapAmount }),\n },\n [Events.SET_INFINITE_APPROVAL]: {\n actions: assign({ infiniteApproval: (_context, event) => event.infiniteApproval }),\n },\n },\n states: {\n [State.idle]: {\n on: {\n [Events.RUN]: [\n { target: State.wrap, cond: (context) => context.wrapAmount.gt(0) },\n { target: State.approveCollateral, cond: (context) => context.requireApproval },\n { target: State.deposit },\n ],\n },\n },\n\n [State.wrap]: {\n invoke: {\n src: ServiceNames.wrapEth,\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({ error: event.data, step: FailedSteps.wrap }),\n }),\n },\n onDone: [\n { target: State.approveCollateral, cond: (context) => context.requireApproval },\n { target: State.deposit },\n ],\n },\n },\n\n [State.approveCollateral]: {\n invoke: {\n src: ServiceNames.approveCollateral,\n onDone: {\n target: State.deposit,\n },\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({\n error: event.data,\n step: FailedSteps.approveCollateral,\n }),\n }),\n },\n },\n },\n\n [State.deposit]: {\n invoke: {\n src: ServiceNames.executeDeposit,\n onDone: {\n target: State.success,\n },\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({ error: event.data, step: FailedSteps.deposit }),\n }),\n },\n },\n },\n\n [State.failed]: {\n on: {\n [Events.RETRY]: [\n {\n target: State.approveCollateral,\n cond: (c) => c.error?.step === FailedSteps.approveCollateral,\n actions: assign({ error: (_) => null }),\n },\n {\n target: State.wrap,\n cond: (c) => c.error?.step === FailedSteps.wrap,\n actions: assign({ error: (_) => null }),\n },\n {\n target: State.deposit,\n cond: (c) => c.error?.step === FailedSteps.deposit,\n actions: assign({ error: (_) => null }),\n },\n ],\n },\n },\n\n [State.success]: {},\n },\n});\n","import { POOL_ID } from '@snx-v3/constants';\nimport { notNil } from '@snx-v3/tsHelpers';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei, { wei } from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport { useReducer } from 'react';\n\nconst log = debug('snx:useDeposit');\n\nexport const useDeposit = ({\n accountId,\n newAccountId,\n collateralTypeAddress,\n collateralChange,\n currentCollateral,\n availableCollateral,\n}: {\n accountId?: string;\n newAccountId: string;\n collateralTypeAddress?: string;\n currentCollateral: Wei;\n availableCollateral?: Wei;\n collateralChange: Wei;\n}) => {\n const [txnState, dispatch] = useReducer(reducer, initialState);\n const { data: CoreProxy } = useCoreProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const { network } = useNetwork();\n const signer = useSigner();\n const provider = useProvider();\n\n const queryClient = useQueryClient();\n const isReady =\n network &&\n provider &&\n signer &&\n CoreProxy &&\n collateralTypeAddress &&\n availableCollateral &&\n collateralChange.gt(0) &&\n // Make it boolean\n true;\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n const walletAddress = await signer.getAddress();\n const id = accountId ?? newAccountId;\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n\n // create account only when no account exists\n const createAccount = accountId\n ? undefined\n : CoreProxyContract.populateTransaction['createAccount(uint128)'](\n ethers.BigNumber.from(id)\n );\n\n log('collateralChange', collateralChange);\n log('availableCollateral', availableCollateral);\n\n const amountNeeded = collateralChange.sub(availableCollateral);\n log('amountNeeded', amountNeeded);\n\n // optionally deposit if available collateral not enough\n const deposit = amountNeeded.gt(0)\n ? CoreProxyContract.populateTransaction.deposit(\n ethers.BigNumber.from(id),\n collateralTypeAddress,\n amountNeeded.toBN() // only deposit what's needed\n )\n : undefined;\n\n log('currentCollateral', currentCollateral);\n log('collateralChange', collateralChange);\n log('newDelegation', currentCollateral.add(collateralChange));\n const delegate = CoreProxyContract.populateTransaction.delegateCollateral(\n ethers.BigNumber.from(id),\n ethers.BigNumber.from(POOL_ID),\n collateralTypeAddress,\n currentCollateral.add(collateralChange).toBN(),\n wei(1).toBN()\n );\n const callsPromise = Promise.all([createAccount, deposit, delegate].filter(notNil));\n\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useDeposit',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'Accounts',\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n isReady,\n };\n};\n","import { useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useEthBalance } from '@snx-v3/useEthBalance';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport Wei from '@synthetixio/wei';\nimport { useMutation } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { Contract } from 'ethers';\nimport { useCallback } from 'react';\n\nconst log = debug('snx:useWrapEth');\n\nexport const useWrapEth = () => {\n const signer = useSigner();\n const provider = useProvider();\n\n const { data: ethCollateral } = useCollateralType('WETH');\n const { data: ethBalance, refetch: refetchETHBalance } = useEthBalance();\n const { data: wethBalance, refetch: refetchWETHBalance } = useTokenBalance(\n ethCollateral?.tokenAddress\n );\n\n const { mutateAsync, isPending } = useMutation({\n mutationFn: async (amount: Wei) => {\n if (!ethCollateral || !signer || !provider) return;\n const contract = new Contract(\n ethCollateral?.tokenAddress,\n ['function deposit() payable'],\n signer\n );\n const txn = await contract.deposit({ value: amount.toBN() });\n log('txn', txn);\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n });\n\n const exec = useCallback(\n async (amount: Wei) => {\n if (!ethBalance) return;\n if (ethBalance.lt(amount)) {\n throw new Error('Amount exceeds balance');\n }\n await mutateAsync(amount);\n refetchETHBalance();\n refetchWETHBalance();\n },\n [ethBalance, mutateAsync, refetchETHBalance, refetchWETHBalance]\n );\n\n return {\n exec,\n isLoading: isPending,\n wethBalance,\n ethBalance,\n };\n};\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Link, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { CRatioChangeStat } from '@snx-v3/CRatioBar';\nimport { currency } from '@snx-v3/format';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { TransactionSummary } from '@snx-v3/TransactionSummary';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useDeposit } from '@snx-v3/useDeposit';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useWrapEth } from '@snx-v3/useWrapEth';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { useMachine } from '@xstate/react';\nimport React from 'react';\nimport { DepositMachine, Events, ServiceNames, State } from './DepositMachine';\n\nexport function DepositModal({ onClose }: { onClose: () => void }) {\n const [params, setParams] = useParams();\n const { collateralChange, setCollateralChange } = React.useContext(ManagePositionContext);\n const { data: CoreProxy } = useCoreProxy();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const currentCollateral = liquidityPosition?.collateralAmount ?? ZEROWEI;\n const availableCollateral = liquidityPosition?.availableCollateral ?? ZEROWEI;\n\n const [txSummary, setTxSummary] = React.useState({\n currentCollateral: ZEROWEI,\n collateralChange: ZEROWEI,\n currentDebt: ZEROWEI,\n });\n\n const synthNeeded = React.useMemo(() => {\n const amount = collateralChange.sub(availableCollateral);\n return amount.lt(0) ? ZEROWEI : amount;\n }, [availableCollateral, collateralChange]);\n\n const collateralNeeded = React.useMemo(() => {\n const amount = synthNeeded;\n return amount.gt(0) ? amount : ZEROWEI;\n }, [synthNeeded]);\n\n //Preparing wETH\n const { exec: wrapEth, wethBalance } = useWrapEth();\n const wrapETHAmount =\n (collateralType?.displaySymbol ?? params.collateralSymbol) === 'WETH' &&\n collateralNeeded.gt(wethBalance || 0)\n ? collateralNeeded.sub(wethBalance || 0)\n : ZEROWEI;\n //Preparing wETH done\n\n //Collateral Approval\n const {\n approve,\n requireApproval,\n isReady: isReadyApprove,\n } = useApprove({\n contractAddress: collateralType?.tokenAddress,\n amount: collateralChange.lte(availableCollateral)\n ? wei(0).toBN()\n : collateralChange.sub(availableCollateral).toBN(),\n spender: CoreProxy?.address,\n });\n //Collateral Approval Done\n\n //Deposit\n const newAccountId = React.useMemo(() => `${Math.floor(Math.random() * 1000000000000)}`, []);\n const { exec: execDeposit, isReady: isReadyDeposit } = useDeposit({\n accountId: params.accountId,\n newAccountId,\n collateralTypeAddress: collateralType?.tokenAddress,\n collateralChange,\n currentCollateral,\n availableCollateral,\n });\n //Deposit done\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const errorParser = useContractErrorParser();\n\n const [state, send] = useMachine(DepositMachine, {\n services: {\n [ServiceNames.wrapEth]: async () => {\n try {\n await wrapEth(state.context.wrapAmount);\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n\n toast.closeAll();\n toast({\n title: 'Wrapping ETH failed',\n description: contractError ? (\n \n ) : (\n error.message || 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Wrapping failed', { cause: error });\n }\n },\n\n [ServiceNames.approveCollateral]: async () => {\n try {\n if (!requireApproval) {\n return;\n }\n toast({\n title: `Approve collateral for transfer`,\n description: `Approve ${collateralType?.displaySymbol} transfer`,\n status: 'info',\n variant: 'left-accent',\n });\n\n await approve(Boolean(state.context.infiniteApproval));\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Approval failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Approve failed', { cause: error });\n }\n },\n\n [ServiceNames.executeDeposit]: async () => {\n try {\n toast.closeAll();\n toast({\n title: Boolean(params.accountId)\n ? 'Locking your collateral'\n : 'Creating your account and locking your collateral',\n description: '',\n variant: 'left-accent',\n });\n\n setTxSummary({\n currentCollateral,\n currentDebt: liquidityPosition?.debt || ZEROWEI,\n collateralChange,\n });\n\n await execDeposit();\n\n setCollateralChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your locked collateral amount has been updated.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Could not complete locking collateral',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Lock collateral failed', { cause: error });\n }\n },\n },\n });\n\n const wrapAmountString = wrapETHAmount.toString();\n const isSuccessOrDeposit = state.matches(State.success) || state.matches(State.deposit);\n React.useEffect(() => {\n if (isSuccessOrDeposit) {\n // We do this to ensure the success state displays the wrap amount used before deposit\n return;\n }\n send(Events.SET_WRAP_AMOUNT, { wrapAmount: wei(wrapAmountString || '0') });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSuccessOrDeposit, wrapAmountString]);\n\n React.useEffect(() => {\n send(Events.SET_REQUIRE_APPROVAL, { requireApproval });\n }, [requireApproval, send]);\n\n const handleClose = React.useCallback(() => {\n const isSuccess = state.matches(State.success);\n\n if (isSuccess && params.accountId && collateralType?.symbol) {\n send(Events.RESET);\n onClose();\n setParams({\n page: 'position',\n collateralSymbol: collateralType.symbol,\n manageAction: 'deposit',\n accountId: params.accountId,\n });\n return;\n }\n send(Events.RESET);\n onClose();\n }, [state, params.accountId, collateralType?.symbol, send, onClose, setParams]);\n\n const onSubmit = React.useCallback(async () => {\n if (state.matches(State.success)) {\n handleClose();\n return;\n }\n if (state.context.error) {\n send(Events.RETRY);\n return;\n }\n\n send(Events.RUN);\n }, [handleClose, send, state]);\n\n const txSummaryItems = React.useMemo(() => {\n const items = [\n {\n label: `Locked ${collateralType?.displaySymbol ?? params.collateralSymbol}`,\n value: (\n currency(val ?? ZEROWEI)}\n hasChanges={txSummary.collateralChange.abs().gt(0)}\n size=\"sm\"\n />\n ),\n },\n ];\n\n return [\n ...items,\n {\n label: 'C-ratio',\n value: (\n \n ),\n },\n ];\n }, [\n collateralType?.displaySymbol,\n params.collateralSymbol,\n txSummary.currentCollateral,\n txSummary.collateralChange,\n txSummary.currentDebt,\n liquidityPosition?.collateralPrice,\n ]);\n\n const symbol = collateralType?.displaySymbol;\n\n const isProcessing =\n state.matches(State.approveCollateral) ||\n state.matches(State.deposit) ||\n state.matches(State.wrap);\n\n const isWETH = (collateralType?.displaySymbol ?? params.collateralSymbol) === 'WETH';\n\n const stepNumbers = {\n wrap: isWETH ? 1 : 0,\n approve: isWETH ? 2 : 1,\n deposit: isWETH ? 3 : 2,\n };\n\n if (state.matches(State.success)) {\n return (\n \n Your collateral has been updated. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={\n <>\n Collateral successfully updated\n \n }\n summary={}\n />\n );\n }\n\n return (\n
\n \n \n Manage Collateral\n \n \n {isWETH ? (\n \n {' '}\n from balance will be used.\n \n ) : (\n \n You must wrap additional {' '}\n before depositing.\n \n )\n }\n status={{\n failed: state.context.error?.step === State.wrap,\n disabled: (collateralType?.displaySymbol ?? params.collateralSymbol) !== 'WETH',\n success: state.context.wrapAmount.eq(0) || state.matches(State.success),\n loading: state.matches(State.wrap) && !state.context.error,\n }}\n />\n ) : null}\n\n \n send(Events.SET_INFINITE_APPROVAL, { infiniteApproval: e.target.checked }),\n }}\n />\n \n {state.matches(State.success) ? (\n \n ) : (\n <>\n {availableCollateral && availableCollateral.gt(ZEROWEI) ? (\n <>\n {availableCollateral.gte(collateralChange) ? (\n \n ) : (\n <>\n \n \n \n \n \n \n \n )}\n \n ) : (\n \n )}\n \n )}\n \n }\n status={{\n failed: state.context.error?.step === State.deposit,\n disabled: state.matches(State.success) && state.context.requireApproval,\n success: state.matches(State.success),\n loading: state.matches(State.deposit) && !state.context.error,\n }}\n />\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_deposit_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n onSubmit();\n }}\n width=\"100%\"\n mt=\"6\"\n data-cy=\"deposit confirm button\"\n >\n {(() => {\n switch (true) {\n case Boolean(state.context.error):\n return 'Retry';\n case isProcessing:\n return 'Processing...';\n case state.matches(State.success):\n return 'Continue';\n default:\n return 'Execute Transaction';\n }\n })()}\n \n
\n );\n}\n","import {\n importPositionManager,\n importPositionManagerAndromedaStataUSDC,\n importPositionManagerAndromedaUSDC,\n} from '@snx-v3/contracts';\nimport { type Network, useNetwork } from '@snx-v3/useBlockchain';\nimport { type CollateralType } from '@snx-v3/useCollateralTypes';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { useQuery } from '@tanstack/react-query';\n\nexport function usePositionManagerForCollateral({\n collateralType,\n customNetwork,\n}: {\n collateralType?: CollateralType;\n customNetwork?: Network;\n}) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork || currentNetwork;\n const { data: synthTokens } = useSynthTokens(customNetwork);\n\n return useQuery({\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'PositionManager',\n { collateralType: collateralType?.address },\n { synthTokens: Boolean(synthTokens) },\n ],\n enabled: Boolean(network && synthTokens && collateralType),\n queryFn: async function () {\n if (!(network && synthTokens && collateralType)) throw 'OMFG';\n const addr = collateralType.address.toLowerCase();\n for (const synthToken of synthTokens) {\n if (addr === synthToken.address.toLowerCase()) {\n if (network.preset === 'andromeda' && synthToken.symbol === 'sUSDC') {\n return importPositionManagerAndromedaUSDC(network.id, network.preset);\n }\n if (network.preset === 'andromeda' && synthToken.symbol === 'sStataUSDC') {\n return importPositionManagerAndromedaStataUSDC(network.id, network.preset);\n }\n }\n }\n return importPositionManager(network.id, network.preset);\n },\n staleTime: Infinity,\n // On some chains this is not available, and that is expected\n throwOnError: false,\n });\n}\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { D18, D6, ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { usePositionManagerForCollateral } from '@snx-v3/usePositionManagerForCollateral';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { Wei } from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:DepositModalAndromeda');\n\nexport function DepositModalAndromeda({ onClose }: { onClose: () => void }) {\n const [params] = useParams();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { collateralChange, setCollateralChange } = React.useContext(ManagePositionContext);\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const queryClient = useQueryClient();\n const errorParser = useContractErrorParser();\n\n const { data: USDC } = useUSDC();\n const { data: AccountProxy } = useAccountProxy();\n const { data: PositionManager } = usePositionManagerForCollateral({ collateralType });\n\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const { network } = useNetwork();\n const signer = useSigner();\n const provider = useProvider();\n\n const {\n approve: approveUSDC,\n requireApproval: requireApprovalUSDC,\n txnState: txnStateApproveUSDC,\n isReady: isReadyApproveUSDC,\n } = useApprove({\n contractAddress: USDC?.address,\n amount: collateralChange.toBN().mul(D6).div(D18),\n spender: PositionManager?.address,\n });\n\n const isReady =\n network &&\n provider &&\n signer &&\n AccountProxy &&\n PositionManager &&\n USDC?.address &&\n collateralType?.tokenAddress &&\n collateralChange.gt(0) &&\n isReadyApproveUSDC &&\n // Make it boolean\n true;\n\n const [txnStateDeposit, dispatch] = React.useReducer(reducer, initialState);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [cachedCollateralChange, setCachedCollateralChange] = React.useState(collateralChange);\n\n const { mutate: execDeposit } = useMutation({\n mutationFn: async function () {\n log('params', params);\n log('collateralType', collateralType);\n\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n if (requireApprovalUSDC) {\n await approveUSDC(false);\n }\n\n dispatch({ type: 'prompting' });\n\n const walletAddress = await signer.getAddress();\n\n const callsPromises = [];\n\n if (params.accountId) {\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n PositionManager.address,\n params.accountId\n );\n callsPromises.push(approveAccountTx);\n }\n\n const PositionManagerContract = new ethers.Contract(\n PositionManager.address,\n PositionManager.abi,\n signer\n );\n\n if (params.accountId) {\n const increasePositionTx = PositionManagerContract.populateTransaction.increasePosition(\n params.accountId,\n collateralChange.toBN().mul(D6).div(D18)\n );\n callsPromises.push(increasePositionTx);\n } else {\n const setupPositionTx = PositionManagerContract.populateTransaction.setupPosition(\n collateralChange.toBN().mul(D6).div(D18)\n );\n callsPromises.push(setupPositionTx);\n }\n\n const calls = await Promise.all(callsPromises);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useDepositAndromeda',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'Accounts',\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your locked collateral amount has been updated.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n\n setCollateralChange(ZEROWEI);\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Transaction failed',\n variant: 'left-accent',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n duration: 3_600_000,\n });\n throw Error('Transaction failed', { cause: error });\n },\n });\n\n return (\n \n \n {\n dispatch({ type: 'settled' });\n setCachedCollateralChange(collateralChange);\n onClose();\n }}\n mr={2}\n />\n {params.accountId ? <>Manage Collateral : <>Open Liquidity Position}\n \n \n \n \n \n }\n status={{\n failed: txnStateApproveUSDC.txnStatus === 'error',\n success: txnStateApproveUSDC.txnStatus === 'success',\n loading:\n txnStateApproveUSDC.txnStatus === 'prompting' ||\n txnStateApproveUSDC.txnStatus === 'pending',\n }}\n />\n \n {!params.accountId ? Create new account : null}\n {params.accountId ? Approve update position on behalf : null}\n \n \n }\n status={{\n failed: txnStateDeposit.txnStatus === 'error',\n success: txnStateDeposit.txnStatus === 'success',\n loading:\n txnStateDeposit.txnStatus === 'prompting' || txnStateDeposit.txnStatus === 'pending',\n }}\n />\n\n {txnStateDeposit.txnStatus === 'success' ? (\n {\n dispatch({ type: 'settled' });\n setCachedCollateralChange(collateralChange);\n onClose();\n }}\n mt=\"6\"\n >\n Done\n \n ) : (\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_deposit_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n execDeposit();\n }}\n mt=\"6\"\n >\n {(() => {\n if (\n txnStateApproveUSDC.txnStatus === 'unsent' &&\n txnStateDeposit.txnStatus === 'unsent'\n ) {\n return 'Execute Transaction';\n }\n if (\n txnStateApproveUSDC.txnStatus === 'error' ||\n txnStateDeposit.txnStatus === 'error'\n ) {\n return 'Retry';\n }\n if (\n txnStateApproveUSDC.txnStatus === 'prompting' ||\n txnStateApproveUSDC.txnStatus === 'pending' ||\n txnStateDeposit.txnStatus === 'prompting' ||\n txnStateDeposit.txnStatus === 'pending'\n ) {\n return 'Processing...';\n }\n return 'Execute Transaction';\n })()}\n \n )}\n \n );\n}\n","import { ArrowUpIcon, CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { transactionLink } from '@snx-v3/etherscanLink';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { WithdrawIncrease } from '@snx-v3/WithdrawIncrease';\nimport { Wei, wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function RepayModal({ txnStatus, txnHash }: { txnStatus: string; txnHash: string | null }) {\n const { debtChange, setCollateralChange, setDebtChange } =\n React.useContext(ManagePositionContext);\n const { data: systemToken } = useSystemToken();\n const [isOpen, setIsOpen] = React.useState(false);\n const { network } = useNetwork();\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n setIsOpen(false);\n }\n }, [txnStatus]);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [repayAmount, setRepayAmount] = React.useState();\n React.useEffect(() => {\n if (debtChange && debtChange.lt(0)) {\n setRepayAmount(debtChange.abs());\n }\n }, [debtChange]);\n\n return (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setIsOpen(false);\n }}\n >\n \n \n \n \n Repaying Debt\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {repayAmount ? (\n \n \n \n ) : (\n \n Claim your rewards\n \n )}\n \n \n \n {txnStatus === 'success' ? (\n setIsOpen(false)}\n >\n Done\n \n ) : null}\n \n \n {txnHash ? (\n <>\n View Transaction\n \n \n ) : (\n <>\n Signing Transaction\n \n )}\n \n \n \n \n \n );\n}\n","import { Button, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useRepay } from '@snx-v3/useRepay';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { wei } from '@synthetixio/wei';\nimport React from 'react';\nimport { RepayModal } from './RepayModal';\n\nexport function Repay() {\n const [params] = useParams();\n const { debtChange, setDebtChange } = React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n const { data: systemToken } = useSystemToken();\n const { data: systemTokenBalance, isPending: isPendingSystemTokenBalance } = useTokenBalance(\n systemToken?.address\n );\n\n const availableSystemToken =\n systemTokenBalance && liquidityPosition\n ? systemTokenBalance.add(liquidityPosition.availableSystemToken)\n : undefined;\n\n const {\n isReady: isReadyRepay,\n txnState,\n mutation: mutationRepay,\n } = useRepay({\n repayAmount: debtChange && debtChange.lt(0) ? debtChange.abs() : undefined,\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n const onSubmit = React.useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n\n try {\n toast.closeAll();\n toast({ title: 'Repaying...', variant: 'left-accent' });\n\n await mutationRepay.mutateAsync();\n setDebtChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your debt has been repaid.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast({\n title: 'Could not complete repaying',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Repay failed', { cause: error });\n }\n },\n [errorParser, mutationRepay, setDebtChange, toast]\n );\n\n return (\n \n \n \n Repay Debt\n \n \n \n \n \n \n {systemToken?.displaySymbol}\n \n \n \n \n {isPendingLiquidityPosition || isPendingSystemTokenBalance ? '~' : null}\n {!(isPendingLiquidityPosition || isPendingSystemTokenBalance) &&\n liquidityPosition &&\n availableSystemToken ? (\n <>\n {liquidityPosition.debt.abs().gt(availableSystemToken) ? (\n <>\n \n  \n {\n e.preventDefault();\n setDebtChange(availableSystemToken.mul(-1));\n }}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n {availableSystemToken.gt(liquidityPosition.debt.abs()) ? (\n <>\n \n  \n {\n e.preventDefault();\n setDebtChange(liquidityPosition.debt.neg());\n }}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n ) : null}\n \n \n \n \n setDebtChange(val.mul(-1))}\n max={liquidityPosition ? liquidityPosition.debt : wei(0)}\n min={ZEROWEI}\n />\n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition &&\n liquidityPosition &&\n liquidityPosition.collateralPrice.gt(0) ? (\n \n ) : null}\n \n \n \n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_repay_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n {debtChange.eq(0) ? 'Enter Amount' : 'Repay'}\n \n \n );\n}\n","import { POOL_ID } from '@snx-v3/constants';\nimport { USDC_BASE_MARKET } from '@snx-v3/isBaseAndromeda';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React from 'react';\n\nconst log = debug('snx:useClearDebt');\n\nexport const useClearDebt = ({\n accountId,\n collateralTypeAddress,\n}: {\n accountId?: string;\n collateralTypeAddress?: string;\n}) => {\n const [txnState, dispatch] = React.useReducer(reducer, initialState);\n const { data: CoreProxy } = useCoreProxy();\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n const { data: AccountProxy } = useAccountProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n\n const signer = useSigner();\n const { network } = useNetwork();\n const provider = useProvider();\n\n const { data: DebtRepayer } = useDebtRepayer();\n\n const queryClient = useQueryClient();\n const mutation = useMutation({\n mutationFn: async () => {\n if (!signer || !network || !provider) throw new Error('No signer or network');\n if (\n !(\n CoreProxy &&\n accountId &&\n collateralTypeAddress &&\n SpotMarketProxy &&\n DebtRepayer &&\n AccountProxy\n )\n ) {\n return;\n }\n\n dispatch({ type: 'prompting' });\n\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const DebtRepayerContract = new ethers.Contract(DebtRepayer.address, DebtRepayer.abi, signer);\n\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n DebtRepayer.address,\n accountId\n );\n\n const depositDebtToRepay = DebtRepayerContract.populateTransaction.depositDebtToRepay(\n CoreProxy.address,\n SpotMarketProxy.address,\n AccountProxy.address,\n accountId,\n POOL_ID,\n collateralTypeAddress,\n USDC_BASE_MARKET\n );\n\n const callsPromise = Promise.all([approveAccountTx, depositDebtToRepay]);\n const [calls] = await Promise.all([callsPromise]);\n\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useRepay',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n dispatch({ type: 'success' });\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n};\n","import { CheckIcon } from '@chakra-ui/icons';\nimport { Alert, Button, Flex, Text } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { parseUnits } from '@snx-v3/format';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useClearDebt } from '@snx-v3/useClearDebt';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useTokenBalance } from '@snx-v3/useTokenBalance';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport React from 'react';\n\nexport function RepayAndromedaDebt() {\n const [params] = useParams();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n // Andromeda users pay with USDC\n const { data: USDC } = useUSDC();\n const { data: usdcBalance } = useTokenBalance(USDC?.address);\n\n const {\n exec: clearDebt,\n settle: settleRepay,\n isLoading,\n } = useClearDebt({\n accountId: params.accountId,\n collateralTypeAddress: collateralType?.address,\n });\n\n const { data: DebtRepayer } = useDebtRepayer();\n const {\n approve,\n requireApproval,\n isLoading: approvalLoading,\n isReady: isReadyApprove,\n } = useApprove({\n contractAddress: USDC?.address,\n // slippage for approval\n amount: liquidityPosition\n ? parseUnits(liquidityPosition.debt.toString(), 6).mul(150).div(100)\n : undefined,\n spender: DebtRepayer?.address,\n });\n\n const submit = React.useCallback(async () => {\n try {\n if (requireApproval) {\n await approve(false);\n }\n await clearDebt();\n\n settleRepay();\n } catch (error) {}\n }, [approve, clearDebt, requireApproval, settleRepay]);\n\n const hasEnoughBalance =\n liquidityPosition &&\n usdcBalance &&\n liquidityPosition.availableSystemToken.add(usdcBalance).gte(liquidityPosition.debt);\n\n return (\n \n \n Repay USDC\n \n {liquidityPosition ? (\n <>\n {liquidityPosition.debt.lte(0) ? (\n \n \n \n \n \n Your account currently has no debt.\n \n \n ) : null}\n\n {liquidityPosition.debt.gt(0) ? (\n <>\n \n Your account currently has a positive debt. This amount must be paid to initiate\n collateral withdrawal.\n \n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_repay_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n submit();\n }}\n data-cy=\"repay debt submit\"\n >\n \n \n \n ) : null}\n \n ) : null}\n \n );\n}\n","import { POOL_ID } from '@snx-v3/constants';\nimport { parseUnits } from '@snx-v3/format';\nimport { getSpotMarketId } from '@snx-v3/isBaseAndromeda';\nimport { notNil } from '@snx-v3/tsHelpers';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { approveAbi } from '@snx-v3/useApprove';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useGetUSDTokens } from '@snx-v3/useGetUSDTokens';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { BigNumber, ethers } from 'ethers';\nimport { useReducer } from 'react';\n\nconst log = debug('snx:useRepayBaseAndromeda');\n\nexport const useRepayBaseAndromeda = ({\n accountId,\n collateralTypeAddress,\n debtChange,\n availableUSDCollateral,\n collateralSymbol,\n}: {\n accountId?: string;\n collateralTypeAddress?: string;\n availableUSDCollateral?: Wei;\n debtChange: Wei;\n collateralSymbol?: string;\n}) => {\n const [txnState, dispatch] = useReducer(reducer, initialState);\n const { data: CoreProxy } = useCoreProxy();\n const { data: systemToken } = useSystemToken();\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n const { data: usdTokens } = useGetUSDTokens();\n\n const signer = useSigner();\n const { network } = useNetwork();\n const provider = useProvider();\n\n const queryClient = useQueryClient();\n const mutation = useMutation({\n mutationFn: async () => {\n if (!signer || !network || !provider) throw new Error('No signer or network');\n\n if (\n !(\n CoreProxy &&\n accountId &&\n collateralTypeAddress &&\n systemToken &&\n SpotMarketProxy &&\n usdTokens?.sUSD\n )\n ) {\n return;\n }\n\n if (!availableUSDCollateral) return;\n if (debtChange.eq(0)) return;\n const debtChangeAbs = debtChange.abs();\n const amountToDeposit = debtChangeAbs.sub(availableUSDCollateral);\n const collateralAmount = amountToDeposit.gt(0)\n ? parseUnits(amountToDeposit.toString(), 6)\n : BigNumber.from(0);\n\n dispatch({ type: 'prompting' });\n\n const spotMarketId = getSpotMarketId(collateralSymbol);\n\n const SpotMarketProxyContract = new ethers.Contract(\n SpotMarketProxy.address,\n SpotMarketProxy.abi,\n signer\n );\n\n // USDC or stataUSDC to sUSDC or sStataUSDC\n const wrap = collateralAmount.gt(0)\n ? SpotMarketProxyContract.populateTransaction.wrap(spotMarketId, collateralAmount, 0)\n : undefined;\n\n const Synth_Contract = new ethers.Contract(collateralTypeAddress, approveAbi, signer);\n const synth_approval = amountToDeposit.gt(0)\n ? Synth_Contract.populateTransaction.approve(\n SpotMarketProxy.address,\n amountToDeposit.toBN()\n )\n : undefined;\n\n // sUSDC or sStataUSDC => snxUSD\n const sell_synth = amountToDeposit.gt(0)\n ? SpotMarketProxyContract.populateTransaction.sell(\n spotMarketId,\n amountToDeposit.toBN(),\n 0,\n ethers.constants.AddressZero\n )\n : undefined;\n\n // approve sUSD to Core\n const SystemTokenContract = new ethers.Contract(systemToken.address, approveAbi, signer);\n const sUSD_Approval = amountToDeposit.gt(0)\n ? SystemTokenContract.populateTransaction.approve(CoreProxy.address, amountToDeposit.toBN())\n : undefined;\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n\n // Only deposit if user doesn't have enough sUSD collateral\n const deposit = amountToDeposit.lte(0)\n ? undefined\n : CoreProxyContract.populateTransaction.deposit(\n BigNumber.from(accountId),\n systemToken.address,\n amountToDeposit.toBN() // only deposit what's needed\n );\n\n const burn = CoreProxyContract.populateTransaction.burnUsd(\n BigNumber.from(accountId),\n BigNumber.from(POOL_ID),\n collateralTypeAddress,\n debtChangeAbs.toBN()\n );\n\n const callsPromise = Promise.all(\n [wrap, synth_approval, sell_synth, sUSD_Approval, deposit, burn].filter(notNil)\n );\n\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const walletAddress = await signer.getAddress();\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useRepay',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n};\n","import { USDC_BASE_MARKET } from '@snx-v3/isBaseAndromeda';\nimport { Network, useNetwork, useProviderForChain } from '@snx-v3/useBlockchain';\nimport { useCollateralTypes } from '@snx-v3/useCollateralTypes';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\n\nexport function useGetUSDTokens(customNetwork?: Network) {\n const { network: currentNetwork } = useNetwork();\n const network = customNetwork ?? currentNetwork;\n const provider = useProviderForChain(network);\n\n const { data: collateralTypes } = useCollateralTypes(false, customNetwork);\n const { data: SpotMarketProxy } = useSpotMarketProxy(customNetwork);\n const { data: systemToken } = useSystemToken(customNetwork);\n\n return useQuery({\n queryKey: [`${network?.id}-${network?.preset}`, 'GetUSDTokens'],\n enabled: Boolean(\n SpotMarketProxy && provider && network && collateralTypes?.length && systemToken\n ),\n queryFn: async () => {\n if (!(SpotMarketProxy && provider && network && collateralTypes?.length && systemToken)) {\n throw 'OMFG';\n }\n const SpotMarketProxyContract = new ethers.Contract(\n SpotMarketProxy.address,\n SpotMarketProxy.abi,\n provider\n );\n\n const USDC: string =\n network?.preset === 'andromeda'\n ? (await SpotMarketProxyContract.getWrapper(USDC_BASE_MARKET))?.wrapCollateralType\n : undefined;\n\n return {\n snxUSD: systemToken.address,\n sUSD: collateralTypes?.find((type) =>\n network?.preset === 'andromeda'\n ? type.symbol.toLowerCase() === 'usdc'\n : type.symbol.toLowerCase() === 'susdc'\n )?.tokenAddress,\n USDC,\n };\n },\n });\n}\n","import { assign, createMachine } from 'xstate';\n\nexport const Events = {\n SET_REQUIRE_APPROVAL: 'SET_REQUIRE_APPROVAL',\n SET_INFINITE_APPROVAL: 'SET_INFINITE_APPROVAL',\n RETRY: 'RETRY',\n RUN: 'RUN',\n SUCCESS: 'SUCCESS',\n FAILURE: 'FAILURE',\n RESET: 'RESET',\n} as const;\n\nexport const State = {\n idle: 'idle',\n approve: 'approve',\n repay: 'repay',\n failed: 'failed',\n success: 'success',\n} as const;\n\nconst FailedSteps = {\n [State.approve]: State.approve,\n [State.repay]: State.repay,\n} as const;\n\nexport const ServiceNames = {\n approveSUSD: 'approveSUSD',\n executeRepay: 'executeRepay',\n} as const;\n\ntype Context = {\n error: {\n error: Error;\n step: keyof typeof FailedSteps;\n } | null;\n requireApproval: boolean;\n infiniteApproval: boolean;\n};\n\ntype EventNamesType = typeof Events;\ntype RepayEvents =\n | { type: EventNamesType['SET_REQUIRE_APPROVAL']; requireApproval: boolean }\n | { type: EventNamesType['SET_INFINITE_APPROVAL']; infiniteApproval: boolean }\n | { type: EventNamesType['RETRY'] }\n | { type: EventNamesType['RUN'] }\n | { type: EventNamesType['SUCCESS'] }\n | { type: EventNamesType['FAILURE'] }\n | { type: EventNamesType['RESET'] };\n\ntype StateType = typeof State;\ntype MachineState =\n | {\n value: StateType['idle'];\n context: Context & { error: null };\n }\n | {\n value: StateType['approve'];\n context: Context & { error: null };\n }\n | {\n value: StateType['repay'];\n context: Context & { error: null };\n }\n | {\n value: StateType['failed'];\n context: Context & { error: { error: Error; step: keyof typeof FailedSteps } };\n }\n | {\n value: StateType['success'];\n context: Context & {\n error: null;\n };\n };\n\nconst initialContext = {\n error: null,\n requireApproval: false,\n infiniteApproval: false,\n};\n\nexport const RepayMachine = createMachine({\n id: 'RepayMachine',\n initial: State.idle,\n predictableActionArguments: true,\n context: initialContext,\n on: {\n [Events.RUN]: {\n target: State.repay,\n actions: assign({\n error: (_) => initialContext.error,\n requireApproval: (_) => initialContext.requireApproval,\n infiniteApproval: (_) => initialContext.infiniteApproval,\n }),\n },\n [Events.SET_REQUIRE_APPROVAL]: {\n actions: assign({ requireApproval: (_context, event) => event.requireApproval }),\n },\n\n [Events.SET_INFINITE_APPROVAL]: {\n actions: assign({ infiniteApproval: (_context, event) => event.infiniteApproval }),\n },\n },\n states: {\n [State.idle]: {\n on: {\n [Events.RUN]: [\n { target: State.approve, cond: (context) => context.requireApproval },\n { target: State.repay },\n ],\n },\n },\n\n [State.approve]: {\n invoke: {\n src: ServiceNames.approveSUSD,\n onDone: {\n target: State.repay,\n },\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({ error: event.data, step: FailedSteps.approve }),\n }),\n },\n },\n },\n [State.repay]: {\n invoke: {\n src: ServiceNames.executeRepay,\n onDone: {\n target: State.success,\n },\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({ error: event.data, step: FailedSteps.repay }),\n }),\n },\n },\n },\n [State.failed]: {\n on: {\n [Events.RETRY]: [\n {\n target: State.approve,\n cond: (c) => c.error?.step === FailedSteps.approve,\n actions: assign({ error: (_) => null }),\n },\n\n {\n target: State.repay,\n cond: (c) => c.error?.step === FailedSteps.repay,\n actions: assign({ error: (_) => null }),\n },\n ],\n },\n },\n [State.success]: {},\n },\n});\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Link, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { D18, D6, ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useRepay } from '@snx-v3/useRepay';\nimport { useRepayBaseAndromeda } from '@snx-v3/useRepayBaseAndromeda';\nimport { useSpotMarketProxy } from '@snx-v3/useSpotMarketProxy';\nimport { useSynthTokens } from '@snx-v3/useSynthTokens';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useMachine } from '@xstate/react';\nimport React from 'react';\nimport { Events, RepayMachine, ServiceNames, State } from './RepayMachine';\n\nexport function RepayModal({ onClose }: { onClose: () => void }) {\n const { debtChange, setDebtChange } = React.useContext(ManagePositionContext);\n const [params] = useParams();\n\n const { network } = useNetwork();\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: systemToken } = useSystemToken();\n\n const { exec: execRepay, settle: settleRepay } = useRepay({\n repayAmount: debtChange && debtChange.lt(0) ? debtChange.abs() : undefined,\n });\n\n const { exec: execRepayBaseAndromeda, settle: settleRepayBaseAndromeda } = useRepayBaseAndromeda({\n accountId: params.accountId,\n collateralTypeAddress: collateralType?.tokenAddress,\n debtChange,\n availableUSDCollateral: liquidityPosition ? liquidityPosition.availableSystemToken : undefined,\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const { data: CoreProxy } = useCoreProxy();\n const { data: SpotMarketProxy } = useSpotMarketProxy();\n\n const errorParser = useContractErrorParser();\n const amountToDeposit = debtChange\n .abs()\n .sub(liquidityPosition ? liquidityPosition.availableSystemToken : 0);\n\n const { data: synthTokens } = useSynthTokens();\n const wrapperToken = React.useMemo(() => {\n if (synthTokens && collateralType) {\n return synthTokens.find((synth) => synth.address === collateralType.tokenAddress)?.token\n ?.address;\n }\n }, [collateralType, synthTokens]);\n\n const collateralAddress = network?.preset === 'andromeda' ? wrapperToken : systemToken?.address;\n\n const {\n approve,\n requireApproval,\n isReady: isReadyApprove,\n } = useApprove({\n contractAddress: collateralAddress,\n amount:\n network?.preset === 'andromeda'\n ? amountToDeposit.toBN().mul(D6).div(D18) // On Base we use USDC and it has 6 decimals\n : amountToDeposit.toBN(),\n spender: network?.preset === 'andromeda' ? SpotMarketProxy?.address : CoreProxy?.address,\n });\n\n const [state, send] = useMachine(RepayMachine, {\n services: {\n [ServiceNames.approveSUSD]: async () => {\n try {\n toast({\n title: `Approve ${systemToken?.displaySymbol} for transfer`,\n description: 'The next transaction will repay your debt.',\n status: 'info',\n variant: 'left-accent',\n });\n\n await approve(Boolean(state.context.infiniteApproval));\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Approval failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Approve failed', { cause: error });\n }\n },\n\n [ServiceNames.executeRepay]: async () => {\n try {\n toast.closeAll();\n toast({ title: 'Repaying...', variant: 'left-accent' });\n\n if (network?.preset === 'andromeda') {\n await execRepayBaseAndromeda();\n } else {\n await execRepay();\n }\n\n setDebtChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your debt has been repaid.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast({\n title: 'Could not complete repaying',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Repay failed', { cause: error });\n }\n },\n },\n });\n const needToDeposit = amountToDeposit.gt(0);\n\n React.useEffect(() => {\n send(Events.SET_REQUIRE_APPROVAL, { requireApproval: requireApproval && needToDeposit });\n }, [needToDeposit, requireApproval, send]);\n\n const onSubmit = React.useCallback(async () => {\n if (state.matches(State.success)) {\n send(Events.RESET);\n onClose();\n return;\n }\n if (state.context.error) {\n send(Events.RETRY);\n return;\n }\n send(Events.RUN);\n }, [onClose, send, state]);\n\n const symbol = network?.preset === 'andromeda' ? 'USDC' : systemToken?.displaySymbol;\n\n if (state.matches(State.success)) {\n return (\n \n Your debt has been updated. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={\n <>\n Debt successfully updated\n \n }\n />\n );\n }\n\n return (\n
\n \n {\n settleRepay();\n settleRepayBaseAndromeda();\n onClose();\n }}\n mr={2}\n />\n Manage Debt\n \n \n \n send(Events.SET_INFINITE_APPROVAL, { infiniteApproval: e.target.checked }),\n }}\n />\n \n Repay \n \n }\n status={{\n failed: state.context.error?.step === State.repay,\n success: state.matches(State.success),\n loading: state.matches(State.repay) && !state.context.error,\n }}\n />\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_repay_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n onSubmit();\n }}\n width=\"100%\"\n mt=\"6\"\n data-cy=\"repay confirm button\"\n >\n {(() => {\n switch (true) {\n case Boolean(state.context.error):\n return 'Retry';\n case state.matches(State.approve) || state.matches(State.repay):\n return 'Processing...';\n case state.matches(State.success):\n return 'Continue';\n default:\n return 'Execute Transaction';\n }\n })()}\n \n
\n );\n}\n","import { POOL_ID } from '@snx-v3/constants';\nimport { contractsHash } from '@snx-v3/tsHelpers';\nimport { useNetwork, useProvider } from '@snx-v3/useBlockchain';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { erc7412Call } from '@snx-v3/withERC7412';\nimport { SmallIntSchema, WeiSchema } from '@snx-v3/zod';\nimport { useQuery } from '@tanstack/react-query';\nimport { ethers } from 'ethers';\nimport { z } from 'zod';\n\nexport const MarketConfigurationSchema = z.object({\n id: SmallIntSchema,\n weight: WeiSchema,\n maxDebtShareValue: WeiSchema,\n isLocked: z.boolean(),\n});\n\nexport const PoolConfigurationSchema = z.object({\n id: z.number(),\n markets: MarketConfigurationSchema.array(),\n isAnyMarketLocked: z.boolean(),\n});\n\nexport const usePoolConfiguration = () => {\n const { network } = useNetwork();\n const { data: CoreProxy } = useCoreProxy();\n const provider = useProvider();\n\n return useQuery({\n enabled: Boolean(CoreProxy && network && provider),\n queryKey: [\n `${network?.id}-${network?.preset}`,\n 'PoolConfiguration',\n { contractsHash: contractsHash([CoreProxy]) },\n ],\n queryFn: async () => {\n if (!(CoreProxy && network && provider)) throw 'OMFG';\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider);\n\n const marketsData: {\n marketId: ethers.BigNumber;\n maxDebtShareValueD18: ethers.BigNumber;\n weightD18: ethers.BigNumber;\n }[] = await CoreProxyContract.getPoolConfiguration(ethers.BigNumber.from(POOL_ID));\n const markets = marketsData.map(({ marketId, maxDebtShareValueD18, weightD18 }) => ({\n id: marketId,\n weight: maxDebtShareValueD18,\n maxDebtShareValue: weightD18,\n }));\n\n const allCalls = await Promise.all(\n markets.map((m) => CoreProxyContract.populateTransaction.isMarketCapacityLocked(m.id))\n );\n\n const decoded = await erc7412Call(\n network,\n provider,\n allCalls,\n (decodedMulticall) => {\n return decodedMulticall.map(({ returnData }) => {\n const [isMarketCapacityLocked] = CoreProxyContract.interface.decodeFunctionResult(\n 'isMarketCapacityLocked',\n returnData\n );\n return isMarketCapacityLocked;\n });\n },\n 'isMarketCapacityLocked'\n );\n\n return PoolConfigurationSchema.parse({\n id: parseInt(POOL_ID),\n markets: markets.map((market, i) => ({\n ...market,\n isLocked: decoded[i],\n })),\n isAnyMarketLocked: decoded.some(Boolean),\n });\n },\n });\n};\n","import { ArrowUpIcon, CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { transactionLink } from '@snx-v3/etherscanLink';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { Wei, wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function UndelegateModal({\n txnStatus,\n approvalTxnStatus,\n txnHash,\n}: {\n txnStatus: string;\n approvalTxnStatus?: string;\n txnHash: string | null;\n}) {\n const [params] = useParams();\n const { collateralChange, setCollateralChange, setDebtChange } =\n React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const [isOpen, setIsOpen] = React.useState(false);\n const { network } = useNetwork();\n\n React.useEffect(() => {\n if (txnStatus === 'prompting' || approvalTxnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error' || approvalTxnStatus === 'error') {\n setIsOpen(false);\n }\n }, [approvalTxnStatus, txnStatus]);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [undelegateAmount, setUndelegateAmount] = React.useState();\n React.useEffect(() => {\n if (collateralChange && collateralChange.lt(0)) {\n setUndelegateAmount(collateralChange.abs());\n }\n }, [collateralChange]);\n\n return (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setIsOpen(false);\n }}\n >\n \n \n \n \n Unlocking Collateral\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {undelegateAmount ? (\n \n \n \n ) : null}\n \n \n\n {txnStatus === 'success' ? (\n setIsOpen(false)}\n >\n Done\n \n ) : null}\n \n \n {txnHash ? (\n <>\n View Transaction\n \n \n ) : (\n <>\n Signing Transaction\n \n )}\n \n \n \n \n \n );\n}\n","import {\n Alert,\n AlertDescription,\n AlertIcon,\n AlertTitle,\n Button,\n Collapse,\n Flex,\n Link,\n Text,\n useToast,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { D18, D6, ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { CRatioChangeStat } from '@snx-v3/CRatioBar';\nimport { currency } from '@snx-v3/format';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { TransactionSummary } from '@snx-v3/TransactionSummary';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { makeSearch, type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { usePoolConfiguration } from '@snx-v3/usePoolConfiguration';\nimport { useUndelegate } from '@snx-v3/useUndelegate';\nimport { useUndelegateBaseAndromeda } from '@snx-v3/useUndelegateBaseAndromeda';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { useWithdrawTimer } from '@snx-v3/useWithdrawTimer';\nimport { validatePosition } from '@snx-v3/validatePosition';\nimport Wei, { wei } from '@synthetixio/wei';\nimport { ethers } from 'ethers';\nimport React from 'react';\nimport { UndelegateModal } from './UndelegateModal';\n\nexport function Undelegate() {\n const [params, setParams] = useParams();\n const { collateralChange, debtChange, setCollateralChange } =\n React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const poolConfiguration = usePoolConfiguration();\n const { network } = useNetwork();\n const { data: USDC } = useUSDC();\n const { data: DebtRepayer } = useDebtRepayer();\n\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const collateralPrice = liquidityPosition?.collateralPrice;\n\n const { newDebt } = validatePosition({\n issuanceRatioD18: collateralType?.issuanceRatioD18,\n collateralAmount: liquidityPosition?.collateralAmount,\n collateralPrice,\n debt: liquidityPosition?.debt,\n collateralChange: collateralChange,\n debtChange: debtChange,\n });\n\n const approveAndromedaUSDCAmount = React.useMemo(() => {\n if (network?.preset !== 'andromeda') {\n return ethers.BigNumber.from(0);\n }\n if (!liquidityPosition) {\n return undefined;\n }\n if (liquidityPosition.debt.lte(0)) {\n return ethers.BigNumber.from(0);\n }\n return liquidityPosition.debt.toBN().mul(D6).div(D18).mul(110).div(100);\n }, [liquidityPosition, network?.preset]);\n const {\n approve,\n requireApproval,\n txnState: approvalTxnState,\n isReady: isReadyApproveAndromedaUSDC,\n } = useApprove({\n contractAddress: USDC?.address,\n amount: approveAndromedaUSDCAmount,\n spender: DebtRepayer?.address,\n });\n\n const {\n isReady: isReadyUndelegate,\n txnState: undelegateTxnState,\n mutation: undelegate,\n } = useUndelegate({\n undelegateAmount:\n collateralChange && collateralChange.lt(0) ? collateralChange.abs() : undefined,\n });\n\n const {\n isReady: isReadyUndelegateAndromeda,\n txnState: undelegateAndromedaTxnState,\n mutation: undelegateAndromeda,\n } = useUndelegateBaseAndromeda({\n undelegateAmount:\n collateralChange && collateralChange.lt(0) ? collateralChange.abs() : undefined,\n });\n\n const isReady =\n (network?.preset === 'andromeda' &&\n isReadyApproveAndromedaUSDC &&\n isReadyUndelegateAndromeda) ||\n (network?.preset !== 'andromeda' && isReadyUndelegate);\n\n const txnState =\n network?.preset === 'andromeda' ? undelegateAndromedaTxnState : undelegateTxnState;\n\n const maxWithdrawable = liquidityPosition?.availableCollateral;\n\n // To get the max withdrawable collateral we look at the new debt and the issuance ratio.\n // This gives us the amount in dollar. We then divide by the collateral price.\n // To avoid the transaction failing due to small price deviations, we also apply a 2% buffer by multiplying with 0.98\n const max = (() => {\n if (!liquidityPosition || !collateralType) {\n return undefined;\n }\n const { collateralAmount, collateralValue } = liquidityPosition;\n\n if (network?.preset === 'andromeda') {\n return collateralAmount;\n }\n\n // if debt is negative it's actually credit, which means we can undelegate all collateral\n if (newDebt.lte(0)) return collateralAmount;\n\n const minCollateralRequired = newDebt.mul(collateralType.liquidationRatioD18);\n\n if (collateralValue.lt(minCollateralRequired))\n // If you're below issuance ratio, you can't withdraw anything\n return wei(0);\n\n const maxWithdrawable = collateralValue.sub(minCollateralRequired).mul(0.98);\n\n return Wei.min(collateralAmount, maxWithdrawable);\n })();\n\n const isLoadingRequiredData = poolConfiguration.isLoading || !max;\n const isAnyMarketLocked = poolConfiguration.data?.isAnyMarketLocked;\n\n const { minutes, hours, isRunning } = useWithdrawTimer(params.accountId);\n\n const leftoverCollateral = liquidityPosition?.collateralAmount?.add(collateralChange) || wei(0);\n const isValidLeftover =\n leftoverCollateral.gte(collateralType?.minDelegationD18 || wei(0)) || leftoverCollateral.eq(0);\n\n const isInputDisabled = isAnyMarketLocked;\n const overAvailableBalance = max ? collateralChange.abs().gt(max) : false;\n const isSubmitDisabled =\n !isReady ||\n isLoadingRequiredData ||\n isAnyMarketLocked ||\n collateralChange.gte(0) ||\n !isValidLeftover ||\n overAvailableBalance;\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n\n const onSubmit = React.useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n\n try {\n toast.closeAll();\n toast({ title: 'Undelegating...', variant: 'left-accent' });\n\n if (network?.preset === 'andromeda') {\n if (requireApproval) {\n await approve(false);\n }\n await undelegateAndromeda.mutateAsync();\n } else {\n await undelegate.mutateAsync();\n }\n\n setCollateralChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your collateral has been updated.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast({\n title: 'Could not complete repaying',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Undelegate failed', { cause: error });\n }\n },\n [\n approve,\n errorParser,\n network?.preset,\n requireApproval,\n setCollateralChange,\n toast,\n undelegate,\n undelegateAndromeda,\n ]\n );\n\n return (\n \n \n \n Unlock Collateral\n \n\n \n \n \n \n \n {collateralType?.displaySymbol ?? params.collateralSymbol}\n \n \n \n {isPendingLiquidityPosition ? 'Locked: ~' : null}\n {!isPendingLiquidityPosition && max ? (\n <>\n \n  \n setCollateralChange(max.mul(-1))}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n \n \n setCollateralChange(val.mul(-1))}\n max={max}\n min={ZEROWEI}\n />\n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition &&\n liquidityPosition &&\n liquidityPosition.collateralPrice.gt(0) ? (\n \n ) : null}\n \n \n \n\n \n \n \n \n Credit capacity reached\n \n One of the markets has reached its credit capacity and is currently in a locked state.\n You cannot unlock collateral from the pool at this time.\n \n \n \n \n\n {collateralType ? (\n \n \n \n \n \n The minimal locked amount is{' '}\n \n \n \n You can close your position by removing all the collateral.\n \n \n \n \n ) : null}\n\n \n \n \n \n You will be able to withdraw assets in {hours}H{minutes}M. Any account activity will\n reset this timer to 24H.\n \n \n \n\n {liquidityPosition ? (\n \n \n \n \n You already have{' '}\n {' '}\n unlocked.  \n {\n e.preventDefault();\n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: 'withdraw',\n accountId: params.accountId,\n });\n }}\n textDecoration=\"underline\"\n >\n Withdraw\n {' '}\n before unlocking again as it will restart the 24h withdrawal timeout.\n \n \n \n ) : null}\n\n {network?.preset === 'andromeda' && liquidityPosition ? (\n \n \n \n \n to\n unlock {liquidityPosition.collateralType.displaySymbol}\n \n \n \n ) : null}\n\n {liquidityPosition ? (\n \n currency(val ?? ZEROWEI)}\n hasChanges={collateralChange.abs().gt(0)}\n size=\"sm\"\n />\n ),\n },\n ...(network?.preset !== 'andromeda'\n ? [\n {\n label: 'C-ratio',\n value: (\n \n ),\n },\n ]\n : []),\n ]}\n />\n \n ) : null}\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_undelegate_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n onSubmit(e);\n }}\n data-cy=\"undelegate submit\"\n type=\"submit\"\n isDisabled={isSubmitDisabled}\n >\n {collateralChange.gte(0) ? 'Enter Amount' : 'Unlock Collateral'}\n \n \n );\n}\n","import Wei, { wei } from '@synthetixio/wei';\nimport { assign, createMachine } from 'xstate';\n\nexport const Events = {\n SET_AMOUNT: 'SET_AMOUNT',\n SET_COLLATERAL_SYMBOL: 'SET_COLLATERAL_SYMBOL',\n RETRY: 'RETRY',\n RUN: 'RUN',\n SUCCESS: 'SUCCESS',\n FAILURE: 'FAILURE',\n RESET: 'RESET',\n} as const;\n\nexport const State = {\n idle: 'idle',\n undelegate: 'undelegate',\n failed: 'failed',\n success: 'success',\n} as const;\n\nexport const FailedSteps = {\n [State.undelegate]: State.undelegate,\n} as const;\n\nexport const ServiceNames = {\n undelegate: 'undelegate',\n} as const;\n\ntype Context = {\n error: { error: Error; step: keyof typeof FailedSteps } | null;\n amount: Wei;\n collateralSymbol?: string;\n};\n\ntype EventType = typeof Events;\ntype UndelegateEvents =\n | { type: EventType['SET_AMOUNT']; amount: Wei }\n | { type: EventType['SET_COLLATERAL_SYMBOL']; symbol: string }\n | { type: EventType['RETRY'] }\n | { type: EventType['RUN'] }\n | { type: EventType['SUCCESS'] }\n | { type: EventType['FAILURE'] }\n | { type: EventType['RESET'] };\n\ntype StateType = typeof State;\nexport type MachineState =\n | {\n value: StateType['idle'];\n context: Context & { error: null };\n }\n | {\n value: StateType['undelegate'];\n context: Context & { error: null };\n }\n | {\n value: StateType['failed'];\n context: Context & { error: { error: Error; step: keyof typeof FailedSteps } };\n }\n | {\n value: StateType['success'];\n context: Context & {\n error: null;\n };\n };\n\nconst initialContext = {\n amount: wei(0),\n error: null,\n collateralSymbol: undefined,\n};\nexport const UndelegateMachine = createMachine({\n id: 'UndelegateMachine',\n initial: State.idle,\n predictableActionArguments: true,\n context: initialContext,\n on: {\n [Events.RESET]: {\n target: State.idle,\n actions: assign({\n amount: (_) => initialContext.amount,\n error: (_) => initialContext.error,\n collateralSymbol: (_) => initialContext.collateralSymbol,\n }),\n },\n [Events.SET_AMOUNT]: {\n actions: assign({ amount: (_context, event) => event.amount }),\n },\n [Events.SET_COLLATERAL_SYMBOL]: {\n actions: assign({ collateralSymbol: (_context, event) => event.symbol }),\n },\n },\n states: {\n [State.idle]: {\n on: {\n [Events.RUN]: [{ target: State.undelegate, cond: (context) => context.amount.gt(0) }],\n },\n },\n\n [State.undelegate]: {\n invoke: {\n src: ServiceNames.undelegate,\n onError: {\n target: State.failed,\n actions: assign({\n error: (_context, event) => ({ error: event.data, step: FailedSteps.undelegate }),\n }),\n },\n onDone: [{ target: State.success }],\n },\n },\n\n [State.failed]: {\n on: {\n [Events.RETRY]: [\n {\n target: State.undelegate,\n cond: (c) => c.error?.step === FailedSteps.undelegate,\n actions: assign({ error: (_) => null }),\n },\n ],\n },\n },\n [State.success]: {},\n },\n});\n","import { ArrowBackIcon } from '@chakra-ui/icons';\nimport { Button, Divider, Link, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { ChangeStat } from '@snx-v3/ChangeStat';\nimport { D18, D6, ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { CRatioChangeStat } from '@snx-v3/CRatioBar';\nimport { currency } from '@snx-v3/format';\nimport { LiquidityPositionUpdated } from '@snx-v3/Manage';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Multistep } from '@snx-v3/Multistep';\nimport { TransactionSummary } from '@snx-v3/TransactionSummary';\nimport { useApprove } from '@snx-v3/useApprove';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useDebtRepayer } from '@snx-v3/useDebtRepayer';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useUndelegate } from '@snx-v3/useUndelegate';\nimport { useUndelegateBaseAndromeda } from '@snx-v3/useUndelegateBaseAndromeda';\nimport { useUSDC } from '@snx-v3/useUSDC';\nimport { Wei, wei } from '@synthetixio/wei';\nimport { useMachine } from '@xstate/react';\nimport { ethers } from 'ethers';\nimport React from 'react';\nimport { Events, ServiceNames, State, UndelegateMachine } from './UndelegateMachine';\n\nexport function UndelegateModal({ onClose }: { onClose: () => void }) {\n const [params] = useParams();\n const { collateralChange, setCollateralChange } = React.useContext(ManagePositionContext);\n const { network } = useNetwork();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n\n const [txSummary, setTxSummary] = React.useState({\n currentCollateral: ZEROWEI,\n collateralChange: ZEROWEI,\n currentDebt: ZEROWEI,\n });\n\n const currentCollateral = liquidityPosition?.collateralAmount || wei(0);\n\n const { exec: execUndelegate, isReady: isReadyUndelegate } = useUndelegate({\n undelegateAmount:\n collateralChange && collateralChange.lt(0) ? collateralChange.abs() : undefined,\n });\n\n // Andromeda debt repayment\n const { data: USDC } = useUSDC();\n const { data: DebtRepayer } = useDebtRepayer();\n const approveAndromedaUSDCAmount = React.useMemo(() => {\n if (network?.preset !== 'andromeda') {\n return ethers.BigNumber.from(0);\n }\n if (!liquidityPosition) {\n return undefined;\n }\n if (liquidityPosition.debt.lte(0)) {\n return ethers.BigNumber.from(0);\n }\n return liquidityPosition.debt.toBN().mul(D6).div(D18).mul(110).div(100);\n }, [liquidityPosition, network?.preset]);\n const {\n approve,\n requireApproval,\n isReady: isReadyApproveAndromedaUSDC,\n } = useApprove({\n contractAddress: USDC?.address,\n amount: approveAndromedaUSDCAmount,\n spender: DebtRepayer?.address,\n });\n const { exec: undelegateBaseAndromeda, isReady: isReadyUndelegateAndromeda } =\n useUndelegateBaseAndromeda({\n undelegateAmount:\n collateralChange && collateralChange.lt(0) ? collateralChange.abs() : undefined,\n });\n // End of Andromeda debt repayment\n\n const errorParser = useContractErrorParser();\n\n const [state, send] = useMachine(UndelegateMachine, {\n context: {\n amount: collateralChange.abs(),\n },\n services: {\n [ServiceNames.undelegate]: async () => {\n try {\n setTxSummary({\n currentCollateral,\n currentDebt: liquidityPosition?.debt || ZEROWEI,\n collateralChange,\n });\n\n if (network?.preset === 'andromeda') {\n if (requireApproval) {\n await approve(false);\n }\n await undelegateBaseAndromeda();\n } else {\n await execUndelegate();\n }\n\n setCollateralChange(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your locked collateral amount has been updated.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Unlock collateral failed',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n throw Error('Unlock collateral failed', { cause: error });\n }\n },\n },\n });\n\n const collateralChangeString = collateralChange.toString();\n\n React.useEffect(() => {\n send(Events.SET_AMOUNT, { amount: wei(collateralChangeString).abs() });\n }, [collateralChangeString, send]);\n\n React.useEffect(() => {\n send(Events.SET_COLLATERAL_SYMBOL, { symbol: wei(collateralChangeString).abs() });\n }, [collateralChangeString, send]);\n\n const onSubmit = React.useCallback(async () => {\n if (state.matches(State.success)) {\n send(Events.RESET);\n onClose();\n return;\n }\n if (state.context.error) {\n send(Events.RETRY);\n return;\n }\n send(Events.RUN);\n }, [onClose, send, state]);\n\n const isProcessing = state.matches(State.undelegate);\n if (state.matches(State.success)) {\n return (\n \n Your collateral has been updated. To learn more, visit the{' '}\n \n Synthetix V3 Documentation\n \n \n }\n alertText={\n <>\n Collateral successfully updated\n \n }\n summary={\n currency(val ?? ZEROWEI)}\n hasChanges={txSummary.collateralChange.abs().gt(0)}\n size=\"sm\"\n />\n ),\n },\n ]\n : []),\n ...(liquidityPosition && network?.preset !== 'andromeda'\n ? [\n {\n label: 'C-ratio',\n value: (\n \n ),\n },\n ]\n : []),\n ]}\n />\n }\n />\n );\n }\n\n const isReady =\n !isProcessing &&\n ((network?.preset === 'andromeda' &&\n isReadyApproveAndromedaUSDC &&\n isReadyUndelegateAndromeda) ||\n (network?.preset !== 'andromeda' && isReadyUndelegate));\n\n return (\n
\n \n \n Manage Collateral\n \n \n \n }\n status={{\n failed: Boolean(state.context.error?.step === State.undelegate),\n disabled: state.context.amount.eq(0),\n success: state.matches(State.success),\n loading: state.matches(State.undelegate) && !state.context.error,\n }}\n />\n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_undelegate_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n onSubmit();\n }}\n width=\"100%\"\n mt=\"6\"\n data-cy=\"undelegate confirm button\"\n >\n {(() => {\n switch (true) {\n case Boolean(state.context.error):\n return 'Retry';\n case isProcessing:\n return 'Processing...';\n case state.matches(State.success):\n return 'Continue';\n default:\n return 'Execute Transaction';\n }\n })()}\n \n
\n );\n}\n","import { UndelegateModal } from './UndelegateModal';\n\nexport * from './UndelegateModal';\nexport default UndelegateModal;\n","import { parseUnits } from '@snx-v3/format';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCoreProxy } from '@snx-v3/useCoreProxy';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport Wei from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { BigNumber, ethers } from 'ethers';\nimport { useReducer } from 'react';\n\nconst log = debug('snx:useWithdraw');\n\nexport const useWithdraw = ({\n accountId,\n token,\n amount,\n}: {\n accountId?: string;\n token?: { address: string; decimals: number };\n amount: Wei;\n}) => {\n const [txnState, dispatch] = useReducer(reducer, initialState);\n const { data: CoreProxy } = useCoreProxy();\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n const { network } = useNetwork();\n\n const signer = useSigner();\n const provider = useProvider();\n\n const isReady = signer && network && provider && CoreProxy && token && amount && amount.gt(0);\n const queryClient = useQueryClient();\n const mutation = useMutation({\n mutationFn: async () => {\n if (!isReady) {\n throw new Error('Not ready');\n }\n const walletAddress = await signer.getAddress();\n\n dispatch({ type: 'prompting' });\n\n const CoreProxyContract = new ethers.Contract(CoreProxy.address, CoreProxy.abi, signer);\n const populatedTxnPromised = CoreProxyContract.populateTransaction.withdraw(\n BigNumber.from(accountId),\n token.address,\n parseUnits(amount.toString(), token.decimals)\n );\n\n const callsPromise = Promise.all([populatedTxnPromised]);\n const [calls] = await Promise.all([callsPromise]);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useWithdraw',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n 'TransferableSynthetix',\n 'AccountCollateralUnlockDate',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n throw error;\n },\n });\n return {\n isReady,\n mutation,\n txnState,\n settle: () => dispatch({ type: 'settled' }),\n isLoading: mutation.isPending,\n exec: mutation.mutateAsync,\n };\n};\n","import { ArrowUpIcon, CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { transactionLink } from '@snx-v3/etherscanLink';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { WithdrawIncrease } from '@snx-v3/WithdrawIncrease';\nimport { Wei, wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function WithdrawModal({\n txnStatus,\n txnHash,\n isDebtWithdrawal,\n}: {\n txnStatus: string;\n txnHash: string | null;\n isDebtWithdrawal?: boolean;\n}) {\n const [params] = useParams();\n const { withdrawAmount, setWithdrawAmount } = React.useContext(ManagePositionContext);\n const { data: systemToken } = useSystemToken();\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const [isOpen, setIsOpen] = React.useState(false);\n const { network } = useNetwork();\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n setIsOpen(false);\n }\n }, [txnStatus]);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [cachedWithdrawAmount, setCachedWithdrawAmount] = React.useState();\n React.useEffect(() => {\n if (withdrawAmount && withdrawAmount.gt(0)) {\n setCachedWithdrawAmount(withdrawAmount.abs());\n }\n }, [withdrawAmount]);\n\n return (\n {\n setWithdrawAmount(wei(0));\n setIsOpen(false);\n }}\n >\n \n \n \n \n {isDebtWithdrawal ? 'Withdrawing' : 'Withdrawing Collateral'}\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {withdrawAmount ? (\n \n \n \n ) : null}\n \n \n \n {txnStatus === 'success' ? (\n setIsOpen(false)}\n >\n Done\n \n ) : null}\n \n \n {txnHash ? (\n <>\n View Transaction\n \n \n ) : (\n <>\n Signing Transaction\n \n )}\n \n \n \n \n \n );\n}\n","import { Alert, AlertIcon, Button, Collapse, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { useAccountCollateralUnlockDate } from '@snx-v3/useAccountCollateralUnlockDate';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { useSystemToken } from '@snx-v3/useSystemToken';\nimport { useWithdraw } from '@snx-v3/useWithdraw';\nimport { useWithdrawTimer } from '@snx-v3/useWithdrawTimer';\nimport React from 'react';\nimport { WithdrawModal } from './WithdrawModal';\n\nexport function Withdraw({ isDebtWithdrawal = false }: { isDebtWithdrawal?: boolean }) {\n const [params] = useParams();\n const { setWithdrawAmount, withdrawAmount } = React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: systemToken } = useSystemToken();\n\n const { data: accountCollateralUnlockDate, isLoading: isLoadingDate } =\n useAccountCollateralUnlockDate({ accountId: params.accountId });\n\n const symbol = isDebtWithdrawal ? systemToken?.symbol : collateralType?.symbol;\n const displaySymbol = isDebtWithdrawal\n ? systemToken?.displaySymbol\n : collateralType?.displaySymbol;\n const { minutes, hours, isRunning } = useWithdrawTimer(params.accountId);\n const unlockDate = !isLoadingDate ? accountCollateralUnlockDate : null;\n\n const maxWithdrawable = React.useMemo(() => {\n if (isDebtWithdrawal && liquidityPosition) {\n return liquidityPosition.availableSystemToken;\n }\n if (!isDebtWithdrawal && liquidityPosition) {\n return liquidityPosition.availableCollateral;\n }\n }, [isDebtWithdrawal, liquidityPosition]);\n\n const {\n mutation: withdraw,\n isReady: isWithdrawReady,\n txnState,\n } = useWithdraw({\n amount: withdrawAmount,\n accountId: params.accountId,\n token: isDebtWithdrawal ? systemToken : collateralType,\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n const onSubmit = React.useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n\n try {\n toast.closeAll();\n toast({ title: 'Withdrawing...', variant: 'left-accent' });\n\n await withdraw.mutateAsync();\n setWithdrawAmount(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Withdrawal was successful',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Could not complete withdrawing',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n }\n },\n [errorParser, setWithdrawAmount, toast, withdraw]\n );\n\n return (\n \n \n \n {isDebtWithdrawal ? 'Withdraw' : 'Withdraw Collateral'}\n \n \n \n \n \n \n {isDebtWithdrawal ? systemToken?.displaySymbol : collateralType?.displaySymbol}\n \n \n \n {isDebtWithdrawal && isPendingLiquidityPosition ? 'Available: ~' : null}\n {!isDebtWithdrawal && isPendingLiquidityPosition ? 'Unlocked: ~' : null}\n {maxWithdrawable ? (\n <>\n \n  \n setWithdrawAmount(maxWithdrawable)}\n color=\"cyan.500\"\n fontWeight={700}\n >\n Max\n \n \n ) : null}\n \n \n \n setWithdrawAmount(val)}\n max={maxWithdrawable}\n min={ZEROWEI}\n />\n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition &&\n liquidityPosition &&\n liquidityPosition.collateralPrice.gt(0) ? (\n \n ) : null}\n \n \n \n\n \n \n \n \n You will be able to withdraw assets in {hours}H{minutes}M. Any account activity will\n reset this timer to 24H.\n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n You cannot Withdraw more {!isDebtWithdrawal ? 'Collateral' : ''} than your Unlocked\n Balance\n \n \n \n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_withdraw_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n {withdrawAmount.gt(0) ? 'Withdraw' : 'Enter Amount'}\n \n \n );\n}\n","import { ArrowUpIcon, CheckIcon } from '@chakra-ui/icons';\nimport {\n Button,\n CircularProgress,\n Divider,\n Flex,\n Link,\n Modal,\n ModalBody,\n ModalContent,\n ModalOverlay,\n Text,\n} from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { transactionLink } from '@snx-v3/etherscanLink';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { WithdrawIncrease } from '@snx-v3/WithdrawIncrease';\nimport { Wei, wei } from '@synthetixio/wei';\nimport React from 'react';\n\nexport function WithdrawModalAndromeda({\n txnStatus,\n txnHash,\n}: {\n txnStatus: string;\n txnHash: string | null;\n}) {\n const { withdrawAmount, setWithdrawAmount } = React.useContext(ManagePositionContext);\n const [isOpen, setIsOpen] = React.useState(false);\n const { network } = useNetwork();\n\n React.useEffect(() => {\n if (txnStatus === 'prompting') {\n setIsOpen(true);\n }\n if (txnStatus === 'error') {\n setIsOpen(false);\n }\n }, [txnStatus]);\n\n // This caching is necessary to keep initial values after success and not reset them to zeroes\n const [cachedWithdrawAmount, setCachedWithdrawAmount] = React.useState();\n React.useEffect(() => {\n if (withdrawAmount && withdrawAmount.gt(0)) {\n setCachedWithdrawAmount(withdrawAmount.abs());\n }\n }, [withdrawAmount]);\n\n return (\n {\n setWithdrawAmount(wei(0));\n setIsOpen(false);\n }}\n >\n \n \n \n \n Withdrawing USDC\n \n\n \n\n \n \n {txnStatus === 'success' ? (\n \n ) : (\n \n )}\n \n \n {withdrawAmount ? (\n \n \n \n ) : null}\n \n \n \n {txnStatus === 'success' ? (\n setIsOpen(false)}\n >\n Done\n \n ) : null}\n \n \n {txnHash ? (\n <>\n View Transaction\n \n \n ) : (\n <>\n Signing Transaction\n \n )}\n \n \n \n \n \n );\n}\n","import { Alert, AlertIcon, Button, Collapse, Flex, Text, useToast } from '@chakra-ui/react';\nimport { Amount } from '@snx-v3/Amount';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ZEROWEI } from '@snx-v3/constants';\nimport { ContractError } from '@snx-v3/ContractError';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { NumberInput } from '@snx-v3/NumberInput';\nimport { TokenIcon } from '@snx-v3/TokenIcon';\nimport { initialState, reducer } from '@snx-v3/txnReducer';\nimport { useAccountCollateralUnlockDate } from '@snx-v3/useAccountCollateralUnlockDate';\nimport { useAccountProxy } from '@snx-v3/useAccountProxy';\nimport { useNetwork, useProvider, useSigner } from '@snx-v3/useBlockchain';\nimport { useCollateralPriceUpdates } from '@snx-v3/useCollateralPriceUpdates';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useContractErrorParser } from '@snx-v3/useContractErrorParser';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport { usePositionManagerForCollateral } from '@snx-v3/usePositionManagerForCollateral';\nimport { useWithdrawTimer } from '@snx-v3/useWithdrawTimer';\nimport { withERC7412 } from '@snx-v3/withERC7412';\nimport { wei } from '@synthetixio/wei';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport debug from 'debug';\nimport { ethers } from 'ethers';\nimport React, { useReducer } from 'react';\nimport { WithdrawModalAndromeda } from './WithdrawModalAndromeda';\n\nconst log = debug('snx:WithdrawAndromeda');\n\nexport function WithdrawAndromeda() {\n const [params] = useParams();\n const { setWithdrawAmount } = React.useContext(ManagePositionContext);\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n\n const { data: liquidityPosition, isPending: isPendingLiquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: accountCollateralUnlockDate, isLoading: isLoadingDate } =\n useAccountCollateralUnlockDate({ accountId: params.accountId });\n\n const symbol = 'USDC';\n const { minutes, hours, isRunning } = useWithdrawTimer(params.accountId);\n const unlockDate = !isLoadingDate ? accountCollateralUnlockDate : null;\n\n const maxWithdrawable = React.useMemo(() => {\n if (liquidityPosition) {\n return liquidityPosition.availableCollateral\n .mul(liquidityPosition.collateralPrice)\n .add(liquidityPosition.availableSystemToken);\n }\n }, [liquidityPosition]);\n\n React.useEffect(() => {\n if (maxWithdrawable && maxWithdrawable.gt(0)) {\n setWithdrawAmount(maxWithdrawable.abs());\n }\n }, [maxWithdrawable, setWithdrawAmount]);\n\n const [txnState, dispatch] = useReducer(reducer, initialState);\n const { data: priceUpdateTx } = useCollateralPriceUpdates();\n const { network } = useNetwork();\n const signer = useSigner();\n const provider = useProvider();\n\n const { data: AccountProxy } = useAccountProxy();\n const { data: PositionManager } = usePositionManagerForCollateral({ collateralType });\n\n const isReady =\n signer &&\n network &&\n provider &&\n AccountProxy &&\n PositionManager &&\n // Make it Boolean\n true;\n\n const queryClient = useQueryClient();\n const withdraw = useMutation({\n mutationFn: async function () {\n log('params', params);\n log('collateralType', collateralType);\n\n if (!isReady) {\n throw new Error('Not ready');\n }\n\n dispatch({ type: 'prompting' });\n\n const walletAddress = await signer.getAddress();\n\n const callsPromises = [];\n\n if (params.accountId) {\n const AccountProxyContract = new ethers.Contract(\n AccountProxy.address,\n AccountProxy.abi,\n signer\n );\n const approveAccountTx = AccountProxyContract.populateTransaction.approve(\n PositionManager.address,\n params.accountId\n );\n callsPromises.push(approveAccountTx);\n }\n\n const PositionManagerContract = new ethers.Contract(\n PositionManager.address,\n PositionManager.abi,\n signer\n );\n\n const withdrawTx = PositionManagerContract.populateTransaction.withdraw(params.accountId);\n callsPromises.push(withdrawTx);\n\n const calls = await Promise.all(callsPromises);\n if (priceUpdateTx) {\n calls.unshift(priceUpdateTx as any);\n }\n\n const { multicallTxn: erc7412Tx, gasLimit } = await withERC7412(\n provider,\n network,\n calls,\n 'useDepositAndromeda',\n walletAddress\n );\n\n const txn = await signer.sendTransaction({\n ...erc7412Tx,\n gasLimit: gasLimit.mul(15).div(10),\n });\n log('txn', txn);\n dispatch({ type: 'pending', payload: { txnHash: txn.hash } });\n\n const receipt = await provider.waitForTransaction(txn.hash);\n log('receipt', receipt);\n return receipt;\n },\n\n onSuccess: async () => {\n const deployment = `${network?.id}-${network?.preset}`;\n await Promise.all(\n [\n //\n 'Accounts',\n 'PriceUpdates',\n 'LiquidityPosition',\n 'LiquidityPositions',\n 'TokenBalance',\n 'SynthBalances',\n 'EthBalance',\n 'Allowance',\n ].map((key) => queryClient.invalidateQueries({ queryKey: [deployment, key] }))\n );\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Your locked collateral amount has been updated.',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n\n dispatch({ type: 'success' });\n },\n\n onError: (error) => {\n dispatch({ type: 'error', payload: { error } });\n\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Transaction failed',\n variant: 'left-accent',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n duration: 3_600_000,\n });\n throw Error('Transaction failed', { cause: error });\n },\n });\n\n const toast = useToast({ isClosable: true, duration: 9000 });\n const errorParser = useContractErrorParser();\n const onSubmit = React.useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n\n try {\n toast.closeAll();\n toast({ title: 'Withdrawing...', variant: 'left-accent' });\n\n await withdraw.mutateAsync();\n setWithdrawAmount(ZEROWEI);\n\n toast.closeAll();\n toast({\n title: 'Success',\n description: 'Withdrawal was successful',\n status: 'success',\n duration: 5000,\n variant: 'left-accent',\n });\n } catch (error: any) {\n const contractError = errorParser(error);\n if (contractError) {\n console.error(new Error(contractError.name), contractError);\n }\n toast.closeAll();\n toast({\n title: 'Could not complete withdrawing',\n description: contractError ? (\n \n ) : (\n 'Please try again.'\n ),\n status: 'error',\n variant: 'left-accent',\n duration: 3_600_000,\n });\n }\n },\n [errorParser, setWithdrawAmount, toast, withdraw]\n );\n\n return (\n \n \n \n Withdraw Collateral\n \n \n \n \n \n \n {symbol}\n \n \n \n {isPendingLiquidityPosition ? 'Unlocked: ~' : null}\n {maxWithdrawable ? (\n \n ) : null}\n \n \n \n \n \n {isPendingLiquidityPosition ? '~' : null}\n {!isPendingLiquidityPosition && maxWithdrawable ? (\n \n ) : null}\n \n \n \n\n \n \n \n \n You will be able to withdraw assets in {hours}H{minutes}M. Any account activity will\n reset this timer to 24H.\n \n \n \n\n \n \n \n \n \n \n\n {\n window?._paq?.push([\n 'trackEvent',\n 'liquidity',\n 'v3_staking',\n `submit_withdraw_${collateralType?.symbol?.toLowerCase()}_v3`,\n ]);\n }}\n >\n Withdraw\n \n \n );\n}\n","import { Box, Flex, Link, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@chakra-ui/react';\nimport { Borrow } from '@snx-v3/Borrow';\nimport { Claim } from '@snx-v3/Claim';\nimport { ClaimModal } from '@snx-v3/ClaimModal';\nimport { Deposit } from '@snx-v3/Deposit';\nimport { DepositModal } from '@snx-v3/DepositModal';\nimport { DepositModalAndromeda } from '@snx-v3/DepositModalAndromeda';\nimport { ManagePositionContext } from '@snx-v3/ManagePositionContext';\nimport { Repay, RepayAndromedaDebt } from '@snx-v3/Repay';\nimport { RepayModal } from '@snx-v3/RepayModal';\nimport { Undelegate } from '@snx-v3/Undelegate';\nimport { UndelegateModal } from '@snx-v3/UndelegateModal';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport {\n makeSearch,\n ManageActionSchema,\n ManageActionType,\n type PositionPageSchemaType,\n useParams,\n} from '@snx-v3/useParams';\nimport { validatePosition } from '@snx-v3/validatePosition';\nimport { Withdraw, WithdrawAndromeda } from '@snx-v3/Withdraw';\nimport { wei } from '@synthetixio/wei';\nimport React, { FormEvent, useCallback } from 'react';\nimport { COLLATERALACTIONS, DEBTACTIONS } from './actions';\n\nexport const ManageAction = ({\n setTxnModalOpen,\n txnModalOpen,\n}: {\n setTxnModalOpen: (action?: ManageActionType) => void;\n txnModalOpen?: ManageActionType;\n}) => {\n const [params, setParams] = useParams();\n const { network } = useNetwork();\n\n const { debtChange, collateralChange, setCollateralChange, setDebtChange } =\n React.useContext(ManagePositionContext);\n\n const { data: collateralType } = useCollateralType(params.collateralSymbol);\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { isValid } = validatePosition({\n issuanceRatioD18: collateralType?.issuanceRatioD18,\n collateralAmount: liquidityPosition?.collateralAmount,\n collateralPrice: liquidityPosition?.collateralPrice,\n debt: liquidityPosition?.debt,\n collateralChange,\n debtChange,\n });\n\n const manageActionParam = ManageActionSchema.safeParse(params.manageAction);\n const manageAction = manageActionParam.success ? manageActionParam.data : undefined;\n const debtActions = DEBTACTIONS(network?.preset === 'andromeda');\n const tab = debtActions.some((action) => action.link === manageAction) ? 'debt' : 'collateral';\n\n const onSubmit = useCallback(\n (e: FormEvent) => {\n e.preventDefault();\n const form = e.target as HTMLFormElement;\n if ((network?.preset === 'andromeda' || isValid) && form.reportValidity()) {\n setTxnModalOpen(manageAction);\n }\n },\n [isValid, manageAction, network?.preset, setTxnModalOpen]\n );\n\n return (\n <>\n {!txnModalOpen ? (\n \n \n \n {\n e.preventDefault();\n if (tab !== 'collateral') {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n }\n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: COLLATERALACTIONS[0].link,\n accountId: params.accountId,\n });\n }}\n color={tab === 'collateral' ? 'white' : 'gray.500'}\n fontWeight={700}\n fontSize={['12px', '16px']}\n whiteSpace=\"nowrap\"\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n Manage Collateral\n \n {\n e.preventDefault();\n if (tab !== 'debt') {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n }\n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: debtActions[0].link,\n accountId: params.accountId,\n });\n }}\n color={tab === 'debt' ? 'white' : 'gray.500'}\n fontWeight={700}\n fontSize={['12px', '16px']}\n whiteSpace=\"nowrap\"\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n {network?.preset === 'andromeda' ? 'Manage PnL' : 'Manage Debt'}\n \n \n\n \n \n \n {COLLATERALACTIONS.map((action) => (\n {\n e.preventDefault();\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: action.link,\n accountId: params.accountId,\n });\n }}\n h=\"84px\"\n minH={['90px', '84px']}\n justifyContent=\"center\"\n key={action.title.concat('-tab-actions')}\n border=\"1px solid\"\n flexDir=\"column\"\n alignItems=\"center\"\n borderColor={manageAction === action.link ? 'cyan.500' : 'gray.900'}\n rounded=\"base\"\n flex=\"1\"\n minWidth={['100%', 'auto']}\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n {action.icon(manageAction === action.link ? 'cyan' : 'white')}\n \n {action.title}\n \n \n ))}\n \n \n \n \n {debtActions.map((action) => (\n {\n e.preventDefault();\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: action.link,\n accountId: params.accountId,\n });\n }}\n flex=\"1\"\n h=\"84px\"\n minH={['90px', '84px']}\n justifyContent=\"center\"\n key={action.title.concat('-tab-actions')}\n border=\"1px solid\"\n flexDir=\"column\"\n alignItems=\"center\"\n borderColor={manageAction === action.link ? 'cyan.500' : 'gray.900'}\n rounded=\"base\"\n cursor=\"pointer\"\n minWidth={['100%', 'auto']}\n textDecoration=\"none\"\n _hover={{ textDecoration: 'none' }}\n >\n {action.icon(manageAction === action.link ? 'cyan' : 'white')}\n \n {action.title}\n \n \n ))}\n \n \n \n \n\n {manageAction === 'repay' && network?.preset !== 'andromeda' ? (\n // These components do not set txnModalOpen\n \n \n \n ) : manageAction === 'claim' && network?.preset !== 'andromeda' ? (\n \n \n \n ) : manageAction === 'withdraw' && network?.preset === 'andromeda' ? (\n \n \n \n ) : manageAction === 'withdraw' && network?.preset !== 'andromeda' ? (\n \n \n \n ) : manageAction === 'withdraw-debt' && network?.preset !== 'andromeda' ? (\n \n \n \n ) : (\n \n {manageAction === 'claim' ? : null}\n {manageAction === 'deposit' ? : null}\n {manageAction === 'repay' && network?.preset === 'andromeda' ? (\n \n ) : null}\n {manageAction === 'repay' && network?.preset !== 'andromeda' ? : null}\n {manageAction === 'undelegate' ? : null}\n \n )}\n \n ) : null}\n\n {txnModalOpen === 'repay' && network?.preset === 'andromeda' ? (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setTxnModalOpen(undefined);\n }}\n />\n ) : null}\n {txnModalOpen === 'claim' ? (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setTxnModalOpen(undefined);\n }}\n />\n ) : null}\n {txnModalOpen === 'deposit' && network?.preset !== 'andromeda' ? (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setTxnModalOpen(undefined);\n }}\n />\n ) : null}\n {txnModalOpen === 'deposit' && network?.preset === 'andromeda' ? (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setTxnModalOpen(undefined);\n }}\n />\n ) : null}\n {txnModalOpen === 'undelegate' ? (\n {\n setCollateralChange(wei(0));\n setDebtChange(wei(0));\n setTxnModalOpen(undefined);\n }}\n />\n ) : null}\n \n );\n};\n","import { InfoIcon } from '@chakra-ui/icons';\nimport { Box, Flex, Text } from '@chakra-ui/react';\nimport { BorderBox } from '@snx-v3/BorderBox';\nimport { ClosePosition } from '@snx-v3/ClosePosition';\nimport { UnsupportedCollateralAlert } from '@snx-v3/CollateralAlert';\nimport { ManageStats, PositionTitle, StataDepositBanner } from '@snx-v3/Manage';\nimport { ManageAction } from '@snx-v3/ManageAction';\nimport { ManagePositionProvider } from '@snx-v3/ManagePositionContext';\nimport { LockedCollateral } from '@snx-v3/Positions';\nimport { Tooltip } from '@snx-v3/Tooltip';\nimport { useApr } from '@snx-v3/useApr';\nimport { useStataUSDCApr } from '@snx-v3/useApr/useStataUSDCApr';\nimport { useNetwork } from '@snx-v3/useBlockchain';\nimport { useCollateralType } from '@snx-v3/useCollateralTypes';\nimport { useIsAndromedaStataUSDC } from '@snx-v3/useIsAndromedaStataUSDC';\nimport { useLiquidityPosition } from '@snx-v3/useLiquidityPosition';\nimport { type ManageActionType, type PositionPageSchemaType, useParams } from '@snx-v3/useParams';\nimport React from 'react';\nimport { Helmet } from 'react-helmet';\n\nexport const ManagePage = () => {\n const [params, setParams] = useParams();\n const { network } = useNetwork();\n\n const { data: collateralType, isPending: isPendingCollateralType } = useCollateralType(\n params.collateralSymbol\n );\n const { data: liquidityPosition } = useLiquidityPosition({\n accountId: params.accountId,\n collateralType,\n });\n\n const { data: stataUSDCApr } = useStataUSDCApr(network?.id, network?.preset);\n\n const isAndromedaStataUSDC = useIsAndromedaStataUSDC({\n tokenAddress: collateralType?.tokenAddress,\n customNetwork: network,\n });\n\n const [txnModalOpen, setTxnModalOpen] = React.useState(undefined);\n\n const { data: apr, isPending: isPendingApr } = useApr(network);\n const positionApr = React.useMemo(\n () =>\n apr?.find(\n (item) => item.collateralType.toLowerCase() === collateralType?.tokenAddress.toLowerCase()\n ),\n [apr, collateralType?.tokenAddress]\n );\n\n return (\n \n \n \n {`Synthetix ${collateralType?.displaySymbol ?? params.collateralSymbol} Position`}\n \n \n \n \n \n \n \n \n \n Performance APR is calculated based on the last 28 days rolling average.
\n Rewards APR is calculated based on the last 1 hour of any active incentive\n program.\n {isAndromedaStataUSDC && (\n <>\n
\n Aave APR is the latest Aave lending rate.\n \n )}\n \n }\n >\n \n Estimated APR\n \n \n \n \n {isPendingApr\n ? '~'\n : positionApr\n ? (\n positionApr.apr28dPerformance * 100 +\n (isAndromedaStataUSDC && stataUSDCApr ? stataUSDCApr : 0) +\n positionApr.apr24hIncentiveRewards * 100\n )\n .toFixed(2)\n .concat('%')\n : '-'}\n \n
\n \n \n \n \n \n \n {isAndromedaStataUSDC &&\n liquidityPosition &&\n liquidityPosition.collateralAmount.eq(0) && }\n \n \n {params.manageAction === 'close' ? (\n \n \n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: 'deposit',\n accountId: params.accountId,\n })\n }\n />\n \n ) : null}\n\n {params.manageAction === 'locked' ? (\n \n \n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: 'deposit',\n accountId: params.accountId,\n })\n }\n />\n \n ) : null}\n\n {!['close', 'locked'].includes(params.manageAction) ? (\n <>\n \n \n \n\n {!txnModalOpen && liquidityPosition?.collateralAmount.gt(0) ? (\n \n setParams({\n page: 'position',\n collateralSymbol: params.collateralSymbol,\n manageAction: 'close',\n accountId: params.accountId,\n })\n }\n color=\"cyan.500\"\n fontWeight={700}\n mt=\"5\"\n data-cy=\"close position\"\n >\n Close Position\n \n ) : null}\n \n ) : null}\n \n \n
\n
\n );\n};\n","import { Box, Container, Flex, Spinner } from '@chakra-ui/react';\nimport { useParams } from '@snx-v3/useParams';\nimport { Suspense } from 'react';\nimport { AccountSettingsPage } from './AccountSettingsPage';\nimport { DashboardPage } from './DashboardPage';\nimport { Footer } from './Footer';\nimport Header from './Header';\nimport { ManagePage } from './ManagePage';\n\nfunction Content() {\n const [params] = useParams();\n if (params.page === 'settings') {\n return ;\n }\n if (params.page === 'position') {\n return ;\n }\n return ;\n}\n\nexport function Router() {\n return (\n }>\n \n \n
\n \n \n \n