= ({ chainId }) => {
+ return (
+
+ );
+};
diff --git a/packages/components/components/NewsletterSubscription.tsx b/packages/greenfield-app/components/NewsletterSubscription.tsx
similarity index 91%
rename from packages/components/components/NewsletterSubscription.tsx
rename to packages/greenfield-app/components/NewsletterSubscription.tsx
index 62721c3d..84ee7f03 100644
--- a/packages/components/components/NewsletterSubscription.tsx
+++ b/packages/greenfield-app/components/NewsletterSubscription.tsx
@@ -1,5 +1,5 @@
-import SecondaryButton from "@popcorn/components/components/SecondaryActionButton";
-import useSubscribeToNewsletter from "@popcorn/components/hooks/useSubscribeToNewsletter";
+import SecondaryButton from "@popcorn/greenfield-app/components/SecondaryActionButton";
+import useSubscribeToNewsletter from "@popcorn/greenfield-app/hooks/useSubscribeToNewsletter";
import React, { useState } from "react";
interface NewsletterSubscriptionProps {
diff --git a/packages/app/components/Rewards/NotAvailable.tsx b/packages/greenfield-app/components/NotAvailable.tsx
similarity index 100%
rename from packages/app/components/Rewards/NotAvailable.tsx
rename to packages/greenfield-app/components/NotAvailable.tsx
diff --git a/packages/app/components/OfacCheck.tsx b/packages/greenfield-app/components/OfacCheck.tsx
similarity index 80%
rename from packages/app/components/OfacCheck.tsx
rename to packages/greenfield-app/components/OfacCheck.tsx
index 297f0978..b33617ee 100644
--- a/packages/app/components/OfacCheck.tsx
+++ b/packages/greenfield-app/components/OfacCheck.tsx
@@ -1,12 +1,11 @@
-import { setSingleActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
-import useWeb3 from "@popcorn/app/hooks/useWeb3";
+import { setSingleActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
import { useContext, useEffect, useState } from "react";
-import { useDisconnect } from "wagmi";
+import { useAccount, useDisconnect } from "wagmi";
export default function OfacCheck(): JSX.Element {
const { dispatch } = useContext(store);
- const { account } = useWeb3();
+ const { address: account } = useAccount();
const [data, setData] = useState<{ success: boolean; permitted: boolean }>(null);
const [isLoading, setLoading] = useState(false);
const { disconnect } = useDisconnect();
diff --git a/packages/components/components/Page.tsx b/packages/greenfield-app/components/Page.tsx
similarity index 68%
rename from packages/components/components/Page.tsx
rename to packages/greenfield-app/components/Page.tsx
index da184265..ae8c876c 100644
--- a/packages/components/components/Page.tsx
+++ b/packages/greenfield-app/components/Page.tsx
@@ -1,10 +1,10 @@
-import useRestakeAlert from "@popcorn/app/hooks/useRestakeAlert";
-import Footer from "@popcorn/components/components/Footer";
-import Navbar from "@popcorn/components/components/NavBar/NavBar";
-import useSubscribeToNewsletter from "@popcorn/components/hooks/useSubscribeToNewsletter";
+import useRestakeAlert from "@popcorn/greenfield-app/hooks/useRestakeAlert";
+import Footer from "@popcorn/greenfield-app/components/Footer";
+import Navbar from "@popcorn/greenfield-app/components/NavBar/NavBar";
+import useSubscribeToNewsletter from "@popcorn/greenfield-app/hooks/useSubscribeToNewsletter";
import React from "react";
import { Toaster } from "react-hot-toast";
-import useTermsCheck from "@popcorn/components/hooks/useTermsCheck";
+import useTermsCheck from "@popcorn/greenfield-app/hooks/useTermsCheck";
import { useRouter } from "next/router";
import NoSSR from "react-no-ssr";
diff --git a/packages/components/components/PageLoader.tsx b/packages/greenfield-app/components/PageLoader.tsx
similarity index 75%
rename from packages/components/components/PageLoader.tsx
rename to packages/greenfield-app/components/PageLoader.tsx
index 4b47cabc..f8e82ec7 100644
--- a/packages/components/components/PageLoader.tsx
+++ b/packages/greenfield-app/components/PageLoader.tsx
@@ -1,5 +1,5 @@
import { FC } from "react";
-import LoadingSpinner from "@popcorn/app/components/LoadingSpinner";
+import LoadingSpinner from "@popcorn/greenfield-app/components/LoadingSpinner";
const PageLoader: FC = () => {
return (
diff --git a/packages/components/components/Portfolio/AssetCell.tsx b/packages/greenfield-app/components/Portfolio/AssetCell.tsx
similarity index 100%
rename from packages/components/components/Portfolio/AssetCell.tsx
rename to packages/greenfield-app/components/Portfolio/AssetCell.tsx
diff --git a/packages/components/components/Portfolio/AssetRow.tsx b/packages/greenfield-app/components/Portfolio/AssetRow.tsx
similarity index 78%
rename from packages/components/components/Portfolio/AssetRow.tsx
rename to packages/greenfield-app/components/Portfolio/AssetRow.tsx
index 0847b3df..10ffcbb9 100644
--- a/packages/components/components/Portfolio/AssetRow.tsx
+++ b/packages/greenfield-app/components/Portfolio/AssetRow.tsx
@@ -1,13 +1,13 @@
-import type { BigNumberWithFormatted, Pop } from "@popcorn/components/lib/types";
+import type { BigNumberWithFormatted, Pop } from "@popcorn/greenfield-app/lib/types";
import { BigNumber, constants } from "ethers";
import { useState } from "react";
-import { NetworkSticker } from "@popcorn/app/components/NetworkSticker";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
-import { formatAndRoundBigNumber } from "@popcorn/utils";
+import { NetworkSticker } from "@popcorn/greenfield-app/components/NetworkSticker";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
-import { getPercentage } from "@popcorn/components/lib/utils/numbers";
-import { Contract } from "@popcorn/components/lib";
+import { getPercentage } from "@popcorn/greenfield-app/lib/utils/numbers";
+import { Contract } from "@popcorn/greenfield-app/lib";
import AssetCell from "./AssetCell";
export default function AssetRow({
@@ -44,7 +44,7 @@ export default function AssetRow({
-
+
diff --git a/packages/components/components/Portfolio/PortfolioClaimableBalance.tsx b/packages/greenfield-app/components/Portfolio/PortfolioClaimableBalance.tsx
similarity index 92%
rename from packages/components/components/Portfolio/PortfolioClaimableBalance.tsx
rename to packages/greenfield-app/components/Portfolio/PortfolioClaimableBalance.tsx
index 2153d75b..084cba99 100644
--- a/packages/components/components/Portfolio/PortfolioClaimableBalance.tsx
+++ b/packages/greenfield-app/components/Portfolio/PortfolioClaimableBalance.tsx
@@ -1,7 +1,7 @@
-import type { Pop } from "@popcorn/components/lib/types";
+import type { Pop } from "@popcorn/greenfield-app/lib/types";
import { BigNumber } from "ethers";
-import { Escrow } from "@popcorn/components/lib";
+import { Escrow } from "@popcorn/greenfield-app/lib";
import AssetRow from "./AssetRow";
function PortfolioClaimableBalance({
diff --git a/packages/components/components/Portfolio/PortfolioHero.tsx b/packages/greenfield-app/components/Portfolio/PortfolioHero.tsx
similarity index 88%
rename from packages/components/components/Portfolio/PortfolioHero.tsx
rename to packages/greenfield-app/components/Portfolio/PortfolioHero.tsx
index e790c7c8..f84dc96f 100644
--- a/packages/components/components/Portfolio/PortfolioHero.tsx
+++ b/packages/greenfield-app/components/Portfolio/PortfolioHero.tsx
@@ -1,11 +1,11 @@
import Image from "next/image";
import { BigNumber } from "ethers";
-import HeroBgMobile from "@popcorn/components/public/images/portfolioHeroBgmobile.svg";
-import HeroBg from "@popcorn/components/public/images/portfolioHeroBg.svg";
-import { ChainId, formatAndRoundBigNumber } from "@popcorn/utils";
-import NetworkFilter from "@popcorn/components/components/NetworkFilter";
+import HeroBgMobile from "@popcorn/greenfield-app/public/images/portfolioHeroBgmobile.svg";
+import HeroBg from "@popcorn/greenfield-app/public/images/portfolioHeroBg.svg";
+import NetworkFilter from "@popcorn/greenfield-app/components/NetworkFilter";
import { Tabs, TabsProps } from "../Tabs";
+import { ChainId, formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
export interface PortfolioHeroProps {
selectedNetworks: ChainId[];
diff --git a/packages/components/components/Portfolio/PortfolioSection.tsx b/packages/greenfield-app/components/Portfolio/PortfolioSection.tsx
similarity index 87%
rename from packages/components/components/Portfolio/PortfolioSection.tsx
rename to packages/greenfield-app/components/Portfolio/PortfolioSection.tsx
index 25df1054..e9611e1a 100644
--- a/packages/components/components/Portfolio/PortfolioSection.tsx
+++ b/packages/greenfield-app/components/Portfolio/PortfolioSection.tsx
@@ -1,10 +1,10 @@
import { BigNumber, constants } from "ethers";
-import { InfoIconWithTooltip } from "@popcorn/app/components/InfoIconWithTooltip";
-import { formatAndRoundBigNumber } from "@popcorn/utils";
+import { InfoIconWithTooltip } from "@popcorn/greenfield-app/components/InfoIconWithTooltip";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
-import { NotAvailable } from "@popcorn/app/components/Rewards/NotAvailable";
-import NetworkIconList from "@popcorn/components/components/NetworkIconList";
-import { getPercentage } from "@popcorn/components/lib/utils/numbers";
+import { NotAvailable } from "@popcorn/greenfield-app/components/NotAvailable";
+import NetworkIconList from "@popcorn/greenfield-app/components/NetworkIconList";
+import { getPercentage } from "@popcorn/greenfield-app/lib/utils/numbers";
export default function PortfolioSection({
selectedNetworks,
diff --git a/packages/app/components/BatchButter/PseudoRadioButton.tsx b/packages/greenfield-app/components/PseudoRadioButton.tsx
similarity index 75%
rename from packages/app/components/BatchButter/PseudoRadioButton.tsx
rename to packages/greenfield-app/components/PseudoRadioButton.tsx
index 20492077..590206c8 100644
--- a/packages/app/components/BatchButter/PseudoRadioButton.tsx
+++ b/packages/greenfield-app/components/PseudoRadioButton.tsx
@@ -15,9 +15,8 @@ const PseudoRadioButton: React.FC
= ({
}) => {
return (
handleClick()}
>
diff --git a/packages/app/components/SVGIcons/DiscordIcon.tsx b/packages/greenfield-app/components/SVGIcons/DiscordIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/DiscordIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/DiscordIcon.tsx
diff --git a/packages/components/components/SVGIcons/FacebookIcon.tsx b/packages/greenfield-app/components/SVGIcons/FacebookIcon.tsx
similarity index 100%
rename from packages/components/components/SVGIcons/FacebookIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/FacebookIcon.tsx
diff --git a/packages/app/components/SVGIcons/GithubIcon.tsx b/packages/greenfield-app/components/SVGIcons/GithubIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/GithubIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/GithubIcon.tsx
diff --git a/packages/app/components/SVGIcons/MediumIcon.tsx b/packages/greenfield-app/components/SVGIcons/MediumIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/MediumIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/MediumIcon.tsx
diff --git a/packages/app/components/SVGIcons/RedditIcon.tsx b/packages/greenfield-app/components/SVGIcons/RedditIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/RedditIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/RedditIcon.tsx
diff --git a/packages/app/components/SVGIcons/RightArrowIcon.tsx b/packages/greenfield-app/components/SVGIcons/RightArrowIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/RightArrowIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/RightArrowIcon.tsx
diff --git a/packages/app/components/SVGIcons/TelegramIcon.tsx b/packages/greenfield-app/components/SVGIcons/TelegramIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/TelegramIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/TelegramIcon.tsx
diff --git a/packages/app/components/SVGIcons/TwitterIcon.tsx b/packages/greenfield-app/components/SVGIcons/TwitterIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/TwitterIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/TwitterIcon.tsx
diff --git a/packages/app/components/SVGIcons/YoutubeIcon.tsx b/packages/greenfield-app/components/SVGIcons/YoutubeIcon.tsx
similarity index 100%
rename from packages/app/components/SVGIcons/YoutubeIcon.tsx
rename to packages/greenfield-app/components/SVGIcons/YoutubeIcon.tsx
diff --git a/packages/components/components/ScrollableSelect.tsx b/packages/greenfield-app/components/ScrollableSelect.tsx
similarity index 100%
rename from packages/components/components/ScrollableSelect.tsx
rename to packages/greenfield-app/components/ScrollableSelect.tsx
diff --git a/packages/app/components/BatchButter/SearchToken.tsx b/packages/greenfield-app/components/SearchToken.tsx
similarity index 92%
rename from packages/app/components/BatchButter/SearchToken.tsx
rename to packages/greenfield-app/components/SearchToken.tsx
index 0c6f01d1..08fd9a20 100644
--- a/packages/app/components/BatchButter/SearchToken.tsx
+++ b/packages/greenfield-app/components/SearchToken.tsx
@@ -1,9 +1,9 @@
import { SearchIcon } from "@heroicons/react/outline";
-import { ChainId } from "@popcorn/utils";
-import { Token } from "@popcorn/utils/types";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import { FC, useState } from "react";
-import { useDefaultTokenList } from "@popcorn/app/hooks/useDefaultTokenList";
+import { useDefaultTokenList } from "@popcorn/greenfield-app/hooks/useDefaultTokenList";
+import { Token } from "@popcorn/greenfield-app/lib/types";
interface SearchTokenProps {
selectToken: (token: Token) => void;
diff --git a/packages/components/components/SecondaryActionButton.tsx b/packages/greenfield-app/components/SecondaryActionButton.tsx
similarity index 93%
rename from packages/components/components/SecondaryActionButton.tsx
rename to packages/greenfield-app/components/SecondaryActionButton.tsx
index 593dc5f9..448d6e1c 100644
--- a/packages/components/components/SecondaryActionButton.tsx
+++ b/packages/greenfield-app/components/SecondaryActionButton.tsx
@@ -1,4 +1,4 @@
-import RightArrowIcon from "@popcorn/components/components/SVGIcons/RightArrowIcon";
+import RightArrowIcon from "@popcorn/greenfield-app/components/SVGIcons/RightArrowIcon";
import React, { useState } from "react";
interface ButtonProps {
diff --git a/packages/app/components/BatchButter/SelectToken.tsx b/packages/greenfield-app/components/SelectToken.tsx
similarity index 88%
rename from packages/app/components/BatchButter/SelectToken.tsx
rename to packages/greenfield-app/components/SelectToken.tsx
index 4879e13b..c4e505b4 100644
--- a/packages/app/components/BatchButter/SelectToken.tsx
+++ b/packages/greenfield-app/components/SelectToken.tsx
@@ -1,12 +1,12 @@
import { ChevronDownIcon } from "@heroicons/react/outline";
-import { ChainId } from "@popcorn/utils";
-import { Token } from "@popcorn/utils/types";
-import PopUpModal from "@popcorn/components/components/Modal/PopUpModal";
-import SingleActionModal from "@popcorn/components/components/Modal/SingleActionModal";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import PopUpModal from "components/Modal/PopUpModal";
+import SingleActionModal from "components/Modal/SingleActionModal";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import Image from "next/image";
import { useState } from "react";
-import { SearchToken } from "@popcorn/app/components/BatchButter/SearchToken";
+import { SearchToken } from "@popcorn/greenfield-app/components/SearchToken";
+import { Token } from "@popcorn/greenfield-app/lib/types";
export interface SelectTokenProps {
allowSelection: boolean;
diff --git a/packages/app/components/Common/SliderContainer.tsx b/packages/greenfield-app/components/SliderContainer.tsx
similarity index 100%
rename from packages/app/components/Common/SliderContainer.tsx
rename to packages/greenfield-app/components/SliderContainer.tsx
diff --git a/packages/app/components/StakingTermsAndConditions.tsx b/packages/greenfield-app/components/StakingTermsAndConditions.tsx
similarity index 93%
rename from packages/app/components/StakingTermsAndConditions.tsx
rename to packages/greenfield-app/components/StakingTermsAndConditions.tsx
index 26b1419b..a1bc173f 100644
--- a/packages/app/components/StakingTermsAndConditions.tsx
+++ b/packages/greenfield-app/components/StakingTermsAndConditions.tsx
@@ -1,18 +1,18 @@
import { Dispatch } from "react";
-interface TermsAndConditionsProps {
+interface StakingTermsAndConditionsProps {
isDisabled: boolean;
termsAccepted: boolean;
setTermsAccepted: Dispatch;
showLockTerms?: boolean;
}
-const TermsAndConditions = ({
+const StakingTermsAndConditions = ({
isDisabled,
termsAccepted,
setTermsAccepted,
showLockTerms = false,
-}: TermsAndConditionsProps) => {
+}: StakingTermsAndConditionsProps) => {
return (
@@ -62,4 +62,4 @@ const TermsAndConditions = ({
);
};
-export default TermsAndConditions;
+export default StakingTermsAndConditions;
diff --git a/packages/app/components/Common/StatusWithLabel.tsx b/packages/greenfield-app/components/StatusWithLabel.tsx
similarity index 83%
rename from packages/app/components/Common/StatusWithLabel.tsx
rename to packages/greenfield-app/components/StatusWithLabel.tsx
index 8de4f627..200e6dd1 100644
--- a/packages/app/components/Common/StatusWithLabel.tsx
+++ b/packages/greenfield-app/components/StatusWithLabel.tsx
@@ -1,4 +1,4 @@
-import { InfoIconWithTooltip } from "@popcorn/app/components/InfoIconWithTooltip";
+import { InfoIconWithTooltip } from "./InfoIconWithTooltip";
interface InfoIconProps {
id: string;
@@ -38,21 +38,19 @@ export default function StatusWithLabel({
)}
{content == "Coming Soon" || typeof content !== "string" ? (
{content}
) : (
{content.split(" ")[0]} {content.split(" ")[1]}
)}
);
-}
+}
\ No newline at end of file
diff --git a/packages/greenfield-app/components/SweetVault/Deposit.tsx b/packages/greenfield-app/components/SweetVault/Deposit.tsx
index e2d3b50f..6ab50dd0 100644
--- a/packages/greenfield-app/components/SweetVault/Deposit.tsx
+++ b/packages/greenfield-app/components/SweetVault/Deposit.tsx
@@ -1,10 +1,10 @@
-import AssetInputWithAction from "@popcorn/components/components/AssetInputWithAction";
+import AssetInputWithAction from "components/AssetInputWithAction";
import FeeBreakdown from "./FeeBreakdown";
-import { useAllowance } from "@popcorn/components/lib/Erc20/hooks";
+import { useAllowance } from "@popcorn/greenfield-app/lib/Erc20/hooks";
import { Address, useAccount } from "wagmi";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
import { BigNumber, constants } from "ethers";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
function Deposit({
vault,
diff --git a/packages/greenfield-app/components/SweetVault/DepositWithdraw.tsx b/packages/greenfield-app/components/SweetVault/DepositWithdraw.tsx
index 127c9a55..f969d0a4 100644
--- a/packages/greenfield-app/components/SweetVault/DepositWithdraw.tsx
+++ b/packages/greenfield-app/components/SweetVault/DepositWithdraw.tsx
@@ -1,11 +1,11 @@
-import type { Pop } from "@popcorn/components/lib/types";
+import type { Pop } from "@popcorn/greenfield-app/lib/types";
import { Fragment, useState } from "react";
import TabSelector from "@popcorn/greenfield-app/components/TabSelector";
import Deposit from "./Deposit";
import Withdraw from "./Withdraw";
import FeeBreakdown from "./FeeBreakdown";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import { ArrowDownIcon } from "@heroicons/react/24/outline";
const TAB_DEPOSIT = "Deposit";
diff --git a/packages/greenfield-app/components/SweetVault/FeeBreakdown.tsx b/packages/greenfield-app/components/SweetVault/FeeBreakdown.tsx
index c3c43348..65b78c06 100644
--- a/packages/greenfield-app/components/SweetVault/FeeBreakdown.tsx
+++ b/packages/greenfield-app/components/SweetVault/FeeBreakdown.tsx
@@ -1,4 +1,4 @@
-import { formatAndRoundBigNumber } from "@popcorn/utils";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
import { constants } from "ethers";
import useVaultFees from "hooks/vaults/useVaultFees";
diff --git a/packages/greenfield-app/components/SweetVault/SweetVault.tsx b/packages/greenfield-app/components/SweetVault/SweetVault.tsx
index 15b0adaf..1fa20c9e 100644
--- a/packages/greenfield-app/components/SweetVault/SweetVault.tsx
+++ b/packages/greenfield-app/components/SweetVault/SweetVault.tsx
@@ -2,27 +2,27 @@ import { Fragment, useEffect, useState } from "react";
import { Address, useAccount, useBalance, useContractRead, useToken } from "wagmi";
import { BigNumber, constants } from "ethers";
-import { BalanceOf, TotalSupply, ValueOfBalance } from "@popcorn/components/lib/Erc20";
-import useVaultToken from "@popcorn/components/hooks/useVaultToken";
+import { BalanceOf, TotalSupply, ValueOfBalance } from "@popcorn/greenfield-app/lib/Erc20";
+import useVaultToken from "@popcorn/greenfield-app/hooks/useVaultToken";
-import { ChainId, formatAndRoundBigNumber } from "@popcorn/utils";
-import Title from "@popcorn/components/components/content/Title";
-import { Apy } from "@popcorn/components/lib/Staking";
+import { ChainId, formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
+import Title from "@popcorn/greenfield-app/components/content/Title";
+import { Apy } from "@popcorn/greenfield-app/lib/Staking";
import MarkdownRenderer from "./MarkdownRenderer";
import AnimatedChevron from "./AnimatedChevron";
import DepositWithdraw from "./DepositWithdraw";
import Accordion from "../Accordion";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import { FetchTokenResult } from "wagmi/dist/actions";
-import { NetworkSticker } from "@popcorn/app/components/NetworkSticker";
-import { useBalanceOf, useTotalSupply } from "@popcorn/components/lib/Erc20/hooks";
-import { usePrice } from "@popcorn/components/lib/Price";
+import { NetworkSticker } from "@popcorn/greenfield-app/components/NetworkSticker";
+import { useBalanceOf, useTotalSupply } from "@popcorn/greenfield-app/lib/Erc20/hooks";
+import { usePrice } from "@popcorn/greenfield-app/lib/Price";
import { parseUnits } from "ethers/lib/utils.js";
-import { useTotalAssets } from "@popcorn/components/lib/Vault/hooks";
-import { formatNumber } from "@popcorn/utils/formatBigNumber";
-import RightArrowIcon from "@popcorn/components/components/SVGIcons/RightArrowIcon";
-import { InfoIconWithTooltip } from "@popcorn/app/components/InfoIconWithTooltip";
-import useVaultMetadata from "@popcorn/components/lib/Vault/hooks/useVaultMetadata";
+import { useTotalAssets } from "@popcorn/greenfield-app/lib/Vault/hooks";
+import { formatNumber } from "@popcorn/greenfield-app/lib/utils/formatBigNumber";
+import RightArrowIcon from "components/SVGIcons/RightArrowIcon";
+import { InfoIconWithTooltip } from "@popcorn/greenfield-app/components/InfoIconWithTooltip";
+import useVaultMetadata from "@popcorn/greenfield-app/lib/Vault/hooks/useVaultMetadata";
const HUNDRED = constants.Zero.add(100);
@@ -34,7 +34,7 @@ const VAULT_APY_RESOLVER = {
function AssetWithName({ vault, token, chainId, protocol }: { vault: FetchTokenResult; token: FetchTokenResult, chainId: ChainId, protocol: string }) {
return
-
+
diff --git a/packages/greenfield-app/components/SweetVault/Withdraw.tsx b/packages/greenfield-app/components/SweetVault/Withdraw.tsx
index 03224343..74593551 100644
--- a/packages/greenfield-app/components/SweetVault/Withdraw.tsx
+++ b/packages/greenfield-app/components/SweetVault/Withdraw.tsx
@@ -1,10 +1,10 @@
import { Address, useAccount } from "wagmi";
import { constants } from "ethers";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
-import AssetInputWithAction from "@popcorn/components/components/AssetInputWithAction";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import AssetInputWithAction from "components/AssetInputWithAction";
import FeeBreakdown from "./FeeBreakdown";
-import { useAllowance } from "@popcorn/components/lib/Erc20/hooks";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { useAllowance } from "@popcorn/greenfield-app/lib/Erc20/hooks";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
function Withdraw({
vault,
diff --git a/packages/components/components/Tabs.tsx b/packages/greenfield-app/components/Tabs.tsx
similarity index 100%
rename from packages/components/components/Tabs.tsx
rename to packages/greenfield-app/components/Tabs.tsx
diff --git a/packages/app/components/TertiaryActionButton.tsx b/packages/greenfield-app/components/TertiaryActionButton.tsx
similarity index 100%
rename from packages/app/components/TertiaryActionButton.tsx
rename to packages/greenfield-app/components/TertiaryActionButton.tsx
diff --git a/packages/app/components/TokenIcon.tsx b/packages/greenfield-app/components/TokenIcon.tsx
similarity index 53%
rename from packages/app/components/TokenIcon.tsx
rename to packages/greenfield-app/components/TokenIcon.tsx
index f3bee6ca..321bc1af 100644
--- a/packages/app/components/TokenIcon.tsx
+++ b/packages/greenfield-app/components/TokenIcon.tsx
@@ -1,5 +1,5 @@
-import { ChainId } from "@popcorn/utils";
-import { useContractMetadata } from "@popcorn/app/hooks/useContractMetadata";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import { useContractMetadata } from "@popcorn/greenfield-app/lib/Contract";
interface TokenIconProps {
token: string;
@@ -14,22 +14,23 @@ export default function TokenIcon({
imageSize,
chainId,
}: TokenIconProps): JSX.Element {
- const metadata = useContractMetadata(address, chainId);
- if (metadata?.icons?.length > 1) {
+ const metadata = useContractMetadata({ address, chainId });
+
+ if (metadata?.data?.icons?.length > 1) {
return (
);
}
- if (metadata?.icons?.length === 1) {
+ if (metadata?.data?.icons?.length === 1) {
return (
-
+
);
}
// Per default show POP icon
diff --git a/packages/greenfield-app/components/WagmiHookExamples.tsx b/packages/greenfield-app/components/WagmiHookExamples.tsx
index 3a4ec9b6..1dd22a26 100644
--- a/packages/greenfield-app/components/WagmiHookExamples.tsx
+++ b/packages/greenfield-app/components/WagmiHookExamples.tsx
@@ -1,4 +1,4 @@
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
import {
useErc20Read,
useErc20BalanceOf,
@@ -20,7 +20,7 @@ import { useSigner } from "wagmi";
import { useCallback, useEffect, useMemo } from "react";
import { BigNumber, constants } from "ethers";
import { useContractWrite, usePrepareContractWrite } from "wagmi";
-import { formatAndRoundBigNumber } from "@popcorn/utils";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
export default function FoundryHookExample() {
const { address } = useAccount();
diff --git a/packages/components/components/content/Title.tsx b/packages/greenfield-app/components/content/Title.tsx
similarity index 100%
rename from packages/components/components/content/Title.tsx
rename to packages/greenfield-app/components/content/Title.tsx
diff --git a/packages/components/components/index.ts b/packages/greenfield-app/components/index.ts
similarity index 100%
rename from packages/components/components/index.ts
rename to packages/greenfield-app/components/index.ts
diff --git a/packages/greenfield-app/components/landing/Hero.tsx b/packages/greenfield-app/components/landing/Hero.tsx
index 14a88b3a..72982ce0 100644
--- a/packages/greenfield-app/components/landing/Hero.tsx
+++ b/packages/greenfield-app/components/landing/Hero.tsx
@@ -1,26 +1,27 @@
-import SliderContainer from "@popcorn/app/components/Common/SliderContainer";
-import { InfoIconWithTooltip } from "@popcorn/app/components/InfoIconWithTooltip";
-import useNetWorth from "@popcorn/app/hooks/useNetWorth";
-import { ConnectWallet } from "@popcorn/components/components/ConnectWallet";
-import useTvl from "@popcorn/components/lib/Contract/hooks/useTvl";
-import TotalTVL from "@popcorn/components/lib/Contract/TotalTvl";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
-import { ChainId } from "@popcorn/utils";
+import SliderContainer from "@popcorn/greenfield-app/components/SliderContainer";
+import { InfoIconWithTooltip } from "@popcorn/greenfield-app/components/InfoIconWithTooltip";
+import { ConnectWallet } from "@popcorn/greenfield-app/components/ConnectWallet";
+import useTvl from "@popcorn/greenfield-app/lib/Contract/hooks/useTvl";
+import TotalTVL from "@popcorn/greenfield-app/lib/Contract/TotalTvl";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { constants } from "ethers";
-import { formatUnits, parseUnits } from "ethers/lib/utils.js";
+import { formatUnits } from "ethers/lib/utils.js";
import { useAccount } from "wagmi";
+import useNetworth from "@popcorn/greenfield-app/hooks/useNetworth";
+
+const formatter: Intl.NumberFormat = Intl.NumberFormat("en", {
+ //@ts-ignore
+ notation: "compact",
+});
export default function Hero(): JSX.Element {
const { address: account } = useAccount();
- const { totalNetWorth } = useNetWorth();
+ const { totalNetWorth } = useNetworth();
const [butter, threeX] = useNamedAccounts("1", ["butter", "threeX"]);
const { data: butterTVL } = useTvl({ chainId: ChainId.Ethereum, address: butter.address });
const { data: threeXTVL } = useTvl({ chainId: ChainId.Ethereum, address: threeX.address });
- const formatter: Intl.NumberFormat = Intl.NumberFormat("en", {
- //@ts-ignore
- notation: "compact",
- });
return (
diff --git a/packages/components/components/landing/Product.tsx b/packages/greenfield-app/components/landing/Product.tsx
similarity index 87%
rename from packages/components/components/landing/Product.tsx
rename to packages/greenfield-app/components/landing/Product.tsx
index ef5b2bc0..87c0363e 100644
--- a/packages/components/components/landing/Product.tsx
+++ b/packages/greenfield-app/components/landing/Product.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import StatusWithLabel, { StatusWithLabelProps } from "@popcorn/app/components/Common/StatusWithLabel";
+import StatusWithLabel, { StatusWithLabelProps } from "@popcorn/greenfield-app/components/StatusWithLabel";
import Link from "next/link";
export interface ProductProps {
@@ -33,8 +33,8 @@ export default function Product({ title, description, stats, badge, customConten
{customContent}
- {stats.map(stat =>
-
+ {stats.map((stat, i) =>
+
)}
diff --git a/packages/components/components/landing/Products.module.css b/packages/greenfield-app/components/landing/Products.module.css
similarity index 100%
rename from packages/components/components/landing/Products.module.css
rename to packages/greenfield-app/components/landing/Products.module.css
diff --git a/packages/components/components/landing/Products.tsx b/packages/greenfield-app/components/landing/Products.tsx
similarity index 95%
rename from packages/components/components/landing/Products.tsx
rename to packages/greenfield-app/components/landing/Products.tsx
index e7b63d58..b11d2444 100644
--- a/packages/components/components/landing/Products.tsx
+++ b/packages/greenfield-app/components/landing/Products.tsx
@@ -1,11 +1,11 @@
import React, { Fragment } from "react";
import { formatUnits } from "ethers/lib/utils";
-import { ChainId } from "@popcorn/utils";
-import Product from "@popcorn/components/components/landing/Product";
-import { useNamedAccounts } from "@popcorn/components/lib/utils/hooks";
-import { useFeatures } from "@popcorn/components/hooks/useFeatures";
-import Tvl from "@popcorn/components/lib/Contract/Tvl";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import Product from "@popcorn/greenfield-app/components/landing/Product";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils/hooks";
+import { useFeatures } from "@popcorn/greenfield-app/hooks/useFeatures";
+import Tvl from "@popcorn/greenfield-app/lib/Contract/Tvl";
import styles from "./Products.module.css";
diff --git a/packages/app/components/landing/SecuritySection.tsx b/packages/greenfield-app/components/landing/SecuritySection.tsx
similarity index 93%
rename from packages/app/components/landing/SecuritySection.tsx
rename to packages/greenfield-app/components/landing/SecuritySection.tsx
index a545c8a5..d4cdc8ba 100644
--- a/packages/app/components/landing/SecuritySection.tsx
+++ b/packages/greenfield-app/components/landing/SecuritySection.tsx
@@ -1,4 +1,3 @@
-import MobileCardSlider from "@popcorn/app/components/Common/MobileCardSlider";
import Link from "next/link";
import React from "react";
@@ -12,7 +11,7 @@ const descriptions = {
href="https://assets.website-files.com/5f99eb79d508ca853be5f2e8/61b21474b7a1746d889f599d_Popcorn%20SC%20Audit.pdf"
className="text-customPurple"
>
- See Zokyo's review.
+ See Zokyo's review.
>
),
@@ -21,7 +20,7 @@ const descriptions = {
Immunefi is a leading bug bounty platform for Web3 where hundreds of security researchers review smart contracts
for vulnerabilites.{" "}
- See Popcorn's bug bounty program.
+ See Popcorn's bug bounty program.
>
),
diff --git a/packages/greenfield-app/components/portfolio/SweetVaultRow.tsx b/packages/greenfield-app/components/portfolio/SweetVaultRow.tsx
index b8e98ffc..ae57eff6 100644
--- a/packages/greenfield-app/components/portfolio/SweetVaultRow.tsx
+++ b/packages/greenfield-app/components/portfolio/SweetVaultRow.tsx
@@ -1,17 +1,16 @@
-import { NetworkSticker } from "@popcorn/app/components/NetworkSticker";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
-import AssetCell from "@popcorn/components/components/Portfolio/AssetCell";
-import useVaultToken from "@popcorn/components/hooks/useVaultToken";
-import { useBalanceOf, useTotalSupply } from "@popcorn/components/lib/Erc20/hooks";
-import { usePrice } from "@popcorn/components/lib/Price";
-import { useTotalAssets } from "@popcorn/components/lib/Vault/hooks";
-import useVaultMetadata from "@popcorn/components/lib/Vault/hooks/useVaultMetadata";
-import { getPercentage } from "@popcorn/components/lib/utils/numbers";
-import { ChainId, formatAndRoundBigNumber } from "@popcorn/utils";
+import AssetCell from "@popcorn/greenfield-app/components/Portfolio/AssetCell";
+import useVaultToken from "@popcorn/greenfield-app/hooks/useVaultToken";
+import { useBalanceOf, useTotalSupply } from "@popcorn/greenfield-app/lib/Erc20/hooks";
+import { usePrice } from "@popcorn/greenfield-app/lib/Price";
+import { useTotalAssets } from "@popcorn/greenfield-app/lib/Vault/hooks";
+import useVaultMetadata from "@popcorn/greenfield-app/lib/Vault/hooks/useVaultMetadata";
+import { getPercentage } from "@popcorn/greenfield-app/lib/utils/numbers";
+import { NetworkSticker } from "components/NetworkSticker";
+import TokenIcon from "components/TokenIcon";
import { BigNumber, constants } from "ethers";
import { parseUnits } from "ethers/lib/utils.js";
import { useEffect, useState } from "react";
-import { Address, useToken } from "wagmi";
+import { Address } from "wagmi";
export default function SweetVaultRow({ vaultAddress, chainId, account, callback, networth }): any {
const { data: token } = useVaultToken(vaultAddress, chainId);
@@ -53,7 +52,7 @@ export default function SweetVaultRow({ vaultAddress, chainId, account, callback
-
+
diff --git a/packages/greenfield-app/components/rewards/AirdropClaim.tsx b/packages/greenfield-app/components/rewards/AirdropClaim.tsx
index ded677a0..13bacf27 100644
--- a/packages/greenfield-app/components/rewards/AirdropClaim.tsx
+++ b/packages/greenfield-app/components/rewards/AirdropClaim.tsx
@@ -1,10 +1,10 @@
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import * as Icon from "react-feather";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
-import AssetInputWithAction from "@popcorn/components/components/AssetInputWithAction";
-import useTokenAllowance from "@popcorn/app/hooks/tokens/useTokenAllowance";
-import { useAccount } from "wagmi";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import AssetInputWithAction from "components/AssetInputWithAction";
+import { Address, useAccount } from "wagmi";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
+import { useAllowance } from "@popcorn/greenfield-app/lib/Erc20/hooks";
interface AirDropClaimProps {
chainId: ChainId;
@@ -13,7 +13,7 @@ interface AirDropClaimProps {
const AirDropClaim: React.FC
= ({ chainId }) => {
const { address: account } = useAccount();
const [pop, xPop, xPopRedemption] = useNamedAccounts(chainId as any, ["pop", "xPop", "xPopRedemption"]);
- const { data: allowance } = useTokenAllowance(xPop?.address, chainId, account, xPopRedemption?.address);
+ const { data: allowance } = useAllowance({ address: xPop?.address, account: xPopRedemption?.address as Address, chainId });
return (
@@ -28,7 +28,7 @@ const AirDropClaim: React.FC
= ({ chainId }) => {
functionName: "redeem",
successMessage: "Redemption successful!",
}}
- allowance={allowance}
+ allowance={allowance?.value}
>
{({ ActionableComponent, data }) => {
return (
diff --git a/packages/greenfield-app/components/rewards/ClaimCard.tsx b/packages/greenfield-app/components/rewards/ClaimCard.tsx
index 928b15a7..bf45e88e 100644
--- a/packages/greenfield-app/components/rewards/ClaimCard.tsx
+++ b/packages/greenfield-app/components/rewards/ClaimCard.tsx
@@ -1,14 +1,14 @@
import { Address, useAccount, useNetwork, useSwitchNetwork } from "wagmi";
-import { BigNumber, constants } from "ethers";
+import { BigNumber, constants, ethers, Contract as EthersContract } from "ethers";
import toast from "react-hot-toast";
import Image from "next/image";
import ContentLoader from "react-content-loader";
-import { ChainId, networkLogos } from "@popcorn/utils";
-import { Contract, Staking } from "@popcorn/components/lib";
-import { useClaim } from "@popcorn/components/lib/Staking/hooks";
-import MainActionButton from "@popcorn/app/components/MainActionButton";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { ChainId, networkLogos } from "@popcorn/greenfield-app/lib/utils";
+import { Contract, Staking } from "@popcorn/greenfield-app/lib";
+import { useClaim } from "@popcorn/greenfield-app/lib/Staking/hooks";
+import MainActionButton from "@popcorn/greenfield-app/components/MainActionButton";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import useClaimModal from "./useClaimModal";
interface ClaimCardProps {
diff --git a/packages/greenfield-app/components/rewards/StakingRewardsContainer.tsx b/packages/greenfield-app/components/rewards/StakingRewardsContainer.tsx
index f2ecb264..176bc225 100644
--- a/packages/greenfield-app/components/rewards/StakingRewardsContainer.tsx
+++ b/packages/greenfield-app/components/rewards/StakingRewardsContainer.tsx
@@ -1,8 +1,8 @@
-import { NotAvailable } from "@popcorn/app/components/Rewards/NotAvailable";
-import { ChainId } from "@popcorn/utils";
+import { NotAvailable } from "@popcorn/greenfield-app/components/NotAvailable";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { constants } from "ethers";
import useAllStakingAddresses from "hooks/staking/useAllStakingAddresses";
-import { useSum } from "@popcorn/components";
+import { useSum } from "@popcorn/greenfield-app/hooks";
import { useEffect, useState } from "react";
import ClaimCard from "./ClaimCard";
import { Address } from "wagmi";
diff --git a/packages/greenfield-app/components/rewards/useClaimModal.tsx b/packages/greenfield-app/components/rewards/useClaimModal.tsx
index 7940a20c..a1f1b7b1 100644
--- a/packages/greenfield-app/components/rewards/useClaimModal.tsx
+++ b/packages/greenfield-app/components/rewards/useClaimModal.tsx
@@ -1,7 +1,7 @@
import Image from "next/image";
import { useContext } from "react";
-import { setMultiChoiceActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
+import { setMultiChoiceActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
export default function useClaimModal() {
const { dispatch } = useContext(store);
diff --git a/packages/greenfield-app/components/staking/StakeCard.tsx b/packages/greenfield-app/components/staking/StakeCard.tsx
index b6b630e3..6bf01088 100644
--- a/packages/greenfield-app/components/staking/StakeCard.tsx
+++ b/packages/greenfield-app/components/staking/StakeCard.tsx
@@ -1,24 +1,22 @@
-import { ChainId, networkMap } from "@popcorn/utils";
-import Badge, { Badge as BadgeType } from "@popcorn/app/components/Common/Badge";
-import MainActionButton from "@popcorn/app/components/MainActionButton";
-import TokenIcon from "@popcorn/app/components/TokenIcon";
+import { ChainId, networkMap } from "@popcorn/greenfield-app/lib/utils";
+import MainActionButton from "@popcorn/greenfield-app/components/MainActionButton";
+import TokenIcon from "@popcorn/greenfield-app/components/TokenIcon";
import { StakingType } from "hooks/staking/useAllStakingAddresses";
import { useRouter } from "next/router";
import ContentLoader from "react-content-loader";
-import { NetworkSticker } from "@popcorn/app/components/NetworkSticker";
-import { Tvl } from "@popcorn/components/lib/Contract";
-import { Staking, Contract } from "@popcorn/components/lib";
-import { ValueOfBalance } from "@popcorn/components/lib/Erc20";
+import { Tvl } from "@popcorn/greenfield-app/lib/Contract";
+import { Staking, Contract } from "@popcorn/greenfield-app/lib";
+import { ValueOfBalance } from "@popcorn/greenfield-app/lib/Erc20";
import { Address } from "wagmi";
+import { NetworkSticker } from "@popcorn/greenfield-app/components/NetworkSticker";
interface StakeCardProps {
stakingAddress: string;
stakingType: StakingType;
chainId: ChainId;
- badge?: BadgeType;
}
-const StakeCard: React.FC = ({ stakingAddress, stakingType, chainId, badge }) => {
+const StakeCard: React.FC = ({ stakingAddress, stakingType, chainId }) => {
const router = useRouter();
function onSelectPool() {
@@ -51,18 +49,13 @@ const StakeCard: React.FC = ({ stakingAddress, stakingType, chai
-
+
{metadata?.name}
- {badge && (
-
-
-
- )}
diff --git a/packages/app/components/staking/VestingRecordDropDown.tsx b/packages/greenfield-app/components/staking/VestingRecordDropDown.tsx
similarity index 95%
rename from packages/app/components/staking/VestingRecordDropDown.tsx
rename to packages/greenfield-app/components/staking/VestingRecordDropDown.tsx
index b31a0596..4c954a9e 100644
--- a/packages/app/components/staking/VestingRecordDropDown.tsx
+++ b/packages/greenfield-app/components/staking/VestingRecordDropDown.tsx
@@ -1,5 +1,5 @@
-import { formatDate } from "@popcorn/utils/src/DateTime";
-import { LockedBalance } from "@popcorn/utils/types";
+import { formatDate } from "@popcorn/greenfield-app/lib/utils";
+import { LockedBalance } from "@popcorn/greenfield-app/lib/types";
import { useState } from "react";
import * as Icon from "react-feather";
diff --git a/packages/components/components/types.ts b/packages/greenfield-app/components/types.ts
similarity index 100%
rename from packages/components/components/types.ts
rename to packages/greenfield-app/components/types.ts
diff --git a/packages/greenfield-app/components/vaults/useFeeModal.tsx b/packages/greenfield-app/components/vaults/useFeeModal.tsx
index a99a56b1..5598723a 100644
--- a/packages/greenfield-app/components/vaults/useFeeModal.tsx
+++ b/packages/greenfield-app/components/vaults/useFeeModal.tsx
@@ -3,9 +3,9 @@ import { useContext } from "react";
import { constants } from "ethers";
import useVaultFees from "hooks/vaults/useVaultFees";
-import { formatAndRoundBigNumber } from "@popcorn/utils";
-import { setSingleActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
+import { setSingleActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
import asset_fee from "@popcorn/greenfield-app/assets/fee.svg";
const ZERO = constants.Zero;
diff --git a/packages/app/components/Rewards/RewardSummaryCard.tsx b/packages/greenfield-app/components/vesting/RewardSummaryCard.tsx
similarity index 92%
rename from packages/app/components/Rewards/RewardSummaryCard.tsx
rename to packages/greenfield-app/components/vesting/RewardSummaryCard.tsx
index 889b0e02..fb93da2e 100644
--- a/packages/app/components/Rewards/RewardSummaryCard.tsx
+++ b/packages/greenfield-app/components/vesting/RewardSummaryCard.tsx
@@ -1,5 +1,5 @@
-import { InfoIconWithTooltip, InfoIconWithTooltipProps } from "@popcorn/app/components/InfoIconWithTooltip";
-import MainActionButton from "@popcorn/app/components/MainActionButton";
+import { InfoIconWithTooltip, InfoIconWithTooltipProps } from "@popcorn/greenfield-app/components/InfoIconWithTooltip";
+import MainActionButton from "@popcorn/greenfield-app/components/MainActionButton";
interface RewardSummaryCardProps {
iconUri: string;
diff --git a/packages/greenfield-app/components/vesting/Vesting.tsx b/packages/greenfield-app/components/vesting/Vesting.tsx
index 2578b72d..56f5f95d 100644
--- a/packages/greenfield-app/components/vesting/Vesting.tsx
+++ b/packages/greenfield-app/components/vesting/Vesting.tsx
@@ -1,14 +1,14 @@
-import RewardSummaryCard from "@popcorn/app/components/Rewards/RewardSummaryCard";
-import { ChainId, formatAndRoundBigNumber, networkLogos } from "@popcorn/utils";
+import RewardSummaryCard from "./RewardSummaryCard";
+import { ChainId, formatAndRoundBigNumber, networkLogos } from "@popcorn/greenfield-app/lib/utils";
import { BigNumber, constants } from "ethers";
import { useEffect, useState } from "react";
import ContentLoader from "react-content-loader";
import Image from "next/image";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
import { useAccount, useNetwork, useSwitchNetwork } from "wagmi";
-import { useEscrows } from "@popcorn/components/lib/Escrow";
+import { useEscrows } from "@popcorn/greenfield-app/lib/Escrow";
import toast from "react-hot-toast";
-import { useClaimEscrow } from "@popcorn/components";
+import { useClaimEscrow } from "@popcorn/greenfield-app/hooks";
interface VestingProps {
chainId: ChainId;
diff --git a/packages/greenfield-app/components/vesting/VestingContainer.tsx b/packages/greenfield-app/components/vesting/VestingContainer.tsx
index b7d290b6..1e690b09 100644
--- a/packages/greenfield-app/components/vesting/VestingContainer.tsx
+++ b/packages/greenfield-app/components/vesting/VestingContainer.tsx
@@ -1,17 +1,17 @@
-import { NotAvailable } from "@popcorn/app/components/Rewards/NotAvailable";
-import useWeb3 from "@popcorn/app/hooks/useWeb3";
-import { ChainId } from "@popcorn/utils";
+import { NotAvailable } from "@popcorn/greenfield-app/components/NotAvailable";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { constants } from "ethers";
-import { useSum } from "@popcorn/components";
+import { useSum } from "@popcorn/greenfield-app/hooks";
import { useEffect, useState } from "react";
import Vesting from "./Vesting";
+import { useAccount } from "wagmi";
interface VestingContainerProps {
selectedNetworks: ChainId[];
}
export default function VestingContainer({ selectedNetworks }: VestingContainerProps): JSX.Element {
- const { account } = useWeb3();
+ const { address: account } = useAccount();
const [prevAccount, setPrevAccount] = useState(account);
const { loading, sum, add, reset } = useSum({ expected: selectedNetworks?.length || 1 });
diff --git a/packages/components/context/FeatureToggleContext.tsx b/packages/greenfield-app/context/FeatureToggleContext.tsx
similarity index 88%
rename from packages/components/context/FeatureToggleContext.tsx
rename to packages/greenfield-app/context/FeatureToggleContext.tsx
index 14c9434d..3a4d6e22 100644
--- a/packages/components/context/FeatureToggleContext.tsx
+++ b/packages/greenfield-app/context/FeatureToggleContext.tsx
@@ -1,4 +1,4 @@
-import defaultFeatureFlags from "@popcorn/components/defaultFeatureFlags";
+import defaultFeatureFlags from "@popcorn/greenfield-app/defaultFeatureFlags";
import { createContext, useState } from "react";
export const FeatureToggleContext = createContext({
diff --git a/packages/components/context/Networth.tsx b/packages/greenfield-app/context/Networth.tsx
similarity index 100%
rename from packages/components/context/Networth.tsx
rename to packages/greenfield-app/context/Networth.tsx
diff --git a/packages/components/context/actions.tsx b/packages/greenfield-app/context/actions.tsx
similarity index 93%
rename from packages/components/context/actions.tsx
rename to packages/greenfield-app/context/actions.tsx
index 8aa4747b..e7bdf33d 100644
--- a/packages/components/context/actions.tsx
+++ b/packages/greenfield-app/context/actions.tsx
@@ -1,19 +1,19 @@
import {
DualActionModalProps,
DefaultDualActionModalProps,
-} from "@popcorn/components/components/Modal/DualActionModal";
+} from "components/Modal/DualActionModal";
import {
DefaultMultiChoiceActionModalProps,
MultiChoiceActionModalProps,
-} from "@popcorn/components/components/Modal/MultiChoiceActionModal";
+} from "components/Modal/MultiChoiceActionModal";
import {
DefaultNetworkChangePromptModalProps,
NetworkChangePromptModalProps,
-} from "@popcorn/components/components/Modal/NetworkChangePromptModal";
+} from "components/Modal/NetworkChangePromptModal";
import {
DefaultSingleActionModalProps,
SingleActionModalProps,
-} from "@popcorn/components/components/Modal/SingleActionModal";
+} from "components/Modal/SingleActionModal";
export const PUSH_NOTIFICATION = "notifications/PUSH_NOTIFICATION";
export const UNSET_NOTIFICATION = "notifications/UNSET_NOTIFICATION";
diff --git a/packages/components/context/store.tsx b/packages/greenfield-app/context/store.tsx
similarity index 89%
rename from packages/components/context/store.tsx
rename to packages/greenfield-app/context/store.tsx
index 7646aa37..1d98750a 100644
--- a/packages/components/context/store.tsx
+++ b/packages/greenfield-app/context/store.tsx
@@ -1,20 +1,20 @@
import {
DefaultMultiChoiceActionModalProps,
MultiChoiceActionModalProps,
-} from "@popcorn/components/components/Modal/MultiChoiceActionModal";
+} from "components/Modal/MultiChoiceActionModal";
import {
DefaultNetworkChangePromptModalProps,
NetworkChangePromptModalProps,
-} from "@popcorn/components/components/Modal/NetworkChangePromptModal";
+} from "components/Modal/NetworkChangePromptModal";
import {
DefaultSingleActionModalProps,
SingleActionModalProps,
-} from "@popcorn/components/components/Modal/SingleActionModal";
+} from "components/Modal/SingleActionModal";
import React, { createContext, useReducer } from "react";
import {
DefaultDualActionModalProps,
DualActionModalProps,
-} from "@popcorn/components/components/Modal/DualActionModal";
+} from "components/Modal/DualActionModal";
import {
AppActions,
CLEAR_NOTIFICATIONS,
@@ -30,7 +30,7 @@ import {
SINGLE_ACTION_MODAL,
UNSET_NOTIFICATION,
WALLET_SELECT_MODAL,
-} from "@popcorn/components/context/actions";
+} from "@popcorn/greenfield-app/context/actions";
interface DefaultState {
singleActionModal: SingleActionModalProps;
diff --git a/packages/components/defaultFeatureFlags.ts b/packages/greenfield-app/defaultFeatureFlags.ts
similarity index 100%
rename from packages/components/defaultFeatureFlags.ts
rename to packages/greenfield-app/defaultFeatureFlags.ts
diff --git a/packages/components/hooks/index.ts b/packages/greenfield-app/hooks/index.ts
similarity index 80%
rename from packages/components/hooks/index.ts
rename to packages/greenfield-app/hooks/index.ts
index 80a4de21..323a6edd 100644
--- a/packages/components/hooks/index.ts
+++ b/packages/greenfield-app/hooks/index.ts
@@ -1,4 +1,3 @@
-export * from "./portfolio";
export * from "./useSum";
export * from "./useFeatures";
export * from "./useClaimEscrow";
diff --git a/packages/greenfield-app/hooks/staking/useAllStakingAddresses.tsx b/packages/greenfield-app/hooks/staking/useAllStakingAddresses.tsx
index 4b930c1d..430fd97c 100644
--- a/packages/greenfield-app/hooks/staking/useAllStakingAddresses.tsx
+++ b/packages/greenfield-app/hooks/staking/useAllStakingAddresses.tsx
@@ -1,6 +1,5 @@
-import { useDeployment } from "@popcorn/app/hooks/useDeployment";
-import { useStakingContracts } from "@popcorn/app/hooks/useStakingContracts";
-import { ChainId } from "@popcorn/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
export enum StakingType {
PopLocker,
@@ -15,33 +14,25 @@ interface StakingAddressWithMetadata {
export default function useAllStakingAddresses(): StakingAddressWithMetadata[] {
// Ethereum
- const { popStaking: ethereumPopStaking } = useDeployment(ChainId.Ethereum);
- const ethereumStakingAddresses = useStakingContracts(ChainId.Ethereum);
+ const [ethereumPopStaking] = useNamedAccounts("1", ["popStaking"]);
+ const ethereumStakingAddresses = useNamedAccounts("1", ["butterStaking", "threeXStaking", "xenStaking", "popUsdcArrakisVaultStaking"]);
// Polygon
- const { popStaking: polygonPopStaking } = useDeployment(ChainId.Polygon);
- const polygonStakingAddresses = useStakingContracts(ChainId.Polygon);
-
- // Localhost
- const { popStaking: localhostPopStaking } = useDeployment(ChainId.Localhost);
- const localhostStakingAddresses = useStakingContracts(ChainId.Localhost);
+ const [polygonPopStaking] = useNamedAccounts("137", ["popStaking"]);
+ const polygonStakingAddresses = useNamedAccounts("137", ["popUsdcArrakisVaultStaking"]);
//Optimism
- const { popStaking: optimismPopStaking } = useDeployment(ChainId.Optimism);
+ const [optimismPopStaking] = useNamedAccounts("10", ["popStaking"]);
return [
- { chainId: ChainId.Ethereum, stakingType: StakingType.PopLocker, address: ethereumPopStaking },
- { chainId: ChainId.Polygon, stakingType: StakingType.PopLocker, address: polygonPopStaking },
- { chainId: ChainId.Optimism, stakingType: StakingType.PopLocker, address: optimismPopStaking },
- { chainId: ChainId.Localhost, stakingType: StakingType.PopLocker, address: localhostPopStaking },
+ { chainId: ChainId.Ethereum, stakingType: StakingType.PopLocker, address: ethereumPopStaking?.address },
+ { chainId: ChainId.Polygon, stakingType: StakingType.PopLocker, address: polygonPopStaking?.address },
+ { chainId: ChainId.Optimism, stakingType: StakingType.PopLocker, address: optimismPopStaking?.address },
...(ethereumStakingAddresses?.length ? ethereumStakingAddresses : []).map(
- (address) => ({ chainId: ChainId.Ethereum, stakingType: StakingType.StakingPool, address } || {}),
+ (staking) => ({ chainId: ChainId.Ethereum, stakingType: StakingType.StakingPool, address: staking?.address } || {}),
),
...(polygonStakingAddresses?.length ? polygonStakingAddresses : []).map(
- (address) => ({ chainId: ChainId.Polygon, stakingType: StakingType.StakingPool, address } || {}),
- ),
- ...(localhostStakingAddresses?.length ? localhostStakingAddresses : []).map(
- (address) => ({ chainId: ChainId.Localhost, stakingType: StakingType.StakingPool, address } || {}),
- ),
+ (staking) => ({ chainId: ChainId.Polygon, stakingType: StakingType.StakingPool, address: staking?.address } || {}),
+ )
];
}
diff --git a/packages/greenfield-app/hooks/staking/useChainsWithStaking.tsx b/packages/greenfield-app/hooks/staking/useChainsWithStaking.tsx
index 59cd7ff0..1f65ec63 100644
--- a/packages/greenfield-app/hooks/staking/useChainsWithStaking.tsx
+++ b/packages/greenfield-app/hooks/staking/useChainsWithStaking.tsx
@@ -1,4 +1,4 @@
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
export function useChainsWithStaking(): ChainId[] {
return [
diff --git a/packages/components/hooks/useApprove.ts b/packages/greenfield-app/hooks/useApprove.ts
similarity index 100%
rename from packages/components/hooks/useApprove.ts
rename to packages/greenfield-app/hooks/useApprove.ts
diff --git a/packages/components/hooks/useApproveBalance.ts b/packages/greenfield-app/hooks/useApproveBalance.ts
similarity index 81%
rename from packages/components/hooks/useApproveBalance.ts
rename to packages/greenfield-app/hooks/useApproveBalance.ts
index 22a113d8..c8c91059 100644
--- a/packages/components/hooks/useApproveBalance.ts
+++ b/packages/greenfield-app/hooks/useApproveBalance.ts
@@ -1,5 +1,5 @@
-import type { ContractWriteArgs } from "@popcorn/components/lib/types";
-import type { ChainId } from "@popcorn/utils";
+import type { ContractWriteArgs } from "@popcorn/greenfield-app/lib/types";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils";
import { useContractWrite, usePrepareContractWrite } from "wagmi";
import { constants } from "ethers";
diff --git a/packages/greenfield-app/hooks/useChainIdFromUrl.ts b/packages/greenfield-app/hooks/useChainIdFromUrl.ts
new file mode 100644
index 00000000..17bebed7
--- /dev/null
+++ b/packages/greenfield-app/hooks/useChainIdFromUrl.ts
@@ -0,0 +1,27 @@
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import { useRouter } from "next/router";
+import { useEffect, useState } from "react";
+import { useNetwork } from "wagmi";
+
+function toTitleCase(toConvert: string): string {
+ if (toConvert.toLowerCase() === ChainId[56].toLowerCase()) {
+ return ChainId[56];
+ }
+ return toConvert.replace(/\w\S*/g, function (txt) {
+ return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
+ });
+}
+
+export function useChainIdFromUrl() {
+ const {chain} = useNetwork();
+ const router = useRouter();
+ const [chainId, setChainId] = useState(chain?.id || Number(process.env.CHAIN_ID));
+
+ useEffect(() => {
+ if (router?.query?.network?.length > 0) {
+ setChainId(ChainId[toTitleCase(router?.query?.network as string)]);
+ }
+ }, [router?.query?.network]);
+
+ return chainId;
+}
diff --git a/packages/components/hooks/useClaimEscrow.ts b/packages/greenfield-app/hooks/useClaimEscrow.ts
similarity index 78%
rename from packages/components/hooks/useClaimEscrow.ts
rename to packages/greenfield-app/hooks/useClaimEscrow.ts
index 04984a8b..21b03298 100644
--- a/packages/components/hooks/useClaimEscrow.ts
+++ b/packages/greenfield-app/hooks/useClaimEscrow.ts
@@ -1,6 +1,6 @@
-import { ConfigArgs } from "../types";
+import { ConfigArgs } from "../../greenfield-app/types";
import { useContractWrite, usePrepareContractWrite } from "wagmi";
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
export const useClaimEscrow = (escrowIds: string[], address: string, chainId: ChainId, wagmiConfig?: ConfigArgs) => {
const { config } = usePrepareContractWrite({
diff --git a/packages/greenfield-app/hooks/useDefaultTokenList.ts b/packages/greenfield-app/hooks/useDefaultTokenList.ts
new file mode 100644
index 00000000..79b458eb
--- /dev/null
+++ b/packages/greenfield-app/hooks/useDefaultTokenList.ts
@@ -0,0 +1,8 @@
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import { useMemo } from "react";
+
+export const useDefaultTokenList = (chainId: ChainId) => {
+ const [dai, usdc, usdt] = useNamedAccounts(String(chainId) as any, ["dai", "usdc", "usdt", ""]);
+ return useMemo(() => [dai, usdc, usdt].filter((token) => !!token), [chainId]);
+};
diff --git a/packages/greenfield-app/hooks/useDeploymentV2.ts b/packages/greenfield-app/hooks/useDeploymentV2.ts
index 07178a69..e50eb56b 100644
--- a/packages/greenfield-app/hooks/useDeploymentV2.ts
+++ b/packages/greenfield-app/hooks/useDeploymentV2.ts
@@ -1,5 +1,5 @@
import { useMemo } from "react";
-import deployments from "@popcorn/hardhat/lib/utils/exporter/out/deployments.json";
+import deployments from "@popcorn/greenfield-app/lib/deployments/deployments.json";
export type Deployments = typeof deployments;
diff --git a/packages/components/hooks/useFeatures.tsx b/packages/greenfield-app/hooks/useFeatures.tsx
similarity index 66%
rename from packages/components/hooks/useFeatures.tsx
rename to packages/greenfield-app/hooks/useFeatures.tsx
index d49ab45f..51c082a4 100644
--- a/packages/components/hooks/useFeatures.tsx
+++ b/packages/greenfield-app/hooks/useFeatures.tsx
@@ -1,4 +1,4 @@
-import { FeatureToggleContext } from "@popcorn/components/context/FeatureToggleContext";
+import { FeatureToggleContext } from "@popcorn/greenfield-app/context/FeatureToggleContext";
import { useContext } from "react";
export const useFeatures = () => {
diff --git a/packages/components/hooks/useInitializeGTM.ts b/packages/greenfield-app/hooks/useInitializeGTM.ts
similarity index 100%
rename from packages/components/hooks/useInitializeGTM.ts
rename to packages/greenfield-app/hooks/useInitializeGTM.ts
diff --git a/packages/greenfield-app/hooks/useNetworkFilter.tsx b/packages/greenfield-app/hooks/useNetworkFilter.tsx
index be5b7641..2c6c6717 100644
--- a/packages/greenfield-app/hooks/useNetworkFilter.tsx
+++ b/packages/greenfield-app/hooks/useNetworkFilter.tsx
@@ -1,4 +1,4 @@
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { useEffect, useState } from "react";
export default function useNetworkFilter(availableNetworks: ChainId[]): [ChainId[], (chainId: ChainId) => void] {
diff --git a/packages/app/hooks/useNetworkName.tsx b/packages/greenfield-app/hooks/useNetworkName.ts
similarity index 79%
rename from packages/app/hooks/useNetworkName.tsx
rename to packages/greenfield-app/hooks/useNetworkName.ts
index 81126973..b38677c1 100644
--- a/packages/app/hooks/useNetworkName.tsx
+++ b/packages/greenfield-app/hooks/useNetworkName.ts
@@ -1,13 +1,12 @@
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { useRouter } from "next/router";
import { useEffect, useMemo, useState } from "react";
-import { useNetwork } from "wagmi";
-import { useIsConnected } from "./useIsConnected";
+import { useAccount, useNetwork } from "wagmi";
export default function useNetworkName() {
const router = useRouter();
const { chain } = useNetwork();
- const isConnected = useIsConnected();
+ const {isConnected} = useAccount()
const [nameFromUrl, setNameFromUrl] = useState((router?.query?.network as string) || "");
useEffect(() => {
diff --git a/packages/app/hooks/useNetWorth.ts b/packages/greenfield-app/hooks/useNetworth.ts
similarity index 91%
rename from packages/app/hooks/useNetWorth.ts
rename to packages/greenfield-app/hooks/useNetworth.ts
index 0b600eb2..00fad71e 100644
--- a/packages/app/hooks/useNetWorth.ts
+++ b/packages/greenfield-app/hooks/useNetworth.ts
@@ -1,18 +1,13 @@
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { BigNumber, constants } from "ethers/lib/ethers";
-import { useCallback, useMemo } from "react";
+import { useCallback } from "react";
import { useAccount } from "wagmi";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
-import usePrice from "@popcorn/components/lib/Price/hooks/usePrice";
-import { useBalanceOf } from "@popcorn/components/lib/Erc20/hooks";
-import { useClaimableBalance } from "@popcorn/components/lib/PopLocker/hooks/useClaimableBalance";
-import { useLockedBalances } from "@popcorn/components/lib/PopLocker/hooks";
-import { useClaimableBalance as useClaimableBalanceStaking } from "@popcorn/components/lib/Staking/hooks/useClaimableBalance";
-import { useEscrowBalance } from "@popcorn/components/lib/Escrow/hooks/useEscrowBalance";
-import { useButterHoldings } from "@popcorn/components/lib/Butter/hooks/useButterHoldings";
-import { useButterRedeemHoldings } from "@popcorn/components/lib/Butter/hooks/useButterRedeemHoldings";
-import { useThreeXHoldings } from "@popcorn/components/lib/3X/hooks/useThreeXHoldings";
-import { useThreeXRedeemHoldings } from "@popcorn/components/lib/3X/hooks";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import usePrice from "@popcorn/greenfield-app/lib/Price/hooks/usePrice";
+import { useBalanceOf } from "@popcorn/greenfield-app/lib/Erc20/hooks";
+import { useClaimableBalance } from "@popcorn/greenfield-app/lib/PopLocker/hooks/useClaimableBalance";
+import { useLockedBalances } from "@popcorn/greenfield-app/lib/PopLocker/hooks";
+import { useEscrowBalance } from "@popcorn/greenfield-app/lib/Escrow/hooks/useEscrowBalance";
function getHoldingValue(tokenAmount: BigNumber, tokenPrice: BigNumber): BigNumber {
tokenAmount = tokenAmount?.gt(constants.Zero) ? tokenAmount : constants.Zero;
diff --git a/packages/greenfield-app/hooks/usePoolTvl.ts b/packages/greenfield-app/hooks/usePoolTvl.ts
new file mode 100644
index 00000000..632031f0
--- /dev/null
+++ b/packages/greenfield-app/hooks/usePoolTvl.ts
@@ -0,0 +1,46 @@
+import { BigNumber, Contract, constants } from "ethers";
+import useSWR, { SWRResponse } from "swr";
+import { usePrice } from "@popcorn/greenfield-app/lib/Price";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import { ChainId, PRC_PROVIDERS } from "@popcorn/greenfield-app/lib/utils/connectors";
+
+const REFETCH_INTERVAL = 10 * 1_000;
+
+export async function getPoolTVL(
+ _key,
+ poolAddress: string,
+ rpcProvider,
+ popAddress: string,
+ usdcAddress: string,
+ popPrice: BigNumber,
+ usdcPrice: BigNumber,
+): Promise {
+ const pop = new Contract(popAddress, ["function balanceOf(address) external view returns (uint256)"], rpcProvider);
+ const usdc = new Contract(usdcAddress, ["function balanceOf(address) external view returns (uint256)"], rpcProvider);
+
+ const popBal = await pop.balanceOf(poolAddress);
+ const usdcBal = await usdc.balanceOf(poolAddress);
+
+ const popValue = popBal.mul(popPrice).div(constants.WeiPerEther);
+ const usdcValue = usdcBal.mul(usdcPrice).div("1000000"); // use 1e6
+ return popValue.add(usdcValue);
+}
+
+export default function usePoolTVL(chainId: ChainId): SWRResponse {
+ const [pop, usdc, popUsdcUniV3Pool] = useNamedAccounts(String(chainId) as any, ["pop", "usdc", "popUsdcUniV3Pool"])
+ const [ethPop, ethUsdc] = useNamedAccounts("1", ["pop", "usdc"]);
+
+ const { data: popPrice } = usePrice({ address: ethPop?.address, chainId: ChainId.Ethereum });
+ const { data: usdcPrice } = usePrice({ address: ethUsdc?.address, chainId: ChainId.Ethereum });
+
+ return useSWR(
+ [`getPoolTVL-${chainId}`, popUsdcUniV3Pool?.address, PRC_PROVIDERS[chainId], pop?.address, usdc?.address, popPrice?.value, usdcPrice?.value],
+ getPoolTVL,
+ {
+ refreshInterval: REFETCH_INTERVAL,
+ dedupingInterval: REFETCH_INTERVAL,
+ shouldRetryOnError: false,
+ keepPreviousData: true
+ },
+ );
+}
diff --git a/packages/app/hooks/useProductLinks.tsx b/packages/greenfield-app/hooks/useProductLinks.ts
similarity index 100%
rename from packages/app/hooks/useProductLinks.tsx
rename to packages/greenfield-app/hooks/useProductLinks.ts
diff --git a/packages/components/hooks/useRedeemXPop.ts b/packages/greenfield-app/hooks/useRedeemXPop.ts
similarity index 100%
rename from packages/components/hooks/useRedeemXPop.ts
rename to packages/greenfield-app/hooks/useRedeemXPop.ts
diff --git a/packages/components/hooks/useRestake.ts b/packages/greenfield-app/hooks/useRestake.ts
similarity index 78%
rename from packages/components/hooks/useRestake.ts
rename to packages/greenfield-app/hooks/useRestake.ts
index a9bea385..4b608564 100644
--- a/packages/components/hooks/useRestake.ts
+++ b/packages/greenfield-app/hooks/useRestake.ts
@@ -1,5 +1,5 @@
-import type { ContractWriteArgs } from "@popcorn/components/lib/types";
-import type { ChainId } from "@popcorn/utils";
+import type { ContractWriteArgs } from "@popcorn/greenfield-app/lib/types";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils";
import { useContractWrite, usePrepareContractWrite } from "wagmi";
const useRestake = (restake: boolean, address: string, chainId: ChainId, wagmiConfig?: ContractWriteArgs) => {
diff --git a/packages/app/hooks/useRestakeAlert.tsx b/packages/greenfield-app/hooks/useRestakeAlert.tsx
similarity index 63%
rename from packages/app/hooks/useRestakeAlert.tsx
rename to packages/greenfield-app/hooks/useRestakeAlert.tsx
index 06989044..894f78e0 100644
--- a/packages/app/hooks/useRestakeAlert.tsx
+++ b/packages/greenfield-app/hooks/useRestakeAlert.tsx
@@ -1,31 +1,48 @@
-import { setMultiChoiceActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
+import { setMultiChoiceActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
import { constants } from "ethers";
-import { getStorage, setStorage } from "@popcorn/app/helper/safeLocalstorageAccess";
import { useRouter } from "next/router";
import { useContext, useEffect, useState } from "react";
-import usePopLocker from "@popcorn/app/hooks/staking/usePopLocker";
-import useNetworkName from "@popcorn/app/hooks/useNetworkName";
-import useWeb3 from "@popcorn/app/hooks/useWeb3";
+import useNetworkName from "@popcorn/greenfield-app/hooks/useNetworkName";
+import { useLockedBalances } from "@popcorn/greenfield-app/lib/PopLocker/hooks";
+import { useAccount, useNetwork } from "wagmi";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+
+
+export const getStorage = (key: string) => {
+ if (typeof window !== "undefined") {
+ return localStorage.getItem(key);
+ }
+ return null;
+};
+export const setStorage = (key: string, value: string) => {
+ if (typeof window !== "undefined") {
+ localStorage.setItem(key, value);
+ }
+};
+export const removeStorage = (key: string) => {
+ if (typeof window !== "undefined") {
+ localStorage.removeItem(key);
+ }
+};
+
const ONE_DAY = 1000 * 60 * 60 * 24;
export default function useRestakeAlert() {
const { dispatch, state } = useContext(store);
- const {
- connectedChainId,
- account,
- contractAddresses: { popStaking },
- } = useWeb3();
- const { data: popLocker } = usePopLocker(popStaking, connectedChainId);
const router = useRouter();
+ const { address: account } = useAccount();
+ const { chain } = useNetwork();
const networkName = useNetworkName();
const [restakeAlerted, setRestakeAlerted] = useState(false);
+ const [popLocker] = useNamedAccounts(chain?.id as any, ["popStaking"])
+ const lockedBalances = useLockedBalances({ chainId: chain?.id, address: popLocker?.address, account })
useEffect(() => {
if (!account || !popLocker) return;
if (
- popLocker.withdrawable.gt(constants.Zero) &&
+ lockedBalances?.data?.unlockable.gt(constants.Zero) &&
!restakeAlerted &&
state.networkChangePromptModal.visible === false &&
state.singleActionModal.content !== "To continue please sign terms and conditions." &&
diff --git a/packages/app/hooks/staking/useStakingTVL.ts b/packages/greenfield-app/hooks/useStakingTVL.ts
similarity index 56%
rename from packages/app/hooks/staking/useStakingTVL.ts
rename to packages/greenfield-app/hooks/useStakingTVL.ts
index 0961d7cd..b71f646c 100644
--- a/packages/app/hooks/staking/useStakingTVL.ts
+++ b/packages/greenfield-app/hooks/useStakingTVL.ts
@@ -1,9 +1,8 @@
-import { ChainId } from "@popcorn/utils";
import { BigNumber, constants, ethers } from "ethers";
-import { useDeployment } from "@popcorn/app/hooks/useDeployment";
import useSWR, { SWRResponse } from "swr";
-import { useRpcProvider } from "@popcorn/app/hooks/useRpcProvider";
-import useTokenPrices from "@popcorn/app/hooks/tokens/useTokenPrices";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import { usePrice } from "@popcorn/greenfield-app/lib/Price";
+import { ChainId, PRC_PROVIDERS } from "@popcorn/greenfield-app/lib/utils/connectors";
const REFETCH_INTERVAL = 10 * 1_000;
@@ -23,20 +22,19 @@ export async function getStakingTVL(
}
export default function useStakingTVL(chainId: ChainId): SWRResponse {
- const addresses = useDeployment(chainId);
- const rpcProvider = useRpcProvider(chainId);
+ const [popStaking] = useNamedAccounts(String(chainId) as any, ["popStaking"])
+ const [pop] = useNamedAccounts("1", ["pop"]);
+ const { data: popPrice } = usePrice({ address: pop?.address, chainId: ChainId.Ethereum })
- const { pop } = useDeployment(ChainId.Ethereum);
- const { data: priceData } = useTokenPrices([pop], ChainId.Ethereum);
return useSWR(
- [`getStakingTVL-${chainId}`, addresses.popStaking, rpcProvider, priceData?.[pop]],
- (args) => getStakingTVL(...args),
+ [`getStakingTVL-${chainId}`, popStaking?.address, PRC_PROVIDERS[chainId], popPrice?.value],
+ getStakingTVL,
{
refreshInterval: REFETCH_INTERVAL,
dedupingInterval: REFETCH_INTERVAL,
- keepPreviousData: true,
shouldRetryOnError: false,
+ keepPreviousData: true
},
);
}
diff --git a/packages/components/hooks/useSubscribeToNewsletter.tsx b/packages/greenfield-app/hooks/useSubscribeToNewsletter.tsx
similarity index 86%
rename from packages/components/hooks/useSubscribeToNewsletter.tsx
rename to packages/greenfield-app/hooks/useSubscribeToNewsletter.tsx
index a2760ec0..7b22ebff 100644
--- a/packages/components/hooks/useSubscribeToNewsletter.tsx
+++ b/packages/greenfield-app/hooks/useSubscribeToNewsletter.tsx
@@ -1,11 +1,17 @@
-import MainActionButton from "@popcorn/components/components/MainActionButton";
-import { setSingleActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
-import { isValidEmailAddress } from "@popcorn/app/helper/verifyEmail";
+import MainActionButton from "@popcorn/greenfield-app/components/MainActionButton";
+import { setSingleActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
import Image from "next/image";
import React, { useContext, useEffect, useRef, useState } from "react";
import { toast } from "react-hot-toast";
+export const isValidEmailAddress = (email: string) => {
+ const regex =
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+ return email.match(regex) === null;
+};
+
+
const useSubscribeToNewsletter = (): {
showNewsletterModal: () => void;
subscribeToNewsLetter: ({ onSuccess, email }: { onSuccess: () => void; email: string }) => void;
diff --git a/packages/components/hooks/useSum.ts b/packages/greenfield-app/hooks/useSum.ts
similarity index 100%
rename from packages/components/hooks/useSum.ts
rename to packages/greenfield-app/hooks/useSum.ts
diff --git a/packages/components/hooks/useSum3.ts b/packages/greenfield-app/hooks/useSum3.ts
similarity index 96%
rename from packages/components/hooks/useSum3.ts
rename to packages/greenfield-app/hooks/useSum3.ts
index 43e176cd..c1e49058 100644
--- a/packages/components/hooks/useSum3.ts
+++ b/packages/greenfield-app/hooks/useSum3.ts
@@ -1,6 +1,6 @@
import { useEffect, useState, useMemo, useRef } from "react";
import { BigNumber, constants } from "ethers";
-import useLog from "@popcorn/components/lib/utils/hooks/useLog";
+import useLog from "@popcorn/greenfield-app/lib/utils/hooks/useLog";
export const useSum = ({
expected,
diff --git a/packages/components/hooks/useTermsCheck.ts b/packages/greenfield-app/hooks/useTermsCheck.ts
similarity index 92%
rename from packages/components/hooks/useTermsCheck.ts
rename to packages/greenfield-app/hooks/useTermsCheck.ts
index a6fa182d..4fb5aeb1 100644
--- a/packages/components/hooks/useTermsCheck.ts
+++ b/packages/greenfield-app/hooks/useTermsCheck.ts
@@ -1,5 +1,5 @@
-import { setSingleActionModal } from "@popcorn/components/context/actions";
-import { store } from "@popcorn/components/context/store";
+import { setSingleActionModal } from "@popcorn/greenfield-app/context/actions";
+import { store } from "@popcorn/greenfield-app/context/store";
import { verifyMessage } from "ethers/lib/utils";
import { useEffect } from "react";
import { useContext } from "react";
diff --git a/packages/components/hooks/useVariadicSum.ts b/packages/greenfield-app/hooks/useVariadicSum.ts
similarity index 100%
rename from packages/components/hooks/useVariadicSum.ts
rename to packages/greenfield-app/hooks/useVariadicSum.ts
diff --git a/packages/components/hooks/useVaultToken.ts b/packages/greenfield-app/hooks/useVaultToken.ts
similarity index 89%
rename from packages/components/hooks/useVaultToken.ts
rename to packages/greenfield-app/hooks/useVaultToken.ts
index ecde00a1..bff8ecd0 100644
--- a/packages/components/hooks/useVaultToken.ts
+++ b/packages/greenfield-app/hooks/useVaultToken.ts
@@ -1,6 +1,6 @@
import { useToken } from "wagmi";
import useVaultTokenAddress from "./useVaultTokenAddress";
-import { useNamedAccounts } from "@popcorn/components/lib/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
function useVaultToken(vaultAddress: string, chainId?: any) {
const { data: vaultTokenAddr } = useVaultTokenAddress(vaultAddress, chainId);
diff --git a/packages/components/hooks/useVaultTokenAddress.ts b/packages/greenfield-app/hooks/useVaultTokenAddress.ts
similarity index 100%
rename from packages/components/hooks/useVaultTokenAddress.ts
rename to packages/greenfield-app/hooks/useVaultTokenAddress.ts
diff --git a/packages/components/hooks/vaults.ts b/packages/greenfield-app/hooks/vaults.ts
similarity index 90%
rename from packages/components/hooks/vaults.ts
rename to packages/greenfield-app/hooks/vaults.ts
index 580eb5c2..1b6f0d78 100644
--- a/packages/components/hooks/vaults.ts
+++ b/packages/greenfield-app/hooks/vaults.ts
@@ -1,9 +1,9 @@
-import type { ContractWriteArgs } from "@popcorn/components/lib/types";
+import type { ContractWriteArgs } from "@popcorn/greenfield-app/lib/types";
import type { BigNumber } from "ethers";
import { constants } from "ethers";
import { Address, useContractWrite, usePrepareContractWrite } from "wagmi";
-import { useNamedAccounts } from "@popcorn/components/lib/utils/hooks";
-import { ChainId } from "@popcorn/utils";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils/hooks";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { useTypedReadCall } from "./wagmi";
// TODO: remove hard-coded gas
diff --git a/packages/greenfield-app/hooks/vesting/useEscrows.tsx b/packages/greenfield-app/hooks/vesting/useEscrows.tsx
deleted file mode 100644
index 8459461e..00000000
--- a/packages/greenfield-app/hooks/vesting/useEscrows.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { useDeployment } from "@popcorn/app/hooks/useDeployment";
-import useGetUserEscrows, { Escrow } from "@popcorn/app/hooks/useGetUserEscrows";
-import useWeb3 from "@popcorn/app/hooks/useWeb3";
-import { ChainId } from "@popcorn/utils";
-import { BigNumber, constants } from "ethers";
-import { useMemo } from "react";
-
-interface EscrowSummary {
- escrows: Escrow[];
- totalClaimablePop: BigNumber;
- totalVestingPop: BigNumber;
- revalidate: () => void;
- isValidating: boolean;
- error: Error;
-}
-
-export default function useEscrows(chainId: ChainId): EscrowSummary {
- const { account } = useWeb3();
- const { rewardsEscrow, vaultsRewardsEscrow } = useDeployment(chainId);
-
- const {
- data: escrowsFetchResult,
- isValidating: escrowsFetchResultIsValidating,
- error: escrowsFetchResultError,
- mutate: revalidateEscrowsFetchResult,
- } = useGetUserEscrows(rewardsEscrow, account, chainId);
- const {
- data: vaultsEscrowsFetchResults,
- isValidating: vaultsEscrowsFetchResultsIsValidating,
- error: vaultsEscrowsFetchResultsError,
- mutate: revalidateVaultsEscrowsFetchResults,
- } = useGetUserEscrows(vaultsRewardsEscrow, account, chainId);
-
- return useMemo(() => {
- return {
- escrows: [].concat(escrowsFetchResult?.escrows || []).concat(vaultsEscrowsFetchResults?.escrows || []),
- totalClaimablePop: constants.Zero.add(escrowsFetchResult?.totalClaimablePop || "0").add(
- vaultsEscrowsFetchResults?.totalClaimablePop || "0",
- ),
- totalVestingPop: constants.Zero.add(escrowsFetchResult?.totalVestingPop || "0").add(
- vaultsEscrowsFetchResults?.totalVestingPop || "0",
- ),
- revalidate: () => {
- revalidateEscrowsFetchResult();
- revalidateVaultsEscrowsFetchResults();
- },
- isValidating: escrowsFetchResultIsValidating || vaultsEscrowsFetchResultsIsValidating,
- error: escrowsFetchResultError || vaultsEscrowsFetchResultsError,
- };
- }, [
- escrowsFetchResult,
- vaultsEscrowsFetchResults,
- revalidateEscrowsFetchResult,
- revalidateVaultsEscrowsFetchResults,
- escrowsFetchResultIsValidating,
- vaultsEscrowsFetchResultsIsValidating,
- escrowsFetchResultError,
- vaultsEscrowsFetchResultsError,
- ]);
-}
diff --git a/packages/components/hooks/wagmi.ts b/packages/greenfield-app/hooks/wagmi.ts
similarity index 80%
rename from packages/components/hooks/wagmi.ts
rename to packages/greenfield-app/hooks/wagmi.ts
index ab9de695..2a043478 100644
--- a/packages/components/hooks/wagmi.ts
+++ b/packages/greenfield-app/hooks/wagmi.ts
@@ -1,4 +1,4 @@
-import type { ContractWriteArgs } from "@popcorn/components/lib/types";
+import type { ContractWriteArgs } from "@popcorn/greenfield-app/lib/types";
import { useContractRead } from "wagmi";
export const useTypedReadCall = (config: ContractWriteArgs) => {
diff --git a/packages/greenfield-app/hooks/xPopRedemption/useXPOPRedemption.ts b/packages/greenfield-app/hooks/xPopRedemption/useXPOPRedemption.ts
deleted file mode 100644
index 1ca6441f..00000000
--- a/packages/greenfield-app/hooks/xPopRedemption/useXPOPRedemption.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import useBalanceAndAllowance from "@popcorn/app/hooks/staking/useBalanceAndAllowance";
-import usePopLocker from "@popcorn/app/hooks/staking/usePopLocker";
-import useERC20 from "@popcorn/app/hooks/tokens/useERC20";
-import { useDeployment } from "@popcorn/app/hooks/useDeployment";
-import { useTransaction } from "@popcorn/app/hooks/useTransaction";
-import useWeb3 from "@popcorn/app/hooks/useWeb3";
-import { PopLocker, Staking, XPopRedemption__factory } from "@popcorn/hardhat/typechain";
-import { useMemo } from "react";
-import { BigNumber, ethers } from "ethers";
-import { useStakingContracts } from "@popcorn/app/hooks/useStakingContracts";
-import useGetMultipleStakingPools from "@popcorn/app/hooks/staking/useGetMultipleStakingPools";
-
-const useXPOPRedemption = (chainId) => {
- const { account, signerOrProvider, signer, connect, chains } = useWeb3();
- const {
- xPopRedemption: xPopRedemptionAddress,
- popStaking,
- xPop: xPopAddress,
- pop: popAddress,
- } = useDeployment(chainId);
-
- const xPopRedemption = useMemo(() => {
- if (xPopRedemptionAddress) {
- return XPopRedemption__factory.connect(xPopRedemptionAddress, signerOrProvider);
- }
- }, [chainId, account, signerOrProvider, xPopRedemptionAddress]);
- const pop = useERC20(popAddress, chainId);
- const xPop = useERC20(xPopAddress, chainId);
- const { data: popLocker, mutate: revalidatePopLocker } = usePopLocker(popStaking, chainId);
- const stakingContracts = useStakingContracts(chainId);
- const { data: stakingPools, mutate: revalidateStakingPools } = useGetMultipleStakingPools(stakingContracts, chainId);
-
- const balancesXPop = useBalanceAndAllowance(xPop?.address, account, xPopRedemptionAddress, chainId);
- const balancesPop = useBalanceAndAllowance(pop?.address, account, xPopAddress, chainId);
-
- const transaction = useTransaction(chainId);
- const revalidate = () => {
- revalidatePopLocker();
- revalidateStakingPools();
- balancesXPop.revalidate();
- balancesPop.revalidate();
- };
-
- async function approveXpopRedemption(): Promise {
- transaction(
- async () => xPop.contract.connect(signer).approve(xPopRedemptionAddress, ethers.constants.MaxUint256),
- "Approving xPOP...",
- "xPOP approved!",
- revalidate,
- );
- }
- async function redeemXpop(amount: BigNumber): Promise {
- transaction(
- async () => xPopRedemption.connect(signer).redeem(amount),
- "Redeeming xPOP...",
- "xPOP redeemed!",
- () => {
- revalidate();
- // postRedeemSuccess();
- },
- );
- }
- return {
- approveXpopRedemption,
- redeemXpop,
- balancesXPop,
- balancesPop,
- xPop,
- pop,
- };
-};
-
-export default useXPOPRedemption;
diff --git a/packages/components/lib/Contract/Metadata.tsx b/packages/greenfield-app/lib/Contract/Metadata.tsx
similarity index 100%
rename from packages/components/lib/Contract/Metadata.tsx
rename to packages/greenfield-app/lib/Contract/Metadata.tsx
diff --git a/packages/components/lib/Contract/TotalTvl.tsx b/packages/greenfield-app/lib/Contract/TotalTvl.tsx
similarity index 81%
rename from packages/components/lib/Contract/TotalTvl.tsx
rename to packages/greenfield-app/lib/Contract/TotalTvl.tsx
index 6cede5ab..a4c228ac 100644
--- a/packages/components/lib/Contract/TotalTvl.tsx
+++ b/packages/greenfield-app/lib/Contract/TotalTvl.tsx
@@ -1,9 +1,9 @@
import type { BigNumber } from "ethers/lib/ethers";
-import { ChainId } from "@popcorn/utils";
+import { ChainId } from "@popcorn/greenfield-app/lib/utils/connectors";
import { formatUnits } from "ethers/lib/utils";
-import useStakingTVL from "@popcorn/app/hooks/staking/useStakingTVL";
-import usePoolTVL from "@popcorn/app/hooks/usePoolTVL";
-import useVariadicSum from "@popcorn/components/hooks/useVariadicSum";
+import useVariadicSum from "@popcorn/greenfield-app/hooks/useVariadicSum";
+import usePoolTVL from "@popcorn/greenfield-app/hooks/usePoolTvl";
+import useStakingTVL from "@popcorn/greenfield-app/hooks/useStakingTVL";
const { Ethereum, Polygon, Optimism } = ChainId;
diff --git a/packages/components/lib/Contract/Tvl.tsx b/packages/greenfield-app/lib/Contract/Tvl.tsx
similarity index 100%
rename from packages/components/lib/Contract/Tvl.tsx
rename to packages/greenfield-app/lib/Contract/Tvl.tsx
diff --git a/packages/components/lib/Contract/Value.tsx b/packages/greenfield-app/lib/Contract/Value.tsx
similarity index 93%
rename from packages/components/lib/Contract/Value.tsx
rename to packages/greenfield-app/lib/Contract/Value.tsx
index 5b6d8451..f25ba2de 100644
--- a/packages/components/lib/Contract/Value.tsx
+++ b/packages/greenfield-app/lib/Contract/Value.tsx
@@ -3,7 +3,7 @@ import { useEffect } from "react";
import { BigNumber, constants } from "ethers";
import { parseUnits } from "ethers/lib/utils";
-import { formatAndRoundBigNumber } from "@popcorn/utils";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils";
import { withLoading } from "../utils";
interface Props {
diff --git a/packages/components/lib/Contract/hooks/index.ts b/packages/greenfield-app/lib/Contract/hooks/index.ts
similarity index 100%
rename from packages/components/lib/Contract/hooks/index.ts
rename to packages/greenfield-app/lib/Contract/hooks/index.ts
diff --git a/packages/components/lib/Contract/hooks/useBalanceValue.ts b/packages/greenfield-app/lib/Contract/hooks/useBalanceValue.ts
similarity index 93%
rename from packages/components/lib/Contract/hooks/useBalanceValue.ts
rename to packages/greenfield-app/lib/Contract/hooks/useBalanceValue.ts
index 213d4baa..1e30642e 100644
--- a/packages/components/lib/Contract/hooks/useBalanceValue.ts
+++ b/packages/greenfield-app/lib/Contract/hooks/useBalanceValue.ts
@@ -1,7 +1,7 @@
import { BigNumber } from "ethers";
import { parseUnits } from "ethers/lib/utils";
import { useMemo } from "react";
-import { formatAndRoundBigNumber } from "@popcorn/utils/src/formatBigNumber";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils/formatBigNumber";
import { Pop, BigNumberWithFormatted } from "../../types";
/**
diff --git a/packages/components/lib/Contract/hooks/useContractMetadata.ts b/packages/greenfield-app/lib/Contract/hooks/useContractMetadata.ts
similarity index 87%
rename from packages/components/lib/Contract/hooks/useContractMetadata.ts
rename to packages/greenfield-app/lib/Contract/hooks/useContractMetadata.ts
index 1ee037db..b6aa8c29 100644
--- a/packages/components/lib/Contract/hooks/useContractMetadata.ts
+++ b/packages/greenfield-app/lib/Contract/hooks/useContractMetadata.ts
@@ -1,7 +1,7 @@
import { useToken as _useToken } from "wagmi";
-import { Pop } from "../../types";
-import { useNamedAccounts } from "../../utils";
-import useLog from "../../utils/hooks/useLog";
+import { Pop } from "@popcorn/greenfield-app/lib/types";
+import { useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import useLog from "@popcorn/greenfield-app/lib/utils/hooks/useLog";
/**
* useContractMetadata will return metadata from namedAccounts.json and merge it with fetched ERC20 metadata.
diff --git a/packages/components/lib/Contract/hooks/useTvl.ts b/packages/greenfield-app/lib/Contract/hooks/useTvl.ts
similarity index 85%
rename from packages/components/lib/Contract/hooks/useTvl.ts
rename to packages/greenfield-app/lib/Contract/hooks/useTvl.ts
index 92b32d6e..04be3dc4 100644
--- a/packages/components/lib/Contract/hooks/useTvl.ts
+++ b/packages/greenfield-app/lib/Contract/hooks/useTvl.ts
@@ -1,13 +1,13 @@
import { parseEther } from "ethers/lib/utils";
import { usePrice } from "../../Price/hooks/usePrice";
import { useTotalSupply } from "../../Erc20/hooks/useTotalSupply";
-import { formatAndRoundBigNumber } from "@popcorn/utils/src/formatBigNumber";
+import { formatAndRoundBigNumber } from "@popcorn/greenfield-app/lib/utils/formatBigNumber";
import { BigNumber } from "ethers";
import { BigNumberWithFormatted, Pop } from "../../types";
-import useNamedAccounts from "../../utils/hooks/useNamedAccounts";
-import { useMultiStatus } from "../../utils/hooks/useMultiStatus";
+import useNamedAccounts from "@popcorn/greenfield-app/lib/utils/hooks/useNamedAccounts";
+import { useMultiStatus } from "@popcorn/greenfield-app/lib/utils/hooks/useMultiStatus";
import { useTvlResolver } from "./useTvlResolver";
-import useLog from "../../utils/hooks/useLog";
+import useLog from "@popcorn/greenfield-app/lib/utils/hooks/useLog";
interface Props {
chainId: number;
diff --git a/packages/components/lib/Contract/hooks/useTvlResolver.ts b/packages/greenfield-app/lib/Contract/hooks/useTvlResolver.ts
similarity index 88%
rename from packages/components/lib/Contract/hooks/useTvlResolver.ts
rename to packages/greenfield-app/lib/Contract/hooks/useTvlResolver.ts
index 324e669c..d0de5e7b 100644
--- a/packages/components/lib/Contract/hooks/useTvlResolver.ts
+++ b/packages/greenfield-app/lib/Contract/hooks/useTvlResolver.ts
@@ -1,9 +1,8 @@
import { BigNumber } from "ethers";
import { useContractRead } from "wagmi";
-import { Pop } from "../../types";
-import { useNamedAccounts } from "../../utils";
-import useLog from "../../utils/hooks/useLog";
-import { useMultiStatus } from "../../utils/hooks/useMultiStatus";
+import { Pop } from "@popcorn/greenfield-app/lib/types";
+import { useMultiStatus, useNamedAccounts } from "@popcorn/greenfield-app/lib/utils";
+import useLog from "@popcorn/greenfield-app/lib/utils/hooks/useLog";
export const useTvlResolver: Pop.Hook = ({ address, chainId, enabled }) => {
const [metadata] = useNamedAccounts(chainId as any, (!!address && [address]) || []);
diff --git a/packages/components/lib/Contract/index.ts b/packages/greenfield-app/lib/Contract/index.ts
similarity index 58%
rename from packages/components/lib/Contract/index.ts
rename to packages/greenfield-app/lib/Contract/index.ts
index 792e990e..3c17fb13 100644
--- a/packages/components/lib/Contract/index.ts
+++ b/packages/greenfield-app/lib/Contract/index.ts
@@ -1,5 +1,4 @@
export * from "./hooks";
export * from "./Metadata";
export * from "./Tvl";
-export * from "./Value";
-export * from "./BalanceOf";
+export * from "./Value";
\ No newline at end of file
diff --git a/packages/components/lib/Erc20/Allowance.tsx b/packages/greenfield-app/lib/Erc20/Allowance.tsx
similarity index 79%
rename from packages/components/lib/Erc20/Allowance.tsx
rename to packages/greenfield-app/lib/Erc20/Allowance.tsx
index dfee126b..89db08e4 100644
--- a/packages/components/lib/Erc20/Allowance.tsx
+++ b/packages/greenfield-app/lib/Erc20/Allowance.tsx
@@ -1,8 +1,6 @@
-import { BigNumber } from "ethers";
import { BigNumberWithFormatted } from "../../reducers/portfolio/reducer";
import { Pop } from "../types";
import { withLoading } from "../utils/hocs/withLoading";
-import { withLogging } from "../utils/hocs/withLogging";
import { useAllowance } from "./hooks";
const eth_call = (Component: Pop.FC) =>
@@ -27,6 +25,6 @@ const eth_call = (Component: Pop.FC