- );
-}
diff --git a/src/components/ProjectDetailCard/index.tsx b/src/components/ProjectDetailCard/index.tsx
index f0d6aba..abd8c71 100644
--- a/src/components/ProjectDetailCard/index.tsx
+++ b/src/components/ProjectDetailCard/index.tsx
@@ -11,9 +11,10 @@ import Ton from '@/assets/logos/ton.svg';
import RightArrow from '@/assets/rightArrow.svg';
import { MainButton } from '@/components/MainButton.js';
import { publicClient } from '@/configs/wagmiClient.js';
-import { IS_TESTNET, POOL_ID, STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
+import { CHAIN_ID, IS_TESTNET, POOL_ID, STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
import { Image } from '@/esm/Image.js';
import { stakeAPI } from '@/providers/StakeAPI.js';
+import { sepolia, mainnet } from 'wagmi';
interface ProjectCardProps {
setIsOpen: (isOpen: boolean) => void;
@@ -36,7 +37,7 @@ export function ProjectDetailCard({ setIsOpen }: ProjectCardProps) {
args: [BigInt(POOL_ID)],
});
- const startTimeStamp = await publicClient({ chainId: IS_TESTNET ? 11155111 : 1 }).getBlock({
+ const startTimeStamp = await publicClient({ chainId: CHAIN_ID }).getBlock({
blockNumber: res[0],
});
const endTimeStamp = Number(res[1] - res[0]) * 12 + Number(startTimeStamp.timestamp);
@@ -114,7 +115,6 @@ export function ProjectDetailCard({ setIsOpen }: ProjectCardProps) {
}}
>
- {' '}
{Math.floor(apyInfo?.data?.apy) || 0}%
APY
@@ -127,7 +127,6 @@ export function ProjectDetailCard({ setIsOpen }: ProjectCardProps) {
}}
>
- {' '}
{Math.floor(apyInfo?.data?.amount) || 0}
diff --git a/src/components/StakeCard/index.tsx b/src/components/StakeCard/index.tsx
index b6dcf33..76241b3 100644
--- a/src/components/StakeCard/index.tsx
+++ b/src/components/StakeCard/index.tsx
@@ -11,46 +11,46 @@ import { STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
import { Image } from '@/esm/Image.js';
interface StakeCardProps {
- setIsOpen: (isOpen: boolean) => void;
+ setIsOpen: (isOpen: boolean) => void;
}
export function StakeCard({ setIsOpen }: StakeCardProps) {
- const { address } = useAccount();
- const { data, isLoading, isError } = useQuery({
- queryKey: ['stake'],
- queryFn: async () => {
- if (!address) return {};
- const [stakeAmount, poolId] = await readContract({
- ...STAKE_MANAGER_CONTRACT,
- functionName: 'userInfos',
- args: [address],
- });
- return { stakeAmount, poolId };
- },
- });
+ const { address } = useAccount();
+ const { data, isLoading, isError } = useQuery({
+ queryKey: ['stake', address],
+ queryFn: async () => {
+ if (!address) return;
+ const [stakeAmount, poolId] = await readContract({
+ ...STAKE_MANAGER_CONTRACT,
+ functionName: 'userInfos',
+ args: [address],
+ });
+ return { stakeAmount, poolId };
+ },
+ });
- return (
-
-
-
Staked MASK
-
- {data?.stakeAmount ? formatEther(data.stakeAmount) : 0}
-
-
+3 Points/h
-
{
- setIsOpen(true);
- }}
- >
-
- Stake MASK
-
-
- );
+ return (
+
+
+
Staked MASK
+
+ {data?.stakeAmount ? formatEther(data.stakeAmount) : 0}
+
+
+3 Points/h
+
{
+ setIsOpen(true);
+ }}
+ >
+
+ Stake MASK
+
+
+ );
}
diff --git a/src/components/StakeModal/StakeTokenInput/SelectLockTime.tsx b/src/components/StakeModal/StakeTokenInput/SelectLockTime.tsx
deleted file mode 100644
index 820be23..0000000
--- a/src/components/StakeModal/StakeTokenInput/SelectLockTime.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-interface SelectLockTimeProps {
- lockTime: number;
- setLockTime: (value: number) => void;
-}
-export function SelectLockTime({ lockTime, setLockTime }: SelectLockTimeProps) {
- return (
-
-
Select lock time
-
-
-
-
-
-
- The longer the duration chosen for staking MASK, the higher the multiplier for the rewards.
-
-
- );
-}
diff --git a/src/components/StakeModal/StakeTokenInput/Stake.tsx b/src/components/StakeModal/StakeTokenInput/Stake.tsx
index 8814b1b..7ad42b1 100644
--- a/src/components/StakeModal/StakeTokenInput/Stake.tsx
+++ b/src/components/StakeModal/StakeTokenInput/Stake.tsx
@@ -9,7 +9,7 @@ import { readContract, waitForTransaction, writeContract } from 'wagmi/actions';
import { InputPanel } from '@/components/StakeModal/StakeTokenInput/InputPanel.js';
import { publicClient } from '@/configs/wagmiClient.js';
-import { IS_TESTNET, MASK_TOKEN_CONTRACT, POOL_ID, STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
+import { CHAIN_ID, IS_TESTNET, MASK_TOKEN_CONTRACT, POOL_ID, STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
import { stakeAPI } from '@/providers/StakeAPI.js';
export function Stake() {
@@ -18,7 +18,7 @@ export function Stake() {
const [allowanceSet, setAllowanceSet] = useState(BigInt(0));
const { data: allowanceFetch } = useSuspenseQuery({
- queryKey: ['allowance'],
+ queryKey: ['allowance', address],
queryFn: async () => {
if (!address) return BigInt(0);
const res = await readContract({
@@ -31,7 +31,7 @@ export function Stake() {
});
const { data: balance } = useQuery({
- queryKey: ['balance'],
+ queryKey: ['balance', address],
queryFn: async () => {
if (!address) return '0';
const res = await readContract({
@@ -44,7 +44,7 @@ export function Stake() {
});
const { data: apyInfo } = useQuery({
- queryKey: ['poolinfo', 'apy'],
+ queryKey: ['poolinfo', 'apy', POOL_ID],
queryFn: async () => {
const res = stakeAPI.getPoolInfo(POOL_ID);
return res;
@@ -59,7 +59,7 @@ export function Stake() {
args: [BigInt(POOL_ID)],
});
- const startTimeStamp = await publicClient({ chainId: IS_TESTNET ? 11155111 : 1 }).getBlock({
+ const startTimeStamp = await publicClient({ chainId: CHAIN_ID }).getBlock({
blockNumber: res[0],
});
const endTimeStamp = Number(res[1] - res[0]) * 12 + Number(startTimeStamp.timestamp);
@@ -71,38 +71,21 @@ export function Stake() {
});
const allowance = allowanceFetch || allowanceSet;
- console.log('allowance', allowance, parseEther(amount));
+
return (
<>
- {/*
*/}
-
-
Unlock MASK Time
-
- {poolInfo ? dayjs(poolInfo.endTime).format('HH:MM MM/DD/YYYY') : null}
-
-
+ {poolInfo ?
+
+
Unlock MASK Time
+
+ {dayjs(poolInfo.endTime).format('HH:MM MM/DD/YYYY')}
+
+
: null}
APY
{Math.floor(apyInfo?.data?.apy) || 0}%
- {/*
-
-
Display X accounts in the staking leaderboard
-
- {({ checked }) => (
-
- )}
-
-
*/}
MASK Staking is exclusively open to individual usersĀ (excluding users listed in the{' '}
blacklist). Organizations, companies, or institutions are not allowed
@@ -119,8 +102,7 @@ export function Stake() {
functionName: 'approve',
args: [STAKE_MANAGER_CONTRACT.address, parseEther(amount)],
});
- console.log('txHash', txHash);
- await waitForTransaction({ hash: txHash.hash, chainId: IS_TESTNET ? 11155111 : 1 });
+ await waitForTransaction({ hash: txHash.hash, chainId: CHAIN_ID });
setAllowanceSet(parseEther(amount));
}
writeContract({
diff --git a/src/components/StakeModal/StakeTokenInput/UnStake.tsx b/src/components/StakeModal/StakeTokenInput/UnStake.tsx
deleted file mode 100644
index c309bc5..0000000
--- a/src/components/StakeModal/StakeTokenInput/UnStake.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { useState } from 'react';
-
-import { InputPanel } from '@/components/StakeModal/StakeTokenInput/InputPanel.js';
-
-export function UnStake() {
- const [amount, setAmount] = useState('');
- return (
- <>
-
-
-
Pending Rewards
-
200.0000 SLN
-
-
-
Share of Pool
-
30.99%
-
-
-
-
Staked
-
200.0000 SLN
-
-
- >
- );
-}
diff --git a/src/components/StakeTokenInfo/index.tsx b/src/components/StakeTokenInfo/index.tsx
deleted file mode 100644
index d135dc5..0000000
--- a/src/components/StakeTokenInfo/index.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import MaskIcon from '@/assets/logos/mask.svg';
-
-export function StakeTokenInfo() {
- return (
-
-
-
Stake Token
-
Liquidity
-
-
-
-
-
-
Wallet Balance
-
45.4K
-
-
-
-
-
-
- );
-}
diff --git a/src/constants/index.ts b/src/constants/index.ts
index 26ba7fd..2ddb294 100644
--- a/src/constants/index.ts
+++ b/src/constants/index.ts
@@ -3,6 +3,7 @@
import { erc20ABI as TOKEN_ABI } from '@/abis/erc20.js';
import { rewardABI as REWARD_ABI } from '@/abis/reward.js';
import { StakeManagerABI } from '@/abis/stakeManager.js';
+import { sepolia, mainnet } from 'wagmi';
export const SITE_NAME = 'Stake Your $MASK';
export const SITE_DESCRIPTION = 'Stake Your $MASK';
@@ -41,22 +42,23 @@ export const REWARD = '0xf0c196d1b1489738cda956e994e82ef6897e85bc' as `0x${strin
export const BASE_URL = 'https://masknetwork-dev.firefly.land/v1/mask_stake';
export const IS_TESTNET = process.env.NEXT_PUBLIC_TEST;
+export const CHAIN_ID = IS_TESTNET ? sepolia.id : mainnet.id
export const STAKE_MANAGER_CONTRACT = {
address: IS_TESTNET ? STAKE_MANAGER_TEST : STAKE_MANAGER,
abi: StakeManagerABI,
- chainId: IS_TESTNET ? 11155111 : 1,
+ chainId: CHAIN_ID,
};
export const MASK_TOKEN_CONTRACT = {
address: IS_TESTNET ? MASK_TOKEN_ADDRESS_TESTNET : MASK_TOKEN_ADDRESS,
- chainId: IS_TESTNET ? 11155111 : 1,
+ chainId: CHAIN_ID,
abi: TOKEN_ABI,
};
export const REWARD_CONTRACT = {
address: IS_TESTNET ? REWARD_TEST : REWARD,
- chainId: IS_TESTNET ? 11155111 : 1,
+ chainId: CHAIN_ID,
abi: REWARD_ABI,
};