import { useTranslation } from 'next-i18next' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import useSrmAccount from '../hooks/useSrmAccount' import { MSRM_DECIMALS, SRM_DECIMALS, } from '@project-serum/serum/lib/token-instructions' import { percentFormat4D } from '../utils/index' import Tooltip from '../components/Tooltip' import { InformationCircleIcon } from '@heroicons/react/solid' import DepositMsrmModal from '../components/DepositMsrmModal' import WithdrawMsrmModal from '../components/WithdrawMsrmModal' import { useState } from 'react' import { LinkButton } from '../components/Button' import useMangoStore from '../stores/useMangoStore' import { msrmMints, ZERO_BN } from '@blockworks-foundation/mango-client' import useFees from '../hooks/useFees' import { useWallet } from '@solana/wallet-adapter-react' export async function getStaticProps({ locale }) { return { props: { ...(await serverSideTranslations(locale, [ 'common', 'delegate', 'profile', ])), // Will be passed to the page component as props }, } } export default function Fees() { const { t } = useTranslation('common') const { totalSrm, totalMsrm, rates } = useSrmAccount() const { takerFeeBeforeDiscount, takerFeeWithTier1Discount, takerFeeWithTier2Discount, makerFee, } = useFees() const { connected } = useWallet() const [showDeposit, setShowDeposit] = useState(false) const [showWithdraw, setShowWithdraw] = useState(false) const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const walletTokens = useMangoStore((s) => s.wallet.tokens) const cluster = useMangoStore.getState().connection.cluster const ownerMsrmAccount = walletTokens.find((t) => t.account.mint.equals(msrmMints[cluster]) ) return (
{t('if-referred', { fee: percentFormat4D.format( takerFeeBeforeDiscount < 0 ? takerFeeBeforeDiscount + takerFeeBeforeDiscount * 0.03 : takerFeeBeforeDiscount - takerFeeBeforeDiscount * 0.03 ), })}
{percentFormat4D.format(takerFeeWithTier1Discount)} if 10k MNGO
{percentFormat4D.format(takerFeeWithTier2Discount)} if 250k MNGO