{"version":3,"sources":["contexts/ExternalMetadataContext.tsx","chain-interaction/tokens.ts","contexts/UserAddressContext.tsx","contexts/WalletBalancesContext.tsx","utils/index.ts","chain-interaction/contracts.ts","assets/logo/logo.png","components/account/AccountModal.tsx","assets/img/color_dot.svg","components/account/UserAddressComponent.tsx","assets/img/horizontal-dots.svg","components/navigation/MenuOptions.tsx","components/navigation/NavigationBar.tsx","components/notifications/GlobalDebtCeilingMessage.tsx","components/notifications/NetworkNotSupported.tsx","components/notifications/PhishingAlertComponent.tsx","components/notifications/TransactionToasts.tsx","contexts/LiquidationFeesContext.tsx","contexts/StrategyMetadataContext.tsx","theme.ts","App.tsx","contexts/LiquidatablePositionsContext.tsx","pages/Admin/components/CopyClipboard/CopyClipboard.tsx","pages/Admin/components/AllAddresses.tsx","constants/deprecated-token-list.ts","components/tokens/TokenDescription.tsx","chain-interaction/transactions.ts","components/notifications/TransactionErrorDialog.tsx","pages/Admin/components/AllContracts/components/UpdatePriceOracle.tsx","pages/Admin/components/AllContracts/components/WithdrawFees.tsx","pages/Admin/components/AllContracts/AllContracts.tsx","pages/Admin/components/AllOpenPositions/components/PositionsRow.tsx","pages/Admin/components/AllOpenPositions/components/PositionsTable.tsx","pages/Admin/components/AllOpenPositions/AllOpenPositions.tsx","pages/Admin/index.tsx","pages/Analytics/AnalyticsBox.tsx","pages/Analytics/index.tsx","constants/hidden-strategies.ts","pages/Dashboard/components/TableSearch.tsx","pages/Dashboard/components/TableTabs.tsx","pages/Dashboard/components/AllSupportedCollateral.tsx","pages/Dashboard/index.tsx","pages/ErrorBoundary/ErrorBoundary.js","pages/Farm/components/ClaimReward.tsx","components/account/EnsureWalletConnected.tsx","components/tokens/TokenAmountInputField.tsx","constants/addresses.ts","pages/Farm/components/DepositForm.tsx","pages/Farm/components/WithdrawForm.tsx","pages/Farm/index.tsx","pages/LiquidatablePositions/LiquidatableRow.tsx","pages/LiquidatablePositions/LiquidatablePositionsTable.tsx","pages/LiquidatablePositions/index.tsx","pages/Loans/index.tsx","pages/Positions/TrancheCard.tsx","pages/Positions/TrancheRow.tsx","pages/Positions/TrancheTable.tsx","pages/Positions/CurrentlyOpenPositions.tsx","pages/Positions/index.tsx","components/navigation/BackButton.tsx","components/notifications/DeprecatedTokenMessage.tsx","pages/TokenPage/components/change-strategy/ChangeStrategyButton.tsx","pages/TokenPage/components/change-strategy/ChangeStrategyTable.tsx","pages/TokenPage/components/change-strategy/ChangeStrategyModal.tsx","pages/TokenPage/components/change-strategy/StrategyNameAndSwitch.tsx","components/notifications/WarningMessage.tsx","pages/TokenPage/components/edit/ConfirmPositionModal.tsx","pages/TokenPage/components/edit/DepositBorrow.tsx","pages/TokenPage/components/edit/RepayWithdraw.tsx","pages/TokenPage/components/edit/EditPosition.tsx","pages/TokenPage/components/metadata/CollateralAPY.tsx","components/data-display/TitleValue.tsx","pages/TokenPage/components/PositionData.tsx","assets/img/lines.svg","pages/TokenPage/components/StrategyTokenInformation.tsx","pages/TokenPage/components/PositionBody.tsx","pages/TokenPage/components/TokenPageBody.tsx","pages/TokenPage/index.tsx","pages/XMore/edit/StakeMore.tsx","pages/XMore/edit/UnstakeMore.tsx","pages/XMore/edit/EditMore.tsx","pages/XMore/metadata/MoreBalance.tsx","pages/XMore/metadata/StakingAPR.tsx","pages/XMore/index.tsx","reportWebVitals.ts","serviceWorker.ts","index.tsx"],"names":["ExternalMetadataContext","React","createContext","yieldFarmingData","yyMetadata","yieldMonitor","xMoreData","additionalYieldData","strategyMetadataCached","ExternalMetadataCtxProvider","children","useState","setXMoreData","setStrategyMetadataCached","setYieldFarmingData","setYYMeta","setYieldMonitor","setAdditionalYieldData","useEffect","fetch","then","response","json","catch","err","console","error","ymData","r","a","getAddress","lpAddress","totalApy","Provider","value","addressToken","Object","fromEntries","values","ChainId","map","key","Map","addressIcons","addressAuxIcon","getTokenFromAddress","chainId","address","Avalanche","get","getIconsFromTokenAddress","tokenAmount","tokenAddress","amount","token","CurrencyValue","getTokensInQuestion","_chainId","undefined","Array","from","entries","filter","aT","LiquidationType","tokenlist","tokens","decimals","name","symbol","logoURI","set","Token","liquidationParams","chainIds","Hardhat","exchangeIcons","JPL","PGL","exchangeRouters","router","liqType","Direct","lptokens","lpTokensPerChain","exchange","records","longTicker","record","pairAddress","ticker","split","slice","join","icons","push","addresses","LPT","deployAddresses","Stablecoin","CurvePool","nativeCurrency","NativeCurrency","wrappedNativeCurrency","UserAddressContext","UserAddressCtxProvider","account","useEthers","search","useLocation","userAddress","URLSearchParams","WalletBalancesContext","WalletBalancesCtxProvider","useContext","tokenBalances","tokensInQuestion","calls","abi","ERC20Interface","method","args","results","useContractCalls","forEach","result","index","useWalletBalance","ctxAccount","balancesCtx","parseFloatNoNaN","input","parsed","parseFloat","isNaN","parseFloatCurrencyValue","format","significantDigits","Infinity","suffix","thousandSeparator","decimalSeparator","formatNumber","toLocaleString","TxStatus","YieldType","require","useAddresses","chainIdStr","toString","useStable","useIsolatedStrategyMetadata","stable","reduceFn","row","parsedRow","globalMoneyAvailable","additionalYield","tvlInToken","tvl","balance","BigNumber","strategyAddress","strategy","underlyingAddress","underlyingStrategy","APY","LiquidYieldStrategy","apy","syntheticDebtCeil","add","totalDebt","trueOne","parseUnits","valPerOne","mul","valuePer1e18","div","parseEther","debtCeiling","gt","stabilityFeePercent","stabilityFee","toNumber","mintingFeePercent","mintingFee","totalCollateral","borrowablePercent","borrowablePer10k","usdPrice","formatEther","strategyName","parseBytes32String","tvlInPeg","harvestBalance2Tally","yieldType","REPAYING","COMPOUNDING","NOYIELD","parseStratMeta","stratMeta","setStratMeta","globalDebtCeiling","useGlobalDebtCeiling","totalSupply","useTotalSupply","token2Strat","YieldYakAVAXStrategy","YieldYakStrategy","TraderJoeMasterChefStrategy","SimpleHoldingStrategy","MultiTraderJoeMasterChef3Strategy","masterChef2Tokens","keys","strats","sub","sJoeStrategy","provider","ethers","providers","JsonRpcProvider","stratViewer","Contract","StrategyViewer","Interface","viewMetadata","StableLending","normalResults","viewMetadataNoHarvestBalance","OracleRegistry","length","fill","TraderJoeMasterChef2Strategy","noHarvestBalanceResults","log","window","alert","reduce","parsedCached","APF","getData","calcLiquidationPrice","debt","collateral","calcLiqPriceFromNum","debtNum","colNum","parsePositionMeta","trancheContract","posYield","yield","trancheId","collateralValue","owner","liquidationPrice","useIsolatedPositionMetadata","defaultResult","IsolatedLending","legacy","useContractCall","current","useIsolatedLendingView","list","legacyResults","ERC20","ONE_WEEK_SECONDS","useUpdatedPositions","timeStart","endPeriod","Math","round","Date","now","startPeriod","floor","x","i","legacyRows","currentRows","parseRows","rows","flatMap","useParsedStakingMetadata","stakingContracts","VestingStakingRewards","userAccount","constants","AddressZero","contractCalls2","useStakingMetadata","stakingMeta","stakingToken","rewardsToken","earned","rewards","totalRewards","aprPercent","aprPer10k","vestingCliff","timestamp2Date","periodFinish","stakedBalance","vestingStart","vested","tstamp","AccountModal","isOpen","onClose","deactivate","balanceCtx","moreToken","MoreToken","walletBalance","moreBalance","explorerLink","getExplorerAddressLink","isCentered","size","background","color","px","fontSize","fontWeight","_hover","pt","borderRadius","border","borderColor","pb","mb","justifyContent","alignItems","variant","height","textDecoration","onClick","mt","lineHeight","ml","shortenAddress","alignContent","m","navigator","clipboard","writeText","mr","display","href","isExternal","p","textAlign","UserAddressComponent","handleOpenModal","useMediaQuery","isLargerThan1280","activateBrowserWallet","spacing","bg","padding","isZero","src","colorDot","h","Links","title","link","MenuOptions","as","IconButton","icon","dots","alt","zIndex","target","rel","NavigationBar","useDisclosure","onOpen","isOpenAccount","onOpenAccount","onCloseAccount","location","position","md","to","logo","width","base","pathname","flexDirection","GlobalDebtCeilingMessage","hasMaxedOut","status","NetworkNotSupported","motionPreset","leastDestructiveRef","colorScheme","PhishingAlertComponent","w","TransactionToasts","notifications","useNotifications","toast","useToast","showToast","notification","hash","transaction","getExplorerTransactionLink","id","description","style","duration","isClosable","type","LiquidationFeesContext","LiquidationFeesCtxProvider","StableLendingLiquidation","tokenFees","IsolatedLendingLiquidation","StrategyMetadataContext","StrategyMetadataCtxProvider","theme","extendTheme","config","initialColorMode","fonts","heading","body","colors","white","black","brand","bgOpacity","active","accent","gradientBg","accent_color","whiteAlpha","gray","blue","zIndices","header","styles","global","components","Button","baseStyle","_active","backgroundColor","variants","action","primary","_disabled","secondary","submit","Text","gradient","WebkitBackgroundClip","WebkitTextFillColor","h200","fontFamily","h300","h400","bodyExtraSmall","bodySmall","bodyMedium","bodyLarge","bodyHuge","bodyExtraLarge","Tabs","tablist","borderBottom","tabpanel","tab","_selected","_after","content","bottom","Input","rounded","percentage","field","percentage_inactive","Table","dashboard","table","borderCollapse","borderSpacing","thead","tr","td","textTransform","paddingTop","paddingBottom","borderTop","_first","transform","tbody","boxSizing","backgroundClip","backgroundOrigin","backgroundImage","top","left","right","borderLeftRadius","_last","borderRightRadius","Link","footer","headerActive","Container","maxWidth","_before","App","params","useConfig","requestedSwitch","setRequestedSwitch","wallet","Web3Provider","ethereum","getNetwork","walletChainId","listAccounts","accounts","supportedChains","includes","request","chainName","rpcUrls","blockExplorerUrls","scrollTo","margin","minHeight","opacity","pointerEvents","bgGradient","LiquidatablePositionsContext","LiquidatablePositionsCtxProvider","tokenPrices","positions","cachedPositions","setCachedPosition","parsedCachePositions","pos","updatedPositions","jointUpdatedPositions","updatedMetadata","positionCalls","useUpdatedMetadataLiquidatablePositions","updatedPositionMetadata","updatedDataMap","acc","parsedPositions","posUpdatedData","dollar","stableTickers","liquidatablePositions","posMeta","collateralVal","totalPercentage","liquidatableZone","criticalZone","riskyZone","healthyZone","positionHealthColor","lt","positionHealth","green","orange","red","liquidateButton","parsedPositionHealth","toFixed","positionHealthOrder","sort","b","isIndeterminate","CopyClipboard","label","useClipboard","hasCopied","onCopy","AllAddresses","props","allowMultiple","flex","deprecatedTokenList","TokenDescription","iconSize","textSize","targetSize","auxIcon","isDeprecated","max","iconUrl","showBorder","isTruncated","useApproveTrans","tokenContract","IERC20","useContractFunction","send","sendApprove","spender","MaxUint256","approveState","state","PNG","JOE","USDCe","USDTe","path","useLiquidationTrans","contractAddress","liquidationContract","DirectFlashLiquidation","sendLiquidation","liquidationState","TransactionErrorDialog","errorMessage","UpdatePriceOracle","inAmount","sendUpdateOraclePrice","updateOraclePriceState","useUpdateOraclePrice","WithdrawFees","contractsABI","isYY","feesContract","sendWithdrawFees","withdrawState","useWithdrawFees","AllContracts","strat","PositionsRow","actionArgs","callback","PositionsTable","allStratMeta","data","AllOpenPositions","AdminPage","useParams","AnalyticsBox","subtitle","Analytics","stakeMeta","CurvePoolRewards","flat","feeContractNames","blacklist","contracts","tvlsFarm","tvlNoFarm","supply","colRatio","fees","contract","IFeeReporter","useAllFeesEver","totalFees","fee","total","circulatingBlacklist","VestingLaunchReward","balances","holder","agg","curr","circulatingSupply","useFixedPrecision","fixedPrecisionDigits","templateColumns","gap","hiddenStrategies","TableSearch","setSearchString","marginTop","placeholder","onChange","event","stripped","trim","toLowerCase","TableTabs","setTableTabFilter","lpTickers","meta","singleAssetTickers","deprecatedTickers","AllSupportedCollateral","hiddenTokens","Set","stratRows","has","options","optionsFiltered","y","aggStrat","nextStrat","tableTabFilter","searchString","asset","MONEYavailable","minColRatio","ltv","tvlPeg","totalBorrowed","liquidationFee","tooltip","colName","hasArrow","columns","Header","accessor","useTable","getTableProps","getTableBodyProps","headerGroups","prepareRow","wrap","headers","headerGroup","column","render","cells","cell","original","getHeaderGroupProps","getHeaderProps","getRowProps","getCellProps","obj","Dashboard","ErrorBoundary","hasError","errorMsg","errorInfo","this","setState","Component","ClaimReward","ilAddress","ilContract","sendClaim","claimState","useClaimReward","buttonDisabled","timeDelta","getTime","isDisabled","EnsureWalletConnected","TokenAmountInputField","registerForm","setValueForm","errorsForm","isInvalid","required","inputMode","step","autoComplete","autoCorrect","defaultValue","minLength","maxLength","spellCheck","pattern","prefix","shouldDirty","shouldTouch","message","WNATIVE_ADDRESS","Mainnet","Ropsten","Rinkeby","Goerli","Kovan","Fantom","xDai","BSC","Harmony","Palm","Moonriver","DepositForm","stakingAddress","isNativeToken","allowance","useTokenAllowance","etherBalance","useEtherBalance","nativeTokenBalance","cprAddress","cprContract","sendStake","stakeToken","sAmount","stakeState","useStake","useForm","handleSubmitDepForm","handleSubmit","registerDepForm","register","setValueDepForm","setValue","formState","errorsDepForm","errors","isSubmittingDepForm","isSubmitting","watch","confirmButtonEnabled","depositBorrowDisabled","onSubmit","justify","marginBottom","isLoading","SUCCESS","WithdrawForm","sendWithdraw","withdrawToken","wAmount","useWithdraw","FarmPage","avaxMorePayload","item","useSpecialRewardsData","sendSpecialWithdraw","useWithdrawLaunchVestingTrans","farmInfoIdx","getLPTokenLinks","farminfo","curvePoolIdx","accordionStyling","externalData","stake","reward","rewardsCoin","apr","getTokenURL","stakeTokenURL","verticalAlign","allowToggle","defaultIndex","colSpan","LiquidatableRow","LiquidatablePositionsTable","LiquidatablePositions","sendDirectLiquidationLegacy","DirectFlashStableLiquidation","sendDirectLiquidationCurrent","sendLPTLiquidationLegacy","LPTFlashLiquidation","LPTFlashStableLiquidation","sendLPTLiquidationCurrent","sendWsMaxiLiquidation","wsMAXIStableLiquidation","sendXJoeLiquidation","xJoeStableLiquidation","lending2Liquidation","token2Liquidation","getLiquidationParams","LiquidationProtectedLoans","TrancheCard","TrancheRow","stratLabel","TrancheTable","CurrentlyOpenPositions","allPositionMeta","PositionsPage","align","BackButton","navigate","useNavigate","cursor","DeprecatedTokenMessage","ChangeStrategyButton","chooseStrategy","ChangeStrategyTable","currentStrategy","ChangeStrategyModal","StrategyNameAndSwitch","chosenStrategy","multipleOptions","textVariant","rowSpan","mx","WarningMessage","autoFocus","returnFocusOnClose","placement","ConfirmPositionModal","confirm","dangerous","DepositBorrow","setData","allowResult","allowCV","lendingAddress","lendingContract","sendDepositBorrow","collateralToken","collateralAmount","borrowAmount","cAmount","bAmount","depositBorrowState","useDepositBorrowTrans","WrapNativeIsolatedLending","WrapNativeStableLending","useNativeDepositBorrowTrans","sendNativeDepositBorrow","nativeDepositBorrowState","collateralInput","borrowInput","customPercentageInput","extantCollateral","extantDebt","currentPercentage","percentageRange","percentageStep","percentageSteps","percentageLabel","percentages","showWarning","isJoeToken","depositBorrowButtonDisabledForJoe","depositBorrowButtonDisabled","inputStyle","dangerousPosition","marginRight","MINING","RepayWithdraw","handleSubmitRepayForm","registerRepayForm","setValueRepayForm","errorsRepayForm","isSubmittingRepayForm","sendRepayWithdraw","repayAmount","repayWithdrawState","useRepayWithdrawTrans","useNativeRepayWithdrawTrans","sendNativeRepayWithdraw","sendNativeWithdrawState","repayWithdrawDisabled","repayInput","curveLink","repayingMoreThanBalance","repayWithdrawButtonDisabled","warningMsgText","residualDebt","EditPosition","CollateralAPY","stratMetaData","TitleValue","PositionData","effectiveDebt","currency","StrategyTokenInformation","lines","PositionBody","inputPos","setChosenStrategy","lendingContractAddress","sendMigrateStrategy","targetStrategy","migrateStrategyState","useMigrateStrategy","templateRows","strategyToChoose","TokenPageBody","positionMeta","TokenPage","StakeMore","xMoreContract","xMore","stakeMoreToken","useStakeMore","moreStakeInput","stakeMoreDisabled","stakeMoreButtonDisabled","UnstakeMore","xMoreToken","sendUnstake","leaveMoreToken","unstakeState","useUnstakeMore","xmoreUnstakeInput","unstakeMoreButtonDisabled","EditMore","MoreBalance","xMoreBalance","direction","marginLeft","StakingAPR","cachedAPR","currentRatio","XMorePage","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","Boolean","hostname","match","ReactDOM","DAppProvider","readOnlyChainId","readOnlyUrls","multicallAddresses","element","document","getElementById","serviceWorker","ready","registration","unregister"],"mappings":"44+1BA6EaA,EACXC,IAAMC,cAAoC,CACxCC,iBAAkB,GAClBC,WAAY,GACZC,aAAc,GACdC,UAAW,GACXC,oBAAqB,GACrBC,uBAAwB,KAGrB,SAASC,EAAT,GAE2B,IADhCC,EAC+B,EAD/BA,SAEA,EAAkCC,mBAChC,IADF,mBAAOL,EAAP,KAAkBM,EAAlB,KAGA,EACED,qBADF,mBAAOH,EAAP,KAA+BK,EAA/B,KA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CAAOnY,KAAK,SAASoZ,QAAS,cAACtX,GAAD,MAC9B,cAAC,IAAD,CAAO9B,KAAK,oBAAoBoZ,QAAS,cAACtX,GAAD,kBAMnDuX,SAASC,eAAe,SDqEpB,kBAAmBtqB,WACrBA,UAAUuqB,cAAcC,MACrB1+B,MAAK,SAAC2+B,GACLA,EAAaC,gBAEdz+B,OAAM,SAACG,GACND,QAAQC,MAAMA,EAAM2uB,YChE5BqO,O","file":"static/js/main.ee58e848.chunk.js","sourcesContent":["import { Progress } from '@chakra-ui/react';\nimport { getAddress } from 'ethers/lib/utils';\nimport React, { useEffect, useState } from 'react';\n\nexport type YYMetadata = Record<\n string,\n { apr: number; apy: number; lastReinvest: { timestamp: number } }\n>;\n\nexport type xMoreMetadata = {\n timestamp: number;\n totalSupply: number;\n moreBalance: number;\n cachedAPR: number;\n currentRatio: number;\n};\n\nexport type CachedStrategyMetadata = {\n debtCeiling: string;\n totalDebt: string;\n stabilityFee: string;\n mintingFee: string;\n strategy: string;\n token: string;\n APF: string;\n totalCollateral: string;\n borrowablePer10k: string;\n valuePer1e18: string;\n strategyName: string;\n tvl: string;\n harvestBalance2Tally: string;\n yieldType: number;\n underlyingStrategy: string;\n};\n\nexport type YieldFarmingData = {\n asset: string;\n stake: string;\n tvl: number;\n reward: string;\n apr: number;\n getTokenURL: string;\n stakeTokenURL: string;\n};\n\nexport type YieldMonitorMetadata = {\n poolNumber: string;\n symbol0Name: string;\n symbol1Name: string;\n symbol0address: string;\n symbol0price: string;\n symbol1address: string;\n symbol1price: string;\n network: string;\n lpAddress: string;\n coinsASec: number;\n tvl: number;\n apy: number;\n apyDaily: number;\n apyMonthly: number;\n totalApy: number;\n totalApyDaily: number;\n totalApyMonthly: number;\n extraRewards: string;\n isActive: boolean;\n rewardsCoin: string;\n};\n\nexport type ExternalMetadataType = {\n yieldFarmingData: YieldFarmingData[];\n yyMetadata: YYMetadata;\n yieldMonitor: Record;\n xMoreData: xMoreMetadata;\n additionalYieldData: Record>;\n strategyMetadataCached: CachedStrategyMetadata[];\n};\n\nexport const ExternalMetadataContext =\n React.createContext({\n yieldFarmingData: [],\n yyMetadata: {},\n yieldMonitor: {},\n xMoreData: {} as xMoreMetadata,\n additionalYieldData: {},\n strategyMetadataCached: {} as CachedStrategyMetadata[],\n });\n\nexport function ExternalMetadataCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const [xMoreData, setXMoreData] = useState(\n {} as xMoreMetadata\n );\n const [strategyMetadataCached, setStrategyMetadataCached] =\n useState();\n const [yieldFarmingData, setYieldFarmingData] = useState();\n const [yyMetadata, setYYMeta] = useState({});\n const [yieldMonitor, setYieldMonitor] = useState<\n Record\n >({});\n\n const [additionalYieldData, setAdditionalYieldData] = useState<\n Record>\n >({});\n\n useEffect(() => {\n fetch('https://staging-api.yieldyak.com/apys')\n .then((response) => response.json())\n .then(setYYMeta)\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/yield-monitor.json'\n )\n .then((response) => response.json())\n .then((response) => {\n const ymData: Record = {};\n for (const r of response) {\n const a = getAddress(r.lpAddress);\n if (!(a in ymData) || r.totalApy > ymData[a].totalApy) {\n ymData[a] = r;\n }\n }\n setYieldMonitor(ymData);\n })\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/yield-farming.json'\n )\n .then((response) => response.json())\n .then((response) => setYieldFarmingData(response))\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/strategy-metadata.json'\n )\n .then((response) => response.json())\n .then((response) => setStrategyMetadataCached(response))\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/xmore-data.json'\n )\n .then((response) => response.json())\n .then((response) => setXMoreData(response))\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/additional-yield.json'\n )\n .then((response) => response.json())\n .then((response) => setAdditionalYieldData(response))\n .catch((err) => {\n console.error('Failed to fetch URL');\n console.error(err);\n });\n }, []);\n return (\n \n {strategyMetadataCached ? children : }\n \n );\n}\n","import { BigNumber } from '@ethersproject/bignumber';\nimport {\n ChainId,\n CurrencyValue,\n NativeCurrency,\n Token,\n useContractCall,\n} from '@usedapp/core';\nimport { getAddress, Interface, parseUnits } from 'ethers/lib/utils';\nimport tokenlist from '../constants/tokenlist.json';\nimport deployAddresses from '../contracts/addresses.json';\nimport lptokens from '../contracts/lptokens.json';\nimport { ParsedPositionMetaRow, useAddresses, useStable } from './contracts';\nimport OracleRegistry from '../contracts/artifacts/contracts/OracleRegistry.sol/OracleRegistry.json';\n\nconst addressToken: Record> = Object.fromEntries(\n Object.values(ChainId).map((key) => [key, new Map()])\n) as any;\nconst addressIcons: Map = new Map();\nconst addressAuxIcon: Map = new Map();\n\nexport function getTokenFromAddress(\n chainId: ChainId | undefined,\n address: string\n): Token {\n return addressToken[chainId ?? ChainId.Avalanche].get(getAddress(address))!;\n}\n\nexport function getIconsFromTokenAddress(address: string): string[] {\n return addressIcons.get(getAddress(address)) ?? [];\n}\n\nexport function getAuxIconFromTokenAddress(\n address: string\n): string | undefined {\n return addressAuxIcon.get(getAddress(address));\n}\n\nexport function tokenAmount(\n chainId: ChainId,\n tokenAddress: string,\n amount: BigNumber\n) {\n const token = addressToken[chainId].get(getAddress(tokenAddress));\n if (token) {\n return new CurrencyValue(token, amount);\n }\n}\n\nexport function getTokensInQuestion(_chainId: ChainId): [string, Token][] {\n if (_chainId === undefined) {\n return [];\n }\n const tokensInQuestion = Array.from(addressToken[_chainId].entries()).filter(\n (aT) => aT[1].chainId === _chainId\n );\n // console.log('tokens in question');\n // console.log(Array.from(addressToken[_chainId].entries()));\n // console.log(tokensInQuestion);\n\n return tokensInQuestion;\n}\n\nfor (const {\n address,\n chainId,\n decimals,\n name,\n symbol,\n logoURI,\n} of tokenlist.tokens) {\n addressToken[chainId as ChainId].set(\n getAddress(address),\n new Token(name, symbol, chainId, getAddress(address), decimals)\n );\n addressIcons.set(getAddress(address), [logoURI]);\n}\n\nexport enum LiquidationType {\n LPT,\n Direct,\n}\n\nexport type LiquidationParams = {\n liqType: LiquidationType;\n router: string;\n};\n\nconst liquidationParams = new Map();\n\n// TODO make this more complete\nconst chainIds: Record = {\n 31337: ChainId.Hardhat,\n 43114: ChainId.Avalanche,\n};\n\nconst exchangeIcons: Record = {\n JPL: 'https://raw.githubusercontent.com/pangolindex/tokens/main/assets/0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd/logo.png',\n PGL: 'https://raw.githubusercontent.com/pangolindex/tokens/main/assets/0x60781C2586D68229fde47564546784ab3fACA982/logo.png',\n};\n\nconst exchangeRouters: Record = {\n JPL: '0x60aE616a2155Ee3d9A68541Ba4544862310933d4',\n PGL: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106',\n};\n\nliquidationParams.set('0x60781C2586D68229fde47564546784ab3fACA982', {\n router: exchangeRouters.PGL,\n liqType: LiquidationType.Direct,\n});\nliquidationParams.set('0x59414b3089ce2AF0010e7523Dea7E2b35d776ec7', {\n router: exchangeRouters.PGL,\n liqType: LiquidationType.Direct,\n});\n\nfor (const [chainId, lpTokensPerChain] of Object.entries(lptokens) as [\n string,\n Record>\n][]) {\n for (const [exchange, records] of Object.entries(lpTokensPerChain)) {\n for (const [longTicker, record] of Object.entries(records)) {\n if ('pairAddress' in record && record.pairAddress && longTicker !== 'JPL-WAVAX-WBTCe') {\n const ticker = longTicker.split('-').slice(1).join('/');\n addressToken[chainIds[chainId]].set(\n getAddress(record.pairAddress),\n new Token(\n longTicker,\n ticker,\n chainIds[chainId],\n getAddress(record.pairAddress),\n 18\n )\n );\n const icons: string[] = [];\n icons.push(\n ...(addressIcons.get(getAddress(record.addresses[0])) ?? [])\n );\n icons.push(\n ...(addressIcons.get(getAddress(record.addresses[1])) ?? [])\n );\n\n addressIcons.set(getAddress(record.pairAddress), icons);\n addressAuxIcon.set(\n getAddress(record.pairAddress),\n exchangeIcons[exchange]\n );\n\n liquidationParams.set(getAddress(record.pairAddress), {\n router: exchangeRouters[exchange],\n liqType: LiquidationType.LPT,\n });\n }\n }\n }\n}\n\nexport function getLiquidationParams(\n pos: ParsedPositionMetaRow\n): LiquidationParams {\n return (\n liquidationParams.get(getAddress(pos.token.address)) ?? {\n router: exchangeRouters.JPL,\n liqType: LiquidationType.Direct,\n }\n );\n}\n\nfor (const [chainId, addresses] of Object.entries(deployAddresses)) {\n addressToken[chainIds[chainId]].set(\n getAddress(addresses.Stablecoin),\n new Token(\n 'Moremoney USD',\n 'MONEY',\n chainIds[chainId],\n getAddress(addresses.Stablecoin),\n 18\n )\n );\n addressIcons.set(getAddress(addresses.Stablecoin), [\n 'https://raw.githubusercontent.com/MoreMoney-Finance/logos/main/Coin-Logo-FINAL.jpg',\n ]);\n\n if ('CurvePool' in addresses) {\n addressToken[chainIds[chainId]].set(\n getAddress(addresses.CurvePool),\n new Token(\n 'Money Curve MetaPool Token',\n 'MONEYCRV',\n chainIds[chainId],\n getAddress(addresses.CurvePool)\n )\n );\n }\n\n if ('MoreToken' in addresses) {\n addressToken[chainIds[chainId]].set(\n getAddress(addresses['MoreToken']),\n new Token(\n 'More Token',\n 'MORE',\n chainIds[chainId],\n getAddress(addresses['MoreToken'])\n )\n );\n addressIcons.set(getAddress(addresses['MoreToken']), [\n 'https://raw.githubusercontent.com/MoreMoney-Finance/logos/main/Moremoney_05.jpg',\n ]);\n }\n\n if ('xMore' in addresses) {\n addressToken[chainIds[chainId]].set(\n getAddress(addresses['xMore']),\n new Token(\n 'xMore Token',\n 'xMORE',\n chainIds[chainId],\n getAddress(addresses['xMore'])\n )\n );\n addressIcons.set(getAddress(addresses['xMore']), [\n 'https://raw.githubusercontent.com/MoreMoney-Finance/logos/main/Moremoney_05.jpg',\n ]);\n }\n}\n\nexport const nativeCurrency: Map = new Map();\n\nnativeCurrency.set(\n ChainId.Hardhat,\n new NativeCurrency('Avalanche', 'AVAX', ChainId.Hardhat)\n);\nnativeCurrency.set(\n ChainId.Avalanche,\n new NativeCurrency('Avalanche', 'AVAX', ChainId.Avalanche)\n);\n\nexport const wrappedNativeCurrency: Map = new Map();\n\nwrappedNativeCurrency.set(\n ChainId.Hardhat,\n addressToken[ChainId.Hardhat].get(\n '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'\n )!\n);\nwrappedNativeCurrency.set(\n ChainId.Avalanche,\n addressToken[ChainId.Avalanche].get(\n '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'\n )!\n);\n\nexport function useOraclePrices(\n tokens: Token[]\n): Record {\n const addresses = useAddresses();\n\n const address = addresses.OracleRegistry;\n const abi = new Interface(OracleRegistry.abi);\n const tokenAddresses = tokens.map((token) => token.address);\n const tokenInAmounts = tokens.map((token) => parseUnits('1', token.decimals));\n const stable = useStable();\n const method = 'viewAmountsInPeg';\n const args = [tokenAddresses, tokenInAmounts, stable.address];\n\n const pegValues = (useContractCall({\n abi,\n address,\n method,\n args,\n }) ?? [[]])[0];\n\n return Object.fromEntries(\n pegValues.map((v: BigNumber, i: number) => [\n tokens[i].address,\n new CurrencyValue(stable, v),\n ])\n );\n}\n","import { useEthers } from '@usedapp/core';\nimport React from 'react';\nimport { useLocation } from 'react-router-dom';\n\nexport const UserAddressContext = React.createContext<\n string | null | undefined\n>(undefined);\n\nexport function UserAddressCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const { account } = useEthers();\n const { search } = useLocation();\n const userAddress = new URLSearchParams(search).get('account');\n\n return (\n \n {children}\n \n );\n}\n","import {\n ContractCall,\n CurrencyValue,\n ERC20Interface,\n Token,\n useContractCalls,\n useEthers,\n} from '@usedapp/core';\nimport { getAddress } from 'ethers/lib/utils';\nimport React, { useContext } from 'react';\nimport { getTokensInQuestion } from '../chain-interaction/tokens';\nimport { UserAddressContext } from './UserAddressContext';\n\nexport const WalletBalancesContext = React.createContext<\n Map\n>(new Map());\n\nexport function WalletBalancesCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const { chainId } = useEthers();\n const account = useContext(UserAddressContext);\n\n const tokenBalances = new Map();\n\n function convert2ContractCall(aT: [string, Token]) {\n return {\n abi: ERC20Interface,\n address: aT[0],\n method: 'balanceOf',\n args: [account],\n };\n }\n const tokensInQuestion = getTokensInQuestion(chainId!);\n const calls: ContractCall[] = account\n ? tokensInQuestion.map(convert2ContractCall)\n : [];\n const results = useContractCalls(calls) ?? [];\n results?.forEach((result: any[] | undefined, index: number) => {\n if (result) {\n const [tokenAddress, token] = tokensInQuestion[index];\n tokenBalances.set(\n getAddress(tokenAddress),\n new CurrencyValue(token, result[0])\n );\n // console.log(\n // `Set balance for ${token.name}: ${result[0]} (${tokenAddress})`\n // );\n // } else {\n // const [tokenAddress, token] = tokensInQuestion[index];\n // console.log(`No result for ${token.name} at ${tokenAddress}`);\n }\n });\n\n return (\n \n {children}\n \n );\n}\n\nexport function useWalletBalance(tokenAddress: string | undefined | null) {\n const account = useContext(UserAddressContext);\n const ctxAccount = useContext(UserAddressContext);\n const balancesCtx = useContext(WalletBalancesContext);\n\n return tokenAddress && account === ctxAccount\n ? balancesCtx.get(getAddress(tokenAddress))\n : undefined;\n}\n","import { CurrencyValue } from '@usedapp/core';\n\nexport function parseFloatNoNaN(input: string) {\n const parsed = parseFloat(input);\n return isNaN(parsed) ? 0 : parsed;\n}\nexport function parseFloatCurrencyValue(input: CurrencyValue) {\n const parsed = parseFloatNoNaN(\n input.format({\n significantDigits: Infinity,\n suffix: '',\n thousandSeparator: '',\n decimalSeparator: '.',\n })\n );\n return isNaN(parsed) ? 0 : parsed;\n}\nexport function formatNumber(input: number) {\n if (input) {\n return input.toLocaleString('en-US', {});\n } else {\n return 0;\n }\n}\n","import { parseUnits } from '@ethersproject/units';\nimport {\n ChainId,\n ContractCall,\n CurrencyValue,\n Token,\n useContractCall,\n useContractCalls,\n useEthers,\n} from '@usedapp/core';\nimport {\n formatEther,\n parseEther,\n} from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber, ethers } from 'ethers';\nimport { getAddress, Interface, parseBytes32String } from 'ethers/lib/utils';\nimport React, { useContext, useState } from 'react';\nimport {\n ExternalMetadataContext,\n YieldMonitorMetadata,\n YYMetadata,\n} from '../contexts/ExternalMetadataContext';\nimport { WalletBalancesContext } from '../contexts/WalletBalancesContext';\nimport ERC20 from '../contracts/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json';\nimport xMore from '../contracts/artifacts/contracts/governance/xMore.sol/xMore.json';\nimport IsolatedLending from '../contracts/artifacts/contracts/IsolatedLending.sol/IsolatedLending.json';\nimport StableLending from '../contracts/artifacts/contracts/StableLending.sol/StableLending.json';\nimport OracleRegistry from '../contracts/artifacts/contracts/OracleRegistry.sol/OracleRegistry.json';\nimport VestingLaunchReward from '../contracts/artifacts/contracts/rewards/VestingLaunchReward.sol/VestingLaunchReward.json';\nimport VestingStakingRewards from '../contracts/artifacts/contracts/rewards/VestingStakingRewards.sol/VestingStakingRewards.json';\nimport Stablecoin from '../contracts/artifacts/contracts/Stablecoin.sol/Stablecoin.json';\nimport YieldConversionStrategy from '../contracts/artifacts/contracts/strategies/YieldConversionStrategy.sol/YieldConversionStrategy.json';\nimport StrategyViewer from '../contracts/artifacts/contracts/StrategyViewer.sol/StrategyViewer.json';\nimport IFeeReporter from '../contracts/artifacts/interfaces/IFeeReporter.sol/IFeeReporter.json';\nimport IStrategy from '../contracts/artifacts/interfaces/IStrategy.sol/IStrategy.json';\nimport { getTokenFromAddress, tokenAmount } from './tokens';\nimport { parseFloatCurrencyValue } from '../utils';\n\n// import earnedRewards from '../constants/earned-rewards.json';\n// import rewardsRewards from '../constants/rewards-rewards.json';\n\n/* eslint-disable */\nexport const addresses: Record<\n string,\n DeploymentAddresses\n> = require('../contracts/addresses.json');\n\nexport type DeploymentAddresses = {\n Fund: string;\n Roles: string;\n IsolatedLending: string;\n IsolatedLendingLiquidation: string;\n DependencyController: string;\n OracleRegistry: string;\n Stablecoin: string;\n StrategyRegistry: string;\n TrancheIDService: string;\n TraderJoeMasterChefStrategy: string;\n TraderJoeMasterChef2Strategy: string;\n YieldYakAVAXStrategy: string;\n SimpleHoldingStrategy: string;\n YieldYakStrategy: string;\n PangolinMiniChefStrategy: string;\n AMMYieldConverter: string;\n WrapNativeIsolatedLending: string;\n CurvePoolRewards: string;\n DirectFlashLiquidation: string;\n LPTFlashLiquidation: string;\n\n MoreToken: string;\n xMore: string;\n\n StableLending: string;\n StableLendingLiquidation: string;\n DirectFlashStableLiquidation: string;\n LPTFlashStableLiquidation: string;\n wsMAXIStableLiquidation: string;\n xJoeStableLiquidation: string;\n WrapNativeStableLending: string;\n sJoeStrategy: string;\n\n VestingLaunchReward: string;\n\n CurvePoolSL: string;\n StrategyViewer: string;\n\n LiquidYieldStrategy: string;\n MultiTraderJoeMasterChef3Strategy: string;\n};\n\nexport function useAddresses() {\n const { chainId } = useEthers();\n\n // TODO make the default avalanche once it's supported by useDApp\n const chainIdStr = chainId ? chainId.toString() : '43114';\n return addresses[chainIdStr];\n}\n\nexport function useIsolatedLendingView(\n method: string,\n args: any[],\n defaultResult: any\n) {\n const addresses = useAddresses();\n\n const abi = new Interface(IsolatedLending.abi);\n\n return {\n legacy: (useContractCall({\n abi,\n address:\n 'IsolatedLending' in addresses\n ? addresses.IsolatedLending\n : addresses.StableLending,\n method,\n args,\n }) ?? [defaultResult])[0],\n current: (useContractCall({\n abi,\n address:\n 'StableLending' in addresses\n ? addresses.StableLending\n : addresses.IsolatedLending,\n method,\n args,\n }) ?? [defaultResult])[0],\n };\n}\n\ntype RawStratMetaRow = {\n debtCeiling: BigNumber;\n APF: BigNumber;\n borrowablePer10k: BigNumber;\n mintingFee: BigNumber;\n stabilityFee: BigNumber;\n strategy: string;\n strategyName: string;\n token: string;\n totalCollateral: BigNumber;\n totalDebt: BigNumber;\n valuePer1e18: BigNumber;\n tvl: BigNumber;\n harvestBalance2Tally: BigNumber;\n yieldType: number;\n underlyingStrategy?: string;\n};\n\nexport enum TxStatus {\n NONE = 'None',\n MINING = 'Mining',\n SUCCESS = 'Success',\n}\n\nexport enum YieldType {\n REPAYING = 'REPAYING',\n COMPOUNDING = 'COMPOUNDING',\n NOYIELD = 'NO YIELD',\n}\n\nexport type ParsedStratMetaRow = {\n debtCeiling: CurrencyValue;\n totalDebt: CurrencyValue;\n stabilityFeePercent: number;\n mintingFeePercent: number;\n strategyAddress: string;\n token: Token;\n APY: number;\n totalCollateral: CurrencyValue;\n borrowablePercent: number;\n usdPrice: number;\n strategyName: string;\n tvlInToken: CurrencyValue;\n tvlInPeg: CurrencyValue;\n harvestBalance2Tally: CurrencyValue;\n yieldType: YieldType;\n balance: number;\n};\n\nfunction parseStratMeta(\n chainId: ChainId,\n row: RawStratMetaRow,\n stable: Token,\n balancesCtx: Map,\n yyMetadata: YYMetadata,\n globalMoneyAvailable: BigNumber,\n yieldMonitor: Record,\n additionalYield: Record>\n): ParsedStratMetaRow | undefined {\n const token = getTokenFromAddress(chainId, row.token);\n if (token) {\n const tvlInToken = tokenAmount(chainId, row.token, row.tvl)!;\n const balance =\n balancesCtx.get(token!.address) ??\n new CurrencyValue(token, BigNumber.from('0'));\n\n const strategyAddress = getAddress(row.strategy);\n const underlyingAddress = row.underlyingStrategy\n ? getAddress(row.underlyingStrategy)\n : strategyAddress;\n\n const APY =\n strategyAddress === addresses[chainId].LiquidYieldStrategy\n ? token.address === '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'\n ? (yieldMonitor['0x4b946c91C2B1a7d7C40FB3C130CdfBaf8389094d']\n .totalApy *\n 0.65 *\n 0.8) /\n 0.5\n : (yieldMonitor['0x4b946c91C2B1a7d7C40FB3C130CdfBaf8389094d']\n .totalApy *\n 0.3 *\n 0.8) /\n 0.5 +\n 8\n : underlyingAddress in yyMetadata\n ? yyMetadata[underlyingAddress].apy * 0.9\n : token.address in yieldMonitor\n ? yieldMonitor[token.address].totalApy\n : token.address in additionalYield &&\n strategyAddress in additionalYield[token.address]\n ? additionalYield[token.address][strategyAddress]\n : 0;\n\n let syntheticDebtCeil = globalMoneyAvailable.add(row.totalDebt);\n\n const trueOne = parseUnits('1', token.decimals);\n const valPerOne = trueOne.mul(row.valuePer1e18).div(parseEther('1'));\n\n return {\n debtCeiling: new CurrencyValue(\n stable,\n row.debtCeiling.gt(syntheticDebtCeil)\n ? syntheticDebtCeil\n : row.debtCeiling\n ),\n totalDebt: new CurrencyValue(stable, row.totalDebt),\n stabilityFeePercent: row.stabilityFee.toNumber() / 100,\n mintingFeePercent: row.mintingFee.toNumber() / 100,\n strategyAddress,\n token,\n APY,\n totalCollateral: tokenAmount(chainId, row.token, row.totalCollateral)!,\n borrowablePercent: row.borrowablePer10k.toNumber() / 100,\n usdPrice:\n parseFloat(formatEther(row.valuePer1e18)) / 10 ** (18 - token.decimals),\n strategyName: parseBytes32String(row.strategyName),\n tvlInToken,\n tvlInPeg: new CurrencyValue(stable, row.tvl.mul(valPerOne).div(trueOne)),\n harvestBalance2Tally: new CurrencyValue(stable, row.harvestBalance2Tally),\n yieldType: [YieldType.REPAYING, YieldType.COMPOUNDING, YieldType.NOYIELD][\n row.yieldType\n ],\n balance: parseFloatCurrencyValue(balance),\n };\n }\n}\n\nconst COMPOUNDING = 52;\n\nfunction convertAPF2APY(APF: BigNumber): number {\n const apf = APF.toNumber();\n return 100 * ((1 + (apf / 10000 - 1) / COMPOUNDING) ** COMPOUNDING - 1);\n}\n\nexport function useStable() {\n const { chainId } = useEthers();\n const addresses = useAddresses();\n return getTokenFromAddress(\n chainId ? (chainId as unknown as ChainId) : ChainId.Avalanche,\n addresses.Stablecoin\n )!;\n}\n\nexport type StrategyMetadata = Record<\n string,\n Record\n>;\n\n// export async function queryStratMeta(library: any) {\n// const wsm = (await new ethers.Contract('0x21c971d78e1a398710d964ed1ac4c80e5940ed25', new Interface(IStrategy.abi), library).viewStrategyMetadata(\n// '0x2148D1B21Faa7eb251789a51B404fc063cA6AAd6'\n// ));\n\n// console.log('wsm', wsm);\n\n// for (let contract of [\n// '0xdfa3bcda5f954a1e6cef247bdfa89f15702a7473',\n// // '0x21c971d78e1a398710d964ed1ac4c80e5940ed25',\n// // '0x0db20d1643112fa00c4d3ddb58369ad26c1f7c1d',\n// '0xaa3ea561a656cbe310f2e10981085da2d989f17e',\n// '0x888fc8d90177a4097e196ef6bbdc7d2e8cffdb17',\n// '0x10d71115360f9129623096e8108bc6856cf86d3a',\n// ]) {\n// const contrac = new ethers.Contract(\n// contract,\n// new Interface(IsolatedLending.abi),\n// library\n// );\n// console.log('querying', contract);\n// const result = await contrac.viewAllStrategyMetadata();\n// console.log('Returened strat meta', contract, result);\n// }\n// return undefined;\n// }\n\nexport function useIsolatedStrategyMetadata(): StrategyMetadata {\n const {\n yyMetadata,\n yieldMonitor,\n additionalYieldData,\n strategyMetadataCached,\n } = useContext(ExternalMetadataContext);\n const stable = useStable();\n const { chainId } = useEthers();\n\n const reduceFn = (result: StrategyMetadata, row: RawStratMetaRow) => {\n const parsedRow = parseStratMeta(\n chainId ?? 43114,\n row,\n stable,\n balancesCtx,\n yyMetadata,\n globalMoneyAvailable,\n yieldMonitor,\n additionalYieldData\n );\n\n return parsedRow\n ? {\n ...result,\n [parsedRow.token.address]: {\n [parsedRow.strategyAddress]: parsedRow,\n ...(result[parsedRow.token.address] || {}),\n },\n }\n : result;\n };\n\n const [stratMeta, setStratMeta] = useState({});\n const globalDebtCeiling = useGlobalDebtCeiling(\n 'globalDebtCeiling',\n [],\n BigNumber.from(0)\n );\n const totalSupply = useTotalSupply('totalSupply', [], BigNumber.from(0));\n\n const balancesCtx = useContext(WalletBalancesContext);\n\n const addresses = useAddresses();\n\n const token2Strat = {\n ['0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE']:\n addresses.LiquidYieldStrategy,\n ['0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7']:\n addresses.YieldYakAVAXStrategy,\n ['0x60781C2586D68229fde47564546784ab3fACA982']: addresses.YieldYakStrategy,\n ['0x59414b3089ce2AF0010e7523Dea7E2b35d776ec7']: addresses.YieldYakStrategy,\n ['0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd']: addresses.YieldYakStrategy,\n ['0xd586e7f844cea2f87f50152665bcbc2c279d8d70']: addresses.YieldYakStrategy,\n ['0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5']: addresses.YieldYakStrategy,\n ['0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664']: addresses.YieldYakStrategy,\n ['0x454E67025631C065d3cFAD6d71E6892f74487a15']:\n addresses.TraderJoeMasterChefStrategy,\n ['0x2148D1B21Faa7eb251789a51B404fc063cA6AAd6']:\n addresses.SimpleHoldingStrategy,\n ['0xCDFD91eEa657cc2701117fe9711C9a4F61FEED23']:\n addresses.MultiTraderJoeMasterChef3Strategy,\n };\n\n const masterChef2Tokens = [\n '0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33',\n '0xa389f9430876455c36478deea9769b7ca4e3ddb1',\n '0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256',\n '0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa',\n ].map(getAddress);\n\n const tokens = Object.keys(token2Strat);\n tokens.push('0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7');\n const strats = Object.values(token2Strat);\n strats.push(addresses.LiquidYieldStrategy);\n const globalMoneyAvailable = globalDebtCeiling.sub(totalSupply);\n\n tokens.push('0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd');\n strats.push(addresses.sJoeStrategy);\n\n React.useEffect(() => {\n async function getData() {\n const provider = new ethers.providers.JsonRpcProvider(\n 'https://api.avax.network/ext/bc/C/rpc'\n );\n\n const stratViewer = new ethers.Contract(\n addresses.StrategyViewer,\n new Interface(StrategyViewer.abi),\n provider\n );\n\n const normalResults = await stratViewer.viewMetadata(\n addresses.StableLending,\n tokens,\n strats\n );\n const noHarvestBalanceResults =\n await stratViewer.viewMetadataNoHarvestBalance(\n addresses.StableLending,\n addresses.OracleRegistry,\n addresses.Stablecoin,\n masterChef2Tokens,\n Array(masterChef2Tokens.length).fill(\n addresses.TraderJoeMasterChef2Strategy\n )\n );\n\n console.log('noHarvestBalanceResults', noHarvestBalanceResults);\n const results = [...normalResults, ...noHarvestBalanceResults];\n window.alert('setStratMeta Blockchain');\n setStratMeta(results?.reduce(reduceFn, {}) ?? {});\n }\n if (\n chainId &&\n stable &&\n balancesCtx &&\n yyMetadata &&\n strategyMetadataCached && \n globalMoneyAvailable != 0 &&\n yieldMonitor &&\n Object.values(stratMeta).length === 0\n ) {\n const parsedCached: RawStratMetaRow[] = strategyMetadataCached?.map(\n (row) => {\n return {\n ...row,\n debtCeiling: BigNumber.from(row.debtCeiling),\n totalDebt: BigNumber.from(row.totalDebt),\n stabilityFee: BigNumber.from(row.stabilityFee),\n mintingFee: BigNumber.from(row.mintingFee),\n APF: BigNumber.from(row.APF),\n totalCollateral: BigNumber.from(row.totalCollateral),\n borrowablePer10k: BigNumber.from(row.borrowablePer10k),\n valuePer1e18: BigNumber.from(row.valuePer1e18),\n tvl: BigNumber.from(row.tvl),\n harvestBalance2Tally: BigNumber.from(row.harvestBalance2Tally),\n };\n }\n );\n const results = parsedCached ? parsedCached?.reduce(reduceFn, {}) : {};\n setStratMeta(results);\n\n getData();\n }\n }, [\n chainId,\n stable,\n balancesCtx,\n yyMetadata,\n globalMoneyAvailable,\n strategyMetadataCached,\n yieldMonitor,\n stratMeta,\n ]);\n\n return stratMeta;\n}\n\nexport type ParsedPositionMetaRow = {\n trancheId: number;\n strategy: string;\n collateral: CurrencyValue | undefined;\n debt: CurrencyValue;\n token: Token;\n yield: CurrencyValue;\n collateralValue: CurrencyValue;\n borrowablePercent: number;\n owner: string;\n liquidationPrice: number;\n trancheContract: string;\n liquidateButton?: boolean;\n positionHealth?: string;\n positionHealthColor?: string;\n parsedPositionHealth?: string;\n positionHealthOrder?: number;\n};\n\nexport type RawPositionMetaRow = {\n trancheId: BigNumber;\n strategy: string;\n collateral: BigNumber;\n debt: BigNumber;\n token: string;\n yield: BigNumber;\n collateralValue: BigNumber;\n borrowablePer10k: BigNumber;\n owner: string;\n};\n\nexport function calcLiquidationPrice(\n borrowablePercent: number,\n debt: CurrencyValue,\n collateral: CurrencyValue\n) {\n const debtNum = parseFloatCurrencyValue(debt);\n const colNum = parseFloatCurrencyValue(collateral);\n\n return calcLiqPriceFromNum(borrowablePercent, debtNum, colNum);\n}\n\nexport function calcLiqPriceFromNum(\n borrowablePercent: number,\n debtNum: number,\n colNum: number\n): number {\n if (colNum > 0) {\n return (100 * debtNum) / (colNum * borrowablePercent);\n } else {\n return 0;\n }\n}\n\nexport function parsePositionMeta(\n row: RawPositionMetaRow,\n stable: Token,\n trancheContract: string\n): ParsedPositionMetaRow {\n const debt = new CurrencyValue(stable, row.debt);\n const posYield = new CurrencyValue(stable, row.yield);\n const collateral =\n tokenAmount(stable.chainId, row.token, row.collateral) ??\n new CurrencyValue(\n new Token('', '', stable.chainId, row.token),\n row.collateral\n );\n\n const borrowablePercent = row.borrowablePer10k.toNumber() / 100;\n\n return {\n trancheContract,\n trancheId: row.trancheId.toNumber(),\n strategy: row.strategy,\n debt,\n collateral,\n token: getTokenFromAddress(stable.chainId, row.token)!,\n yield: posYield,\n collateralValue: new CurrencyValue(stable, row.collateralValue),\n borrowablePercent,\n owner: row.owner,\n liquidationPrice: debt.gt(posYield)\n ? calcLiquidationPrice(borrowablePercent, debt.sub(posYield), collateral!)\n : 0,\n };\n}\n\nexport type TokenStratPositionMetadata = Record<\n string,\n ParsedPositionMetaRow[]\n>;\nexport function useIsolatedPositionMetadata(\n account: string\n): TokenStratPositionMetadata {\n const { legacy, current } = useIsolatedLendingView(\n 'viewPositionsByOwner',\n [account],\n []\n );\n const stable = useStable();\n\n function reduceFn(trancheContract: string) {\n return (result: TokenStratPositionMetadata, row: RawPositionMetaRow) => {\n const parsedRow = parsePositionMeta(row, stable, trancheContract);\n const tokenAddress = parsedRow.token?.address;\n const list = result[tokenAddress] || [];\n return {\n ...result,\n [tokenAddress]: [...list, parsedRow],\n };\n };\n }\n\n const addresses = useAddresses();\n const legacyResults =\n 'IsolatedLending' in addresses\n ? legacy.reduce(reduceFn(addresses.IsolatedLending), {})\n : {};\n return 'StableLending' in addresses\n ? current.reduce(reduceFn(addresses.StableLending), legacyResults)\n : legacyResults;\n}\n\nexport function xMoreTotalSupply(\n method: string,\n args: any[],\n defaultResult: any\n) {\n const address = useAddresses().xMore;\n const abi = new Interface(xMore.abi);\n return (useContractCall({\n abi,\n address,\n method,\n args,\n }) ?? [defaultResult])[0];\n}\n\nexport function useGlobalDebtCeiling(\n method: string,\n args: any[],\n defaultResult: any\n) {\n const address = useAddresses().Stablecoin;\n const abi = new Interface(Stablecoin.abi);\n return (useContractCall({\n abi,\n address,\n method,\n args,\n }) ?? [defaultResult])[0];\n}\n\nexport function useTotalSupply(\n method: string,\n args: any[],\n defaultResult: any\n) {\n const address = useAddresses().Stablecoin;\n const abi = new Interface(ERC20.abi);\n return (useContractCall({\n abi,\n address,\n method,\n args,\n }) ?? [defaultResult])[0];\n}\n\nexport function useYieldConversionStrategyView(\n strategyAddress: string,\n method: string,\n args: any[],\n defaultResult: any\n) {\n const abi = new Interface(YieldConversionStrategy.abi);\n return (useContractCall({\n abi,\n address: strategyAddress,\n method,\n args,\n }) ?? [defaultResult])[0];\n}\n\nconst ONE_WEEK_SECONDS = 60 * 60 * 24 * 7;\nexport function useUpdatedPositions(timeStart: number) {\n const endPeriod = 1 + Math.round(Date.now() / 1000 / ONE_WEEK_SECONDS);\n const startPeriod = Math.floor(timeStart / 1000 / ONE_WEEK_SECONDS) - 2;\n // console.log('endPeriod', endPeriod);\n // console.log('startPeriod', startPeriod);\n const stable = useStable();\n const addresses = useAddresses();\n\n function args(trancheContract: string) {\n return Array(endPeriod - startPeriod)\n .fill(startPeriod)\n .map((x, i) => ({\n abi: new Interface(IsolatedLending.abi),\n address: trancheContract,\n method: 'viewPositionsByTrackingPeriod',\n args: [x + i],\n }));\n }\n\n const legacyRows =\n (useContractCalls(\n args(addresses.IsolatedLending)\n ) as RawPositionMetaRow[][][]) || [];\n const currentRows =\n (useContractCalls(\n args(addresses.StableLending)\n ) as RawPositionMetaRow[][][]) || [];\n\n function parseRows(rows: RawPositionMetaRow[][][], trancheContract: string) {\n return rows\n .flatMap((x) => x)\n .flatMap((x) => x)\n .filter((x) => x)\n .map((row) => parsePositionMeta(row, stable, trancheContract));\n }\n return [\n ...((legacyRows.length > 0 &&\n parseRows(legacyRows, addresses.IsolatedLending)) ||\n []),\n ...((currentRows.length > 0 &&\n parseRows(currentRows, addresses.StableLending)) ||\n []),\n ];\n}\n\nexport function useUpdatedMetadataLiquidatablePositions(\n positions?: ParsedPositionMetaRow[]\n) {\n const abi = {\n [useAddresses().IsolatedLending]: new Interface(IsolatedLending.abi),\n [useAddresses().StableLending]: new Interface(StableLending.abi),\n };\n\n const positionCalls: ContractCall[] = positions!.map((pos) => {\n return {\n abi: abi[pos.trancheContract],\n address: pos.trancheContract,\n method: 'viewPositionMetadata',\n args: [pos.trancheId],\n };\n });\n\n const updatedData = useContractCalls(positionCalls);\n\n return updatedData.filter((x) => x !== undefined);\n}\n\nexport function useRegisteredOracle(tokenAddress?: string) {\n const address = useAddresses().OracleRegistry;\n const abi = new Interface(OracleRegistry.abi);\n const stable = useStable();\n return (useContractCall({\n abi,\n address,\n method: 'tokenOracle',\n args: [tokenAddress, stable.address],\n }) ?? [undefined])[0];\n}\n\nexport function useAllFeesEver(contracts: string[]) {\n function convert2ContractCall(contract: string) {\n return {\n abi: new Interface(IFeeReporter.abi),\n address: contract,\n method: 'viewAllFeesEver',\n args: [],\n };\n }\n\n const calls: ContractCall[] = contracts.map(convert2ContractCall);\n // console.log('calls', calls);\n const results = useContractCalls(calls) ?? [];\n\n return results;\n}\n\nexport function useEstimatedHarvestable(\n strategyAddress: string,\n tokenAddress: string\n) {\n const abi = new Interface(IStrategy.abi);\n return (useContractCall({\n abi,\n address: strategyAddress,\n method: 'viewEstimatedHarvestable',\n args: [tokenAddress],\n }) ?? [undefined])[0];\n}\n\nexport function useStakingMetadata(\n stakingContracts: string[],\n account?: string\n): [RawStakingMetadata][] {\n const abi = new Interface(VestingStakingRewards.abi);\n const userAccount = account ?? ethers.constants.AddressZero;\n const calls: ContractCall[] = stakingContracts.map((address) => ({\n abi,\n address,\n method: 'stakingMetadata',\n args: [userAccount],\n }));\n\n let contractCalls2 = useContractCalls(calls);\n const results = (contractCalls2 ?? []) as unknown as [RawStakingMetadata][];\n return results;\n}\n\ntype RawStakingMetadata = {\n stakingToken: string;\n rewardsToken: string;\n totalSupply: BigNumber;\n tvl: BigNumber;\n aprPer10k: BigNumber;\n vestingCliff: BigNumber;\n periodFinish: BigNumber;\n stakedBalance: BigNumber;\n vestingStart: BigNumber;\n earned: BigNumber;\n vested: BigNumber;\n rewards: BigNumber;\n};\n\nexport type ParsedStakingMetadata = {\n stakingToken: Token;\n rewardsToken: Token;\n totalSupply: CurrencyValue;\n tvl: CurrencyValue;\n aprPercent: number;\n vestingCliff: Date;\n periodFinish: Date;\n stakedBalance: CurrencyValue;\n vestingStart: Date;\n earned: CurrencyValue;\n vested: CurrencyValue;\n rewards: CurrencyValue;\n totalRewards: CurrencyValue;\n};\n\n// function unifyRewards(account?: string): BigNumber {\n// const lcAccount = account ? account.toLowerCase() : undefined;\n// const earned =\n// lcAccount && lcAccount in earnedRewards\n// ? BigNumber.from(earnedRewards[lcAccount as keyof typeof earnedRewards])\n// : BigNumber.from(0);\n\n// const rewards =\n// lcAccount && lcAccount in rewardsRewards\n// ? BigNumber.from(rewardsRewards[lcAccount as keyof typeof rewardsRewards])\n// : BigNumber.from(0);\n\n// // console.log('unifying', formatEther(earned), formatEther(rewards));\n\n// return earned.add(rewards);\n// }\n\nexport function useParsedStakingMetadata(\n stakingContracts: string[],\n account?: string\n): ParsedStakingMetadata[] {\n const { chainId } = useEthers();\n const stable = useStable();\n return useStakingMetadata(stakingContracts, account)\n .filter((x) => x)\n .filter(([x]) => x)\n .map(([stakingMeta]: [RawStakingMetadata], i) => {\n const stakingToken = getTokenFromAddress(\n chainId,\n stakingMeta.stakingToken\n )!;\n const rewardsToken = getTokenFromAddress(\n chainId,\n stakingMeta.rewardsToken\n )!;\n\n const earned = new CurrencyValue(rewardsToken, stakingMeta.earned);\n const rewards = new CurrencyValue(rewardsToken, stakingMeta.rewards);\n // console.log('unifying with earned', formatEther(earned.value));\n\n const rawTotalRewards = earned.add(rewards);\n const totalRewards = rawTotalRewards;\n // i === 0\n // ? new CurrencyValue(\n // rewardsToken,\n // rawTotalRewards.value.add(\n // rawTotalRewards.value.sub(unifyRewards(account)).mul(4)\n // )\n // )\n // : rawTotalRewards;\n\n const rawAprPercent = (100 * stakingMeta.aprPer10k.toNumber()) / 10000;\n const aprPercent = rawAprPercent; //i === 0 ? rawAprPercent * 5 : rawAprPercent;\n\n return {\n stakingToken,\n rewardsToken,\n totalSupply: new CurrencyValue(stakingToken, stakingMeta.totalSupply),\n tvl: new CurrencyValue(stable, stakingMeta.tvl),\n aprPercent,\n vestingCliff: timestamp2Date(stakingMeta.vestingCliff),\n periodFinish: timestamp2Date(stakingMeta.periodFinish),\n stakedBalance: new CurrencyValue(\n stakingToken,\n stakingMeta.stakedBalance\n ),\n vestingStart: timestamp2Date(stakingMeta.vestingStart),\n earned,\n vested: new CurrencyValue(rewardsToken, stakingMeta.vested),\n rewards,\n totalRewards,\n };\n });\n}\n\nexport function useSpecialRewardsData(account: string) {\n const addresses = useAddresses();\n const address = addresses.VestingLaunchReward;\n const abi = new Interface(VestingLaunchReward.abi);\n const { chainId } = useEthers();\n const moreToken = getTokenFromAddress(chainId, addresses.MoreToken);\n\n const balance = (useContractCall({\n address,\n abi,\n method: 'balanceOf',\n args: [account],\n }) ?? [BigNumber.from(0)])[0];\n\n const vested = (useContractCall({\n address,\n abi,\n method: 'burnableByAccount',\n args: [account],\n }) ?? [BigNumber.from(0)])[0];\n\n return {\n balance: new CurrencyValue(moreToken, balance),\n vested: new CurrencyValue(moreToken, vested),\n };\n}\n\nfunction timestamp2Date(tstamp: BigNumber) {\n return new Date(tstamp.toNumber() * 1000);\n}\n\nexport function useCurvePoolSLDeposited() {\n // const address = useAddresses().CurvePoolSL;\n return parseEther('2240893.705535866887471228');\n}\n","export default __webpack_public_path__ + \"static/media/logo.6d503a67.png\";","import * as React from 'react';\nimport {\n Box,\n Button,\n Flex,\n Link,\n Modal,\n ModalOverlay,\n ModalContent,\n ModalHeader,\n ModalFooter,\n ModalBody,\n ModalCloseButton,\n Text,\n} from '@chakra-ui/react';\nimport { ExternalLinkIcon, CopyIcon } from '@chakra-ui/icons';\nimport {\n ChainId,\n CurrencyValue,\n getExplorerAddressLink,\n shortenAddress,\n useEthers,\n} from '@usedapp/core';\nimport { useContext } from 'react';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { BigNumber } from 'ethers';\nimport { useStable, useAddresses } from '../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../chain-interaction/tokens';\nimport { WalletBalancesContext } from '../../contexts/WalletBalancesContext';\n\ntype Props = {\n isOpen: any;\n onClose: any;\n};\n\nexport default function AccountModal({ isOpen, onClose }: Props) {\n const { deactivate } = useEthers();\n const account = useContext(UserAddressContext);\n const { chainId } = useEthers();\n const _chainId = chainId === ChainId.Hardhat ? ChainId.Avalanche : chainId;\n const stable = useStable();\n const balanceCtx = React.useContext(WalletBalancesContext);\n const moreToken = getTokenFromAddress(chainId, useAddresses().MoreToken);\n\n const walletBalance =\n balanceCtx.get(stable.address) ||\n new CurrencyValue(stable, BigNumber.from('0'));\n\n const moreBalance =\n balanceCtx.get(moreToken.address) ||\n new CurrencyValue(moreToken, BigNumber.from('0'));\n\n const explorerLink = account\n ? getExplorerAddressLink(account, _chainId!)\n : '';\n\n function handleDeactivateAccount() {\n deactivate();\n onClose();\n }\n\n return (\n \n \n \n \n \n Account\n \n \n \n \n \n \n Connected with MetaMask\n \n \n Change\n \n \n \n \n {account && `${shortenAddress(account)}`}\n \n \n \n {walletBalance?.format({ significantDigits: 2 })} /{' '}\n {moreBalance?.format({ significantDigits: 2 })}\n \n \n navigator.clipboard.writeText(account ?? '')}\n _hover={{\n textDecoration: 'none',\n }}\n >\n \n Copy Address\n \n \n \n View on Explorer\n \n \n \n \n\n \n \n Your transactions willl appear here...\n \n \n \n \n \n );\n}\n","export default __webpack_public_path__ + \"static/media/color_dot.411f3a2b.svg\";","import { Button, HStack, Image, Text, useMediaQuery } from '@chakra-ui/react';\nimport { CurrencyValue, useEthers } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport colorDot from '../../assets/img/color_dot.svg';\nimport { useAddresses, useStable } from '../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../chain-interaction/tokens';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { WalletBalancesContext } from '../../contexts/WalletBalancesContext';\n\ntype Props = {\n handleOpenModal: any;\n};\n\nexport function UserAddressComponent({ handleOpenModal }: Props) {\n const [isLargerThan1280] = useMediaQuery('(min-width: 1280px)');\n const { activateBrowserWallet, chainId } = useEthers();\n const account = useContext(UserAddressContext);\n const stable = useStable();\n const balanceCtx = React.useContext(WalletBalancesContext);\n const moreToken = getTokenFromAddress(chainId, useAddresses().MoreToken);\n\n const walletBalance =\n balanceCtx.get(stable.address) ||\n new CurrencyValue(stable, BigNumber.from('0'));\n\n const moreBalance =\n balanceCtx.get(moreToken.address) ||\n new CurrencyValue(moreToken, BigNumber.from('0'));\n\n function handleConnectWallet() {\n activateBrowserWallet();\n }\n\n return (\n \n \n {walletBalance &&\n moreBalance &&\n !moreBalance.isZero() &&\n !walletBalance.isZero() &&\n isLargerThan1280 ? (\n \n {walletBalance?.format({ significantDigits: 2 })} /{' '}\n {moreBalance?.format({ significantDigits: 2 })}\n \n ) : (\n \n )}\n \n \n {account ? (\n \n {account &&\n `${account.slice(0, 6)}...${account.slice(\n account.length - 4,\n account.length\n )}`}\n \n ) : (\n Connect wallet\n )}\n \n \n );\n}\n","export default __webpack_public_path__ + \"static/media/horizontal-dots.6d6385e8.svg\";","import {\n Container,\n IconButton,\n Image,\n Menu,\n MenuButton,\n MenuItem,\n MenuList,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport dots from '../../assets/img/horizontal-dots.svg';\n\nconst Links = [\n {\n title: 'Audit',\n link: 'https://github.com/MoreMoney-Finance/audits/blob/main/PeckShield-Audit-Report-Moremoney-1.0.pdf',\n },\n { title: 'Twitter', link: 'https://twitter.com/Moremoneyfi' },\n { title: 'Discord', link: 'https://discord.gg/uHwQgNE776' },\n { title: 'Telegram', link: 'https://t.me/moremoneyfi' },\n { title: 'Github', link: 'https://github.com/MoreMoney-Finance' },\n { title: 'Documentation', link: 'https://moremoney.gitbook.io/docs' },\n {\n title: 'Trade MORE',\n link: 'https://traderjoexyz.com/trade?inputCurrency=AVAX&outputCurrency=0xd9d90f882cddd6063959a9d837b05cb748718a05',\n },\n { title: 'Trade MONEY (Curve)', link: 'https://avax.curve.fi/factory/39' },\n {\n title: 'Trade MONEY (Pangolin)',\n link: 'https://app.pangolin.exchange/#/swap?inputCurrency=AVAX&outputCurrency=0x0f577433Bf59560Ef2a79c124E9Ff99fCa258948',\n },\n];\n\nexport default function MenuOptions() {\n return (\n
\n \n }\n variant=\"outline\"\n />\n \n \n {Links.map((link, index) => (\n \n {link.title}\n \n ))}\n \n \n \n
\n );\n}\n","import { CloseIcon, HamburgerIcon } from '@chakra-ui/icons';\nimport {\n Box,\n Flex,\n HStack,\n IconButton,\n Image,\n Link as LinkComponent,\n Stack,\n Text,\n useDisclosure,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport { Link, useLocation } from 'react-router-dom';\nimport logo from '../../assets/logo/logo.png';\nimport AccountModal from '../account/AccountModal';\nimport { UserAddressComponent } from '../account/UserAddressComponent';\nimport MenuOptions from './MenuOptions';\nimport { useMediaQuery } from '@chakra-ui/react';\n\nconst Links = [\n { title: 'Borrow', link: '/' },\n { title: 'My Positions', link: '/positions' },\n { title: 'Farm', link: '/farm' },\n { title: 'Stake', link: '/xmore' },\n // { title: 'Liquidate', link: '/liquidatable-positions' },\n { title: 'Analytics', link: '/analytics' },\n];\n\nexport default function NavigationBar() {\n const [isLargerThan1280] = useMediaQuery('(min-width: 1280px)');\n const { isOpen, onOpen, onClose } = useDisclosure();\n const {\n isOpen: isOpenAccount,\n onOpen: onOpenAccount,\n onClose: onCloseAccount,\n } = useDisclosure();\n const location = useLocation();\n\n return (\n <>\n \n \n : }\n aria-label={'Open Menu'}\n display={{ md: 'none' }}\n onClick={isOpen ? onClose : onOpen}\n />\n \n \n \"Logo\"\n  \n {isLargerThan1280 ? (\n \n moremoney\n \n ) : (\n ''\n )}\n \n \n \n {Links.map((link) => (\n \n {link.title}\n \n ))}\n \n \n \n \n \n \n \n {isOpen ? (\n \n \n {Links.map((link) => (\n \n {link.title}\n \n ))}\n \n \n ) : null}\n \n \n );\n}\n","import { Alert, AlertIcon } from '@chakra-ui/react';\nimport { parseEther } from '@ethersproject/units';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport {\n useGlobalDebtCeiling,\n useTotalSupply,\n} from '../../chain-interaction/contracts';\n\nexport default function GlobalDebtCeilingMessage() {\n const globalDebtCeiling = useGlobalDebtCeiling(\n 'globalDebtCeiling',\n [],\n BigNumber.from(0)\n );\n const totalSupply = useTotalSupply('totalSupply', [], undefined);\n const hasMaxedOut =\n totalSupply && totalSupply.gt(globalDebtCeiling.sub(parseEther('1000')));\n\n return (\n <>\n {hasMaxedOut ? (\n \n \n Global debt ceiling has been maxed out, please come back later!\n \n ) : (\n ''\n )}\n \n );\n}\n","import React from 'react';\nimport {\n AlertDialog,\n AlertDialogBody,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogContent,\n AlertDialogOverlay,\n useDisclosure,\n Button,\n AlertDialogCloseButton,\n} from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\n\nexport default function NetworkNotSupported() {\n const { onClose } = useDisclosure();\n const { deactivate } = useEthers();\n\n return (\n <>\n \n
\n \n \n Network Not Supported\n \n \n

Please connect to the appropriate Avalanche network.

\n
\n \n \n \n
\n
\n \n \n );\n}\n","import { Box, Text } from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\n\nexport default function PhishingAlertComponent() {\n const { account } = useEthers();\n const userAccount = useContext(UserAddressContext);\n\n return (\n <>\n {account != userAccount ? (\n \n \n \n Phishing danger: do not make any transactions unless you know what\n you're doing!\n \n \n \n ) : (\n ''\n )}\n \n );\n}\n","import * as React from 'react';\nimport { AlertStatus, useToast } from '@chakra-ui/react';\nimport {\n ChainId,\n getExplorerTransactionLink,\n useEthers,\n useNotifications,\n} from '@usedapp/core';\n\nexport const TransactionToasts: React.FC = () => {\n const { notifications } = useNotifications();\n const toast = useToast();\n const { chainId } = useEthers();\n const _chainId = chainId === ChainId.Hardhat ? ChainId.Avalanche : chainId;\n\n function showToast(title: string, status: AlertStatus, notification: any) {\n const hash = notification.transaction.hash;\n const explorerLink = getExplorerTransactionLink(hash, _chainId!);\n toast({\n id: notification.id,\n title: title,\n description: (\n \n {`${hash.slice(0, 6)}...${hash.slice(hash.length - 4, hash.length)}`}\n \n ),\n status: status,\n duration: 7000,\n isClosable: true,\n position: 'bottom-right',\n });\n }\n\n React.useEffect(() => {\n notifications.map((notification: any) => {\n switch (notification.type) {\n case 'transactionStarted':\n showToast('Transaction Started', 'info', notification);\n break;\n case 'transactionSucceed':\n showToast('Transaction Succeeded', 'success', notification);\n break;\n case 'transactionFailed':\n showToast('Transaction Failed', 'error', notification);\n break;\n default:\n break;\n }\n });\n }, [notifications]);\n\n return <>;\n};\n","import {\n ContractCall,\n Token,\n useContractCalls,\n useEthers\n} from '@usedapp/core';\nimport { getAddress, Interface } from 'ethers/lib/utils';\nimport React from 'react';\nimport { useAddresses } from '../chain-interaction/contracts';\nimport { getTokensInQuestion } from '../chain-interaction/tokens';\nimport IsolatedLendingLiquidation from '../contracts/artifacts/contracts/IsolatedLendingLiquidation.sol/IsolatedLendingLiquidation.json';\n\nexport const LiquidationFeesContext = React.createContext>(\n new Map()\n);\n\nexport function LiquidationFeesCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const { chainId } = useEthers();\n const address = useAddresses().StableLendingLiquidation;\n const tokenFees = new Map();\n\n function convert2ContractCall(aT: [string, Token]) {\n return {\n abi: new Interface(IsolatedLendingLiquidation.abi),\n address: address,\n method: 'viewLiquidationFeePer10k',\n args: [aT[0]],\n };\n }\n const tokensInQuestion = getTokensInQuestion(chainId!);\n const calls: ContractCall[] = tokensInQuestion.map(convert2ContractCall);\n const results = useContractCalls(calls) ?? [];\n results?.forEach((result: any[] | undefined, index: number) => {\n if (result) {\n const [tokenAddress, ] = tokensInQuestion[index];\n tokenFees.set(getAddress(tokenAddress), result[0].toNumber() / 100);\n // console.log(`Set Fee for ${token.name}: ${result[0]} (${tokenAddress}): ${result[0].toNumber()}`);\n } else {\n // const [tokenAddress, token] = tokensInQuestion[index];\n // console.log(`No result fee for ${token.name} at ${tokenAddress}`);\n }\n });\n\n return (\n \n {children}\n \n );\n}\n","import React from 'react';\nimport {\n StrategyMetadata,\n useIsolatedStrategyMetadata\n} from '../chain-interaction/contracts';\n\nexport const StrategyMetadataContext = React.createContext(\n {}\n);\n\nexport function StrategyMetadataCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const stratMeta = useIsolatedStrategyMetadata();\n\n return (\n \n {children}\n \n );\n}\n","import { extendTheme } from '@chakra-ui/react';\nimport '@fontsource/poppins';\nimport '@fontsource/rubik';\n\nconst Container = {\n variants: {\n token: {\n position: 'relative',\n maxWidth: '100%',\n height: '100%',\n background: 'brand.gradientBg',\n padding: '0',\n borderRadius: '10px',\n _before: {\n content: '\"\"',\n position: 'absolute',\n top: '-2px',\n bottom: '-2px',\n left: '-2px',\n right: '-2px',\n background:\n 'linear-gradient(to right, hsla(0, 100%, 64%, 0.06), hsla(193, 100%, 50%, 0.06))',\n borderRadius: '10px',\n zIndex: '-2',\n },\n _after: {\n content: '\"\"',\n position: 'absolute',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n bg: 'brand.bg',\n borderRadius: '10px',\n zIndex: 'var(--chakra-zIndices-hide)',\n },\n },\n },\n};\n\nconst Link = {\n baseStyle: {\n fontSize: '14px',\n lineHeight: '24px',\n color: 'whiteAlpha.600',\n },\n variants: {\n footer: {\n fontSize: '17px',\n lineHeight: '24px',\n color: 'whiteAlpha.700',\n },\n header: {\n fontSize: '17px',\n fontWeight: '600',\n _hover: {\n background: 'brand.accent',\n WebkitBackgroundClip: 'text',\n WebkitTextFillColor: 'transparent',\n },\n },\n headerActive: {\n fontSize: '17px',\n fontWeight: '600',\n background: 'brand.accent',\n WebkitBackgroundClip: 'text',\n WebkitTextFillColor: 'transparent',\n },\n },\n};\n\nconst Button = {\n baseStyle: {\n border: '1px solid transparent',\n },\n _hover: {\n borderColor: 'blue.700',\n color: 'blue.400',\n },\n _active: {\n backgroundColor: 'blue.800',\n borderColor: 'blue.700',\n },\n variants: {\n action: {\n bg: 'blue.800',\n color: 'blue.300',\n fontSize: 'lg',\n fontWeight: 'medium',\n borderRadius: 'lg',\n },\n primary: {\n bg: 'brand.accent',\n border: 'none',\n _hover: {\n _disabled: {\n bg: 'brand.accent',\n },\n },\n },\n secondary: {\n bg: 'whiteAlpha.100',\n border: 'none',\n _hover: {\n _disabled: {\n bg: 'whiteAlpha.100',\n },\n },\n },\n 'submit-primary': {\n padding: '16px',\n h: '56px',\n borderRadius: '10px',\n bg: 'brand.accent',\n border: 'none',\n _hover: {\n _disabled: {\n bg: 'brand.accent',\n },\n },\n width: '100%',\n },\n submit: {\n padding: '16px',\n h: '56px',\n borderRadius: '10px',\n bg: 'whiteAlpha.200',\n width: '100%',\n },\n },\n};\n\nconst Text = {\n variants: {\n gradient: {\n background: 'linear-gradient(to right, #7bb07b, #3c7998)',\n WebkitBackgroundClip: 'text',\n WebkitTextFillColor: 'transparent',\n },\n h200: {\n fontFamily: 'Rubik',\n fontSize: '18px',\n lineHeight: '27px',\n fontWeight: 400,\n },\n h300: {\n fontFamily: 'Rubik',\n fontSize: '16px',\n lineHeight: '24px',\n fontWeight: 400,\n },\n h400: {\n fontFamily: 'Rubik',\n fontSize: '14px',\n lineHeight: '17px',\n fontWeight: 400,\n },\n bodyExtraSmall: {\n fontFamily: 'Poppins',\n fontSize: '12px',\n lineHeight: '18px',\n fontWeight: 400,\n },\n bodySmall: {\n fontFamily: 'Poppins',\n fontSize: '14px',\n lineHeight: '21px',\n fontWeight: 400,\n },\n bodyMedium: {\n fontFamily: 'Poppins',\n fontSize: '16px',\n lineHeight: '24px',\n fontWeight: 400,\n },\n bodyLarge: {\n fontFamily: 'Poppins',\n fontSize: '18px',\n lineHeight: '27px',\n fontWeight: 500,\n },\n bodyHuge: {\n fontFamily: 'Poppins',\n fontSize: '22px',\n lineHeight: '27px',\n fontWeight: 500,\n },\n bodyExtraLarge: {\n fontFamily: 'Poppins',\n fontSize: '48px',\n lineHeight: '72px',\n fontWeight: 600,\n },\n },\n};\n\nconst Tabs = {\n variants: {\n primary: {\n tablist: {\n borderBottom: '1px solid',\n borderColor: 'whiteAlpha.200',\n },\n tabpanel: {\n padding: '30px 0 0',\n },\n tab: {\n fontFamily: 'Poppins',\n fontSize: '16px',\n lineHeight: '24px',\n fontWeight: 400,\n color: 'white',\n _selected: {\n position: 'relative',\n fontWeight: 600,\n _after: {\n content: '\"\"',\n position: 'absolute',\n bottom: '-1px',\n width: '100%',\n height: '2px',\n bg: 'brand.accent',\n },\n },\n },\n },\n 'soft-rounded': {\n tab: {\n borderRadius: 'full',\n fontSize: '14px',\n lineHeight: '21px',\n fontWeight: 'normal',\n color: 'whiteAlpha.500',\n padding: '8px 22px',\n _selected: {\n color: 'white',\n bg: 'brand.active',\n },\n },\n },\n },\n};\n\nconst Input = {\n variants: {\n rounded: {\n borderRadius: '20px',\n bg: 'transparent',\n },\n percentage: {\n field: {\n borderRadius: 'full',\n bg: 'whiteAlpha.100',\n textAlign: 'right',\n fontWeight: '500',\n border: '1px',\n borderColor: 'blue.500',\n },\n },\n percentage_inactive: {\n field: {\n borderRadius: 'full',\n bg: 'whiteAlpha.100',\n textAlign: 'right',\n fontWeight: '500',\n border: 'none',\n borderColor: '',\n },\n },\n },\n};\n\nconst Table = {\n variants: {\n dashboard: {\n table: {\n width: '100%',\n borderCollapse: 'separate',\n borderSpacing: '0 16px',\n },\n thead: {\n tr: {\n td: {\n fontFamily: 'Rubik',\n fontSize: '12px',\n lineHeight: '14px',\n color: 'whiteAlpha.400',\n textTransform: 'uppercase',\n paddingTop: '20px',\n paddingBottom: '8px',\n borderTop: '1px solid',\n },\n },\n _first: {\n transform: 'translateY(16px)',\n },\n },\n tbody: {\n /** Because the table uses tr as a link */\n a: {\n position: 'relative',\n _after: {\n content: '\"\"',\n position: 'absolute',\n borderRadius: '10px',\n boxSizing: 'border-box',\n border: '1px solid transparent',\n backgroundClip: 'padding-box, border-box',\n backgroundOrigin: 'padding-box, border-box',\n backgroundImage:\n 'linear-gradient(hsla(227, 12%, 15%, 1), hsla(227, 12%, 15%, 1)), linear-gradient(to right, hsla(0, 100%, 64%, 0.3) 0%, hsla(193, 100%, 50%, 0.3) 100%)',\n top: '0',\n left: '0',\n bottom: '0',\n right: '0',\n zIndex: 'var(--chakra-zIndices-hide)',\n },\n td: {\n fontSize: '18px',\n lineHeight: '27px',\n padding: '16px 30px',\n bg: 'whiteAlpha.30',\n _first: {\n borderLeftRadius: '10px',\n },\n _last: {\n borderRightRadius: '10px',\n },\n },\n },\n },\n },\n },\n};\n\nexport const theme = extendTheme({\n config: { initialColorMode: 'dark' },\n fonts: {\n heading: 'Rubik',\n body: 'Poppins',\n },\n colors: {\n white: 'hsl(0, 0%, 100%)',\n black: 'hsl(0,0%,0%)',\n brand: {\n bg: 'hsla(227, 12%, 15%, 1)',\n bgOpacity: 'hsla(0, 0%, 0%, 0.2)',\n active: 'hsla(227, 22%, 26%, 0.59)',\n accent:\n 'linear-gradient(to bottom, hsla(166, 100%, 46%, 1), hsla(165, 86%, 34%, 1))',\n gradientBg:\n 'linear-gradient(to bottom, hsla(0, 0%, 100%, 0.1), hsla(0, 0%, 100%, 0.03))',\n },\n accent_color: 'hsla(166, 100%, 46%, 0.9)',\n accent: {\n 100: 'accent_color',\n 200: 'hsla(166, 100%, 46%, 0.9)',\n 300: 'hsla(166, 100%, 46%, 0.8)',\n 400: 'hsla(166, 100%, 46%, 0.7)',\n 500: 'hsla(166, 100%, 46%, 0.6)',\n 600: 'hsla(166, 100%, 46%, 0.5)',\n 700: 'hsla(166, 100%, 46%, 0.4)',\n 800: 'hsla(166, 100%, 46%, 0.3)',\n 900: 'hsla(166, 100%, 46%, 0.2)',\n },\n whiteAlpha: {\n 30: 'hsla(0, 0%, 100%, 0.03)',\n 50: 'hsla(0, 0%, 100%, 0.05)',\n 100: 'hsla(0, 0%, 100%, 0.1)',\n 200: 'hsla(0, 0%, 100%, 0.2)',\n 300: 'hsla(0, 0%, 100%, 0.3)',\n 400: 'hsla(0, 0%, 100%, 0.4)',\n 500: 'hsla(0, 0%, 100%, 0.5)',\n 600: 'hsla(0, 0%, 100%, 0.6)',\n 700: 'hsla(0, 0%, 100%, 0.7)',\n 800: 'hsla(0, 0%, 100%, 0.8)',\n 900: 'hsla(0, 0%, 100%, 0.9)',\n },\n gray: {\n 50: 'hsla(204, 45%, 98%, 1)',\n 100: 'hsla(210, 38%, 95%, 1)',\n 200: 'hsla(214, 32%, 91%, 1)',\n 300: 'hsla(211, 25%, 84%, 1)',\n 400: 'hsla(214, 20%, 69%, 1)',\n 500: 'hsla(216, 15%, 52%, 1)',\n 600: 'hsla(218, 17%, 35%, 1)',\n 700: 'hsla(218, 23%, 23%, 1)',\n 800: 'hsla(220, 26%, 14%, 1)',\n 900: 'hsla(230, 21%, 11%, 1)',\n },\n blue: {\n 50: 'hsla(201, 100%, 96%, 1)',\n 100: 'hsla(202, 81%, 86%, 1)',\n 200: 'hsla(203, 82%, 76%, 1)',\n 300: 'hsla(205, 79%, 66%, 1)',\n 400: 'hsla(207, 73%, 57%, 1)',\n 500: 'hsla(209, 62%, 50%, 1)',\n 600: 'hsla(211, 61%, 43%, 1)',\n 700: 'hsla(213, 49%, 34%, 1)',\n 800: 'hsla(215, 41%, 28%, 1)',\n 900: 'hsla(215, 56%, 23%, 1)',\n },\n },\n zIndices: {\n header: 100,\n },\n styles: {\n global: {\n body: {\n bg: 'brand.bg',\n color: 'white',\n },\n a: {\n textDecoration: 'none !important',\n },\n },\n },\n components: {\n Button,\n Text,\n Tabs,\n Input,\n Table,\n Link,\n Container,\n },\n});\n","import { Box, ChakraProvider } from '@chakra-ui/react';\nimport { useConfig, useEthers } from '@usedapp/core';\nimport { ethers } from 'ethers';\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport { Outlet, useLocation } from 'react-router-dom';\nimport { useAddresses } from './chain-interaction/contracts';\nimport NavigationBar from './components/navigation/NavigationBar';\nimport GlobalDebtCeilingMessage from './components/notifications/GlobalDebtCeilingMessage';\nimport NetworkNotSupported from './components/notifications/NetworkNotSupported';\nimport PhishingAlertComponent from './components/notifications/PhishingAlertComponent';\nimport { TransactionToasts } from './components/notifications/TransactionToasts';\nimport { ExternalMetadataCtxProvider } from './contexts/ExternalMetadataContext';\nimport { LiquidationFeesCtxProvider } from './contexts/LiquidationFeesContext';\nimport { StrategyMetadataCtxProvider } from './contexts/StrategyMetadataContext';\nimport { UserAddressCtxProvider } from './contexts/UserAddressContext';\nimport { WalletBalancesCtxProvider } from './contexts/WalletBalancesContext';\nimport { theme } from './theme';\n\ndeclare let window: any;\n\nexport const App = (params: React.PropsWithChildren) => {\n const addresses = useAddresses();\n const { active, chainId, activateBrowserWallet, account } = useEthers();\n const config = useConfig();\n\n const [requestedSwitch, setRequestedSwitch] = React.useState(false);\n useEffect(() => {\n (async () => {\n const wallet = new ethers.providers.Web3Provider(window.ethereum);\n const { chainId: walletChainId } = await wallet.getNetwork();\n const accounts = await wallet.listAccounts();\n\n if (chainId === 31337) {\n activateBrowserWallet();\n }\n\n if (\n accounts.length > 0 &&\n !requestedSwitch &&\n walletChainId &&\n !config.supportedChains.includes(walletChainId)\n ) {\n setRequestedSwitch(true);\n try {\n await wallet.provider.request!({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: '0xa86a' }],\n });\n activateBrowserWallet();\n } catch (switchError) {\n try {\n await wallet.provider.request!({\n method: 'wallet_addEthereumChain',\n params: [\n {\n chainId: '0xa86a',\n chainName: 'Avalanche Network',\n nativeCurrency: {\n name: 'avax',\n symbol: 'AVAX',\n decimals: 18,\n },\n rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'],\n blockExplorerUrls: ['https://snowtrace.io/'],\n },\n ],\n });\n activateBrowserWallet();\n } catch (addError) {\n alert(\n `Your wallet may be connected to an unsupported network. Please manually switch to a supported network: ${addError}`\n );\n }\n }\n } else if (accounts.length > 0 && !account) {\n activateBrowserWallet();\n }\n })();\n }, [active, chainId]);\n\n const location = useLocation();\n useEffect(() => window.scrollTo(0, 0), [location]);\n\n return (\n \n \n \n \n \n {addresses ? (\n <>\n \n \n \n \n \n \n \n
\n \n {/* */}\n \n {params.children}\n \n \n
\n \n \n ) : (\n \n )}\n
\n
\n
\n
\n
\n );\n};\n","import { Progress } from '@chakra-ui/react';\nimport { CurrencyValue } from '@usedapp/core';\nimport { parseEther } from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber } from '@usedapp/core/node_modules/ethers';\nimport React, { useEffect, useState } from 'react';\nimport {\n ParsedPositionMetaRow,\n parsePositionMeta,\n useStable,\n useUpdatedMetadataLiquidatablePositions,\n useUpdatedPositions,\n} from '../chain-interaction/contracts';\nimport { parseFloatCurrencyValue } from '../utils';\nimport { StrategyMetadataContext } from './StrategyMetadataContext';\n\nexport const LiquidatablePositionsContext = React.createContext<\n ParsedPositionMetaRow[] | []\n>([]);\n\ntype CachedPos = {\n trancheId: number;\n strategy: string;\n collateral: string;\n debt: number;\n token: string;\n collateralValue: number;\n borrowablePer10k: number;\n owner: string;\n trancheContract: string;\n};\n\nexport function LiquidatablePositionsCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const tokenPrices = Object.fromEntries(\n Object.entries(React.useContext(StrategyMetadataContext))\n .filter((row) => Object.values(row[1]).length > 0)\n .map(([tokenAddress, stratMeta]) => [\n tokenAddress,\n Object.values(stratMeta)[0].usdPrice,\n ])\n );\n const stable = useStable();\n\n const [cachedPositions, setCachedPosition] = useState<{\n tstamp: number;\n positions: Record;\n }>({\n tstamp: Date.now(),\n positions: {},\n });\n useEffect(() => {\n fetch(\n 'https://raw.githubusercontent.com/MoreMoney-Finance/craptastic-api/main/src/updated-positions.json'\n )\n .then((response) => response.json())\n .then(setCachedPosition)\n .catch((err) => {\n console.error('Failed to fetch cached positions');\n console.log(err);\n });\n }, []);\n const parsedCachePositions = Object.values(cachedPositions.positions)\n .map((pos) => ({\n trancheId: BigNumber.from(pos.trancheId),\n strategy: pos.strategy,\n collateral: BigNumber.from(pos.collateral),\n debt: parseEther(pos.debt.toString()),\n token: pos.token,\n collateralValue: parseEther(pos.collateralValue.toString()),\n borrowablePer10k: BigNumber.from(pos.borrowablePer10k),\n owner: pos.owner,\n yield: BigNumber.from(0),\n trancheContract: pos.trancheContract,\n }))\n .map((pos) => parsePositionMeta(pos, stable, pos.trancheContract));\n\n const START = cachedPositions.tstamp;\n const updatedPositions = useUpdatedPositions(START);\n console.log('parseCachePositions', parsedCachePositions);\n console.log('updatedPositions', updatedPositions);\n const jointUpdatedPositions = [...parsedCachePositions, ...updatedPositions];\n const updatedMetadata =\n useUpdatedMetadataLiquidatablePositions(parsedCachePositions);\n const updatedPositionMetadata = updatedMetadata\n .map((x) => (x && x[0] != undefined ? x[0] : []))\n .map((pos) => {\n return parsePositionMeta(pos, stable, pos.trancheContract);\n });\n\n const updatedDataMap = updatedPositionMetadata.reduce((acc, x) => {\n acc[x.trancheId] = x;\n return acc;\n }, {} as Record);\n\n const parsedPositions = new Map();\n for (let index = 0; index < jointUpdatedPositions.length; index++) {\n const pos = jointUpdatedPositions[index];\n const posUpdatedData = {\n ...updatedDataMap[pos.trancheId],\n trancheContract: pos.trancheContract,\n };\n parsedPositions.set(pos.trancheId, posUpdatedData);\n }\n const dollar = new CurrencyValue(stable, parseEther('1'));\n\n const stableTickers = [\n 'USDT',\n 'USDC',\n 'DAI',\n 'FRAX',\n 'USDT.e',\n 'USDC.e',\n 'DAI.e',\n ];\n\n const liquidatablePositions = Array.from(parsedPositions.values())\n .filter((posMeta) => {\n return (\n 1.25 * posMeta.liquidationPrice > tokenPrices[posMeta.token?.address] &&\n posMeta.debt.gt(dollar)\n );\n })\n .map((posMeta) => {\n const collateralVal =\n parseFloatCurrencyValue(posMeta.collateral!) *\n tokenPrices[posMeta.token?.address];\n const totalPercentage =\n parseFloatCurrencyValue(posMeta.collateral!) > 0 &&\n tokenPrices[posMeta.token?.address] > 0\n ? (100 * parseFloatCurrencyValue(posMeta.debt)) / collateralVal\n : 0;\n const liquidatableZone = posMeta.borrowablePercent;\n const criticalZone = (90 * posMeta.borrowablePercent) / 100;\n const riskyZone = (80 * posMeta.borrowablePercent) / 100;\n const healthyZone = (50 * posMeta.borrowablePercent) / 100;\n\n const positionHealthColor = posMeta.debt.value.lt(parseEther('0.1'))\n ? 'accent'\n : totalPercentage > liquidatableZone\n ? 'purple.400'\n : totalPercentage > criticalZone\n ? 'red'\n : totalPercentage > riskyZone\n ? 'orange'\n : totalPercentage > healthyZone\n ? 'green'\n : 'accent';\n\n const positionHealth = {\n accent: 'Safe',\n green: 'Healthy',\n orange: 'Risky',\n red: 'Critical',\n ['purple.400']: 'Liquidatable',\n };\n\n return {\n ...posMeta,\n liquidateButton:\n posMeta.liquidationPrice > tokenPrices[posMeta.token?.address],\n positionHealthColor: positionHealthColor,\n parsedPositionHealth: positionHealth[positionHealthColor],\n collateralValue: new CurrencyValue(\n stable,\n parseEther(collateralVal.toFixed(18))\n ),\n };\n })\n .map((posMeta) => {\n const positionHealthOrder = new Map([\n ['Safe', 4],\n ['Healthy', 3],\n ['Risky', 2],\n ['Critical', 1],\n ['Liquidatable', 0],\n ]);\n\n return {\n ...posMeta,\n positionHealthOrder:\n positionHealthOrder.get(posMeta.parsedPositionHealth) ?? 4,\n };\n })\n .filter((posMeta) => !stableTickers.includes(posMeta.token?.ticker))\n //sort liquidatable first\n .sort(function (a, b) {\n return a.positionHealthOrder - b.positionHealthOrder;\n });\n\n return (\n \n {Object.values(updatedDataMap).length > 0 ? (\n children\n ) : (\n \n )}\n \n );\n}\n","import { Button, Flex, useClipboard } from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport default function CopyClipboard({\n value,\n label,\n}: {\n value: string;\n label?: string;\n}) {\n const { hasCopied, onCopy } = useClipboard(value);\n\n return (\n <>\n \n \n \n \n );\n}\n","import {\n Accordion,\n AccordionItem,\n AccordionButton,\n Box,\n AccordionIcon,\n AccordionPanel,\n Button,\n} from '@chakra-ui/react';\nimport { useEthers, getExplorerAddressLink } from '@usedapp/core';\nimport * as React from 'react';\nimport { useAddresses } from '../../../chain-interaction/contracts';\nimport CopyClipboard from './CopyClipboard/CopyClipboard';\n\nexport default function AllAddresses(props: React.PropsWithChildren) {\n const addresses = useAddresses();\n const { chainId } = useEthers();\n\n return (\n
\n \n \n

