Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug2/farm #370

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const TransactionStateModal: React.FC = () => {

<Text fontSize="20px" fontWeight="normal" color={textColour}>
{modalDetails?.trxState === TrxState.TransactionSuccessful ?
"Transaction Succesful" :
"Transaction Successful" :
modalDetails?.trxState === TrxState.WaitingForConfirmation ?
modalDetails?.text ?? " Waiting for Confirmation" :
modalDetails?.trxState === TrxState.TransactionFailed ?
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddLiquidity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
useUserGasPricePercentage,
useUpdateUserGasPreference,
} from "../../state/gas/hooks";
import { clearSearchResult } from "../../state/farming/action";
import { clearSearchResult } from "../../state/newFarming/action";
import {
GFailedTransaction,
GSuccessfullyTransaction,
Expand Down
53 changes: 20 additions & 33 deletions src/pages/FarmingV2/ShowNewFarm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ import {
} from "../../utils/addresses";
import {clearInputInfo, convertFromWei, convertToNumber} from "../../utils";
import {useRGPBalance} from "../../utils/hooks/useBalances";
import {updateFarmAllowances} from "../../state/farm/actions";
import { updateFarmAllowances } from "../../state/newfarm/actions";
import {useActiveWeb3React} from "../../utils/hooks/useActiveWeb3React";
import Joyride from "react-joyride";
import {steps} from "../../components/Onboarding/YieldSteps";
import {Contract} from "@ethersproject/contracts";
import {calculateGas} from "../Swap/components/sendToken";
import {useUserGasPricePercentage} from "../../state/gas/hooks";

import {useFetchYieldFarmDetails, useUpdateFarm} from "../../state/newfarm/hooks";
import {useNewYieldFarmDetails, useUpdateNewFarm} from "../../state/LPFarm/hooks";
import {
GButtonClicked,
Expand All @@ -98,7 +96,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
img: string;
ARYValue: string;
lpSymbol: string;
tokensStaked: string[];
tokenStaked: string[];
availableToken: string;
deposit: string;
poolAllowance: any;
Expand Down Expand Up @@ -239,7 +237,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
if (content.deposit === "RGP" && Number(content.id) === 1) {
const specialPoolV1Approval = await specialPoolV1Allowance(rgp);
changeApprovalButton(true, specialPoolV1Approval);
} else if (content.deposit === "RGP" && Number(content.id) === 13) {
} else if (content.deposit === "RGP" && content.id === "special") {
const specialPoolV2Approval = await specialPoolV2Allowance(rgp);
changeApprovalButton(true, specialPoolV2Approval);
} else {
Expand Down Expand Up @@ -382,12 +380,12 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
await RGPSpecialPoolV1Approval();
setApproveValueForOtherToken(true);
setApproveValueForRGP(true);
} else if (content.deposit === "RGP" && Number(content.id) === 13) {
} else if (content.deposit === "RGP" && content.id === "special") {
await RGPSpecialPoolV2Approval();
setApproveValueForOtherToken(true);
setApproveValueForRGP(true);
} else {
const pool = await smartSwapLPTokenPoolTwo(content.address, library);
const pool = await smartSwapLPTokenPoolTwo(content?.address, library);
if (!approveValueForOtherToken && !approveValueForRGP) {
await RGPApproval();
await LPApproval(pool,content.deposit);
Expand Down Expand Up @@ -622,7 +620,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
return;
} else if (
Number(content.poolVersion) === 2 &&
parseFloat(content.tokensStaked[1]) <= 0 &&
parseFloat(content.tokenStaked[1]) <= 0 &&
Number(depositTokenValue) < Number(minimumStakeAmount)
) {
setDepositInputHasError(true);
Expand Down Expand Up @@ -667,9 +665,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
if (
parseFloat(unstakeToken) >
parseFloat(
content.deposit === "RGP"
? content.tokensStaked[1]
: content.tokenStaked[1]
content.tokenStaked[1]
)
) {
setInputHasError(true);
Expand All @@ -685,11 +681,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
GButtonClicked(`max_button for ${input}`,content.deposit,"v2")
setDepositTokenValue(content.availableToken);
} else if (input === "unstake") {
setUnstakeToken(
content.deposit === "RGP"
? content.tokensStaked[1]
: content.tokenStaked[1]
);
setUnstakeToken(content.tokenStaked[1]);
}
} catch (e) {
console.log(
Expand Down Expand Up @@ -876,7 +868,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
})
);
}
} else if (id === 10793) {
} else if (id === "special") {
const specialPool = await RGPSpecialPool2(
RGPSPECIALPOOLADDRESSES2[chainId as number],
library
Expand Down Expand Up @@ -1102,7 +1094,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
GFarmingSuccessTransaction("farming", "stake", val,"v2")
setDeposited(true);
setReload(true);
setContentId(content.deposit === "RGP" ? undefined : content.id);
// setContentId(content.deposit === "RGP" ? undefined : content.id);
// callRefreshFarm(confirmations, status);
}
} catch (error: any) {
Expand Down Expand Up @@ -1595,11 +1587,11 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
>
<Tooltip
hasArrow
label={content.tokensStaked[1]}
label={content.tokenStaked[1]}
bg='gray.300'
color='black'
>
{parseFloat(content.tokensStaked[1]).toFixed(4)}
{parseFloat(content.tokenStaked[1]).toFixed(4)}
</Tooltip>
</Text>
<Text
Expand All @@ -1623,7 +1615,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
disabled={
approveValueForRGP &&
approveValueForOtherToken &&
parseFloat(content.tokensStaked[1]) <= 0
parseFloat(content.tokenStaked[1]) <= 0
}
padding='10px 40px'
cursor='pointer'
Expand Down Expand Up @@ -1748,8 +1740,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
_hover={{ color: "white" }}
disabled={parseFloat(content.RGPEarned) <= 0}
onClick={() => {
harvestTokens(
content.deposit === "RGP" ? content.pId : content.id
harvestTokens(content.id
);
}}
className={"harvest"}
Expand Down Expand Up @@ -1839,15 +1830,15 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
label={
content?.type !== "RGP"
? content?.tokenStaked[1]
: content.tokensStaked[1]
: content.tokenStaked[1]
}
bg='gray.300'
color='black'
>
{parseFloat(
content.type !== "RGP"
? content?.tokenStaked[1]
: content.tokensStaked[1]
: content.tokenStaked[1]
).toFixed(4)}
</Tooltip>
</Text>
Expand All @@ -1874,7 +1865,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
parseFloat(
content.type !== "RGP"
? content.tokenStaked[1]
: content.tokensStaked[1]
: content.tokenStaked[1]
) <= 0
}
padding='10px 40px'
Expand Down Expand Up @@ -1960,9 +1951,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
_hover={{ color: "white" }}
disabled={parseFloat(content.RGPEarned) <= 0}
onClick={() => {
harvestTokens(
content.deposit === "RGP" ? content.pId : content.id
);
harvestTokens(content.id);
}}
className={"harvest"}
>
Expand Down Expand Up @@ -1999,9 +1988,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
_hover={{ color: "white" }}
disabled={parseFloat(content.RGPEarned) <= 0}
onClick={() => {
harvestTokens(
content.deposit === "RGP" ? content.pId : content.id
);
harvestTokens(content.id);
}}
className={"harvest"}
>
Expand Down Expand Up @@ -2517,7 +2504,7 @@ const ShowNewFarm = ({content, wallet, URLReferrerAddress, LoadingState, section
<Text color='gray.400' align='right' mb={3}>
{`${
content.type === "RGP"
? content.tokensStaked[1]
? content.tokenStaked[1]
: content.tokenStaked[1]
}
${content.deposit} Staked `}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/FarmingV2/ShowProductFarmDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from "../../utils/addresses";
import { clearInputInfo, convertFromWei, convertToNumber } from "../../utils";
import { useRGPBalance } from "../../utils/hooks/useBalances";
import { updateFarmProductAllowances } from "../../state/farm/actions";
import { updateFarmProductAllowances } from "../../state/newfarm/actions";
import { useActiveWeb3React } from "../../utils/hooks/useActiveWeb3React";
import { Contract } from "@ethersproject/contracts";
import { formatAmount, getERC20Token } from "../../utils/utilsFunctions";
Expand Down Expand Up @@ -679,11 +679,11 @@ return (
>
{/* <Tooltip
hasArrow
label={content.tokensStaked[1]}
label={content.tokenStaked[1]}
bg='gray.300'
color='black'
>
{parseFloat(content.tokensStaked[1]).toFixed(4)}
{parseFloat(content.tokenStaked[1]).toFixed(4)}
</Tooltip> */}
{content.RGPStaked}
</Text>
Expand Down
Loading