move bridgeNumbers to global constants
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
b7823f19dd
commit
094904c163
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.8.5",
|
||||
"version": "0.8.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -41,9 +41,8 @@ import BondIcon from "../Icon/BondIcon";
|
||||
import StakeIcon from "../Icon/StakeIcon";
|
||||
import WrapIcon from "../Icon/WrapIcon";
|
||||
|
||||
import { isNetworkAvailable } from "../../constants";
|
||||
import { isNetworkAvailable, bridgeNumbers } from "../../constants";
|
||||
import { AVAILABLE_DEXES } from "../../constants/dexes";
|
||||
import { GATEKEEPER_ADDRESSES } from "../../constants/addresses";
|
||||
import { ECOSYSTEM } from "../../constants/ecosystem";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { sortBondsByDiscount, formatCurrency } from "../../helpers";
|
||||
@ -92,11 +91,6 @@ const NavContent = ({ chainId, addressChainId, address }) => {
|
||||
}, [pendingHistory]);
|
||||
|
||||
const sortedGhostBonds = useMemo(() => sortBondsByDiscount(ghostBonds), [ghostBonds]);
|
||||
const bridgeNumbers = useMemo(() => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
return `(${number}, ${number})`;
|
||||
}, [chainId]);
|
||||
|
||||
return (
|
||||
<Paper className="dapp-sidebar">
|
||||
@ -190,7 +184,7 @@ const NavContent = ({ chainId, addressChainId, address }) => {
|
||||
</AccordionDetails>
|
||||
}
|
||||
/>
|
||||
<NavItem icon={ForkRightIcon} label={`${bridgeNumbers} Bridge-In`} to={`/${chainName}/bridge-in`} />
|
||||
<NavItem icon={ForkRightIcon} label={`${bridgeNumbers()} Bridge-In`} to={`/${chainName}/bridge-in`} />
|
||||
{/* <NavItem icon={GavelIcon} label={`Governance`} to={`/${chainName}/governance`} /> */}
|
||||
<NavItem icon={HistoryIcon} chipColor="warning" chip={pendingTransactions} label="Transaction History" to={`/${chainName}/history`} />
|
||||
|
||||
@ -204,7 +198,7 @@ const NavContent = ({ chainId, addressChainId, address }) => {
|
||||
</div>
|
||||
|
||||
<Box>
|
||||
<NavItem href="https://ghostchain.io/game-theory-3-3" icon={CasinoIcon} label={`${bridgeNumbers} Game Theory`} />
|
||||
<NavItem href="https://ghostchain.io/game-theory-3-3" icon={CasinoIcon} label={`${bridgeNumbers()} Game Theory`} />
|
||||
<NavItem href="https://docs.ghostchain.io/" icon={BookIcon} label={`Documentation`} />
|
||||
<StyledBox display="flex" justifyContent="space-around" paddingY="24px">
|
||||
<Link href="https://git.ghostchain.io/ghostchain/ghost-dao-contracts" target="_blank" rel="noopener noreferrer">
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
const CONNECTED_NETWORKS = 1;
|
||||
|
||||
export enum NetworkId {
|
||||
TESTNET_SEPOLIA = 11155111,
|
||||
TESTNET_HOODI = 560048,
|
||||
@ -67,3 +69,8 @@ export const networkAvgBlockSpeed = (chainId) => {
|
||||
}
|
||||
return blockSpeed
|
||||
}
|
||||
|
||||
export const bridgeNumbers = () => {
|
||||
const number = 1 + CONNECTED_NETWORKS * 3;
|
||||
return `(${number}, ${number})`;
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import GhostStyledIcon from "../../components/Icon/GhostIcon";
|
||||
import { PrimaryButton, SecondaryButton } from "../../components/Button";
|
||||
import { GATEKEEPER_ADDRESSES, EMPTY_ADDRESS } from "../../constants/addresses";
|
||||
import { GHOST_CONNECT } from "../../constants/ecosystem";
|
||||
import { bridgeNumbers } from "../../constants";
|
||||
|
||||
import { useLocalStorage } from "../../hooks/localstorage";
|
||||
import { useBreakoutModal } from "../../hooks/breakoutModal";
|
||||
@ -75,13 +76,6 @@ const BreakoutModal = ({ chainId, address }) => {
|
||||
if (isClaimBondOpened && warmupPeriod > 0) return "Bond in Warm-up"
|
||||
}, [isStakingOpened, isClaimBondOpened, warmupPeriod]);
|
||||
|
||||
// TODO: make it global helpers
|
||||
const bridgeNumbers = useMemo(() => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
return `(${number}, ${number})`;
|
||||
}, [chainId]);
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
const [publicKey, prefix] = ss58Decode(receiver);
|
||||
@ -98,7 +92,7 @@ const BreakoutModal = ({ chainId, address }) => {
|
||||
<Modal
|
||||
headerContent={
|
||||
<Box display="flex" justifyContent="center" alignItems="center" gap="15px">
|
||||
<Typography variant="h4">{step === 0 ? header : step === 1 ? `Start ${bridgeNumbers} ${"Stake\u00B2"}` : "Bridge Confirmation"}</Typography>
|
||||
<Typography variant="h4">{step === 0 ? header : step === 1 ? `Start ${bridgeNumbers()} ${"Stake\u00B2"}` : "Bridge Confirmation"}</Typography>
|
||||
</Box>
|
||||
}
|
||||
open={isOpened}
|
||||
@ -114,7 +108,7 @@ const BreakoutModal = ({ chainId, address }) => {
|
||||
warmupPeriod={warmupPeriod}
|
||||
ghstSymbol={ghstSymbol}
|
||||
ftsoSymbol={ftsoSymbol}
|
||||
bridgeNumbers={bridgeNumbers}
|
||||
bridgeNumbers={bridgeNumbers()}
|
||||
defaultFunction={defaultFunction}
|
||||
goNext={() => setStep(1)}
|
||||
closeModal={closeModal}
|
||||
@ -124,7 +118,7 @@ const BreakoutModal = ({ chainId, address }) => {
|
||||
receiver={receiver}
|
||||
setReceiver={setReceiver}
|
||||
chainId={chainId}
|
||||
bridgeNumbers={bridgeNumbers}
|
||||
bridgeNumbers={bridgeNumbers()}
|
||||
ghstSymbol={ghstSymbol}
|
||||
estimatedAmount={estimatedAmount}
|
||||
incomingFee={incomingFee}
|
||||
@ -139,7 +133,7 @@ const BreakoutModal = ({ chainId, address }) => {
|
||||
receiver={receiver}
|
||||
executableFunction={executableFunction}
|
||||
isStakingOpened={isStakingOpened}
|
||||
bridgeNumbers={bridgeNumbers}
|
||||
bridgeNumbers={bridgeNumbers()}
|
||||
incomingFee={incomingFee}
|
||||
estimatedAmount={estimatedAmount}
|
||||
ghstSymbol={ghstSymbol}
|
||||
@ -308,7 +302,11 @@ const WelcomeView = ({
|
||||
|
||||
<Box display="flex" flexDirection="column" justifyContent="space-between" gap="10px">
|
||||
<Typography fontWeight="bold">Skip the Warm-up Now!</Typography>
|
||||
<Typography>{`Bridge your ${ghstSymbol} to GHOST Chain and start ${bridgeNumbers} ${"Stake\u00B2"} at:`}</Typography>
|
||||
<Typography>
|
||||
Bridge your {ghstSymbol} to GHOST Chain and start{" "}
|
||||
<Box component="span" sx={{ whiteSpace: "nowrap" }}>{bridgeNumbers}</Box>{" "}
|
||||
{"Stake\u00B2"} at:
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
<Box display="flex" justifyContent="center" flexDirection="column" alignItems="center">
|
||||
|
||||
@ -43,7 +43,7 @@ import { prettifySeconds } from "../../helpers/timeUtil";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { formatNumber, formatCurrency } from "../../helpers";
|
||||
import { GATEKEEPER_ADDRESSES } from "../../constants/addresses";
|
||||
import { networkAvgBlockSpeed } from "../../constants";
|
||||
import { networkAvgBlockSpeed, bridgeNumbers } from "../../constants";
|
||||
|
||||
const DECIMALS_PREFIX = "bridge-in-decimals";
|
||||
|
||||
@ -65,8 +65,8 @@ const BridgeStatusCard = ({ progressPercent, totalValidators, pendingValidators,
|
||||
</Box>
|
||||
|
||||
<LinearProgressBar
|
||||
variant="determinate"
|
||||
value={progressPercent}
|
||||
variant={typeof progressPercent === "number" ? "determinate" : "indeterminate"}
|
||||
value={progressPercent ? progressPercent : 0}
|
||||
height={6}
|
||||
barColor={tapestryDraft
|
||||
? theme.colors.feedback.success
|
||||
@ -107,12 +107,6 @@ const BridgeIn = ({ chainId, address, config, connect }) => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
|
||||
const bridgeNumbers = useMemo(() => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
return `(${number}, ${number})`;
|
||||
}, [chainId]);
|
||||
|
||||
const { data: chainProperties } = useSWR(
|
||||
client ? ['chainProperties', client] : null,
|
||||
() => client.getChainSpecData(),
|
||||
@ -400,7 +394,7 @@ const BridgeIn = ({ chainId, address, config, connect }) => {
|
||||
}, [currentBlockNumber]);
|
||||
|
||||
const progressPercent = useMemo(() => {
|
||||
if (!nextConsensusAttempt || !attestationDelay || !weavingDelay) return 5;
|
||||
if (!nextConsensusAttempt || !attestationDelay || !weavingDelay) return null;
|
||||
|
||||
const total = tapestryDraft ? weavingDelay : attestationDelay;
|
||||
const end = tapestryDraft ? tapestryDraft.until : nextConsensusAttempt;
|
||||
@ -409,10 +403,8 @@ const BridgeIn = ({ chainId, address, config, connect }) => {
|
||||
const passed = Number(total) - remaining;
|
||||
const progress = passed * 100 / Number(total);
|
||||
|
||||
// TODO
|
||||
const virtualBlocksPassed = Math.min(msSinceLastBlock / 12000, 1);
|
||||
const smoothBlocksPassed = passed + virtualBlocksPassed;
|
||||
|
||||
const smoothProgress = (smoothBlocksPassed * 100) / Number(total);
|
||||
|
||||
return Math.min(Math.max(smoothProgress, 3), 100);
|
||||
@ -420,7 +412,7 @@ const BridgeIn = ({ chainId, address, config, connect }) => {
|
||||
|
||||
return (
|
||||
<Box minHeight="calc(100vh - 43px)">
|
||||
<PageTitle name="GHOST Bridge-In" subtitle={`${bridgeNumbers} Bridge-In ${ghstSymbol ? ghstSymbol : "CSPR"} into ${bridgeNumbers} Stake\u00B2`} />
|
||||
<PageTitle name="GHOST Bridge-In" subtitle={`${bridgeNumbers()} Bridge-In ${ghstSymbol ? ghstSymbol : "CSPR"} into ${bridgeNumbers()} Stake\u00B2`} />
|
||||
<Container
|
||||
style={{
|
||||
paddingLeft: isSmallScreen || isVerySmallScreen ? "0" : "3.3rem",
|
||||
|
||||
@ -25,6 +25,7 @@ import { formatCurrency } from "../../helpers";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { GATEKEEPER_ADDRESSES } from "../../constants/addresses";
|
||||
import { GHOST_CONNECT } from "../../constants/ecosystem";
|
||||
import { bridgeNumbers } from "../../constants";
|
||||
|
||||
export const BridgeModal = ({
|
||||
providerDetail,
|
||||
@ -52,12 +53,6 @@ export const BridgeModal = ({
|
||||
});
|
||||
};
|
||||
|
||||
const bridgeNumbers = () => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
return `(${number}, ${number})`;
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
data-testid="transaction-details-modal"
|
||||
|
||||
@ -11,6 +11,7 @@ import { SecondaryButton } from "../../../components/Button";
|
||||
import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber";
|
||||
|
||||
import { GATEKEEPER_ADDRESSES, EMPTY_ADDRESS } from "../../../constants/addresses";
|
||||
import { bridgeNumbers } from "../../../constants";
|
||||
|
||||
const ProtocolDetail = ({ isMobileScreen, theme, name, sideName, url, urlParams, description }) => {
|
||||
const navigate = useNavigate();
|
||||
@ -80,12 +81,6 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
|
||||
return `Up to ${formatNumber(maxDiscount, 0)}% Discount`;
|
||||
}, [liveBonds]);
|
||||
|
||||
const bridgeNumbers = useMemo(() => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
return `(${number}, ${number})`;
|
||||
}, [chainId]);
|
||||
|
||||
return (
|
||||
<Grid container spacing={0} justifyContent={"center"}>
|
||||
<Box display="flex" flexWrap="wrap" justifyContent="space-between" mt="10px" gap="25px">
|
||||
@ -117,16 +112,16 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
|
||||
url={`/${networkName.toLowerCase()}/stake`}
|
||||
name="(3, 3) Stake"
|
||||
sideName={`${formatNumber(apyInner, 2)}% APY`}
|
||||
description={`Staking enables (3, 3) coordination by aligning long-term incentives, sustainably backed by (1, 1) Bonds, LP fees, and Farming. Stake ${ftsoSymbol} to earn rewards and unlock ${bridgeNumbers} Stake\u00B2.`}
|
||||
description={`Staking enables (3, 3) coordination by aligning long-term incentives, sustainably backed by (1, 1) Bonds, LP fees, and Farming. Stake ${ftsoSymbol} to earn rewards and unlock ${bridgeNumbers()} Stake\u00B2.`}
|
||||
/>
|
||||
|
||||
<ProtocolDetail
|
||||
isMobileScreen={isMobileScreen}
|
||||
theme={theme}
|
||||
url={`/${networkName.toLowerCase()}/bridge`}
|
||||
name={`${bridgeNumbers} Stake\u00B2`}
|
||||
name={`${bridgeNumbers()} Stake\u00B2`}
|
||||
sideName={`${formatNumber(gatekeepedApy, 2)}% APY`}
|
||||
description={`Staking\u00B2 strategy further deepens long-term incentives powered by sustainable cross-chain bridging revenue. ${bridgeNumbers} Stake\u00B2 ${csprSymbol} to receive organic APY with no warmup and no dilution.`}
|
||||
description={`Staking\u00B2 strategy further deepens long-term incentives powered by sustainable cross-chain bridging revenue. ${bridgeNumbers()} Stake\u00B2 ${csprSymbol} to receive organic APY with no warmup and no dilution.`}
|
||||
/>
|
||||
</Box>
|
||||
</Grid>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user