{"version":3,"sources":["chain-interaction/tokens.ts","chain-interaction/views/contracts.ts","assets/logo/logo.png","contexts/UserAddressContext.tsx","contexts/WalletBalancesContext.tsx","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/ExternalMetadataContext.tsx","contexts/LiquidationFeesContext.tsx","utils/index.ts","chain-interaction/views/strategies.ts","contexts/StrategyMetadataContext.tsx","theme.ts","App.tsx","chain-interaction/views/positions.ts","contexts/LiquidatablePositionsContext.tsx","pages/Admin/components/CopyClipboard/CopyClipboard.tsx","pages/Admin/components/AllAddresses.tsx","constants/deprecated-token-list.ts","components/tokens/TokenDescription.tsx","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","chain-interaction/views/staking.ts","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/FarmCard.tsx","pages/Farm/FarmRow.tsx","pages/Farm/FarmItem.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":["addressToken","Object","fromEntries","values","ChainId","map","key","Map","addressIcons","addressAuxIcon","getTokenFromAddress","chainId","address","Avalanche","get","getAddress","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","TxStatus","YieldType","require","useAddresses","useEthers","chainIdStr","toString","useApproveTrans","tokenContract","Contract","Interface","IERC20","abi","useContractFunction","send","sendApprove","spender","ethers","constants","MaxUint256","approveState","state","useStable","useGlobalDebtCeiling","method","args","defaultResult","useContractCall","useTotalSupply","ERC20","PNG","JOE","USDCe","USDTe","path","UserAddressContext","React","createContext","UserAddressCtxProvider","children","account","search","useLocation","userAddress","URLSearchParams","Provider","value","WalletBalancesContext","WalletBalancesCtxProvider","useContext","tokenBalances","tokensInQuestion","calls","ERC20Interface","results","useContractCalls","forEach","result","index","useWalletBalance","ctxAccount","balancesCtx","AccountModal","isOpen","onClose","deactivate","stable","balanceCtx","moreToken","MoreToken","walletBalance","BigNumber","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","format","significantDigits","alignContent","m","navigator","clipboard","writeText","mr","display","href","isExternal","p","textAlign","UserAddressComponent","handleOpenModal","useMediaQuery","isLargerThan1280","activateBrowserWallet","spacing","bg","padding","isZero","src","colorDot","h","length","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","globalDebtCeiling","totalSupply","hasMaxedOut","gt","sub","parseEther","status","NetworkNotSupported","motionPreset","leastDestructiveRef","colorScheme","PhishingAlertComponent","userAccount","w","TransactionToasts","notifications","useNotifications","toast","useToast","showToast","notification","hash","transaction","getExplorerTransactionLink","id","description","style","duration","isClosable","type","ExternalMetadataContext","yieldFarmingData","yyMetadata","yieldMonitor","xMoreData","additionalYieldData","ExternalMetadataCtxProvider","useState","setXMoreData","setYieldFarmingData","setYYMeta","setYieldMonitor","setAdditionalYieldData","useEffect","fetch","then","response","json","catch","err","console","error","ymData","r","a","lpAddress","totalApy","LiquidationFeesContext","LiquidationFeesCtxProvider","StableLendingLiquidation","tokenFees","IsolatedLendingLiquidation","toNumber","parseFloatNoNaN","input","parsed","parseFloat","isNaN","parseFloatCurrencyValue","Infinity","suffix","thousandSeparator","decimalSeparator","formatNumber","toLocaleString","calcLiquidationPrice","borrowablePercent","debt","collateral","calcLiqPriceFromNum","debtNum","colNum","parseStratMeta","row","globalMoneyAvailable","additionalYield","tvlInToken","tvl","balance","strategyAddress","strategy","underlyingAddress","underlyingStrategy","APY","LiquidYieldStrategy","apy","syntheticDebtCeil","add","totalDebt","trueOne","parseUnits","valPerOne","mul","valuePer1e18","div","debtCeiling","stabilityFeePercent","stabilityFee","mintingFeePercent","mintingFee","totalCollateral","borrowablePer10k","usdPrice","formatEther","strategyName","parseBytes32String","tvlInPeg","harvestBalance2Tally","yieldType","REPAYING","COMPOUNDING","NOYIELD","StrategyMetadataContext","StrategyMetadataCtxProvider","stratMeta","setStratMeta","token2Strat","YieldYakAVAXStrategy","YieldYakStrategy","TraderJoeMasterChefStrategy","SimpleHoldingStrategy","MultiTraderJoeMasterChef3Strategy","masterChef2Tokens","keys","strats","sJoeStrategy","provider","providers","JsonRpcProvider","stratViewer","StrategyViewer","viewMetadata","StableLending","normalResults","viewMetadataNoHarvestBalance","OracleRegistry","fill","TraderJoeMasterChef2Strategy","noHarvestBalanceResults","reduceFn","parsedRow","reduce","getData","useIsolatedStrategyMetadata","isIndeterminate","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","window","ethereum","getNetwork","walletChainId","listAccounts","accounts","supportedChains","includes","request","chainName","rpcUrls","blockExplorerUrls","alert","scrollTo","margin","minHeight","opacity","pointerEvents","bgGradient","useIsolatedPositionMetadata","IsolatedLending","legacy","current","useIsolatedLendingView","trancheContract","parsePositionMeta","list","legacyResults","ONE_WEEK_SECONDS","useUpdatedPositions","timeStart","endPeriod","Math","round","Date","now","startPeriod","floor","x","i","legacyRows","currentRows","parseRows","rows","flatMap","useLiquidationTrans","contractAddress","liquidationContract","DirectFlashLiquidation","sendLiquidation","liquidationState","posYield","yield","trancheId","collateralValue","owner","liquidationPrice","LiquidatablePositionsContext","LiquidatablePositionsCtxProvider","tokenPrices","tstamp","positions","cachedPositions","setCachedPosition","log","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","CopyClipboard","label","useClipboard","hasCopied","onCopy","AllAddresses","props","allowMultiple","flex","deprecatedTokenList","TokenDescription","iconSize","textSize","targetSize","auxIcon","isDeprecated","max","iconUrl","showBorder","isTruncated","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","timestamp2Date","useParsedStakingMetadata","stakingContracts","VestingStakingRewards","AddressZero","contractCalls2","useStakingMetadata","stakingMeta","stakingToken","rewardsToken","earned","rewards","totalRewards","aprPercent","aprPer10k","vestingCliff","periodFinish","stakedBalance","vestingStart","vested","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","Dashboard","ErrorBoundary","hasError","errorMsg","errorInfo","this","setState","Component","ClaimReward","ilAddress","ilContract","sendClaim","claimState","useClaimReward","buttonDisabled","timeDelta","getTime","justify","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","marginBottom","isLoading","SUCCESS","WithdrawForm","sendWithdraw","withdrawToken","wAmount","useWithdraw","FarmCard","stake","reward","apr","acquire","allowToggle","defaultIndex","FarmRow","verticalAlign","FarmItem","FarmPage","avaxMorePayload","item","useSpecialRewardsData","sendSpecialWithdraw","useWithdrawLaunchVestingTrans","farmInfoIdx","getLPTokenLinks","farminfo","curvePoolIdx","externalData","rewardsCoin","getTokenURL","stakeTokenURL","templateRows","colSpan","rowSpan","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","stratFilter","textVariant","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","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":"47muBAgBMA,EAAoDC,OAAOC,YAC/DD,OAAOE,OAAOC,KAASC,KAAI,SAACC,GAAD,MAAS,CAACA,EAAK,IAAIC,SAE1CC,EAAsC,IAAID,IAC1CE,EAAsC,IAAIF,IAEzC,SAASG,EACdC,EACAC,GAEA,OAAOZ,E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,eAAC0T,GAAD,QAIN,eAAC,IAAD,CAAO1uB,KAAK,SAASi5B,QAAS,eAACxJ,GAAD,MAC9B,eAAC,IAAD,CAAOzvB,KAAK,aAAai5B,QAAS,eAACrX,GAAD,MAClC,eAAC,IAAD,CAAO5hB,KAAK,SAASi5B,QAAS,eAACjB,GAAD,MAC9B,eAAC,IAAD,CAAOh4B,KAAK,SAASi5B,QAAS,eAAC7Y,GAAD,MAC9B,eAAC,IAAD,CAAOpgB,KAAK,oBAAoBi5B,QAAS,eAAC7Y,GAAD,kBAMnD8Y,SAASC,eAAe,SDqEpB,kBAAmB90B,WACrBA,UAAU+0B,cAAcC,MACrBjvB,MAAK,SAACkvB,GACLA,EAAaC,gBAEdhvB,OAAM,SAACG,GACND,QAAQC,MAAMA,EAAM+e,YChE5BwO,M","file":"static/js/main.236932b9.chunk.js","sourcesContent":["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 OracleRegistry from '../contracts/artifacts/contracts/OracleRegistry.sol/OracleRegistry.json';\nimport lptokens from '../contracts/lptokens.json';\nimport { useAddresses, useStable } from './views/contracts';\nimport { ParsedPositionMetaRow } from './views/positions';\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 (\n 'pairAddress' in record &&\n record.pairAddress &&\n longTicker !== 'JPL-WAVAX-WBTCe'\n ) {\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 { Contract } from '@ethersproject/contracts';\nimport IERC20 from '@openzeppelin/contracts/build/contracts/IERC20.json';\nimport {\n ChainId,\n ContractCall,\n useContractCall,\n useContractCalls,\n useContractFunction,\n useEthers,\n} from '@usedapp/core';\nimport { parseEther } from '@usedapp/core/node_modules/@ethersproject/units';\nimport { BigNumber, ethers } from 'ethers';\nimport { getAddress, Interface } from 'ethers/lib/utils';\nimport ERC20 from '../../contracts/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json';\nimport IsolatedLending from '../../contracts/artifacts/contracts/IsolatedLending.sol/IsolatedLending.json';\nimport OracleRegistry from '../../contracts/artifacts/contracts/OracleRegistry.sol/OracleRegistry.json';\nimport Stablecoin from '../../contracts/artifacts/contracts/Stablecoin.sol/Stablecoin.json';\nimport StableLending from '../../contracts/artifacts/contracts/StableLending.sol/StableLending.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 IFeeReporter from '../../contracts/artifacts/interfaces/IFeeReporter.sol/IFeeReporter.json';\nimport { getTokenFromAddress } from '../tokens';\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\nconst COMPOUNDING = 52;\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 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\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 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 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\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 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\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 useCurvePoolSLDeposited() {\n // const address = useAddresses().CurvePoolSL;\n return 0;\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","export default __webpack_public_path__ + \"static/media/logo.6d503a67.png\";","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 * 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 {\n useStable,\n useAddresses,\n} from '../../chain-interaction/views/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 {\n useAddresses,\n useStable,\n} from '../../chain-interaction/views/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/views/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 { 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 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};\n\nexport const ExternalMetadataContext =\n React.createContext({\n yieldFarmingData: [],\n yyMetadata: {},\n yieldMonitor: {},\n xMoreData: {} as xMoreMetadata,\n additionalYieldData: {},\n });\n\nexport function ExternalMetadataCtxProvider({\n children,\n}: React.PropsWithChildren) {\n const [xMoreData, setXMoreData] = useState(\n {} as xMoreMetadata\n );\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\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 {children}\n \n );\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/views/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 { 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 { Contract } from '@ethersproject/contracts';\nimport { formatEther, parseEther, parseUnits } from '@ethersproject/units';\nimport {\n ChainId,\n CurrencyValue,\n Token,\n useContractFunction,\n useEthers,\n} from '@usedapp/core';\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 { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { WalletBalancesContext } from '../../contexts/WalletBalancesContext';\nimport IsolatedLending from '../../contracts/artifacts/contracts/IsolatedLending.sol/IsolatedLending.json';\nimport YieldConversionStrategy from '../../contracts/artifacts/contracts/strategies/YieldConversionStrategy.sol/YieldConversionStrategy.json';\nimport Strategy from '../../contracts/artifacts/contracts/Strategy.sol/Strategy.json';\nimport StrategyViewer from '../../contracts/artifacts/contracts/StrategyViewer.sol/StrategyViewer.json';\nimport WrapNativeIsolatedLending from '../../contracts/artifacts/contracts/WrapNativeIsolatedLending.sol/WrapNativeIsolatedLending.json';\nimport { parseFloatCurrencyValue } from '../../utils';\nimport { getTokenFromAddress, tokenAmount } from '../tokens';\nimport {\n addresses,\n useAddresses,\n useGlobalDebtCeiling,\n useStable,\n useTotalSupply,\n YieldType,\n} from './contracts';\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 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\nexport type StrategyMetadata = Record<\n string,\n Record\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\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 [stratMeta, setStratMeta] = useState({});\n const stable = useStable();\n const { chainId } = useEthers();\n\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 const { yyMetadata, yieldMonitor, additionalYieldData } = useContext(\n ExternalMetadataContext\n );\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 ['0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1']: addresses.YieldYakStrategy,\n ['0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256']: 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 ].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\n tokens.push('0x454E67025631C065d3cFAD6d71E6892f74487a15');\n strats.push(addresses.YieldYakStrategy);\n\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 const results = [...normalResults, ...noHarvestBalanceResults];\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 setStratMeta(results?.reduce(reduceFn, {}) ?? {});\n }\n if (\n chainId &&\n stable &&\n balancesCtx &&\n yyMetadata &&\n globalMoneyAvailable != 0 &&\n yieldMonitor &&\n Object.values(stratMeta).length === 0\n ) {\n getData();\n }\n }, [\n chainId,\n stable,\n balancesCtx,\n yyMetadata,\n globalMoneyAvailable,\n yieldMonitor,\n stratMeta,\n ]);\n\n return stratMeta;\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 const 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\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 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\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 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","import { Progress } from '@chakra-ui/react';\nimport React from 'react';\nimport {\n StrategyMetadata,\n useIsolatedStrategyMetadata,\n} from '../chain-interaction/views/strategies';\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 {Object.values(stratMeta).length > 0 ? (\n children\n ) : (\n \n )}\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/views/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 {\n ContractCall,\n CurrencyValue,\n Token,\n useContractCalls,\n useContractFunction,\n} from '@usedapp/core';\nimport { BigNumber, Contract } from 'ethers';\nimport { Interface } from 'ethers/lib/utils';\nimport IsolatedLending from '../../contracts/artifacts/contracts/IsolatedLending.sol/IsolatedLending.json';\nimport StableLending from '../../contracts/artifacts/contracts/StableLending.sol/StableLending.json';\nimport DirectFlashLiquidation from '../../contracts/artifacts/contracts/liquidation/DirectFlashLiquidation.sol/DirectFlashLiquidation.json';\nimport { useAddresses, useIsolatedLendingView, useStable } from './contracts';\nimport { calcLiquidationPrice } from './strategies';\nimport { tokenAmount, getTokenFromAddress } from '../tokens';\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 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\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 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 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","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 { useStable } from '../chain-interaction/views/contracts';\nimport {\n ParsedPositionMetaRow,\n parsePositionMeta,\n useUpdatedMetadataLiquidatablePositions,\n useUpdatedPositions,\n} from '../chain-interaction/views/positions';\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/views/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 {\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/views/contracts';\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 { useWithdrawFees } from '../../../../../chain-interaction/views/contracts';\nimport { ParsedStratMetaRow } from '../../../../../chain-interaction/views/strategies';\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 { useStable } from '../../../../../chain-interaction/views/contracts';\nimport { ParsedPositionMetaRow } from '../../../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../../../chain-interaction/views/strategies';\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/views/positions';\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/views/positions';\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 { Interface } from '@ethersproject/abi';\nimport { parseUnits } from '@ethersproject/units';\nimport {\n ContractCall,\n CurrencyValue,\n Token,\n useContractCall,\n useContractCalls,\n useContractFunction,\n useEthers,\n} from '@usedapp/core';\nimport { BigNumber, Contract, ethers } from 'ethers';\nimport xMore from '../../contracts/artifacts/contracts/governance/xMore.sol/xMore.json';\nimport CurvePoolRewards from '../../contracts/artifacts/contracts/rewards/CurvePoolRewards.sol/CurvePoolRewards.json';\nimport VestingLaunchReward from '../../contracts/artifacts/contracts/rewards/VestingLaunchReward.sol/VestingLaunchReward.json';\nimport VestingStakingRewards from '../../contracts/artifacts/contracts/rewards/VestingStakingRewards.sol/VestingStakingRewards.json';\nimport IStrategy from '../../contracts/artifacts/interfaces/IStrategy.sol/IStrategy.json';\nimport { getTokenFromAddress } from '../tokens';\nimport { useAddresses, useStable } from './contracts';\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\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 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\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 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 const contractCalls2 = useContractCalls(calls);\n const results = (contractCalls2 ?? []) as unknown as [RawStakingMetadata][];\n return results;\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 useXMoreTotalSupply(\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\nfunction timestamp2Date(tstamp: BigNumber) {\n return new Date(tstamp.toNumber() * 1000);\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]) => {\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","import { Box, Container, Grid, Text } from '@chakra-ui/react';\nimport {\n CurrencyValue,\n ERC20Interface,\n useContractCalls,\n useEthers,\n} from '@usedapp/core';\nimport { BigNumber, ethers } from 'ethers';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport {\n DeploymentAddresses,\n useAddresses,\n useAllFeesEver,\n useCurvePoolSLDeposited,\n useStable,\n useTotalSupply,\n} from '../../chain-interaction/views/contracts';\nimport { StrategyMetadataContext } from '../../contexts/StrategyMetadataContext';\nimport { AnalyticsBox } from './AnalyticsBox';\nimport { UserAddressContext } from '../../contexts/UserAddressContext';\nimport { parseEther } from '@usedapp/core/node_modules/@ethersproject/units';\nimport { tokenAmount } from '../../chain-interaction/tokens';\nimport {\n ParsedStakingMetadata,\n useParsedStakingMetadata,\n} from '../../chain-interaction/views/staking';\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 curvePoolSL = useCurvePoolSLDeposited();\n const colRatio = !tvl.isZero()\n ? tvlNoFarm.value.mul(10000).div(supply.sub(curvePoolSL)).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 '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7': [\n '0xaa3Ea561a656cbE310F2E10981085DA2D989f17e',\n ],\n '0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1': [\n '0x10d71115360F9129623096E8108bC6856cf86D3A',\n ],\n '0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256': [\n '0x10d71115360F9129623096E8108bC6856cf86D3A',\n ],\n '0x454E67025631C065d3cFAD6d71E6892f74487a15': [\n '0x0Db20d1643112fA00C4D3DDB58369Ad26c1F7c1d',\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/views/strategies';\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 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/views/strategies';\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 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\n return (\n hiddenStrategies[tokenAddress] ? optionsFiltered : 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 {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 \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 {\n Avatar,\n Button,\n Flex,\n HStack,\n Link,\n Text,\n VStack,\n} from '@chakra-ui/react';\nimport { Token } from '@usedapp/core';\nimport * as React from 'react';\nimport { getIconsFromTokenAddress } from '../../../chain-interaction/tokens';\nimport {\n ParsedStakingMetadata,\n useClaimReward,\n} from '../../../chain-interaction/views/staking';\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 \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}\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,\n FormControl,\n FormErrorMessage,\n Input,\n InputGroup,\n InputRightElement,\n 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 useAddresses,\n TxStatus,\n useApproveTrans,\n} from '../../../chain-interaction/views/contracts';\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';\nimport {\n ParsedStakingMetadata,\n useStake,\n} from '../../../chain-interaction/views/staking';\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 {\n ParsedStakingMetadata,\n useWithdraw,\n} from '../../../chain-interaction/views/staking';\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 =\n 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 {\n Accordion,\n AccordionButton,\n AccordionIcon,\n AccordionItem,\n Box,\n Container,\n Flex,\n Text,\n} from '@chakra-ui/react';\nimport React from 'react';\n\nexport function FarmCard({\n asset,\n stake,\n tvl,\n reward,\n apr,\n acquire,\n content,\n}: {\n asset: any;\n stake: string;\n tvl: string;\n reward: any;\n apr: string;\n acquire: any;\n content?: any;\n}) {\n return (\n <>\n \n \n \n Asset\n \n \n {asset}\n \n \n\n \n \n Stake\n \n \n {stake}\n \n \n\n \n \n TVL\n \n \n {tvl}\n \n \n\n \n \n Reward\n \n {reward}\n \n\n \n \n APR\n \n \n {apr}\n \n \n\n \n \n Acquire\n \n {acquire}\n \n\n {content ? (\n \n \n \n \n Actions\n \n \n \n {content}\n \n \n ) : (\n ''\n )}\n \n \n );\n}\n","import {\n AccordionButton,\n AccordionItem,\n Box,\n Flex,\n Grid,\n Text,\n} from '@chakra-ui/react';\nimport * as React from 'react';\n\nexport default function FarmRow({\n asset,\n stake,\n tvl,\n reward,\n apr,\n acquire,\n content,\n}: {\n asset: any;\n stake: string;\n tvl: string;\n reward: any;\n apr: string;\n acquire: any;\n content?: any;\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 return (\n \n \n \n \n {asset}\n \n \n {stake}\n \n \n {tvl}\n \n \n {reward}\n \n {apr}\n {acquire}\n \n \n {content}\n \n );\n}\n","import { useMediaQuery } from '@chakra-ui/react';\nimport * as React from 'react';\nimport { FarmCard } from './FarmCard';\nimport FarmRow from './FarmRow';\n\nexport default function FarmItem({\n asset,\n stake,\n tvl,\n reward,\n apr,\n acquire,\n content,\n}: {\n asset: any;\n stake: string;\n tvl: string;\n reward: any;\n apr: string;\n acquire: any;\n content?: any;\n}) {\n const [isLargerThan720] = useMediaQuery('(min-width: 720px)');\n\n return isLargerThan720 ? (\n \n ) : (\n \n );\n}\n","import { ExternalLinkIcon } from '@chakra-ui/icons';\nimport {\n Accordion,\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 { useAddresses } from '../../chain-interaction/views/contracts';\nimport {\n ParsedStakingMetadata,\n useParsedStakingMetadata,\n useSpecialRewardsData,\n useWithdrawLaunchVestingTrans,\n} from '../../chain-interaction/views/staking';\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';\nimport FarmItem from './FarmItem';\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 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 console.log(`Claiming vested`, vested.format());\n sendSpecialWithdraw(vested.value);\n }}\n >\n {vested.format({ suffix: '' })} Vested\n \n }\n />\n ) : (\n <>\n )}\n {externalData.length > 0 ? (\n externalData.map((item) => (\n \n \n Get LP Token\n \n \n \n Stake LP Token\n \n \n \n }\n />\n ))\n ) : (\n <>\n )}\n {stakeMeta.map((item, index) => {\n const { totalRewards } = item;\n return (\n }\n stake={`${item.stakedBalance.format({ suffix: '' })}`}\n tvl={`$ ${item.tvl.format({ suffix: '' })}`}\n reward={\n totalRewards.isZero() ? (\n \n \n \n ) : (\n totalRewards.format()\n )\n }\n apr={`${item.aprPercent.toFixed(1)} %`}\n acquire={\n \n Get LP Token  \n \n \n }\n content={\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 { useStable } from '../../chain-interaction/views/contracts';\nimport { ParsedPositionMetaRow } from '../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../chain-interaction/views/strategies';\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/views/positions';\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/views/contracts';\nimport {\n getLiquidationParams,\n LiquidationType,\n} from '../../chain-interaction/tokens';\nimport { LiquidatablePositionsContext } from '../../contexts/LiquidatablePositionsContext';\nimport { LiquidatablePositionsTable } from './LiquidatablePositionsTable';\nimport { useLiquidationTrans } from '../../chain-interaction/views/positions';\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(pos);\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 { ParsedPositionMetaRow } from '../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../chain-interaction/views/strategies';\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/views/positions';\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 { useStable, YieldType } from '../../chain-interaction/views/contracts';\nimport {\n TokenStratPositionMetadata,\n useIsolatedPositionMetadata,\n} from '../../chain-interaction/views/positions';\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/views/strategies';\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/views/strategies';\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 { YieldType } from '../../../../chain-interaction/views/contracts';\nimport { ParsedPositionMetaRow } from '../../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../../chain-interaction/views/strategies';\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 stratFilter(strat, position)\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\nexport function stratFilter(\n strat: ParsedStratMetaRow,\n position?: ParsedPositionMetaRow\n) {\n if (position && position.trancheId == 60200000002) {\n if (position.strategy === strat.strategyAddress) {\n return true;\n } else {\n return false;\n }\n } else if (hiddenStrategies[strat.token.address]) {\n //if the strategy is hidden\n if (hiddenStrategies[strat.token.address].includes(strat.strategyAddress)) {\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","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 TxStatus,\n useApproveTrans,\n useStable,\n} from '../../../../chain-interaction/views/contracts';\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';\nimport { ParsedPositionMetaRow } from '../../../../chain-interaction/views/positions';\nimport {\n calcLiqPriceFromNum,\n ParsedStratMetaRow,\n useDepositBorrowTrans,\n useNativeDepositBorrowTrans,\n} from '../../../../chain-interaction/views/strategies';\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 { useStable } from '../../../../chain-interaction/views/contracts';\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';\nimport { ParsedPositionMetaRow } from '../../../../chain-interaction/views/positions';\nimport {\n calcLiqPriceFromNum,\n ParsedStratMetaRow,\n useNativeRepayWithdrawTrans,\n useRepayWithdrawTrans,\n} from '../../../../chain-interaction/views/strategies';\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 { ParsedPositionMetaRow } from '../../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../../chain-interaction/views/strategies';\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/views/strategies';\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 { ParsedPositionMetaRow } from '../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../chain-interaction/views/strategies';\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 // useStable,\n// useEstimatedHarvestable,\n// YieldType,\n'../../../chain-interaction/views/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';\nimport { ParsedPositionMetaRow } from '../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../chain-interaction/views/strategies';\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 { useStable } from '../../../chain-interaction/views/contracts';\nimport { ParsedPositionMetaRow } from '../../../chain-interaction/views/positions';\nimport {\n ParsedStratMetaRow,\n useMigrateStrategy,\n} from '../../../chain-interaction/views/strategies';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { UserAddressContext } from '../../../contexts/UserAddressContext';\nimport StrategyNameAndSwitch, {\n stratFilter,\n} 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 stratMeta = Object.fromEntries(\n Object.entries(stratMeta).filter(([, strat]) =>\n stratFilter(strat, position)\n )\n );\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 TokenStratPositionMetadata,\n useIsolatedPositionMetadata,\n ParsedPositionMetaRow,\n} from '../../../chain-interaction/views/positions';\nimport { ParsedStratMetaRow } from '../../../chain-interaction/views/strategies';\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 { getTokenFromAddress } from '../../chain-interaction/tokens';\nimport { ParsedStratMetaRow } from '../../chain-interaction/views/strategies';\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 {\n TxStatus,\n useAddresses,\n useApproveTrans,\n} from '../../../chain-interaction/views/contracts';\nimport { getTokenFromAddress } from '../../../chain-interaction/tokens';\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';\nimport { useStakeMore } from '../../../chain-interaction/views/staking';\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/views/contracts';\nimport { getTokenFromAddress } from '../../../chain-interaction/tokens';\nimport { TransactionErrorDialog } from '../../../components/notifications/TransactionErrorDialog';\nimport { TokenAmountInputField } from '../../../components/tokens/TokenAmountInputField';\nimport { WalletBalancesContext } from '../../../contexts/WalletBalancesContext';\nimport { parseFloatNoNaN } from '../../../utils';\nimport { useUnstakeMore } from '../../../chain-interaction/views/staking';\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/views/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":""}