mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
making needed pSEED configurable 🚵🏿♀️
This commit is contained in:
committed by
Dan OneTree
parent
2b72e71db5
commit
b1e4c0e4d7
@@ -17,13 +17,13 @@ export async function isAllowedToCreateQuest(
|
||||
);
|
||||
const pSEEDBalance = await pSEEDContract.balanceOf(playerAddress);
|
||||
const pSEEDDecimals = await pSEEDContract.decimals();
|
||||
const minimumPooledSeedBalance = new BN(100);
|
||||
const minimumPooledSeedBalance = new BN(Constants.PSEED_FOR_QUEST);
|
||||
const pSEEDBalanceInDecimal = amountToDecimal(
|
||||
pSEEDBalance.toString(),
|
||||
pSEEDDecimals,
|
||||
);
|
||||
|
||||
const allowed = new BN(pSEEDBalanceInDecimal).gt(minimumPooledSeedBalance);
|
||||
const allowed = new BN(pSEEDBalanceInDecimal).gte(minimumPooledSeedBalance);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ export {
|
||||
ChakraProps,
|
||||
ChakraProvider,
|
||||
CloseButton,
|
||||
Code,
|
||||
Collapse,
|
||||
ComponentWithAs,
|
||||
Container,
|
||||
@@ -161,12 +162,14 @@ export {
|
||||
StatNumber,
|
||||
Switch,
|
||||
Tab,
|
||||
Table,
|
||||
TabList,
|
||||
TabPanel,
|
||||
TabPanels,
|
||||
Tabs,
|
||||
Text,
|
||||
Textarea,
|
||||
Th,
|
||||
Tooltip,
|
||||
UnorderedList,
|
||||
useBoolean,
|
||||
|
||||
@@ -22,3 +22,5 @@ export const IPFS_LINK_PATTERN =
|
||||
'https://{v1cid}.ipfs.dweb.link/{path}';
|
||||
|
||||
export const PSEED_ADDRESS = '0x8a8fcd351ed553fc75aecbc566a32f94471f302e';
|
||||
|
||||
export const PSEED_FOR_QUEST = 0;
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
QuestWithCompletionFragment,
|
||||
Skill,
|
||||
} from 'graphql/autogen/types';
|
||||
import parse from 'html-react-parser';
|
||||
import { useUser } from 'lib/hooks';
|
||||
import moment from 'moment';
|
||||
import { optimizedImage } from 'utils/imageHelpers';
|
||||
@@ -96,7 +95,7 @@ export const QuestDetails: React.FC<Props> = ({ quest }) => {
|
||||
<Text textStyle="caption" pb={1}>
|
||||
DESCRIPTION
|
||||
</Text>
|
||||
<Text>{parse(quest.description || '')}</Text>
|
||||
<Text>{quest.description ?? ''}</Text>
|
||||
</Box>
|
||||
|
||||
{quest.repetition === QuestRepetition_Enum.Recurring && (
|
||||
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
MetaTag,
|
||||
Select,
|
||||
Text,
|
||||
Textarea,
|
||||
VStack,
|
||||
} from '@metafam/ds';
|
||||
import { FlexContainer } from 'components/Container';
|
||||
import { RepetitionColors } from 'components/Quest/QuestTags';
|
||||
import { RolesSelect } from 'components/Quest/Roles';
|
||||
import { SkillsSelect } from 'components/Quest/Skills';
|
||||
import { WYSIWYGEditor } from 'components/Quest/WYSIWYGEditor';
|
||||
import {
|
||||
GuildFragment,
|
||||
PlayerRole,
|
||||
@@ -208,7 +208,7 @@ export const QuestForm: React.FC<Props> = ({
|
||||
}}
|
||||
defaultValue={defaultValues.description}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<WYSIWYGEditor {...{ value, onChange }} />
|
||||
<Textarea {...{ value, onChange }} />
|
||||
)}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
@@ -85,9 +85,9 @@ const QuestPage: React.FC<Props> = ({ quest_id }) => {
|
||||
direction="column"
|
||||
>
|
||||
<Heading mb={4} ml={2}>
|
||||
Quest details
|
||||
Quest: {quest.title}
|
||||
</Heading>
|
||||
<QuestDetails quest={quest} />
|
||||
<QuestDetails {...{ quest }} />
|
||||
</Flex>
|
||||
</WrapItem>
|
||||
<WrapItem
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Tooltip,
|
||||
useToast,
|
||||
} from '@metafam/ds';
|
||||
import { Constants } from '@metafam/utils';
|
||||
import { PageContainer } from 'components/Container';
|
||||
import { QuestFilter } from 'components/Quest/QuestFilter';
|
||||
import { QuestList } from 'components/Quest/QuestList';
|
||||
@@ -69,7 +70,7 @@ const QuestsPage: React.FC<Props> = ({ roleChoices }) => {
|
||||
<Tooltip
|
||||
label={
|
||||
!canCreateQuest &&
|
||||
'You need to hold at least 100 pSEED to create a quest.'
|
||||
`You need to hold at least ${Constants.PSEED_FOR_QUEST} pSEED to create a quest.`
|
||||
}
|
||||
>
|
||||
<MetaButton
|
||||
@@ -79,8 +80,7 @@ const QuestsPage: React.FC<Props> = ({ roleChoices }) => {
|
||||
if (!canCreateQuest) {
|
||||
toast({
|
||||
title: 'Error',
|
||||
description:
|
||||
'Insufficient pSEED Balance. Must have ≥ 100pSEED.',
|
||||
description: `Insufficient pSEED Balance. Must have ≥ ${Constants.PSEED_FOR_QUEST} pSEED.`,
|
||||
status: 'error',
|
||||
isClosable: true,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Maybe, numbers } from '@metafam/utils';
|
||||
import { Constants, Maybe, numbers } from '@metafam/utils';
|
||||
import {
|
||||
Player,
|
||||
QuestRepetition_Enum,
|
||||
@@ -21,13 +21,13 @@ export function transformCooldownForBackend(
|
||||
}
|
||||
|
||||
export function isAllowedToCreateQuest(balance?: string | null): boolean {
|
||||
if (!balance) return false;
|
||||
if (balance == null) return false;
|
||||
|
||||
const pSEEDDecimals = 18;
|
||||
const minimumPooledSeedBalance = new BN(100);
|
||||
const minimumPooledSeedBalance = new BN(Constants.PSEED_FOR_QUEST);
|
||||
const pSEEDBalanceInDecimal = amountToDecimal(balance, pSEEDDecimals);
|
||||
|
||||
const allowed = new BN(pSEEDBalanceInDecimal).gt(minimumPooledSeedBalance);
|
||||
const allowed = new BN(pSEEDBalanceInDecimal).gte(minimumPooledSeedBalance);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user