\n \n \n Addresses.json\n \n \n \n

\n \n
\n \n \n \n \n \n \n \n {Object.entries(addresses).map(([key, value]) => (\n \n \n \n \n \n ))}\n \n
Deployment NameCopy ClipboardFees
\n \n {key}\n \n \n \n \n \n
\n
    \n {props.children}\n
    \n
    \n
    \n
    \n {props.children}\n
    \n );\n}\n","export const deprecatedTokenList: string[] = [\n '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',\n '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',\n '0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33',\n '0xd5a37dC5C9A396A03dd1136Fc76A1a02B1c88Ffa',\n];\n","import { HStack, AvatarGroup, Avatar, Text, Flex } from '@chakra-ui/react';\nimport { Token } from '@usedapp/core';\nimport * as React from 'react';\nimport {\n getAuxIconFromTokenAddress,\n getIconsFromTokenAddress,\n} from '../../chain-interaction/tokens';\nimport { deprecatedTokenList } from '../../constants/deprecated-token-list';\n\nexport function TokenDescription({\n token,\n iconSize,\n textSize,\n}: {\n token?: Token;\n iconSize?: string;\n textSize?: string;\n}) {\n const targetSize = iconSize ?? 'xs';\n const auxIcon = getAuxIconFromTokenAddress(token?.address ?? '');\n const isDeprecated = deprecatedTokenList.includes(token?.address ?? '');\n\n return token ? (\n \n \n \n {(getIconsFromTokenAddress(token.address) ?? []).map((iconUrl, i) => (\n \n ))}\n \n  \n \n {token.ticker}\n {isDeprecated ? <>(deprecated) : ''}\n \n  \n {auxIcon ? (\n <>\n (\n \n \n \n )\n \n ) : undefined}\n \n \n ) : (\n Loading token information\n );\n}\n","import { Interface } from '@ethersproject/abi';\nimport { Contract } from '@ethersproject/contracts';\nimport IERC20 from '@openzeppelin/contracts/build/contracts/IERC20.json';\nimport { useContractFunction } from '@usedapp/core';\nimport { Token } from '@usedapp/core/dist/esm/src/model';\nimport {\n parseEther,\n parseUnits,\n} from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber, ethers } from 'ethers';\nimport { getAddress } from 'ethers/lib/utils';\nimport { useContext } from 'react';\nimport { UserAddressContext } from '../contexts/UserAddressContext';\nimport OracleRegistry from '../contracts/artifacts/contracts/OracleRegistry.sol/OracleRegistry.json';\nimport IsolatedLending from '../contracts/artifacts/contracts/IsolatedLending.sol/IsolatedLending.json';\nimport CurvePoolRewards from '../contracts/artifacts/contracts/rewards/CurvePoolRewards.sol/CurvePoolRewards.json';\nimport AMMYieldConverter from '../contracts/artifacts/contracts/strategies/AMMYieldConverter.sol/AMMYieldConverter.json';\nimport YieldConversionStrategy from '../contracts/artifacts/contracts/strategies/YieldConversionStrategy.sol/YieldConversionStrategy.json';\nimport YieldYakStrategy from '../contracts/artifacts/contracts/strategies/YieldYakStrategy.sol/YieldYakStrategy.json';\nimport StableLending from '../contracts/artifacts/contracts/StableLending.sol/StableLending.json';\nimport DirectFlashLiquidation from '../contracts/artifacts/contracts/liquidation/DirectFlashLiquidation.sol/DirectFlashLiquidation.json';\nimport Strategy from '../contracts/artifacts/contracts/Strategy.sol/Strategy.json';\nimport WrapNativeIsolatedLending from '../contracts/artifacts/contracts/WrapNativeIsolatedLending.sol/WrapNativeIsolatedLending.json';\nimport IOracle from '../contracts/artifacts/interfaces/IOracle.sol/IOracle.json';\nimport VestingLaunchReward from '../contracts/artifacts/contracts/rewards/VestingLaunchReward.sol/VestingLaunchReward.json';\nimport xMore from '../contracts/artifacts/contracts/governance/xMore.sol/xMore.json';\nimport {\n useAddresses,\n useRegisteredOracle,\n useStable,\n useYieldConversionStrategyView,\n} from './contracts';\n\nexport function useWithdrawFees(strategyAddress: string, tokenAddress: string) {\n const contractsABI: Record = {\n [useAddresses().YieldYakStrategy]: new Interface(YieldYakStrategy.abi),\n [useAddresses().StableLending]: new Interface(StableLending.abi),\n [useAddresses().IsolatedLending]: new Interface(IsolatedLending.abi),\n };\n const isYY = useAddresses().YieldYakStrategy === strategyAddress;\n\n const feesContract = new Contract(\n strategyAddress,\n contractsABI[strategyAddress] ?? new Interface(StableLending.abi)\n );\n const { send, state } = useContractFunction(feesContract, 'withdrawFees');\n\n return {\n sendWithdrawFees:\n contractsABI[strategyAddress] === undefined\n ? null\n : isYY\n ? () => send(tokenAddress)\n : () => send(),\n withdrawState: state,\n };\n}\n\nexport function useUnstakeMore() {\n // TODO: change cprAddress and the ABI to use the correct address\n const cprAddress = useAddresses().xMore;\n const cprContract = new Contract(cprAddress, new Interface(xMore.abi));\n const { send, state } = useContractFunction(cprContract, 'leave');\n\n return {\n sendUnstake: (leaveMoreToken: Token, amount: string | number) => {\n const sAmount = parseUnits(amount.toString(), leaveMoreToken.decimals);\n return send(sAmount);\n },\n unstakeState: state,\n };\n}\n\nexport function useStakeMore() {\n // TODO: change cprAddress and the ABI to use the correct address\n const cprAddress = useAddresses().xMore;\n const cprContract = new Contract(cprAddress, new Interface(xMore.abi));\n const { send, state } = useContractFunction(cprContract, 'enter');\n\n return {\n sendStake: (stakeMoreToken: Token, amount: string | number) => {\n const sAmount = parseUnits(amount.toString(), stakeMoreToken.decimals);\n return send(sAmount);\n },\n stakeState: state,\n };\n}\n\nexport function useClaimReward() {\n const ilAddress = useAddresses().CurvePoolRewards;\n const ilContract = new Contract(\n ilAddress,\n new Interface(CurvePoolRewards.abi)\n );\n const { send, state } = useContractFunction(\n ilContract,\n 'withdrawVestedReward'\n );\n\n return {\n sendClaim: () => {\n return send();\n },\n claimState: state,\n };\n}\n\nexport function useStake() {\n const cprAddress = useAddresses().CurvePoolRewards;\n const cprContract = new Contract(\n cprAddress,\n new Interface(CurvePoolRewards.abi)\n );\n const { send, state } = useContractFunction(cprContract, 'stake');\n\n return {\n sendStake: (stakeToken: Token, amount: string | number) => {\n const sAmount = parseUnits(amount.toString(), stakeToken.decimals);\n return send(sAmount);\n },\n stakeState: state,\n };\n}\n\nexport function useWithdraw() {\n const cprAddress = useAddresses().CurvePoolRewards;\n const cprContract = new Contract(\n cprAddress,\n new Interface(CurvePoolRewards.abi)\n );\n const { send, state } = useContractFunction(cprContract, 'withdraw');\n\n return {\n sendWithdraw: (withdrawToken: Token, amount: string | number) => {\n const wAmount = parseUnits(amount.toString(), withdrawToken.decimals);\n return send(wAmount);\n },\n withdrawState: state,\n };\n}\n\nexport function useNativeDepositBorrowTrans(\n trancheId: number | null | undefined,\n lendingAddress: string | undefined | null\n) {\n const addresses = useAddresses();\n const lendingContract = new Contract(\n lendingAddress === addresses.IsolatedLending\n ? addresses.WrapNativeIsolatedLending\n : addresses.WrapNativeStableLending,\n new Interface(WrapNativeIsolatedLending.abi)\n );\n const { send, state } = useContractFunction(\n lendingContract,\n trancheId ? 'depositAndBorrow' : 'mintDepositAndBorrow'\n );\n const account = useContext(UserAddressContext);\n\n return {\n sendDepositBorrow: (\n collateralToken: Token,\n strategyAddress: string,\n collateralAmount: string | number,\n borrowAmount: string | number\n ) => {\n const cAmount = parseUnits(\n collateralAmount.toString(),\n collateralToken.decimals\n );\n const bAmount = parseEther(borrowAmount.toString());\n\n return trancheId\n ? send(trancheId, bAmount, account, { value: cAmount })\n : send(strategyAddress, bAmount, account, { value: cAmount });\n },\n depositBorrowState: state,\n };\n}\n\nexport function useNativeRepayWithdrawTrans(\n trancheId: number | null | undefined,\n collateralToken: Token | null | undefined,\n lendingAddress: string | undefined | null\n) {\n const addresses = useAddresses();\n const lendingContract = new Contract(\n lendingAddress === addresses.IsolatedLending\n ? addresses.WrapNativeIsolatedLending\n : addresses.WrapNativeStableLending,\n new Interface(WrapNativeIsolatedLending.abi)\n );\n\n const { send, state } = useContractFunction(\n lendingContract,\n 'repayAndWithdraw'\n );\n\n const account = useContext(UserAddressContext);\n\n return {\n sendRepayWithdraw: (\n collateralAmount: string | number,\n repayAmount: string | number\n ) =>\n account && trancheId && collateralToken\n ? send(\n trancheId,\n parseUnits(collateralAmount.toString(), collateralToken.decimals),\n parseEther(repayAmount.toString()),\n account\n )\n : console.error('Trying to withdraw but parameters not set'),\n repayWithdrawState: state,\n };\n}\n\nexport function useDepositBorrowTrans(\n trancheId: number | null | undefined,\n lendingAddress: string | undefined | null\n) {\n const addresses = useAddresses();\n const lendingContract = new Contract(\n lendingAddress === addresses.IsolatedLending\n ? addresses.IsolatedLending\n : addresses.StableLending,\n new Interface(IsolatedLending.abi)\n );\n const { send, state } = useContractFunction(\n lendingContract,\n trancheId ? 'depositAndBorrow' : 'mintDepositAndBorrow'\n );\n const account = useContext(UserAddressContext);\n\n return {\n sendDepositBorrow: (\n collateralToken: Token,\n strategyAddress: string,\n collateralAmount: string | number,\n borrowAmount: string | number\n ) => {\n const cAmount = parseUnits(\n collateralAmount.toString(),\n collateralToken.decimals\n );\n const bAmount = parseEther(borrowAmount.toString());\n\n return trancheId\n ? send(trancheId, cAmount, bAmount, account)\n : send(\n collateralToken.address,\n strategyAddress,\n cAmount,\n bAmount,\n account\n );\n },\n depositBorrowState: state,\n };\n}\n\nexport function useApproveTrans(tokenAddress: string) {\n const tokenContract = new Contract(tokenAddress, new Interface(IERC20.abi));\n const { send, state } = useContractFunction(tokenContract, 'approve');\n\n return {\n sendApprove: (spender: string) =>\n send(spender, ethers.constants.MaxUint256),\n approveState: state,\n };\n}\n\nexport function useRepayWithdrawTrans(\n trancheId: number | null | undefined,\n collateralToken: Token | null | undefined,\n lendingAddress: string | undefined | null\n) {\n const addresses = useAddresses();\n const lendingContract = new Contract(\n lendingAddress === addresses.IsolatedLending\n ? addresses.IsolatedLending\n : addresses.StableLending,\n new Interface(IsolatedLending.abi)\n );\n\n const { send, state } = useContractFunction(\n lendingContract,\n 'repayAndWithdraw'\n );\n\n const account = useContext(UserAddressContext);\n\n return {\n sendRepayWithdraw: (\n collateralAmount: string | number,\n repayAmount: string | number\n ) =>\n account && trancheId && collateralToken\n ? send(\n trancheId,\n parseUnits(collateralAmount.toString(), collateralToken.decimals),\n parseEther(repayAmount.toString()),\n account\n )\n : console.error('Trying to withdraw but parameters not set'),\n repayWithdrawState: state,\n };\n}\n\nexport function useTallyHarvestBalance(strategyAddress: string) {\n const strategy = new Contract(strategyAddress, new Interface(Strategy.abi));\n const { send, state } = useContractFunction(strategy, 'tallyHarvestBalance');\n\n return {\n sendTallyHarvestBalance: (tokenAddress: string) => send(tokenAddress),\n tallyHarvestState: state,\n };\n}\n\nexport function useConvertReward2Stable(contractAddress: string) {\n const strategy = new Contract(\n contractAddress,\n new Interface(YieldConversionStrategy.abi)\n );\n const { send, state } = useContractFunction(strategy, 'convertReward2Stable');\n\n return {\n sendConvertReward2Stable: (rewardAmount: BigNumber, targetBid: BigNumber) =>\n send(rewardAmount, targetBid),\n convertReward2StableState: state,\n };\n}\n\nexport function useUpdateOraclePrice() {\n const addresses = useAddresses();\n const inAmount = parseEther('1');\n const stable = useStable();\n\n const strategy = new Contract(\n addresses.OracleRegistry,\n new Interface(OracleRegistry.abi)\n );\n const { send, state } = useContractFunction(strategy, 'getAmountInPeg');\n\n return {\n sendUpdateOraclePrice: (tokenAddress: string) =>\n send(tokenAddress, inAmount, stable.address),\n updateOraclePriceState: state,\n };\n}\n\nexport function useHarvestPartially(strategyAddress: string) {\n const strategy = new Contract(\n strategyAddress,\n new Interface(YieldConversionStrategy.abi)\n );\n const { send, state } = useContractFunction(strategy, 'harvestPartially');\n return {\n sendHarvestPartially: (tokenAddress: string) => send(tokenAddress),\n harvestPartiallyState: state,\n };\n}\n\nexport function useMigrateStrategy(\n lendingContractAddress: string | undefined | null\n) {\n const addresses = useAddresses();\n const lendingAddress =\n lendingContractAddress ??\n addresses.StableLending ??\n addresses.IsolatedLending;\n\n const strategy = new Contract(\n lendingAddress,\n new Interface(IsolatedLending.abi)\n );\n const { send, state } = useContractFunction(strategy, 'migrateStrategy');\n\n return {\n sendMigrateStrategy: (\n trancheId: number,\n targetStrategy: string,\n stable: Token,\n account: string\n ) => send(trancheId, targetStrategy, stable.address, account),\n migrateStrategyState: state,\n };\n}\n\nconst PNG = '0x60781C2586D68229fde47564546784ab3fACA982';\nconst JOE = '0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd';\nconst USDCe = '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664';\nconst USDTe = '0xc7198437980c041c805A1EDcbA50c1Ce5db95118';\n\nconst ammDefaults: Record = {\n [PNG]: {\n router: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106',\n path: [PNG, USDCe],\n },\n [JOE]: {\n router: '0x60aE616a2155Ee3d9A68541Ba4544862310933d4',\n path: [JOE, USDCe],\n },\n [USDTe]: {\n router: '0x60aE616a2155Ee3d9A68541Ba4544862310933d4',\n path: [USDTe, USDCe],\n },\n};\n\nexport function useAMMHarvest(strategyAddress: string) {\n const conversionAddress = useAddresses().AMMYieldConverter;\n const conversionContract = new Contract(\n conversionAddress,\n new Interface(AMMYieldConverter.abi)\n );\n const rewardToken: string | undefined = useYieldConversionStrategyView(\n strategyAddress,\n 'rewardToken',\n [],\n undefined\n );\n\n const undefinedArgs = { router: undefined, path: undefined };\n const { router, path } = rewardToken\n ? ammDefaults[getAddress(rewardToken)] ?? undefinedArgs\n : undefinedArgs;\n const { send, state } = useContractFunction(conversionContract, 'harvest');\n\n return {\n sendAMMHarvest: (yieldBearingToken: string) => {\n // console.log(\n // 'Sending AMM harvest',\n // strategyAddress,\n // yieldBearingToken,\n // router,\n // path\n // );\n send(strategyAddress, yieldBearingToken, router, path);\n },\n AMMHarvestState: state,\n };\n}\n\nexport function useUpdatePriceOracle(token?: Token) {\n const oracleAddress = useRegisteredOracle(token?.address);\n const oracleContract =\n oracleAddress && new Contract(oracleAddress, IOracle.abi);\n const stable = useStable();\n\n const { send, state } = useContractFunction(oracleContract, 'getAmountInPeg');\n return {\n sendUpdatePriceOracle: () =>\n token && send(token.address, parseEther('1'), stable.address),\n updatePriceOracleState: state,\n };\n}\n\nexport function useLiquidationTrans(contractAddress: string) {\n const liquidationContract = new Contract(\n contractAddress,\n new Interface(DirectFlashLiquidation.abi)\n );\n const { send, state } = useContractFunction(liquidationContract, 'liquidate');\n\n return {\n sendLiquidation: send,\n liquidationState: state,\n };\n}\n\nexport function useWithdrawLaunchVestingTrans() {\n const addresses = useAddresses();\n return useContractFunction(\n new Contract(\n addresses.VestingLaunchReward,\n new Interface(VestingLaunchReward.abi)\n ),\n 'burn'\n );\n}\n","import {\n Button,\n Modal,\n ModalBody,\n ModalCloseButton,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalOverlay,\n useDisclosure,\n} from '@chakra-ui/react';\nimport { TransactionStatus } from '@usedapp/core';\nimport * as React from 'react';\nimport { useEffect } from 'react';\n\nexport function TransactionErrorDialog({\n title,\n state,\n}: {\n title: string;\n state: TransactionStatus;\n}) {\n const { isOpen, onOpen, onClose } = useDisclosure();\n\n useEffect(() => {\n if (['Fail', 'Exception'].includes(state.status)) {\n onOpen();\n }\n }, [state]);\n\n return (\n <>\n \n \n \n {title} - Transaction Failed\n \n {state.errorMessage}\n \n \n \n \n \n \n );\n}\n","import { Button } from '@chakra-ui/react';\nimport { Token } from '@usedapp/core';\nimport * as React from 'react';\nimport { useUpdateOraclePrice } from '../../../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../../../components/notifications/TransactionErrorDialog';\n\nexport default function UpdatePriceOracle({ token }: { token: Token }) {\n const { sendUpdateOraclePrice, updateOraclePriceState } =\n useUpdateOraclePrice();\n\n return (\n <>\n \n {\n sendUpdateOraclePrice(token.address);\n }}\n >\n Update Price Oracle\n \n \n );\n}\n","import { Button } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedStratMetaRow } from '../../../../../chain-interaction/contracts';\nimport { useWithdrawFees } from '../../../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../../../components/notifications/TransactionErrorDialog';\n\nexport default function WithdrawFees({\n stratMeta,\n}: React.PropsWithChildren<{ stratMeta: ParsedStratMetaRow }>) {\n const { sendWithdrawFees, withdrawState } = useWithdrawFees(\n stratMeta.strategyAddress,\n stratMeta.token.address\n );\n\n const withdrawFees = () => {\n sendWithdrawFees!();\n };\n\n return (\n <>\n {sendWithdrawFees !== null ? (\n <>\n \n \n \n ) : (\n <>\n )}\n \n );\n}\n","import { Button, Flex } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { TokenDescription } from '../../../../components/tokens/TokenDescription';\nimport { StrategyMetadataContext } from '../../../../contexts/StrategyMetadataContext';\nimport CopyClipboard from '../CopyClipboard/CopyClipboard';\nimport UpdatePriceOracle from './components/UpdatePriceOracle';\nimport WithdrawFees from './components/WithdrawFees';\n\nexport default function AllContracts(props: React.PropsWithChildren) {\n const stratMeta = React.useContext(StrategyMetadataContext);\n return (\n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n {Object.values(stratMeta).map((strat) => {\n return Object.values(strat).map((strat, index) => {\n return (\n \n \n \n \n \n \n \n );\n });\n })}\n \n
    AssetStrategyFeesOracleHarvest
    \n \n \n \n \n \n

    {strat.strategyName}

    \n
    \n \n \n \n \n \n
    \n {props.children}\n
    \n );\n}\n","import { Button, Td, Text, Tr } from '@chakra-ui/react';\nimport { CurrencyValue } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n useStable,\n} from '../../../../../chain-interaction/contracts';\nimport { TokenDescription } from '../../../../../components/tokens/TokenDescription';\nimport CopyClipboard from '../../CopyClipboard/CopyClipboard';\nimport { LiquidatableAction } from './PositionsTable';\n\nexport function PositionsRow(\n params: React.PropsWithChildren<\n ParsedStratMetaRow & ParsedPositionMetaRow & { action?: LiquidatableAction }\n >\n) {\n const { token, action, liquidateButton } = params;\n\n // const location = useLocation();\n // const details = location.search?.includes('details=true');\n\n // console.log('details', details);\n\n const actionArgs =\n action && action.args ? action.args : () => ({} as Record);\n\n const stable = useStable();\n\n // const walletBalance =\n // useWalletBalance(token.address) ??\n // new CurrencyValue(token, BigNumber.from('0'));\n // console.log(\n // `wallet balance for ${token.name}: ${walletBalance.format({\n // significantDigits: 30,\n // })} (${token.address})`\n // );\n\n const collateral =\n 'collateral' in params && params.collateral\n ? params.collateral\n : new CurrencyValue(token, BigNumber.from(0));\n const debt =\n 'debt' in params && params.debt.gt(params.yield)\n ? params.debt.sub(params.yield)\n : new CurrencyValue(stable, BigNumber.from(0));\n\n return (\n \n \n \n View\n \n \n {/* \n \n {parsedPositionHealth ?? ''}\n \n */}\n \n \n \n \n \n \n\n {((1 / (params.borrowablePercent / 100)) * 100).toFixed(2) + '%'}\n\n \n {debt.isZero()\n ? '∞'\n : (\n params.collateralValue.value\n .mul(10000)\n .div(debt.value)\n .toNumber() / 100\n ).toFixed(1)}\n %\n \n\n \n $ {params.liquidationPrice.toFixed(2)}\n \n\n \n {collateral.format({\n significantDigits: Infinity,\n suffix: '',\n })}\n \n\n \n {debt.format({\n significantDigits: 3,\n suffix: '',\n })}\n \n\n \n {liquidateButton ? (\n action.callback!(params),\n }\n : actionArgs(params))}\n >\n Liquidate\n \n ) : (\n Not Liquidatable Yet\n )}\n \n \n );\n}\n","import { Table, Tbody, Td, Thead, Tr } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedPositionMetaRow } from '../../../../../chain-interaction/contracts';\nimport { StrategyMetadataContext } from '../../../../../contexts/StrategyMetadataContext';\nimport { PositionsRow } from './PositionsRow';\n\nexport type LiquidatableAction = {\n args?: (pos: ParsedPositionMetaRow) => Record;\n callback?: (pos: ParsedPositionMetaRow) => void;\n label: string;\n};\n\nexport function PositionsTable({\n positions,\n action,\n}: {\n positions: ParsedPositionMetaRow[];\n action?: LiquidatableAction;\n}) {\n const allStratMeta = React.useContext(StrategyMetadataContext);\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n {positions.map((posMeta, i) => {\n const stratMeta = allStratMeta[posMeta.token.address];\n const data = { action, ...posMeta, ...stratMeta[posMeta.strategy] };\n if (posMeta.collateralValue.isZero()) {\n return <>;\n }\n return ;\n })}\n \n
    ViewAssetTranche IdMin Col RatioCurrent Col RatioLiquidation priceCollateralDebtLiquidate
    \n );\n}\n","import { parseEther } from '@ethersproject/units';\nimport * as React from 'react';\nimport { useUpdatedPositions } from '../../../../chain-interaction/contracts';\nimport { PositionsTable } from './components/PositionsTable';\n\nexport default function AllOpenPositions(\n props: React.PropsWithChildren\n) {\n const updatedPositions = useUpdatedPositions(1646182247947).filter(\n (position) => {\n return position?.collateralValue.value.gt(parseEther('0.01'));\n }\n );\n return (\n <>\n
    \n \n {props.children}\n
    \n \n );\n}\n","import { Container } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { useParams } from 'react-router-dom';\nimport AllAddresses from './components/AllAddresses';\nimport AllContracts from './components/AllContracts/AllContracts';\nimport AllOpenPositions from './components/AllOpenPositions/AllOpenPositions';\n\nexport default function AdminPage(props: React.PropsWithChildren) {\n const { positions } = useParams();\n return (\n <>\n \n \n {props.children}\n \n {positions ? : ''}\n \n \n );\n}\n","import * as React from 'react';\nimport { Box, Text } from '@chakra-ui/react';\n\nexport function AnalyticsBox({\n title,\n subtitle,\n value,\n}: {\n title: string;\n subtitle: string;\n value: string;\n}) {\n return (\n \n {title}\n \n {subtitle}\n \n \n {value}\n \n \n );\n}\n","import { Box, Container, Grid, Text } from '@chakra-ui/react';\nimport {\n CurrencyValue,\n ERC20Interface,\n useContractCalls,\n useEthers,\n} from '@usedapp/core';\nimport { parseEther } from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber, ethers } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport {\n DeploymentAddresses,\n ParsedStakingMetadata,\n useAddresses,\n useAllFeesEver,\n useParsedStakingMetadata,\n useStable,\n useTotalSupply,\n} from '../../chain-interaction/contracts';\nimport { tokenAmount } from '../../chain-interaction/tokens';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { AnalyticsBox } from './AnalyticsBox';\n\nexport default function Analytics(props: React.PropsWithChildren) {\n const allStratMeta = React.useContext(StrategyMetadataContext);\n\n const account = useContext(UserAddressContext);\n const addresses = useAddresses();\n\n const stakeMeta: ParsedStakingMetadata[] = useParsedStakingMetadata(\n [addresses.CurvePoolRewards],\n account ?? ethers.constants.AddressZero\n ).flat(1);\n\n const feeContractNames = [\n 'IsolatedLending',\n 'StableLending',\n 'IsolatedLendingLiquidation',\n 'StableLendingLiquidation',\n ];\n const blacklist = [\n 'StrategyRegistry',\n 'StrategyTokenActivation',\n 'StrategyViewer',\n ];\n const keys: (keyof DeploymentAddresses)[] = Object.keys(\n addresses\n ) as (keyof DeploymentAddresses)[];\n const filteredNames = keys.filter((key) => {\n return (\n feeContractNames.includes(key) ||\n (key.includes('Strategy') && !blacklist.includes(key))\n );\n });\n\n const contracts = filteredNames.map((name) => {\n return addresses[name];\n });\n // console.log('contracts', contracts);\n const stable = useStable();\n const tvlsFarm = stakeMeta.reduce(\n (tvl, row) => tvl.add(row.tvl),\n new CurrencyValue(stable, BigNumber.from(0))\n );\n\n Object.values(allStratMeta)\n .flatMap((rows) => Object.values(rows))\n .map((row) => console.log(row.token.ticker, row.tvlInPeg.format()));\n const tvlNoFarm = Object.values(allStratMeta)\n .flatMap((rows) => Object.values(rows))\n .reduce(\n (tvl, row) => tvl.add(row.tvlInPeg),\n new CurrencyValue(stable, BigNumber.from(0))\n );\n\n const tvl = tvlNoFarm.add(tvlsFarm);\n\n const supply = useTotalSupply('totalSupply', [], ['']);\n\n const colRatio = !tvl.isZero()\n ? tvlNoFarm.value.mul(10000).div(supply.sub(0)).toNumber() / 100\n : 0;\n\n const fees = useAllFeesEver(contracts);\n\n const totalFees = fees\n .filter((fee) => fee)\n .filter((fee) => fee![0])\n .reduce(\n (total, fee) => total.add(new CurrencyValue(stable, fee![0])),\n new CurrencyValue(stable, BigNumber.from(0))\n );\n\n const circulatingBlacklist = [\n addresses.CurvePoolRewards,\n addresses.VestingLaunchReward,\n '0xcb2fb8db0e80adf47720d48e1ae9315e7d128808',\n '0xba8983fdde65354c1330e38d042c7d2f784ca3de',\n '0xc2Ee73EF5FF77c37dEBa2593EC80e5d4B655735E',\n ];\n\n function convert2ContractCall(holder: string) {\n return {\n abi: ERC20Interface,\n address: addresses.MoreToken,\n method: 'balanceOf',\n args: [holder],\n };\n }\n const balances = useContractCalls(\n circulatingBlacklist.map(convert2ContractCall)\n )\n .map(\n (result: any[] | undefined) =>\n (result ? result[0] : undefined) ?? BigNumber.from(0)\n )\n .reduce((agg, curr) => agg.add(curr));\n\n const { chainId } = useEthers();\n const circulatingSupply = chainId\n ? tokenAmount(\n chainId,\n addresses.MoreToken,\n parseEther('1000000000').sub(balances)\n )?.format({ useFixedPrecision: true, fixedPrecisionDigits: 0 }) ?? ''\n : '';\n\n return (\n \n Moremoney Analytics\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 \n \n \n \n \n {props.children}\n
    \n );\n}\n","export const hiddenStrategies: Record = {\n '0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd': [\n '0x888fC8d90177a4097e196EF6BBDc7d2e8CfFDb17',\n ],\n};\n","import { SearchIcon } from '@chakra-ui/icons';\nimport { Box, Input, InputGroup, InputLeftElement } from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport function TableSearch({\n setSearchString,\n}: {\n setSearchString: React.Dispatch>;\n}) {\n const handleSearch: React.ChangeEventHandler = (event) => {\n const stripped = event.target.value.trim();\n setSearchString(stripped.toLowerCase());\n };\n\n return (\n \n \n \n \n \n \n \n \n );\n}\n","import { Box, Tab, TabList, Tabs } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedStratMetaRow } from '../../../chain-interaction/contracts';\nimport { deprecatedTokenList } from '../../../constants/deprecated-token-list';\n\nexport function TableTabs({\n setTableTabFilter,\n stratMeta,\n}: {\n setTableTabFilter: React.Dispatch>;\n stratMeta: ParsedStratMetaRow[];\n}) {\n // const stableTickers = [\n // 'USDT',\n // 'USDC',\n // 'DAI',\n // 'FRAX',\n // 'USDT.e',\n // 'USDC.e',\n // 'DAI.e',\n // ];\n\n const lpTickers = stratMeta\n .filter((meta) => meta.token.ticker.includes('/'))\n .map((meta) => meta.token.ticker);\n\n const singleAssetTickers = stratMeta\n .filter((meta) => !meta.token.ticker.includes('/'))\n .map((meta) => meta.token.ticker);\n\n const deprecatedTickers = stratMeta\n .filter((meta) => deprecatedTokenList.includes(meta.token.address))\n .map((meta) => meta.token.ticker);\n\n return (\n \n {\n if (index === 0) {\n setTableTabFilter([]);\n // } else if (index === 1) {\n // setTableTabFilter(stableTickers);\n } else if (index === 1) {\n setTableTabFilter(singleAssetTickers);\n } else if (index === 2) {\n setTableTabFilter(lpTickers);\n } else if (index === 3) {\n setTableTabFilter(deprecatedTickers);\n }\n }}\n >\n \n All Assets\n {/* Stablecoins */}\n Single Asset\n LP Tokens\n Deprecated\n \n \n \n );\n}\n","import { InfoIcon } from '@chakra-ui/icons';\nimport {\n Box,\n Button,\n Container,\n Flex,\n Skeleton,\n Stack,\n Table,\n Tbody,\n Td,\n Text,\n Thead,\n Tooltip,\n Tr,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport { Link } from 'react-router-dom';\nimport { Column, useTable } from 'react-table';\nimport { ParsedStratMetaRow } from '../../../chain-interaction/contracts';\nimport { TokenDescription } from '../../../components/tokens/TokenDescription';\nimport { hiddenStrategies } from '../../../constants/hidden-strategies';\nimport { LiquidationFeesContext } from '../../../contexts/LiquidationFeesContext';\nimport { StrategyMetadataContext } from '../../../contexts/StrategyMetadataContext';\nimport { TableSearch } from './TableSearch';\nimport { TableTabs } from './TableTabs';\n\ntype Entity = ParsedStratMetaRow & {\n asset: any;\n apy: string;\n MONEYavailable: string;\n tvlPeg: string;\n totalBorrowed: string;\n liquidationFee: string;\n balance: number;\n ltv: string;\n};\n\nexport function AllSupportedCollateral() {\n const hiddenTokens: Set = new Set([]);\n\n const stratMeta: ParsedStratMetaRow[] = Object.values(\n React.useContext(StrategyMetadataContext)\n )\n .filter(\n (stratRows: Record) =>\n !hiddenTokens.has(Object.values(stratRows)[0].token.ticker)\n )\n .map((x: Record) => {\n const tokenAddress = x[Object.keys(x)[0]].token.address;\n const options = Object.values(x);\n const optionsFiltered = Object.values(x).filter(\n (y) =>\n hiddenStrategies[tokenAddress] &&\n !hiddenStrategies[tokenAddress].includes(y.strategyAddress)\n );\n return (\n hiddenStrategies[tokenAddress] && optionsFiltered.length > 0\n ? optionsFiltered\n : options\n ).reduce((aggStrat, nextStrat) => {\n return {\n ...aggStrat,\n APY: aggStrat.APY > nextStrat.APY ? aggStrat.APY : nextStrat.APY,\n debtCeiling: aggStrat.debtCeiling.add(nextStrat.debtCeiling),\n totalDebt: aggStrat.totalDebt.add(nextStrat.totalDebt),\n tvlInPeg: aggStrat.tvlInPeg.add(nextStrat.tvlInPeg),\n };\n });\n });\n\n const tokenFees = React.useContext(LiquidationFeesContext);\n const [tableTabFilter, setTableTabFilter] = React.useState([]);\n const [searchString, setSearchString] = React.useState('');\n\n const data = stratMeta\n .filter((meta) => {\n if (tableTabFilter.length === 0) {\n return true;\n } else if (tableTabFilter.includes(meta.token.ticker)) {\n return true;\n } else {\n return false;\n }\n })\n .filter((meta) =>\n searchString.length > 0\n ? meta.token.name.toLowerCase().includes(searchString) ||\n meta.token.ticker.toLowerCase().includes(searchString)\n : true\n )\n .map((meta) => {\n return {\n ...meta,\n asset: ,\n apy: Math.round(meta.APY) + '%',\n MONEYavailable: meta.debtCeiling.gt(meta.totalDebt)\n ? meta.debtCeiling.sub(meta.totalDebt).format({ suffix: '' })\n : '0',\n minColRatio: `${Math.round(\n (1 / (meta.borrowablePercent / 100)) * 100\n )}%`,\n ltv: `${5 * Math.round(meta.borrowablePercent / 5)}%`,\n tvlPeg: `$ ${meta.tvlInPeg.format({ suffix: '' })}`,\n totalBorrowed: meta.totalDebt.format({ significantDigits: 2 }),\n liquidationFee:\n (tokenFees.get(meta.token.address) ?? 'Loading...') + '%',\n balance: meta.balance,\n };\n })\n .sort(function (a, b) {\n if (a.token.ticker < b.token.ticker) {\n return -1;\n }\n if (a.token.ticker > b.token.ticker) {\n return 1;\n }\n return 0;\n })\n .sort((a, b) => b.balance - a.balance);\n\n function tooltip(colName: string, label: string) {\n return (\n \n {' '}\n {colName}  \n \n \n \n \n );\n }\n\n const columns = React.useMemo[]>(\n () => [\n {\n Header: tooltip(\n 'Collateral Asset ',\n 'The kinds of collateral you can deposit to borrow MONEY'\n ),\n accessor: 'asset',\n },\n {\n Header: tooltip(\n 'APY earned ',\n 'The yield you earn on your deposited collateral'\n ),\n accessor: 'apy',\n },\n {\n Header: tooltip(\n 'MONEY available ',\n 'How much in total still can be borrowed against this asset'\n ),\n accessor: 'MONEYavailable',\n },\n {\n Header: tooltip(\n 'TVL ',\n 'Total amount of this asset locked in our protocol, in US dollars'\n ),\n accessor: 'tvlPeg',\n },\n {\n Header: tooltip(\n 'Max LTV ',\n 'How much of your deposited value you can extract as MONEY loan'\n ),\n accessor: 'ltv',\n },\n {\n Header: tooltip(\n 'Liquidation Fee ',\n 'Percentage of loan paid if you get liquidated'\n ),\n accessor: 'liquidationFee',\n },\n ],\n []\n );\n\n const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =\n useTable({ columns, data });\n\n return (\n <>\n \n \n Select a collateral asset to\n \n \n Open an interest-free debt position\n \n \n that improves with yield from\n \n \n collateral\n \n \n\n \n \n \n \n \n \n \n\n \n {rows.map((row) => {\n prepareRow(row);\n const headers = headerGroups\n .map((headerGroup) => {\n return headerGroup.headers.map((column) =>\n column.render('Header')\n );\n })\n .flat(1);\n return (\n // eslint-disable-next-line\n \n {row.cells.map((cell, index) => {\n // eslint-disable-next-line\n return (\n \n \n {headers[index]}\n \n {cell.render('Cell')}\n \n );\n })}\n {/* */}\n {/* */}\n \n View\n \n \n );\n })}\n \n\n \n \n {headerGroups.map((headerGroup) => (\n // eslint-disable-next-line\n \n {headerGroup.headers.map((column) => (\n // eslint-disable-next-line\n \n {column.render('Header')}\n \n ))}\n \n ))}\n \n \n {rows.map((row) => {\n prepareRow(row);\n return (\n // eslint-disable-next-line\n \n {row.cells.map((cell) => {\n // eslint-disable-next-line\n return (\n // eslint-disable-next-line\n {cell.render('Cell')}\n );\n })}\n \n );\n })}\n \n \n {rows.length === 0 ? (\n \n {['60px', '60px', '60px', '60px', '60px', '60px'].map(\n (obj, index) => (\n \n )\n )}\n \n ) : (\n <>\n )}\n \n \n );\n}\n","import * as React from 'react';\nimport { Outlet } from 'react-router-dom';\nimport { AllSupportedCollateral } from './components/AllSupportedCollateral';\n\nexport default function Dashboard(params: React.PropsWithChildren) {\n // const account = React.useContext(UserAddressContext);\n // const location = useLocation();\n // const details = location.search?.includes('details=true');\n\n return (\n <>\n {params.children}\n \n \n \n );\n}\n","import React from 'react';\n\nexport class ErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false, errorMsg: '' };\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { hasError: true, errorMsg: error.toString() };\n }\n\n componentDidCatch(error, errorInfo) {\n // You can also log the error to an error reporting service\n console.log('error', error, errorInfo);\n this.setState({ hasError: true, errorMsg: error.toString() });\n // logErrorToMyService(error, errorInfo);\n }\n\n render() {\n if (this.state.hasError) {\n // You can render any custom fallback UI\n return (\n <>\n

    Something went wrong.

    \n
    \n
    \n
    \n {this.state.errorMsg}\n \n );\n }\n\n return this.props.children;\n }\n}\n","import { InfoOutlineIcon } from '@chakra-ui/icons';\nimport { Avatar, Button, HStack, Link, Text, VStack } from '@chakra-ui/react';\nimport { Token } from '@usedapp/core';\nimport * as React from 'react';\nimport { ParsedStakingMetadata } from '../../../chain-interaction/contracts';\nimport { getIconsFromTokenAddress } from '../../../chain-interaction/tokens';\nimport { useClaimReward } from '../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { parseFloatCurrencyValue } from '../../../utils';\n\nexport default function ClaimReward({\n token,\n stakeMeta,\n}: React.PropsWithChildren<{\n token: Token;\n stakeMeta: ParsedStakingMetadata;\n}>) {\n const { sendClaim, claimState } = useClaimReward();\n\n const buttonDisabled = stakeMeta?.vested?.isZero();\n console.log(buttonDisabled);\n\n const timeDelta = (Date.now() - stakeMeta.vestingStart.getTime()) / 1000;\n\n const vested =\n (parseFloatCurrencyValue(stakeMeta.rewards) * timeDelta) /\n (60 * 24 * 60 * 60);\n\n return (\n \n \n Vested Reward{' '}\n \n \n \n \n \n \n {vested.toFixed(2)} MORE\n \n \n {stakeMeta.earned.gt(stakeMeta.rewards.mul(2))\n ? `Vest ${stakeMeta.earned.format({\n fixedPrecisionDigits: 0,\n useFixedPrecision: true,\n })}`\n : 'Claim'}\n \n \n \n );\n}\n","import { Button } from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\n\nexport function EnsureWalletConnected(\n params: React.PropsWithChildren\n) {\n const { activateBrowserWallet } = useEthers();\n const account = useContext(UserAddressContext);\n\n return (\n <>\n {account ? (\n params.children\n ) : (\n {\n activateBrowserWallet();\n }}\n >\n Connect to a wallet\n \n )}\n \n );\n}\n","import {\n Button, FormControl,\n FormErrorMessage, Input,\n InputGroup, InputRightElement, Text\n} from '@chakra-ui/react';\nimport { CurrencyValue } from '@usedapp/core';\nimport * as React from 'react';\n\nexport function TokenAmountInputField(props: {\n name: string;\n max?: CurrencyValue;\n placeholder: string;\n registerForm: (name: string, params: { required: string }) => any;\n setValueForm: (\n name: string,\n max: string,\n args?: { shouldDirty: boolean; shouldTouch: boolean }\n ) => any;\n errorsForm?: Record;\n isDisabled?: boolean;\n percentage?: string;\n width?: string;\n}) {\n const {\n name,\n max,\n placeholder,\n registerForm,\n setValueForm,\n errorsForm,\n isDisabled,\n percentage,\n width = '200px',\n } = props;\n\n const error = errorsForm?.[name];\n\n return (\n \n \n \n \n {max ? (\n \n setValueForm(\n name,\n max.format({\n significantDigits: Infinity,\n prefix: '',\n suffix: '',\n thousandSeparator: '',\n decimalSeparator: '.',\n }),\n { shouldDirty: true, shouldTouch: true }\n )\n }\n >\n \n MAX\n \n \n ) : percentage ? (\n \n \n {percentage}\n \n \n ) : (\n <>\n )}\n \n \n {error && error.message}\n \n );\n}\n","import { ChainId } from '@usedapp/core';\n\ntype AddressMap = { [chainId: number]: string };\n\nexport const WNATIVE_ADDRESS: AddressMap = {\n [ChainId.Mainnet]: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n [ChainId.Ropsten]: '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n [ChainId.Rinkeby]: '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n [ChainId.Goerli]: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6',\n [ChainId.Kovan]: '0xd0A1E359811322d97991E03f863a0C30C2cF029C',\n [ChainId.Fantom]: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83',\n [ChainId.xDai]: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',\n [ChainId.BSC]: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',\n [ChainId.Avalanche]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',\n [ChainId.Hardhat]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',\n [ChainId.Harmony]: '0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a',\n [ChainId.Palm]: '0xF98cABF0a963452C5536330408B2590567611a71',\n [ChainId.Moonriver]: '0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d',\n};\n","import { Box, Button, Flex, Text } from '@chakra-ui/react';\nimport {\n CurrencyValue,\n useEtherBalance,\n useEthers,\n useTokenAllowance,\n} from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { useForm } from 'react-hook-form';\nimport {\n ParsedStakingMetadata,\n useAddresses,\n TxStatus,\n} from '../../../chain-interaction/contracts';\nimport {\n useApproveTrans,\n useStake,\n} from '../../../chain-interaction/transactions';\nimport { EnsureWalletConnected } from '../../../components/account/EnsureWalletConnected';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { TokenAmountInputField } from '../../../components/tokens/TokenAmountInputField';\nimport { WNATIVE_ADDRESS } from '../../../constants/addresses';\nimport { UserAddressContext } from '../../../contexts/UserAddressContext';\nimport { useWalletBalance } from '../../../contexts/WalletBalancesContext';\nimport { parseFloatNoNaN } from '../../../utils';\n\nexport default function DepositForm({\n stakeMeta,\n}: React.PropsWithChildren<{\n stakeMeta: ParsedStakingMetadata;\n}>) {\n const token = stakeMeta.stakingToken;\n const stakingAddress = useAddresses().CurvePoolRewards;\n const { chainId } = useEthers();\n const account = useContext(UserAddressContext);\n\n const isNativeToken = WNATIVE_ADDRESS[chainId!] === token.address;\n\n const allowance = new CurrencyValue(\n token,\n useTokenAllowance(token.address, account, stakingAddress) ??\n BigNumber.from('0')\n );\n const etherBalance = useEtherBalance(account);\n\n const nativeTokenBalance = etherBalance\n ? new CurrencyValue(token, etherBalance)\n : new CurrencyValue(token, BigNumber.from('0'));\n\n const walletBalance =\n useWalletBalance(token.address) ??\n new CurrencyValue(token, BigNumber.from('0'));\n\n const { approveState, sendApprove } = useApproveTrans(token.address);\n\n const { sendStake, stakeState } = useStake();\n\n const {\n handleSubmit: handleSubmitDepForm,\n register: registerDepForm,\n setValue: setValueDepForm,\n formState: { errors: errorsDepForm, isSubmitting: isSubmittingDepForm },\n watch,\n } = useForm();\n\n const [depositInput] = watch(['amount-stake']);\n\n function onDeposit(data: { [x: string]: any }) {\n // console.log('data', data, position);\n sendStake(token, data['amount-stake']);\n setValueDepForm('amount-stake', '');\n }\n\n const confirmButtonEnabled = parseFloatNoNaN(depositInput) > 0;\n\n const depositBorrowDisabled = isNativeToken\n ? nativeTokenBalance.isZero()\n : walletBalance.isZero();\n\n return (\n
    \n \n \n \n Deposit\n \n \n \n \n\n \n \n\n \n {allowance.gt(walletBalance) === false && isNativeToken === false ? (\n \n sendApprove(stakingAddress)}\n width={'full'}\n variant={'submit-primary'}\n isLoading={\n approveState.status == TxStatus.SUCCESS &&\n allowance.gt(walletBalance) === false\n }\n >\n Approve\n \n \n ) : (\n \n Confirm\n \n )}\n \n \n );\n}\n","import { Box, Button, Flex, Text } from '@chakra-ui/react';\nimport { CurrencyValue, useEtherBalance, useEthers } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport { getAddress } from 'ethers/lib/utils';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { ParsedStakingMetadata } from '../../../chain-interaction/contracts';\nimport { useWithdraw } from '../../../chain-interaction/transactions';\nimport { EnsureWalletConnected } from '../../../components/account/EnsureWalletConnected';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { TokenAmountInputField } from '../../../components/tokens/TokenAmountInputField';\nimport { WNATIVE_ADDRESS } from '../../../constants/addresses';\nimport { UserAddressContext } from '../../../contexts/UserAddressContext';\nimport { parseFloatNoNaN } from '../../../utils';\n\nexport default function WithdrawForm({\n stakeMeta,\n}: React.PropsWithChildren<{\n stakeMeta: ParsedStakingMetadata;\n}>) {\n const token = stakeMeta.stakingToken;\n\n const { chainId } = useEthers();\n const account = useContext(UserAddressContext);\n\n const isNativeToken = getAddress(WNATIVE_ADDRESS[chainId!]) === getAddress(token.address);\n\n const etherBalance = useEtherBalance(account);\n\n const nativeTokenBalance = etherBalance\n ? new CurrencyValue(token, etherBalance)\n : new CurrencyValue(token, BigNumber.from('0'));\n\n const walletBalance =\n stakeMeta.stakedBalance ?? new CurrencyValue(token, BigNumber.from('0'));\n\n const { sendWithdraw, withdrawState } = useWithdraw();\n\n const {\n handleSubmit: handleSubmitDepForm,\n register: registerDepForm,\n setValue: setValueDepForm,\n formState: { errors: errorsDepForm, isSubmitting: isSubmittingDepForm },\n watch,\n } = useForm();\n\n function onWithdraw(data: { [x: string]: any }) {\n // console.log('withdraw from farm', data, position);\n sendWithdraw(token, data['amount-withdraw']);\n setValueDepForm('amount-withdraw', '');\n }\n\n const [withdrawInput] = watch(['amount-withdraw']);\n\n const confirmButtonEnabled = parseFloatNoNaN(withdrawInput) > 0;\n\n const depositBorrowDisabled = isNativeToken\n ? nativeTokenBalance.isZero()\n : walletBalance.isZero();\n\n return (\n
    \n \n \n \n Withdraw\n \n \n \n \n\n \n\n \n \n \n Withdraw\n \n \n \n \n );\n}\n","import { ExternalLinkIcon } from '@chakra-ui/icons';\nimport {\n Accordion,\n AccordionButton,\n AccordionItem,\n AccordionPanel,\n Box,\n Button,\n Container,\n Flex,\n Grid,\n GridItem,\n Link,\n Text,\n} from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport { ethers } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport {\n ParsedStakingMetadata,\n useAddresses,\n useParsedStakingMetadata,\n useSpecialRewardsData,\n} from '../../chain-interaction/contracts';\nimport { useWithdrawLaunchVestingTrans } from '../../chain-interaction/transactions';\nimport { TokenDescription } from '../../components/tokens/TokenDescription';\nimport {\n ExternalMetadataContext,\n YieldFarmingData,\n} from '../../contexts/ExternalMetadataContext';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport farminfo from '../../contracts/farminfo.json';\nimport { formatNumber } from '../../utils';\nimport ClaimReward from './components/ClaimReward';\nimport DepositForm from './components/DepositForm';\nimport WithdrawForm from './components/WithdrawForm';\n\nexport default function FarmPage(params: React.PropsWithChildren) {\n const { chainId } = useEthers();\n const account = useContext(UserAddressContext);\n\n const stakeMeta: ParsedStakingMetadata[] = useParsedStakingMetadata(\n [useAddresses().CurvePoolRewards],\n account ?? ethers.constants.AddressZero\n ).flat(1);\n\n const { yieldFarmingData, yieldMonitor } = useContext(\n ExternalMetadataContext\n );\n const avaxMorePayload = Object.values(yieldMonitor).filter(\n (item) => item.lpAddress === '0xb8361d0e3f3b0fc5e6071f3a3c3271223c49e3d9'\n )[0];\n\n const { balance, vested } = useSpecialRewardsData(\n account ?? ethers.constants.AddressZero\n );\n const { send: sendSpecialWithdraw } = useWithdrawLaunchVestingTrans();\n\n const farmInfoIdx = (chainId?.toString() ?? '43114') as keyof typeof farminfo;\n const getLPTokenLinks = [\n `https://avax.curve.fi/factory/${farminfo[farmInfoIdx].curvePoolIdx}/deposit`,\n ];\n\n const accordionStyling = {\n content: '\"\"',\n borderRadius: '10px',\n marginTop: '10px',\n border: '1px solid transparent',\n backgroundClip: 'padding-box, border-box',\n backgroundOrigin: 'padding-box, border-box',\n backgroundImage:\n 'linear-gradient(hsla(227, 12%, 15%, 1), hsla(227, 12%, 15%, 1)), linear-gradient(to right, hsla(0, 100%, 64%, 0.3) 0%, hsla(193, 100%, 50%, 0.3) 100%)',\n zIndex: 'var(--chakra-zIndices-hide)',\n fontSize: '18px',\n lineHeight: '27px',\n padding: '16px 30px',\n };\n\n const externalData: YieldFarmingData[] =\n avaxMorePayload && yieldFarmingData\n ? [\n ...yieldFarmingData,\n {\n asset: 'MORE-AVAX',\n stake: 'n/a',\n tvl: avaxMorePayload.tvl,\n reward: \"MORE + \" + avaxMorePayload.rewardsCoin,\n apr: avaxMorePayload.totalApy,\n getTokenURL:\n 'https://traderjoexyz.com/pool/AVAX/0xd9d90f882cddd6063959a9d837b05cb748718a05',\n stakeTokenURL:\n 'https://traderjoexyz.com/farm/0xb8361D0E3F3B0fc5e6071f3a3C3271223C49e3d9-0x188bED1968b795d5c9022F6a0bb5931Ac4c18F00?fm=fm',\n },\n ]\n : [];\n\n return (\n <>\n \n \n \n Yield Farming is easy, stake your\n \n \n token, sit back and relax!\n \n \n \n Asset\n Stake\n TVL\n Reward\n APR\n Acquire\n \n \n {!balance.isZero() ? (\n \n \n \n \n Special Launch Rewards\n \n \n n/a\n \n \n $ {stakeMeta[0].tvl.format({ suffix: '' })}\n \n \n {balance.format()}\n \n n/a\n \n {\n console.log(`Claiming vested`, vested.format());\n sendSpecialWithdraw(vested.value);\n }}\n >\n {vested.format({ suffix: '' })} Vested\n \n \n \n \n \n ) : (\n <>\n )}\n {externalData.length > 0 ? (\n externalData.map((item) => (\n \n \n \n \n {item.asset}\n \n\n \n {item.stake}\n \n\n \n $ {formatNumber(item.tvl)}\n \n\n \n {item.reward}\n \n\n {formatNumber(item.apr)} %\n\n \n \n Get LP Token\n \n \n \n Stake LP Token\n \n \n \n \n \n \n ))\n ) : (\n <>\n )}\n {stakeMeta.map((item, index) => {\n const { totalRewards } = item;\n return (\n
    \n \n \n \n \n \n \n \n \n \n {item.stakedBalance.format({ suffix: '' })}\n \n \n $ {item.tvl.format({ suffix: '' })}\n \n \n {totalRewards.isZero() ? (\n \n \n \n ) : (\n totalRewards.format()\n )}\n \n {item.aprPercent.toFixed(1)} %\n \n \n Get LP Token  \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 {params.children}\n
    \n \n );\n}\n","import { Button, Td, Text, Tr } from '@chakra-ui/react';\nimport { CurrencyValue } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport React from 'react';\nimport {\n ParsedStratMetaRow,\n ParsedPositionMetaRow,\n useStable,\n} from '../../chain-interaction/contracts';\nimport { TokenDescription } from '../../components/tokens/TokenDescription';\nimport { LiquidatableAction } from './LiquidatablePositionsTable';\n\nexport function LiquidatableRow(\n params: React.PropsWithChildren<\n ParsedStratMetaRow & ParsedPositionMetaRow & { action?: LiquidatableAction }\n >\n) {\n const {\n token,\n action,\n liquidateButton,\n positionHealthColor,\n parsedPositionHealth,\n } = params;\n\n // const location = useLocation();\n // const details = location.search?.includes('details=true');\n\n // console.log('details', details);\n\n const actionArgs =\n action && action.args ? action.args : () => ({} as Record);\n\n const stable = useStable();\n\n // const walletBalance =\n // useWalletBalance(token.address) ??\n // new CurrencyValue(token, BigNumber.from('0'));\n // console.log(\n // `wallet balance for ${token.name}: ${walletBalance.format({\n // significantDigits: 30,\n // })} (${token.address})`\n // );\n\n const collateral =\n 'collateral' in params && params.collateral\n ? params.collateral\n : new CurrencyValue(token, BigNumber.from(0));\n const debt =\n 'debt' in params && params.debt.gt(params.yield)\n ? params.debt.sub(params.yield)\n : new CurrencyValue(stable, BigNumber.from(0));\n\n console.log(\n 'liquidatable',\n params.trancheId,\n params.debt.format(),\n params.collateral?.toString(),\n params.collateral?.format(),\n parsedPositionHealth\n );\n return (\n <>\n \n \n \n {parsedPositionHealth ?? ''}\n \n \n \n \n \n\n \n {((1 / (params.borrowablePercent / 100)) * 100).toFixed(2) + '%'}\n \n\n \n {debt.isZero()\n ? '∞'\n : (\n params.collateralValue.value\n .mul(10000)\n .div(debt.value)\n .toNumber() / 100\n ).toFixed(1)}\n %\n \n\n \n $ {params.liquidationPrice.toFixed(2)}\n \n\n \n {collateral.format({\n significantDigits: Infinity,\n suffix: '',\n })}\n \n\n \n {debt.format({\n significantDigits: 3,\n suffix: '',\n })}\n \n\n \n {liquidateButton ? (\n action.callback!(params),\n }\n : actionArgs(params))}\n >\n Liquidate\n \n ) : (\n Not Liquidatable Yet\n )}\n \n \n \n );\n}\n","import { Table, Tbody, Td, Thead, Tr } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedPositionMetaRow } from '../../chain-interaction/contracts';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { LiquidatableRow } from './LiquidatableRow';\n\nexport type LiquidatableAction = {\n args?: (pos: ParsedPositionMetaRow) => Record;\n callback?: (pos: ParsedPositionMetaRow) => void;\n label: string;\n};\n\nexport function LiquidatablePositionsTable({\n positions,\n action,\n}: {\n positions: ParsedPositionMetaRow[];\n action?: LiquidatableAction;\n}) {\n const allStratMeta = React.useContext(StrategyMetadataContext);\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n {positions.map((posMeta, i) => {\n const stratMeta = allStratMeta[posMeta.token.address];\n const data = { action, ...posMeta, ...stratMeta[posMeta.strategy] };\n if (posMeta.collateralValue.isZero()) {\n return <>;\n }\n return ;\n })}\n \n
    Position HealthAssetMin Col RatioCurrent Col RatioLiquidation priceCollateralDebtLiquidate
    \n );\n}\n","import { VStack } from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport { getAddress } from 'ethers/lib/utils';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { useAddresses } from '../../chain-interaction/contracts';\nimport {\n getLiquidationParams,\n LiquidationType,\n} from '../../chain-interaction/tokens';\nimport { useLiquidationTrans } from '../../chain-interaction/transactions';\nimport { LiquidatablePositionsContext } from '../../contexts/LiquidatablePositionsContext';\nimport { LiquidatablePositionsTable } from './LiquidatablePositionsTable';\n\nexport default function LiquidatablePositions() {\n const addresses = useAddresses();\n const { sendLiquidation: sendDirectLiquidationLegacy } = useLiquidationTrans(\n 'IsolatedLending' in addresses\n ? addresses.DirectFlashLiquidation\n : addresses.DirectFlashStableLiquidation\n );\n const { sendLiquidation: sendDirectLiquidationCurrent } = useLiquidationTrans(\n 'StableLending' in addresses\n ? addresses.DirectFlashStableLiquidation\n : addresses.DirectFlashLiquidation\n );\n const { sendLiquidation: sendLPTLiquidationLegacy } = useLiquidationTrans(\n 'IsolatedLending' in addresses\n ? addresses.LPTFlashLiquidation\n : addresses.LPTFlashStableLiquidation\n );\n const { sendLiquidation: sendLPTLiquidationCurrent } = useLiquidationTrans(\n 'StableLending' in addresses\n ? addresses.LPTFlashStableLiquidation\n : addresses.LPTFlashLiquidation\n );\n\n const { sendLiquidation: sendWsMaxiLiquidation } = useLiquidationTrans(\n 'wsMAXIStableLiquidation' in addresses\n ? addresses.wsMAXIStableLiquidation\n : addresses.DirectFlashLiquidation\n );\n const { sendLiquidation: sendXJoeLiquidation } = useLiquidationTrans(\n 'xJoeStableLiquidation' in addresses\n ? addresses.xJoeStableLiquidation\n : addresses.DirectFlashLiquidation\n );\n\n const lending2Liquidation: Record<\n string,\n Record Promise>\n > = {\n ...('IsolatedLending' in addresses\n ? {\n [addresses.IsolatedLending]: {\n [LiquidationType.LPT]: sendLPTLiquidationLegacy,\n [LiquidationType.Direct]: sendDirectLiquidationLegacy,\n },\n }\n : {}),\n ...('StableLending' in addresses\n ? {\n [addresses.StableLending]: {\n [LiquidationType.LPT]: sendLPTLiquidationCurrent,\n [LiquidationType.Direct]: sendDirectLiquidationCurrent,\n },\n }\n : {}),\n };\n\n const token2Liquidation = {\n [getAddress('0x2148D1B21Faa7eb251789a51B404fc063cA6AAd6')]:\n sendWsMaxiLiquidation,\n [getAddress('0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33')]:\n sendXJoeLiquidation,\n };\n // in this case using account is OK\n const { account } = useEthers();\n\n const liquidatablePositions = useContext(LiquidatablePositionsContext);\n\n return (\n <>\n {liquidatablePositions.length > 0 ? (\n \n

    Liquidatable positions

    \n {\n const { liqType, router } = getLiquidationParams(\n pos\n );\n console.log('liquidating', pos, liqType, router);\n console.log(lending2Liquidation);\n if (getAddress(pos.token.address) in token2Liquidation) {\n token2Liquidation[getAddress(pos.token.address)](\n pos.trancheId,\n router,\n account\n );\n } else {\n lending2Liquidation[pos.trancheContract][liqType](\n pos.trancheId,\n router,\n account\n );\n }\n },\n label: 'Liquidate',\n }}\n />\n
    \n ) : undefined}\n \n );\n}\n","import { Box, Text } from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport default function LiquidationProtectedLoans(\n params: React.PropsWithChildren\n) {\n return (\n <>\n \n \n Coming soon: Liquidation protected loans\n \n \n {params.children}\n \n );\n}\n","import { Box, Button, Container, Flex, Text } from '@chakra-ui/react';\nimport { Token } from '@usedapp/core';\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { TokenDescription } from '../../components/tokens/TokenDescription';\nimport { TrancheData } from './CurrentlyOpenPositions';\n\nexport function TrancheCard({\n token,\n row,\n}: {\n token: Token;\n row: TrancheData;\n}) {\n return (\n <>\n \n \n \n Position Health\n \n \n \n {row.positionHealth}\n \n \n \n\n \n \n Asset\n \n \n \n \n \n \n \n Strategy\n \n \n {row.APY}\n \n \n\n \n \n Cur. ColRatio\n \n \n {row.collateralValue}\n \n \n\n \n \n Liq. price\n \n \n {row.liquidationPrice}\n \n \n\n \n \n Collateral\n \n \n {row.collateral}\n \n \n\n \n \n Debt\n \n \n {row.debt}\n \n \n\n \n \n \n );\n}\n","import { Td, Text, Tr } from '@chakra-ui/react';\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n} from '../../chain-interaction/contracts';\nimport { TokenDescription } from '../../components/tokens/TokenDescription';\nimport { TrancheData } from './CurrentlyOpenPositions';\nimport { TrancheAction } from './TrancheTable';\n\nexport function TrancheRow(\n params: React.PropsWithChildren<\n ParsedStratMetaRow &\n ParsedPositionMetaRow & { action?: TrancheAction; row: TrancheData }\n >\n) {\n const { row } = params;\n return (\n <>\n \n \n \n {row.positionHealth}\n \n \n \n \n \n\n {row.stratLabel}\n\n {row.APY}\n\n {row.collateralValue}\n\n \n {row.liquidationPrice}\n \n\n {row.collateral}\n\n {row.debt}\n \n \n );\n}\n","import { Table, Tbody, Td, Thead, Tr } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedPositionMetaRow } from '../../chain-interaction/contracts';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { TrancheData } from './CurrentlyOpenPositions';\nimport { TrancheRow } from './TrancheRow';\n\nexport type TrancheAction = {\n args?: (pos: ParsedPositionMetaRow) => Record;\n callback?: (pos: ParsedPositionMetaRow) => void;\n label: string;\n};\n\nexport function TrancheTable({\n positions,\n rows,\n}: {\n positions: ParsedPositionMetaRow[];\n action?: TrancheAction;\n rows: TrancheData[];\n}) {\n const allStratMeta = React.useContext(StrategyMetadataContext);\n\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n {positions.map((posMeta, i) => {\n const stratMeta = allStratMeta[posMeta.token.address];\n const data = { ...posMeta, ...stratMeta[posMeta.strategy] };\n if (posMeta.collateralValue.isZero()) {\n return <>;\n }\n return (\n \n );\n })}\n \n
    Position HealthAssetStrategyAPYCur. ColRatioLiq. priceCollateralDebt
    \n \n );\n}\n","import { Flex } from '@chakra-ui/react';\nimport { CurrencyValue, Token } from '@usedapp/core';\nimport { parseEther } from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport {\n TokenStratPositionMetadata,\n useIsolatedPositionMetadata,\n useStable,\n YieldType,\n} from '../../chain-interaction/contracts';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { parseFloatCurrencyValue } from '../../utils';\nimport { TrancheCard } from './TrancheCard';\nimport { TrancheTable } from './TrancheTable';\n\nexport type TrancheData = {\n token: Token;\n trancheId: number;\n positionHealth: string;\n stratLabel: string;\n APY: string;\n collateralValue: string;\n liquidationPrice: string;\n collateral: string;\n debt: string;\n positionHealthColor: string;\n};\n\nexport default function CurrentlyOpenPositions({\n account,\n}: React.PropsWithChildren<{ account: string }>) {\n const allPositionMeta: TokenStratPositionMetadata =\n useIsolatedPositionMetadata(account);\n\n const allStratMeta = React.useContext(StrategyMetadataContext);\n const positions = Object.values(allPositionMeta)\n .flatMap((x) => x)\n .filter((pos) => pos.collateralValue.value.gt(parseEther('0.01')))\n .filter((pos) => pos.strategy in allStratMeta[pos.token.address]);\n const stable = useStable();\n\n const rows: TrancheData[] =\n positions.length > 0\n ? positions.map((posMeta) => {\n const stratMeta = allStratMeta[posMeta.token.address];\n const params = { ...posMeta, ...stratMeta[posMeta.strategy] };\n const { token, APY, borrowablePercent, usdPrice } = params;\n\n const collateral =\n 'collateral' in params && params.collateral\n ? params.collateral\n : new CurrencyValue(token, BigNumber.from(0));\n const debt =\n 'debt' in params && params.debt.gt(params.yield)\n ? params.debt.sub(params.yield)\n : new CurrencyValue(stable, BigNumber.from(0));\n\n const stratLabel =\n params.yieldType === YieldType.REPAYING\n ? 'Self-repaying'\n : 'Compounding';\n const totalPercentage =\n parseFloatCurrencyValue(collateral) > 0 && usdPrice > 0\n ? (100 * parseFloatCurrencyValue(debt)) /\n (parseFloatCurrencyValue(collateral) * usdPrice)\n : 0;\n const liquidatableZone = borrowablePercent;\n const criticalZone = (90 * borrowablePercent) / 100;\n const riskyZone = (80 * borrowablePercent) / 100;\n const healthyZone = (50 * borrowablePercent) / 100;\n\n const positionHealthColor = debt.value.lt(parseEther('0.1'))\n ? 'accent'\n : totalPercentage > liquidatableZone\n ? 'purple.400'\n : totalPercentage > criticalZone\n ? 'red'\n : totalPercentage > riskyZone\n ? 'orange'\n : totalPercentage > healthyZone\n ? 'green'\n : 'accent';\n const positionHealth = {\n accent: 'Safe',\n green: 'Healthy',\n orange: 'Risky',\n red: 'Critical',\n ['purple.400']: 'Liquidatable',\n };\n\n return {\n token: token,\n trancheId: params.trancheId,\n positionHealth: positionHealth[positionHealthColor],\n stratLabel: stratLabel,\n APY: APY.toFixed(2) + '%',\n collateralValue: debt.isZero()\n ? '∞'\n : (\n params.collateralValue.value\n .mul(10000)\n .div(debt.value)\n .toNumber() / 100\n ).toFixed(1) + '%',\n liquidationPrice: '$' + params.liquidationPrice.toFixed(2),\n collateral: collateral.format({\n significantDigits: Infinity,\n suffix: '',\n }),\n debt: debt.format({\n significantDigits: 3,\n suffix: '',\n }),\n positionHealthColor: positionHealthColor,\n };\n })\n : ([] as TrancheData[]);\n\n return positions.length > 0 ? (\n <>\n \n {rows.map((row, i) => {\n return (\n \n );\n })}\n \n \n \n \n \n ) : (\n <> \n );\n}\n","import { Box, Text } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport CurrentlyOpenPositions from './CurrentlyOpenPositions';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\n\nexport default function PositionsPage(params: React.PropsWithChildren) {\n const account = useContext(UserAddressContext);\n return (\n <>\n \n \n My Positions\n \n \n {account && }\n {params.children}\n \n );\n}\n","import React from 'react';\nimport { HStack, Text } from '@chakra-ui/react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowBackIcon } from '@chakra-ui/icons';\n\nexport function BackButton() {\n const navigate = useNavigate();\n\n return (\n navigate(-1)} cursor={'pointer'}>\n \n BACK\n \n );\n}\n","import { Alert, AlertIcon } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { useParams } from 'react-router-dom';\nimport { deprecatedTokenList } from '../../constants/deprecated-token-list';\n\nexport default function DeprecatedTokenMessage() {\n const params = useParams<'tokenAddress'>();\n const isDeprecated = deprecatedTokenList.includes(params.tokenAddress ?? '');\n\n return (\n <>\n {isDeprecated ? (\n <>\n \n \n \n This token has been deprecated, you can repay, but not borrow\n against it.\n \n \n
    \n \n ) : (\n ''\n )}\n \n );\n}\n","import { Button } from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport default function ChangeStrategyButton({\n chooseStrategy,\n onClose,\n}: {\n chooseStrategy: () => void;\n onClose: () => void;\n}) {\n return (\n <>\n {\n if (false) {\n chooseStrategy();\n }\n onClose();\n }}\n >\n Choose\n \n \n );\n}\n","import { Box, Table, Tbody, Td, Thead, Tr } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { Column, useTable } from 'react-table';\nimport { ParsedStratMetaRow } from '../../../../chain-interaction/contracts';\nimport ChangeStrategyButton from './ChangeStrategyButton';\n\ntype Entity = {\n strategyName: string;\n apy: string;\n totalBorrowed: string;\n action: any;\n};\n\nexport function ChangeStrategyTable({\n stratMeta,\n chooseStrategy,\n currentStrategy,\n onClose,\n}: {\n stratMeta: Record;\n chooseStrategy: (strategyToChoose: string) => void;\n currentStrategy: string;\n onClose: () => void;\n}) {\n const data = Object.keys(stratMeta).map((key) => {\n const meta = stratMeta[key];\n return {\n strategyAddress: meta.strategyAddress,\n strategyName: meta.strategyName,\n apy: meta.APY.toFixed(2) + '%',\n totalBorrowed: meta.totalDebt.format({ significantDigits: 2 }),\n action:\n meta.strategyAddress === currentStrategy ? (\n <>Current strategy\n ) : (\n {\n chooseStrategy(meta.strategyAddress);\n }}\n />\n ),\n };\n });\n\n const columns = React.useMemo[]>(\n () => [\n {\n Header: 'Strategy Name',\n accessor: 'strategyName',\n },\n {\n Header: 'Collateral APY',\n accessor: 'apy',\n },\n {\n Header: 'Total borrowed',\n accessor: 'totalBorrowed',\n },\n {\n Header: 'Action',\n accessor: 'action',\n },\n ],\n []\n );\n\n const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =\n useTable({ columns, data });\n\n return (\n <>\n \n <>\n \n \n {headerGroups.map((headerGroup) => (\n // eslint-disable-next-line\n \n {headerGroup.headers.map((column) => (\n // eslint-disable-next-line\n \n ))}\n \n ))}\n \n \n {rows.map((row) => {\n prepareRow(row);\n return (\n // eslint-disable-next-line\n \n {row.cells.map((cell) => {\n // eslint-disable-next-line\n return (\n // eslint-disable-next-line\n \n );\n })}\n \n );\n })}\n \n
    \n {column.render('Header')}\n
    {cell.render('Cell')}
    \n \n
    \n \n );\n}\n","import {\n Button,\n Modal,\n ModalBody,\n ModalCloseButton,\n ModalContent,\n ModalHeader,\n ModalOverlay,\n Text,\n useDisclosure,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedStratMetaRow } from '../../../../chain-interaction/contracts';\nimport { ChangeStrategyTable } from './ChangeStrategyTable';\n\nexport default function ChangeStrategyModal({\n chooseStrategy,\n stratMeta,\n currentStrategy,\n}: {\n chooseStrategy: (strategyToChoose: string) => void;\n stratMeta: Record;\n currentStrategy: string;\n}) {\n const { isOpen, onOpen, onClose } = useDisclosure();\n return (\n <>\n \n Change\n \n\n \n \n \n Select Strategy\n \n \n \n \n \n \n \n );\n}\n","import { Container, Flex, GridItem, Text } from '@chakra-ui/react';\nimport * as React from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n YieldType,\n} from '../../../../chain-interaction/contracts';\nimport { hiddenStrategies } from '../../../../constants/hidden-strategies';\nimport ChangeStrategyModal from './ChangeStrategyModal';\n\nexport default function StrategyNameAndSwitch({\n position,\n chooseStrategy,\n stratMeta,\n chosenStrategy,\n}: {\n position?: ParsedPositionMetaRow;\n chooseStrategy: (strategyToChoose: string) => void;\n stratMeta: Record;\n chosenStrategy: string;\n}) {\n const stratLabel =\n stratMeta[chosenStrategy].yieldType === YieldType.REPAYING\n ? 'Self-repaying loan'\n : 'Compound collateral';\n\n const options = Object.values(stratMeta).filter((strat) => {\n //if we have hidden strategies for this token\n if (hiddenStrategies[strat.token.address]) {\n //if the strategy is hidden\n if (\n hiddenStrategies[strat.token.address].includes(strat.strategyAddress)\n ) {\n //if the strategy that is hidden has a position opened for that\n if (position?.strategy === strat.strategyAddress) {\n return true;\n } else {\n return false;\n }\n } else {\n return true;\n }\n } else {\n return true;\n }\n });\n\n const multipleOptions = options.length > 1;\n const textVariant = multipleOptions ? 'bodySmall' : 'bodyLarge';\n\n return (\n \n \n \n \n Strategy\n \n \n {stratLabel}\n \n
    \n {multipleOptions && (\n \n )}\n \n
    \n
    \n );\n}\n","import {\n Alert,\n AlertIcon,\n Popover,\n PopoverArrow,\n PopoverBody,\n PopoverContent,\n PopoverTrigger,\n} from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport default function WarningMessage(\n props: React.PropsWithChildren<{ isOpen: boolean; message: string }>\n) {\n const { message, isOpen } = props;\n return (\n <>\n \n {props.children}\n \n \n \n \n \n {message}\n \n \n \n \n \n );\n}\n","import {\n Alert,\n AlertIcon,\n Box,\n Button,\n Flex,\n Modal,\n ModalBody,\n ModalCloseButton,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalOverlay\n} from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport const ConfirmPositionModal = ({\n title,\n isOpen,\n onClose,\n confirm,\n dangerous,\n body,\n}: {\n title: string;\n isOpen: boolean;\n onClose: () => void;\n body: { title: any; value: any }[];\n confirm: any;\n dangerous: boolean;\n}) => {\n function depositBorrow() {\n confirm();\n onClose();\n }\n\n return (\n <>\n \n \n \n \n {title}\n \n \n {/* Your position would be close to liquidation, if the collateral loses\n value. Are you sure you want to proceed? */}\n\n {body.map((item, index) => (\n \n {item.title}\n {item.value}\n \n ))}\n\n
    \n {dangerous ? (\n \n \n Your position would be close to liquidation, if the collateral\n loses value. Are you sure you want to proceed?\n \n ) : (\n ''\n )}\n
    \n \n \n \n \n
    \n
    \n
    \n \n );\n};\n","import {\n Box,\n Button,\n Flex,\n HStack,\n Input,\n InputGroup,\n InputRightElement,\n Progress,\n Text,\n useDisclosure,\n VStack,\n} from '@chakra-ui/react';\nimport {\n CurrencyValue,\n useEtherBalance,\n useEthers,\n useTokenAllowance,\n} from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport { getAddress } from 'ethers/lib/utils';\nimport * as React from 'react';\nimport { useContext, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport {\n calcLiqPriceFromNum,\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n TxStatus,\n useStable,\n} from '../../../../chain-interaction/contracts';\nimport {\n useApproveTrans,\n useDepositBorrowTrans,\n useNativeDepositBorrowTrans,\n} from '../../../../chain-interaction/transactions';\nimport { EnsureWalletConnected } from '../../../../components/account/EnsureWalletConnected';\nimport { TransactionErrorDialog } from '../../../../components/notifications/TransactionErrorDialog';\nimport WarningMessage from '../../../../components/notifications/WarningMessage';\nimport { TokenAmountInputField } from '../../../../components/tokens/TokenAmountInputField';\nimport { TokenDescription } from '../../../../components/tokens/TokenDescription';\nimport { WNATIVE_ADDRESS } from '../../../../constants/addresses';\nimport { UserAddressContext } from '../../../../contexts/UserAddressContext';\nimport { useWalletBalance } from '../../../../contexts/WalletBalancesContext';\nimport { parseFloatCurrencyValue, parseFloatNoNaN } from '../../../../utils';\nimport { ConfirmPositionModal } from './ConfirmPositionModal';\n\nexport default function DepositBorrow({\n position,\n stratMeta,\n}: React.PropsWithChildren<{\n position?: ParsedPositionMetaRow;\n stratMeta: ParsedStratMetaRow;\n}>) {\n const { token, strategyAddress, borrowablePercent, usdPrice } = stratMeta;\n const { chainId } = useEthers();\n const [data, setData] = useState<{ [x: string]: any }>();\n const { isOpen, onOpen, onClose } = useDisclosure();\n const account = useContext(UserAddressContext);\n const stable = useStable();\n\n const isNativeToken = WNATIVE_ADDRESS[chainId!] === token.address;\n\n const allowResult = useTokenAllowance(\n token.address,\n account,\n strategyAddress\n );\n const allowCV = new CurrencyValue(token, allowResult ?? BigNumber.from('0'));\n const allowance = token.address && account && strategyAddress && allowCV;\n\n const etherBalance = useEtherBalance(account);\n\n const nativeTokenBalance = etherBalance\n ? new CurrencyValue(token, etherBalance)\n : new CurrencyValue(token, BigNumber.from('0'));\n\n const walletBalance =\n useWalletBalance(token.address) ??\n new CurrencyValue(token, BigNumber.from('0'));\n\n const { approveState, sendApprove } = useApproveTrans(token.address);\n\n const {\n handleSubmit: handleSubmitDepForm,\n register: registerDepForm,\n setValue: setValueDepForm,\n formState: { errors: errorsDepForm, isSubmitting: isSubmittingDepForm },\n watch,\n } = useForm();\n\n const { sendDepositBorrow, depositBorrowState } = useDepositBorrowTrans(\n position ? position.trancheId : undefined,\n position ? position.trancheContract : undefined\n );\n const {\n sendDepositBorrow: sendNativeDepositBorrow,\n depositBorrowState: nativeDepositBorrowState,\n } = useNativeDepositBorrowTrans(\n position ? position.trancheId : undefined,\n position ? position.trancheContract : undefined\n );\n\n function onDepositBorrow(data: { [x: string]: any }) {\n // console.log('deposit borrow');\n // console.log(data);\n setData(data);\n onOpen();\n }\n\n function confirmDeposit() {\n if (isNativeToken) {\n sendNativeDepositBorrow(\n token,\n strategyAddress,\n data!['collateral-deposit'] ?? '0',\n data!['money-borrow'] ?? '0'\n );\n } else {\n sendDepositBorrow(\n token,\n strategyAddress,\n data!['collateral-deposit'] ?? '0',\n data!['money-borrow'] ?? '0'\n );\n }\n }\n\n const [collateralInput, borrowInput, customPercentageInput] = watch([\n 'collateral-deposit',\n 'money-borrow',\n 'custom-percentage',\n ]);\n\n const extantCollateral =\n position && position.collateral\n ? parseFloatCurrencyValue(position.collateral)\n : 0;\n const totalCollateral = parseFloatNoNaN(collateralInput) + extantCollateral;\n\n const extantDebt =\n position && position.debt && position.debt.gt(position.yield)\n ? parseFloatCurrencyValue(position.debt.sub(position.yield))\n : 0;\n const totalDebt = parseFloatNoNaN(borrowInput) + extantDebt;\n\n const currentPercentage =\n totalCollateral > 0 && usdPrice > 0\n ? (100 * extantDebt) / (totalCollateral * usdPrice)\n : 0;\n const percentageRange = borrowablePercent - currentPercentage;\n\n const percentageStep = Math.max(percentageRange / 5, 10);\n const percentageSteps =\n 10 >= percentageRange\n ? [(currentPercentage + borrowablePercent) / 2]\n : Array(Math.floor((percentageRange - 0.5) / percentageStep))\n .fill(currentPercentage)\n .map((p, i) => Math.round((p + (i + 1) * percentageStep) / 5) * 5);\n\n const totalPercentage =\n totalCollateral > 0 && usdPrice > 0\n ? (100 * totalDebt) / (totalCollateral * usdPrice)\n : 0;\n\n const percentageLabel =\n totalCollateral > 0 && usdPrice > 0\n ? `${totalPercentage.toFixed(0)} %`\n : 'LTV %';\n const percentages = Object.fromEntries(\n percentageSteps.map((percentage) => [\n `${percentage.toFixed(0)} %`,\n (percentage * totalCollateral * usdPrice) / 100 - extantDebt,\n ])\n );\n\n const showWarning =\n !(\n parseFloatNoNaN(collateralInput) === 0 &&\n parseFloatNoNaN(borrowInput) === 0\n ) && totalPercentage > borrowablePercent;\n\n React.useEffect(() => {\n // console.log('In effect', customPercentageInput);\n if (customPercentageInput) {\n setValueDepForm(\n 'money-borrow',\n (customPercentageInput * totalCollateral * usdPrice) / 100 - extantDebt,\n { shouldDirty: true }\n );\n }\n }, [customPercentageInput, totalCollateral, extantDebt, usdPrice]);\n\n const depositBorrowDisabled =\n !position &&\n (isNativeToken ? nativeTokenBalance.isZero() : walletBalance.isZero());\n\n const isJoeToken =\n getAddress(token.address) ===\n getAddress('0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd');\n\n const depositBorrowButtonDisabledForJoe =\n parseFloatNoNaN(collateralInput) > 0 && isJoeToken;\n\n const depositBorrowButtonDisabled =\n (parseFloatNoNaN(collateralInput) === 0 &&\n parseFloatNoNaN(borrowInput) === 0) ||\n totalPercentage > borrowablePercent;\n\n const inputStyle = {\n padding: '8px 8px 8px 20px',\n bg: 'whiteAlpha.50',\n borderRadius: '10px',\n justifyContent: 'space-between',\n };\n\n const liquidatableZone = borrowablePercent;\n const criticalZone = (90 * borrowablePercent) / 100;\n const riskyZone = (80 * borrowablePercent) / 100;\n const healthyZone = (50 * borrowablePercent) / 100;\n\n const positionHealthColor =\n 0.1 > totalDebt\n ? 'accent'\n : totalPercentage > liquidatableZone\n ? 'purple.400'\n : totalPercentage > criticalZone\n ? 'red'\n : totalPercentage > riskyZone\n ? 'orange'\n : totalPercentage > healthyZone\n ? 'green'\n : 'accent';\n const positionHealth = {\n accent: 'Safe',\n green: 'Healthy',\n orange: 'Risky',\n red: 'Critical',\n ['purple.400']: 'Liquidatable',\n };\n\n // console.log(\n // 'DepositBorrow',\n // position?.debt,\n // borrowablePercent,\n // totalPercentage,\n // currentPercentage\n // );\n\n const dangerousPosition = totalPercentage > borrowablePercent * 0.92;\n console.log('customPercentageInput', customPercentageInput);\n\n return (\n <>\n ,\n value: {data ? data!['collateral-deposit'] : ''},\n },\n {\n title: ,\n value: {data ? data!['money-borrow'] : ''},\n },\n {\n title: 'At Loan-To-Value %',\n value: totalPercentage.toFixed(1) + ' %',\n },\n ]}\n dangerous={dangerousPosition}\n />\n
    \n \n \n \n \n Deposit Collateral\n \n \n \n \n \n \n \n \n \n \n \n \n Borrow MONEY\n \n \n \n \n \n \n \n \n
    \n \n {percentages &&\n Object.entries(percentages).map(([key, value]) => (\n {\n setValueDepForm('custom-percentage', '');\n setValueDepForm('money-borrow', value.toFixed(10), {\n shouldDirty: true,\n });\n }}\n >\n \n {key}\n \n \n ))}\n \n \n \n %\n \n \n \n
    \n \n \n \n Deposit Value\n \n \n $ {(usdPrice * (totalCollateral - extantCollateral)).toFixed(2)}\n \n \n \n \n Liquidation Price\n \n \n ${' '}\n {calcLiqPriceFromNum(\n borrowablePercent,\n totalDebt,\n totalCollateral\n ).toFixed(2)}\n \n \n \n \n {positionHealth[positionHealthColor]} Position\n \n \n \n \n \n \n \n cRatio\n \n \n {totalDebt > 0.01\n ? ((100 * usdPrice * totalCollateral) / totalDebt).toFixed(2)\n : '∞'}\n \n \n \n \n \n Price:\n \n {`1 ${\n token.ticker\n } = $ ${usdPrice.toFixed(2)}`}\n \n \n \n \n\n \n {allowance && !allowance.gt(walletBalance) && !isNativeToken ? (\n \n sendApprove(strategyAddress)}\n isLoading={\n approveState.status === TxStatus.MINING &&\n allowance &&\n !allowance.gt(walletBalance)\n }\n >\n Approve {token.name}{' '}\n \n \n ) : (\n \n Deposit & Borrow\n \n )}\n \n \n \n );\n}\n","import { ExternalLinkIcon } from '@chakra-ui/icons';\nimport {\n Alert,\n AlertIcon,\n Box,\n Button,\n Flex,\n HStack,\n Link,\n Progress,\n Text,\n useDisclosure,\n VStack,\n} from '@chakra-ui/react';\nimport { CurrencyValue, useEthers } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport { getAddress, parseEther } from 'ethers/lib/utils';\nimport * as React from 'react';\nimport { useContext, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport {\n calcLiqPriceFromNum,\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n useStable,\n} from '../../../../chain-interaction/contracts';\nimport {\n useNativeRepayWithdrawTrans,\n useRepayWithdrawTrans,\n} from '../../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../../components/notifications/TransactionErrorDialog';\nimport WarningMessage from '../../../../components/notifications/WarningMessage';\nimport { TokenAmountInputField } from '../../../../components/tokens/TokenAmountInputField';\nimport { TokenDescription } from '../../../../components/tokens/TokenDescription';\nimport { WNATIVE_ADDRESS } from '../../../../constants/addresses';\nimport {\n useWalletBalance,\n WalletBalancesContext,\n} from '../../../../contexts/WalletBalancesContext';\nimport farminfo from '../../../../contracts/farminfo.json';\nimport { parseFloatCurrencyValue, parseFloatNoNaN } from '../../../../utils';\nimport { ConfirmPositionModal } from './ConfirmPositionModal';\n\nexport default function RepayWithdraw({\n position,\n stratMeta,\n}: React.PropsWithChildren<{\n position?: ParsedPositionMetaRow;\n stratMeta: ParsedStratMetaRow;\n}>) {\n const { token, usdPrice, borrowablePercent } = stratMeta;\n const { chainId } = useEthers();\n const [data, setData] = useState<{ [x: string]: any }>();\n const { isOpen, onOpen, onClose } = useDisclosure();\n const stable = useStable();\n const isNativeToken = chainId\n ? getAddress(WNATIVE_ADDRESS[chainId!]) === getAddress(token.address)\n : false;\n const balanceCtx = useContext(WalletBalancesContext);\n\n const {\n handleSubmit: handleSubmitRepayForm,\n register: registerRepayForm,\n setValue: setValueRepayForm,\n formState: { errors: errorsRepayForm, isSubmitting: isSubmittingRepayForm },\n watch,\n } = useForm();\n\n const { sendRepayWithdraw, repayWithdrawState } = useRepayWithdrawTrans(\n position && position.trancheId,\n token,\n position ? position.trancheContract : undefined\n );\n // console.log('position.trancheId', position?.trancheId);\n const {\n sendRepayWithdraw: sendNativeRepayWithdraw,\n repayWithdrawState: sendNativeWithdrawState,\n } = useNativeRepayWithdrawTrans(\n position && position.trancheId,\n token,\n position ? position.trancheContract : undefined\n );\n\n function onRepayWithdraw(data: { [x: string]: any }) {\n // console.log('repay withdraw');\n // console.log(data);\n setData(data);\n onOpen();\n }\n\n function repayWithdraw() {\n if (isNativeToken) {\n sendNativeRepayWithdraw(\n data!['collateral-withdraw'] ?? '0',\n data!['money-repay'] ?? '0'\n );\n } else {\n sendRepayWithdraw(\n data!['collateral-withdraw'] ?? '0',\n data!['money-repay'] ?? '0'\n );\n }\n }\n\n const walletBalance =\n useWalletBalance(stable.address) ??\n new CurrencyValue(stable, BigNumber.from('0'));\n\n const repayWithdrawDisabled =\n !position ||\n !position.collateral ||\n (position.collateral.isZero() && position.debt.isZero());\n\n const [collateralInput, repayInput /*customPercentageInput*/] = watch([\n 'collateral-withdraw',\n 'money-repay',\n // 'custom-percentage',\n ]);\n\n const extantCollateral =\n position && position.collateral\n ? parseFloatCurrencyValue(position.collateral)\n : 0;\n const totalCollateral = extantCollateral - parseFloatNoNaN(collateralInput);\n\n const extantDebt =\n position && position.debt && position.debt.gt(position.yield)\n ? parseFloatCurrencyValue(position.debt.sub(position.yield))\n : 0;\n const totalDebt = extantDebt - parseFloatNoNaN(repayInput);\n\n // const currentPercentage =\n // totalCollateral > 0 ? (100 * extantDebt) / (totalCollateral * usdPrice) : 0;\n\n // const percentageStep = Math.max(currentPercentage / 5, 10);\n // const percentageSteps =\n // 10 >= currentPercentage\n // ? [currentPercentage / 2]\n // : Array(Math.floor((currentPercentage - 0.5) / percentageStep))\n // .fill(0)\n // .map((p, i) => Math.round((p + (i + 1) * percentageStep) / 5) * 5);\n\n const totalPercentage =\n totalCollateral > 0 && usdPrice > 0\n ? (100 * totalDebt) / (totalCollateral * usdPrice)\n : 0;\n\n const percentageLabel =\n totalCollateral > 0 ? `${totalPercentage.toFixed(0)} %` : 'LTV %';\n // const percentages = Object.fromEntries(\n // percentageSteps.map((percentage) => [\n // `${percentage.toFixed(0)} %`,\n // totalCollateral - (totalDebt * 100) / (usdPrice * customPercentageInput)\n // ])\n // );\n\n // React.useEffect(() => {\n // if (customPercentageInput) {\n // setValueRepayForm(\n // 'collateral-withdraw',\n // totalCollateral - (totalDebt * 100) / (usdPrice * customPercentageInput)\n // );\n // } else if (\n // collateralInput &&\n // collateralInput > 0 &&\n // totalPercentage > borrowablePercent\n // ) {\n // setValueRepayForm(\n // 'money-repay',\n // (borrowablePercent * totalCollateral * usdPrice) / 100 - extantDebt\n // );\n // }\n // }, [\n // customPercentageInput,\n // collateralInput,\n // totalCollateral,\n // extantDebt,\n // usdPrice,\n // ]);\n\n const farmInfoIdx = (chainId?.toString() ?? '43114') as keyof typeof farminfo;\n const curveLink = `https://avax.curve.fi/factory/${farminfo[farmInfoIdx].curvePoolIdx}/`;\n\n const repayingMoreThanBalance =\n !isNaN(parseFloat(repayInput)) &&\n parseEther(repayInput || '0').gt(walletBalance.value);\n\n const repayWithdrawButtonDisabled =\n (parseFloatNoNaN(collateralInput) === 0 &&\n parseFloatNoNaN(repayInput) === 0) ||\n totalPercentage > borrowablePercent ||\n (totalCollateral === 0 && totalDebt > 0) ||\n repayingMoreThanBalance;\n\n const inputStyle = {\n padding: '8px 8px 8px 20px',\n bg: 'whiteAlpha.50',\n borderRadius: '10px',\n justifyContent: 'space-between',\n };\n\n const showWarning =\n (!(\n parseFloatNoNaN(collateralInput) === 0 &&\n parseFloatNoNaN(repayInput) === 0\n ) &&\n totalPercentage > borrowablePercent) ||\n repayingMoreThanBalance ||\n (totalCollateral === 0 && totalDebt > 0);\n\n const warningMsgText = repayingMoreThanBalance\n ? 'Input more than wallet balance: buy more MONEY'\n : 'Repay more to keep position cRatio healthy';\n\n const residualDebt =\n position && position.debt.gt(position.yield)\n ? position.debt.sub(position.yield)\n : new CurrencyValue(stable, BigNumber.from(0));\n\n const dangerousPosition =\n totalPercentage > borrowablePercent * 0.92 && totalDebt > 0;\n const liquidatableZone = borrowablePercent;\n const criticalZone = (90 * borrowablePercent) / 100;\n const riskyZone = (80 * borrowablePercent) / 100;\n const healthyZone = (50 * borrowablePercent) / 100;\n\n const positionHealthColor =\n 0.1 > totalDebt\n ? 'accent'\n : totalPercentage > liquidatableZone\n ? 'purple.400'\n : totalPercentage > criticalZone\n ? 'red'\n : totalPercentage > riskyZone\n ? 'orange'\n : totalPercentage > healthyZone\n ? 'green'\n : 'accent';\n const positionHealth = {\n accent: 'Safe',\n green: 'Healthy',\n orange: 'Risky',\n red: 'Critical',\n ['purple.400']: 'Liquidatable',\n };\n return (\n <>\n ,\n value: {data ? data!['money-repay'] : ''},\n },\n {\n title: ,\n value: {data ? data!['collateral-withdraw'] : ''},\n },\n {\n title: 'At Loan-To-Value %',\n value: totalPercentage.toFixed(1) + ' %',\n },\n ]}\n dangerous={dangerousPosition}\n />\n
    \n \n \n \n \n Repay MONEY\n \n \n \n \n \n \n \n \n \n \n \n Withdraw Collateral\n \n \n \n \n \n \n \n
    \n \n {/* {percentages &&\n Object.entries(percentages).map(([key, value]) => (\n \n setValueRepayForm('collateral-withdraw', value.toFixed(18))\n }\n >\n {key}\n \n ))} */}\n\n {/* \n \n \n %\n \n */}\n \n \n To unwind / repay minting fee:\n\n \n Buy MONEY  \n \n \n \n \n
    \n \n \n \n Withdrawal Value\n \n \n $ {(usdPrice * (extantCollateral - totalCollateral)).toFixed(2)}\n \n \n \n \n Liquidation Price\n \n \n ${' '}\n {calcLiqPriceFromNum(\n borrowablePercent,\n totalDebt,\n totalCollateral\n ).toFixed(2)}\n \n \n \n \n {positionHealth[positionHealthColor]} Position\n \n \n \n \n \n \n \n cRatio\n \n \n {totalDebt > 0.01\n ? ((100 * usdPrice * totalCollateral) / totalDebt).toFixed(2)\n : '∞'}\n \n \n \n \n \n Price:\n \n {`1 ${\n token.ticker\n } = $ ${usdPrice.toFixed(2)}`}\n \n\n \n \n\n \n \n Repay & Withdraw\n \n \n \n \n );\n}\n","import {\n Container,\n GridItem,\n Tab,\n TabList,\n TabPanel,\n TabPanels,\n Tabs,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n} from '../../../../chain-interaction/contracts';\nimport DepositBorrow from './DepositBorrow';\nimport RepayWithdraw from './RepayWithdraw';\n\nexport default function EditPosition({\n position,\n stratMeta,\n}: React.PropsWithChildren<{\n position?: ParsedPositionMetaRow;\n stratMeta: ParsedStratMetaRow;\n}>) {\n return (\n \n {/* */}\n \n \n \n Borrow\n Repay\n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import { Container, Flex, GridItem, Text } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { ParsedStratMetaRow } from '../../../../chain-interaction/contracts';\n\nexport default function CollateralAPY({\n stratMetaData,\n}: {\n stratMetaData: ParsedStratMetaRow;\n}) {\n return (\n \n {/* */}\n \n \n \n Collateral APY\n \n \n {' '}\n {stratMetaData.APY.toFixed(2)}%\n \n \n \n \n );\n}\n","import React from 'react';\nimport { VStack, Text } from '@chakra-ui/react';\n\ntype Props = {\n title: string;\n value: any;\n};\n\nexport function TitleValue({ title, value }: Props) {\n return (\n \n \n {title}\n \n {value}\n \n );\n}\n","import { Container, Flex, GridItem, Text } from '@chakra-ui/react';\nimport { parseEther } from '@ethersproject/units';\nimport { CurrencyValue } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport React from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n} from '../../../chain-interaction/contracts';\nimport { TitleValue } from '../../../components/data-display/TitleValue';\nimport { parseFloatCurrencyValue } from '../../../utils';\n\nexport function PositionData({\n position,\n stratMeta,\n}: {\n position: ParsedPositionMetaRow;\n stratMeta: ParsedStratMetaRow;\n}) {\n const effectiveDebt = position.debt.gt(position.yield)\n ? position.debt.sub(position.yield)\n : new CurrencyValue(position.debt.currency, BigNumber.from(0));\n\n const { collateral, debt, borrowablePercent } = position;\n const { usdPrice } = stratMeta;\n\n const totalPercentage =\n collateral?.value.gt(0) && usdPrice > 0\n ? (100 * parseFloatCurrencyValue(debt)) /\n (parseFloatCurrencyValue(collateral) * usdPrice)\n : 0;\n const liquidatableZone = borrowablePercent;\n const criticalZone = (90 * borrowablePercent) / 100;\n const riskyZone = (80 * borrowablePercent) / 100;\n const healthyZone = (50 * borrowablePercent) / 100;\n\n const positionHealthColor = debt.value.lt(parseEther('0.1'))\n ? 'accent'\n : totalPercentage > liquidatableZone\n ? 'purple.400'\n : totalPercentage > criticalZone\n ? 'red'\n : totalPercentage > riskyZone\n ? 'orange'\n : totalPercentage > healthyZone\n ? 'green'\n : 'accent';\n const positionHealth = {\n accent: 'Safe',\n green: 'Healthy',\n orange: 'Risky',\n red: 'Critical',\n ['purple.400']: 'Liquidatable',\n };\n\n // console.log('PositionData', debt, borrowablePercent, totalPercentage);\n return (\n \n \n \n \n {positionHealth[positionHealthColor]}\n \n }\n />\n \n \n \n \n \n \n \n );\n}\n","export default __webpack_public_path__ + \"static/media/lines.1f814fe9.svg\";","import {\n // Button,\n Container,\n Flex,\n GridItem,\n Image,\n Spacer,\n Text,\n} from '@chakra-ui/react';\n// import { CurrencyValue } from '@usedapp/core';\n// import { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n // useStable,\n // useEstimatedHarvestable,\n // YieldType,\n} from '../../../chain-interaction/contracts';\n// import {\n// useAMMHarvest,\n// useHarvestPartially,\n// } from '../../../chain-interaction/transactions';\n// import { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { LiquidationFeesContext } from '../../../contexts/LiquidationFeesContext';\nimport lines from '../../../assets/img/lines.svg';\n\nexport default function StrategyTokenInformation({\n stratMeta,\n}: React.PropsWithChildren<{\n position?: ParsedPositionMetaRow;\n stratMeta: ParsedStratMetaRow;\n}>) {\n const calcCRatio = () => {\n return `${Math.round((1 / (stratMeta.borrowablePercent / 100)) * 100)}%`;\n };\n\n // const { sendAMMHarvest, AMMHarvestState } = useAMMHarvest(\n // stratMeta.strategyAddress\n // );\n\n const tokenFees = React.useContext(LiquidationFeesContext);\n\n // const { sendHarvestPartially, harvestPartiallyState } = useHarvestPartially(\n // stratMeta.strategyAddress\n // );\n\n // const stable = useStable();\n // const estimatedHarvestable: BigNumber | undefined = useEstimatedHarvestable(\n // stratMeta.strategyAddress,\n // stratMeta.token.address\n // );\n // const harvestLabel = estimatedHarvestable\n // ? ` $ ${new CurrencyValue(stable, estimatedHarvestable).format({\n // fixedPrecisionDigits: 0,\n // useFixedPrecision: true,\n // suffix: '',\n // prefix: '',\n // })}`\n // : '';\n return (\n \n \n \n {/* \n */}\n \n \n \n Borrow Fee\n \n \n \n {stratMeta.mintingFeePercent.toFixed(2)}%\n \n \n \n \n Minimum cRatio\n \n \n {calcCRatio()}\n \n \n \n Max Loan-To-Value\n \n \n \n {Math.round(stratMeta.borrowablePercent)}%\n \n \n \n \n Liquidation Fee\n \n \n \n {tokenFees.get(stratMeta.token.address) + '%'}\n \n \n {/* \n \n Stability fee\n \n \n \n {stratMeta.stabilityFeePercent.toFixed(2)}%\n \n */}\n {/* \n {stratMeta.yieldType !== YieldType.COMPOUNDING && false ? (\n \n \n Harvestable\n \n \n {\n if (stratMeta.yieldType === YieldType.REPAYING) {\n sendAMMHarvest(stratMeta.token.address);\n } else if (stratMeta.yieldType === YieldType.COMPOUNDING) {\n sendHarvestPartially(stratMeta.token.address);\n }\n }}\n >\n {`Harvest${harvestLabel}`}\n \n \n ) : undefined} */}\n \n \n \n );\n}\n","import { Grid } from '@chakra-ui/react';\nimport { parseEther } from '@ethersproject/units';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n useStable,\n} from '../../../chain-interaction/contracts';\nimport { useMigrateStrategy } from '../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { UserAddressContext } from '../../../contexts/UserAddressContext';\nimport StrategyNameAndSwitch from './change-strategy/StrategyNameAndSwitch';\nimport EditPosition from './edit/EditPosition';\nimport CollateralAPY from './metadata/CollateralAPY';\nimport { PositionData } from './PositionData';\nimport StrategyTokenInformation from './StrategyTokenInformation';\n\nexport function PositionBody({\n position: inputPos,\n stratMeta,\n}: React.PropsWithChildren<{\n position?: ParsedPositionMetaRow;\n stratMeta: Record;\n}>) {\n const position =\n inputPos &&\n inputPos.collateralValue.value.gt(parseEther('0.01')) &&\n inputPos.strategy in stratMeta\n ? inputPos\n : undefined;\n\n const [chosenStrategy, setChosenStrategy] = React.useState(\n position?.strategy ?? Object.keys(stratMeta)[0]\n );\n const account = useContext(UserAddressContext);\n const stable = useStable();\n const { sendMigrateStrategy, migrateStrategyState } = useMigrateStrategy(\n position?.trancheContract\n );\n\n function chooseStrategy(strategyToChoose: string) {\n if (position) {\n sendMigrateStrategy(\n position.trancheId,\n stratMeta[strategyToChoose].strategyAddress,\n stable,\n account!\n );\n } else {\n setChosenStrategy(strategyToChoose);\n }\n }\n\n // console.log('strategy', chosenStrategy);\n\n return (\n <>\n \n \n {position && position.collateralValue.value.gt(parseEther('0.01')) && (\n \n )}\n \n\n \n \n\n \n \n \n \n \n );\n}\n","import { parseEther } from '@ethersproject/units';\nimport * as React from 'react';\nimport {\n ParsedPositionMetaRow,\n ParsedStratMetaRow,\n TokenStratPositionMetadata,\n useIsolatedPositionMetadata,\n} from '../../../chain-interaction/contracts';\nimport { PositionBody } from './PositionBody';\n\nexport function TokenPageBody({\n stratMeta,\n account,\n tokenAddress,\n}: React.PropsWithChildren<{\n stratMeta: Record;\n account: string;\n tokenAddress?: string;\n}>) {\n const allPositionMeta: TokenStratPositionMetadata =\n useIsolatedPositionMetadata(account);\n const positionMeta1: ParsedPositionMetaRow[] =\n (tokenAddress && allPositionMeta && allPositionMeta[tokenAddress]) || [];\n const positionMeta =\n positionMeta1\n .filter((pos) => pos)\n .filter((pos) => pos.collateralValue.value.gt(parseEther('0.01')))\n .filter((pos) => pos.strategy in stratMeta) ?? [];\n\n return positionMeta.length === 0 ? (\n \n ) : (\n <>\n {positionMeta.map((position) => (\n \n ))}\n \n );\n}\n","import { Box, HStack } from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { ParsedStratMetaRow } from '../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../chain-interaction/tokens';\nimport { BackButton } from '../../components/navigation/BackButton';\nimport DeprecatedTokenMessage from '../../components/notifications/DeprecatedTokenMessage';\nimport { TokenDescription } from '../../components/tokens/TokenDescription';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { PositionBody } from './components/PositionBody';\nimport { TokenPageBody } from './components/TokenPageBody';\n\nexport default function TokenPage(props: React.PropsWithChildren) {\n const { chainId } = useEthers();\n const account = useContext(UserAddressContext);\n const params = useParams<'tokenAddress'>();\n const tokenAddress = params.tokenAddress;\n const allStratMeta = React.useContext(StrategyMetadataContext);\n const token = tokenAddress\n ? getTokenFromAddress(chainId, tokenAddress)\n : undefined;\n\n const stratMeta: Record =\n tokenAddress && tokenAddress in allStratMeta\n ? allStratMeta[tokenAddress]\n : {};\n\n return Object.values(stratMeta).length > 0 ? (\n \n \n \n \n \n {token ? (\n \n ) : undefined}\n \n {account ? (\n \n ) : (\n \n )}\n {props.children}\n \n ) : (\n <> \n );\n}\n","import { Box, Button, Flex, Text } from '@chakra-ui/react';\nimport { CurrencyValue, useEthers, useTokenAllowance } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { TxStatus, useAddresses } from '../../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../../chain-interaction/tokens';\nimport {\n useApproveTrans,\n useStakeMore,\n} from '../../../chain-interaction/transactions';\nimport { EnsureWalletConnected } from '../../../components/account/EnsureWalletConnected';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { TokenAmountInputField } from '../../../components/tokens/TokenAmountInputField';\nimport { UserAddressContext } from '../../../contexts/UserAddressContext';\nimport {\n useWalletBalance,\n WalletBalancesContext,\n} from '../../../contexts/WalletBalancesContext';\nimport { parseFloatNoNaN } from '../../../utils';\n\nexport function StakeMore(props: React.PropsWithChildren) {\n const xMoreContract = useAddresses().xMore;\n const balanceCtx = useContext(WalletBalancesContext);\n const moreToken = useAddresses().MoreToken;\n const account = useContext(UserAddressContext);\n const { chainId } = useEthers();\n\n const token = getTokenFromAddress(chainId, moreToken);\n const walletBalance =\n useWalletBalance(token.address) ??\n new CurrencyValue(token, BigNumber.from('0'));\n\n const { sendStake, stakeState } = useStakeMore();\n\n const allowance = new CurrencyValue(\n token,\n useTokenAllowance(token.address, account, xMoreContract) ??\n BigNumber.from('0')\n );\n const { approveState, sendApprove } = useApproveTrans(token.address);\n\n const {\n handleSubmit: handleSubmitDepForm,\n register: registerDepForm,\n setValue: setValueDepForm,\n formState: { errors: errorsDepForm, isSubmitting: isSubmittingDepForm },\n watch,\n } = useForm();\n\n const [moreStakeInput] = watch(['more-stake']);\n\n function onStakeMore(data: { [x: string]: any }) {\n console.log('data', data);\n sendStake(token, data['more-stake']);\n }\n\n const stakeMoreDisabled = balanceCtx.get(moreToken)?.isZero();\n const stakeMoreButtonDisabled = parseFloatNoNaN(moreStakeInput) === 0;\n\n return (\n
    \n \n \n \n Stake MORE\n \n \n \n \n \n \n \n {allowance.gt(walletBalance) === false ? (\n \n sendApprove(xMoreContract)}\n isLoading={\n approveState.status == TxStatus.SUCCESS &&\n allowance.gt(walletBalance) === false\n }\n >\n Approve {token.name}{' '}\n \n \n ) : (\n \n Stake MORE\n \n )}\n \n {props.children}\n \n );\n}\n","import { Box, Button, Flex, Text } from '@chakra-ui/react';\nimport { useEthers } from '@usedapp/core';\nimport * as React from 'react';\nimport { useForm } from 'react-hook-form';\nimport { useAddresses } from '../../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../../chain-interaction/tokens';\nimport {\n useUnstakeMore\n} from '../../../chain-interaction/transactions';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { TokenAmountInputField } from '../../../components/tokens/TokenAmountInputField';\nimport {\n WalletBalancesContext\n} from '../../../contexts/WalletBalancesContext';\nimport { parseFloatNoNaN } from '../../../utils';\n\nexport function UnstakeMore(props: React.PropsWithChildren) {\n const balanceCtx = React.useContext(WalletBalancesContext);\n const xMoreToken = useAddresses().xMore;\n const { chainId } = useEthers();\n\n const token = getTokenFromAddress(chainId, xMoreToken);\n\n const { sendUnstake, unstakeState } = useUnstakeMore();\n\n const {\n handleSubmit: handleSubmitDepForm,\n register: registerDepForm,\n setValue: setValueDepForm,\n formState: { errors: errorsDepForm, isSubmitting: isSubmittingDepForm },\n watch,\n } = useForm();\n\n const [xmoreUnstakeInput] = watch(['xmore-unstake']);\n\n function onStakeMore(data: { [x: string]: any }) {\n console.log('data', data);\n sendUnstake(token, data['xmore-unstake']);\n }\n\n const stakeMoreDisabled = balanceCtx.get(xMoreToken)?.isZero();\n const unstakeMoreButtonDisabled = parseFloatNoNaN(xmoreUnstakeInput) === 0;\n\n return (\n
    \n \n \n \n Unstake xMORE\n \n \n \n \n \n \n \n Unstake xMORE\n \n \n {props.children}\n \n );\n}\n","import {\n Container,\n GridItem,\n Tab,\n TabList,\n TabPanel,\n TabPanels,\n Tabs,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport { StakeMore } from './StakeMore';\nimport { UnstakeMore } from './UnstakeMore';\n\nexport function EditMore(props: React.PropsWithChildren) {\n return (\n \n \n \n \n Stake MORE\n Unstake\n \n \n \n \n \n \n \n \n \n \n {props.children}\n \n \n );\n}\n","import { Container, Flex, GridItem, Image, Text } from '@chakra-ui/react';\nimport { CurrencyValue, useEthers } from '@usedapp/core';\nimport { BigNumber } from 'ethers';\nimport * as React from 'react';\nimport { useAddresses } from '../../../chain-interaction/contracts';\nimport { getTokenFromAddress } from '../../../chain-interaction/tokens';\nimport { useWalletBalance } from '../../../contexts/WalletBalancesContext';\n\nexport function MoreBalance() {\n const { chainId } = useEthers();\n const moreToken = getTokenFromAddress(chainId, useAddresses().MoreToken);\n const xMoreToken = getTokenFromAddress(chainId, useAddresses().xMore);\n\n const moreBalance =\n useWalletBalance(moreToken.address) ??\n new CurrencyValue(moreToken, BigNumber.from('0'));\n const xMoreBalance =\n useWalletBalance(xMoreToken.address) ??\n new CurrencyValue(xMoreToken, BigNumber.from('0'));\n\n return (\n \n \n \n \n \n \n {moreBalance.format()}\n \n \n\n \n \n \n {xMoreBalance.format()}\n \n \n \n \n \n );\n}\n","import {\n Container,\n Flex,\n GridItem,\n Image,\n Spacer,\n Text,\n} from '@chakra-ui/react';\nimport * as React from 'react';\nimport lines from '../../../assets/img/lines.svg';\nimport { ExternalMetadataContext } from '../../../contexts/ExternalMetadataContext';\nimport { formatNumber } from '../../../utils';\n\nexport function StakingAPR(props: React.PropsWithChildren) {\n const { xMoreData } = React.useContext(ExternalMetadataContext);\n\n return (\n \n \n \n \n \n \n Approximate APR\n \n \n \n {xMoreData?.cachedAPR?.toFixed(2)}%\n \n \n \n \n Total Supply\n \n \n \n {formatNumber(xMoreData?.totalSupply)}\n \n \n \n \n MORE / xMORE\n \n \n \n {formatNumber(xMoreData?.currentRatio)}\n \n \n \n {props?.children}\n \n \n );\n}\n","import { Box, Flex, Grid, Text } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { EditMore } from './edit/EditMore';\nimport { MoreBalance } from './metadata/MoreBalance';\nimport { StakingAPR } from './metadata/StakingAPR';\n\nexport default function XMorePage(props: React.PropsWithChildren) {\n return (\n \n \n \n Maximize yield by staking MORE for xMORE\n \n \n \n \n \n \n \n {props.children}\n \n );\n}\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://cra.link/PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://cra.link/PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then((registration) => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://cra.link/PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It is the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch((error) => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' },\n })\n .then((response) => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then((registration) => {\n registration.unregister();\n })\n .catch((error) => {\n console.error(error.message);\n });\n }\n}\n","import { ColorModeScript } from '@chakra-ui/react';\nimport { ChainId, DAppProvider } from '@usedapp/core';\nimport * as React from 'react';\nimport ReactDOM from 'react-dom';\nimport { BrowserRouter, Route, Routes } from 'react-router-dom';\nimport { App } from './App';\nimport { LiquidatablePositionsCtxProvider } from './contexts/LiquidatablePositionsContext';\nimport AdminPage from './pages/Admin';\nimport Analytics from './pages/Analytics';\nimport Dashboard from './pages/Dashboard';\nimport { ErrorBoundary } from './pages/ErrorBoundary/ErrorBoundary';\nimport FarmPage from './pages/Farm';\nimport LiquidatablePositions from './pages/LiquidatablePositions';\nimport LiquidationProtectedLoans from './pages/Loans';\nimport PositionsPage from './pages/Positions';\nimport TokenPage from './pages/TokenPage';\nimport XMorePage from './pages/XMore';\nimport reportWebVitals from './reportWebVitals';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\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 document.getElementById('root')\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://cra.link/PWA\nserviceWorker.unregister();\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}