@ape.swap/bonds-sdk 3.0.57-test.2 → 3.0.57-test.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +557 -532
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -60910,10 +60910,16 @@ var get$1 = /*@__PURE__*/getDefaultExportFromCjs(get_1);
|
|
|
60910
60910
|
const useModal = (modal, closeOnOverlayClick = true, updateOnPropsChange = false, modalId = 'defaultNodeId', clearModalStack = false) => {
|
|
60911
60911
|
// Clear modal stack will not update props if the parent modal gets unmounted
|
|
60912
60912
|
const { nodeId, modalNode, setModalNode, onPresent, handleClose, setCloseOnOverlayClick } = useContext(Context);
|
|
60913
|
-
const onPresentCallback = useCallback(() => {
|
|
60914
|
-
onPresent(modal, modalId, clearModalStack);
|
|
60915
|
-
}, [modal, modalId, clearModalStack, onPresent]);
|
|
60916
60913
|
const nodeIdIndex = nodeId.indexOf(modalId);
|
|
60914
|
+
const onPresentCallback = useCallback(() => {
|
|
60915
|
+
if (nodeIdIndex !== -1) {
|
|
60916
|
+
console.error('Modal is already open.'); //TODO: when sure this works as expected. remove console
|
|
60917
|
+
return;
|
|
60918
|
+
}
|
|
60919
|
+
else {
|
|
60920
|
+
onPresent(modal, modalId, clearModalStack);
|
|
60921
|
+
}
|
|
60922
|
+
}, [modal, modalId, clearModalStack, onPresent, nodeIdIndex]);
|
|
60917
60923
|
useEffect(() => {
|
|
60918
60924
|
// NodeId is needed in case there are 2 useModal hooks on the same page and one has updateOnPropsChange
|
|
60919
60925
|
if (updateOnPropsChange) {
|
|
@@ -79718,190 +79724,470 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
79718
79724
|
} }));
|
|
79719
79725
|
};
|
|
79720
79726
|
|
|
79721
|
-
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
79722
|
-
const CheckUrl = () => {
|
|
79723
|
-
var _a, _b;
|
|
79724
|
-
if (typeof window === 'undefined')
|
|
79725
|
-
return null;
|
|
79726
|
-
const { data: bonds } = useBondsData();
|
|
79727
|
-
const asPath = window.location.search;
|
|
79728
|
-
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
79729
|
-
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
79730
|
-
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
79731
|
-
const bond = useMemo(() => {
|
|
79732
|
-
if (!bondAddress)
|
|
79733
|
-
return undefined;
|
|
79734
|
-
return bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
79735
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
79736
|
-
const [onPresentBuyBillsModal] = useModal(jsx$2(ModalHandler, { bondAddress: bondAddress, bondChain: parseInt(bondChain) }), true, true, `BuyBondModal:${bondAddress.toLowerCase()}-${bondChain}-${bond === null || bond === void 0 ? void 0 : bond.index}`);
|
|
79737
|
-
useEffect(() => {
|
|
79738
|
-
if (bond && bondChain && bondAddress) {
|
|
79739
|
-
onPresentBuyBillsModal();
|
|
79740
|
-
track({
|
|
79741
|
-
event: 'buyModalOpen',
|
|
79742
|
-
chain: bondChain,
|
|
79743
|
-
data: {
|
|
79744
|
-
cat: 'customURL',
|
|
79745
|
-
bond: bond.earnToken.symbol,
|
|
79746
|
-
bondChain: bondChain,
|
|
79747
|
-
},
|
|
79748
|
-
});
|
|
79749
|
-
}
|
|
79750
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
79751
|
-
return jsx$2(Fragment$1, {});
|
|
79752
|
-
};
|
|
79753
|
-
|
|
79754
|
-
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
79755
|
-
var _a;
|
|
79756
|
-
const isMobile = useIsMobile();
|
|
79757
|
-
return (jsxs(Flex, { id: `${NETWORK_LABEL[chain].toLowerCase().replace(/\s+/g, '')}`, className: "chaintitle", sx: {
|
|
79758
|
-
pt,
|
|
79759
|
-
pb: '10px',
|
|
79760
|
-
color: 'textDisabledButton',
|
|
79761
|
-
fontSize: '13px',
|
|
79762
|
-
fontWeight: 500,
|
|
79763
|
-
cursor: 'pointer',
|
|
79764
|
-
textTransform: 'uppercase',
|
|
79765
|
-
display: hideTitles ? 'none' : 'flex',
|
|
79766
|
-
width: '300px',
|
|
79767
|
-
alignItems: 'center',
|
|
79768
|
-
}, children: [NETWORK_LABEL[chain], " Bonds", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'down' : 'up', width: 8, color: "textDisabledButton" }) }), ((_a = NETWORK_LABEL[chain]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('testnet')) && (jsxs(Flex, { sx: { ml: '15px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', color: '#DE62F3', fontWeight: 700, mr: '7px' }, children: "TESTNET" }), jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Testnet Bonds let you experiment with fake tokens for free on upcoming chains still in development." }), width: isMobile ? '272px' : '280px', placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(10%, -5%)' : 'translate(-5%, -5%)', children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) })] }))] }));
|
|
79769
|
-
};
|
|
79770
|
-
|
|
79771
|
-
const ProgressBar = ({ value, color = 'text' }) => {
|
|
79772
|
-
return (jsx$2(Flex$1, { sx: { width: ['100px', '100px', '100px', '100%'], alignItems: 'center', flexDirection: 'row', mt: '5px' }, children: jsx$2(Box$1, { className: "progressbar-background", children: jsx$2(Box$1, { className: "progressbar-completed", style: {
|
|
79773
|
-
width: `${value <= 3 ? 3 : value}%`,
|
|
79774
|
-
} }) }) }));
|
|
79775
|
-
};
|
|
79776
|
-
|
|
79777
79727
|
const styles$9 = {
|
|
79778
|
-
|
|
79779
|
-
|
|
79728
|
+
buyContainer: {
|
|
79729
|
+
width: '100%',
|
|
79730
|
+
mb: ['30px', '30px', '30px', '0px'],
|
|
79731
|
+
flexDirection: 'column',
|
|
79732
|
+
},
|
|
79733
|
+
cardContainer: {
|
|
79734
|
+
width: '100%',
|
|
79735
|
+
background: 'white2',
|
|
79736
|
+
borderRadius: 'normal',
|
|
79737
|
+
flexDirection: 'column',
|
|
79738
|
+
},
|
|
79739
|
+
infoRowsContainer: {
|
|
79740
|
+
width: '100%',
|
|
79741
|
+
flexDirection: 'column',
|
|
79742
|
+
mb: '10px',
|
|
79743
|
+
},
|
|
79744
|
+
infoRow: {
|
|
79745
|
+
width: '100%',
|
|
79746
|
+
justifyContent: 'space-between',
|
|
79747
|
+
},
|
|
79748
|
+
infoTitle: {
|
|
79780
79749
|
fontSize: '12px',
|
|
79781
|
-
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
79782
79750
|
fontWeight: 400,
|
|
79783
79751
|
},
|
|
79784
|
-
|
|
79785
|
-
|
|
79786
|
-
|
|
79787
|
-
|
|
79788
|
-
}};
|
|
79789
|
-
|
|
79790
|
-
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
79791
|
-
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$9.titleText, children: `${title}` }) }), showTooltip ? (jsx$2(Flex, { sx: { alignItems: 'center', width: '100%' }, children: jsx$2(TooltipBubble, { placement: toolTipPlacement, transformTip: toolTipTransform, body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: toolTip }), width: "250px", children: jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', width: '127px' }, children: value ? value : jsx$2(Skeleton, { sx: styles$9.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$9.skeleton }) }))] }));
|
|
79792
|
-
};
|
|
79793
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
79794
|
-
|
|
79795
|
-
const BonusContainer = ({ bond, tooltipPosition = 'bottomRight', }) => {
|
|
79796
|
-
var _a, _b;
|
|
79797
|
-
const SDKConfig = useSDKConfig();
|
|
79798
|
-
const isMobile = useIsMobile();
|
|
79799
|
-
return (jsx$2("div", { className: `discount-column`, children: 'trueBondPrices' in bond ? (((_b = (_a = findHighestTrueBondPrice((SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) > 0 ? (jsx$2(BonusComponent, { bond: bond, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }));
|
|
79752
|
+
infoData: {
|
|
79753
|
+
fontSize: '12px',
|
|
79754
|
+
fontWeight: 700,
|
|
79755
|
+
},
|
|
79800
79756
|
};
|
|
79757
|
+
({
|
|
79758
|
+
[types.LaunchBondTiers.Bronze]: '#CD7F32',
|
|
79759
|
+
[types.LaunchBondTiers.Silver]: '#C0C0C0',
|
|
79760
|
+
[types.LaunchBondTiers.Gold]: '#FFD700',
|
|
79761
|
+
[types.LaunchBondTiers.Diamond]: '#B9F2FF',
|
|
79762
|
+
[types.LaunchBondTiers.Legend]: '#a587e6', // Replaced hex color for a violet hex
|
|
79763
|
+
});
|
|
79801
79764
|
|
|
79802
|
-
const
|
|
79803
|
-
|
|
79804
|
-
|
|
79805
|
-
[
|
|
79806
|
-
|
|
79807
|
-
|
|
79808
|
-
|
|
79809
|
-
|
|
79810
|
-
|
|
79811
|
-
|
|
79812
|
-
|
|
79813
|
-
|
|
79814
|
-
|
|
79815
|
-
|
|
79816
|
-
|
|
79817
|
-
|
|
79818
|
-
}
|
|
79819
|
-
|
|
79820
|
-
|
|
79821
|
-
|
|
79822
|
-
|
|
79823
|
-
|
|
79824
|
-
|
|
79825
|
-
? bond.billAddress
|
|
79826
|
-
: 'contractAddress' in bond
|
|
79827
|
-
? bond.contractAddress[bond.chainId]
|
|
79828
|
-
: undefined;
|
|
79829
|
-
const isGoldRush = 'billArt' in bond ? bond.billArt.collection === types.BillArtCollection.GoldenTicket_Collection1 : false;
|
|
79830
|
-
const isSoldOut = isBondSoldOut(bond);
|
|
79831
|
-
// Modal
|
|
79832
|
-
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
|
|
79833
|
-
const handleOpenModal = () => {
|
|
79834
|
-
if (isSoldOut)
|
|
79835
|
-
return;
|
|
79836
|
-
openBuyModal();
|
|
79837
|
-
if (typeof window !== 'undefined') {
|
|
79838
|
-
window.history.pushState({}, '', `${locationPath}?bondAddress=${billAddress}&bondChain=${bond.chainId}`);
|
|
79765
|
+
const ParticipationSuccessful = ({ onDismiss, launchBond, inputAmount, }) => {
|
|
79766
|
+
var _a, _b, _c, _d;
|
|
79767
|
+
const { data: tokenPrices } = useTokenPrices();
|
|
79768
|
+
const principalTokenPrice = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.find((token) => { var _a, _b, _c; return ((_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_c = (_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.token) === null || _b === void 0 ? void 0 : _b.address[launchBond === null || launchBond === void 0 ? void 0 : launchBond.chainId]) === null || _c === void 0 ? void 0 : _c.toLowerCase()); })) === null || _a === void 0 ? void 0 : _a.price;
|
|
79769
|
+
const inputValue = parseFloat(inputAmount !== null && inputAmount !== void 0 ? inputAmount : '0');
|
|
79770
|
+
const depositAmountUsd = inputValue * (principalTokenPrice !== null && principalTokenPrice !== void 0 ? principalTokenPrice : 0);
|
|
79771
|
+
const userAllocation = depositAmountUsd / (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
79772
|
+
const userAllocationUsd = userAllocation * (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
79773
|
+
const finishTime = ((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.redeemTime) !== null && _b !== void 0 ? _b : 0) * 1000;
|
|
79774
|
+
const finishDate = new Date(finishTime);
|
|
79775
|
+
const month = finishDate.toLocaleDateString('en-US', { month: 'short' });
|
|
79776
|
+
const getDayWithSuffix = (day) => {
|
|
79777
|
+
if (day > 3 && day < 21)
|
|
79778
|
+
return `${day}th`;
|
|
79779
|
+
switch (day % 10) {
|
|
79780
|
+
case 1:
|
|
79781
|
+
return `${day}st`;
|
|
79782
|
+
case 2:
|
|
79783
|
+
return `${day}nd`;
|
|
79784
|
+
case 3:
|
|
79785
|
+
return `${day}rd`;
|
|
79786
|
+
default:
|
|
79787
|
+
return `${day}th`;
|
|
79839
79788
|
}
|
|
79840
|
-
track({
|
|
79841
|
-
event: 'buyModalOpen',
|
|
79842
|
-
chain: bond.chainId,
|
|
79843
|
-
data: {
|
|
79844
|
-
cat: 'Row',
|
|
79845
|
-
bond: bond.earnToken.symbol,
|
|
79846
|
-
bondChain: bond.chainId,
|
|
79847
|
-
},
|
|
79848
|
-
});
|
|
79849
|
-
};
|
|
79850
|
-
const remainingPercentage = (bond) => {
|
|
79851
|
-
var _a, _b, _c;
|
|
79852
|
-
const maxTotalPayout = 'maxTotalPayout' in bond ? bond.maxTotalPayout : undefined;
|
|
79853
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : undefined;
|
|
79854
|
-
if (!maxTotalPayout)
|
|
79855
|
-
return 0;
|
|
79856
|
-
const totalMaxPayout = new BigNumber$1(maxTotalPayout !== null && maxTotalPayout !== void 0 ? maxTotalPayout : '0').div(new BigNumber$1(10).pow((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
79857
|
-
const remainingTokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
|
|
79858
|
-
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
79859
|
-
};
|
|
79860
|
-
const remainingTokensFormat = (bond) => {
|
|
79861
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
79862
|
-
return formatNumberSI(parseFloat(tokensRemaining), 0);
|
|
79863
|
-
};
|
|
79864
|
-
const remainingTokensUsd = (bond) => {
|
|
79865
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
79866
|
-
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
79867
|
-
const tokens = new BigNumber$1(tokensRemaining);
|
|
79868
|
-
return tokens.times(payoutTokenPrice);
|
|
79869
|
-
};
|
|
79870
|
-
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: {
|
|
79871
|
-
borderRadius: 'normal',
|
|
79872
|
-
background: NETWORK_COLORS$1[bond.chainId]
|
|
79873
|
-
? `linear-gradient(90deg, ${NETWORK_COLORS$1[bond.chainId]} ${rangeColorNetworkRow.from}, rgba(21,20,32,1) ${rangeColorNetworkRow.to})`
|
|
79874
|
-
: 'linear-gradient(90deg, rgba(21,20,32,0.3) 3%, rgba(21,20,32,1) 8%)',
|
|
79875
|
-
}, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['70%', '70%', '65%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond, isGoldBond: isGoldRush }) }), jsxs("div", { className: "bond-info-columns", sx: { width: '55%' }, children: [jsx$2(BonusContainer, { bond: bond }), jsxs("div", { className: "terms-column", children: [getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
79876
|
-
width: '127px',
|
|
79877
|
-
height: '25px',
|
|
79878
|
-
flexDirection: 'column',
|
|
79879
|
-
justifyContent: 'center',
|
|
79880
|
-
display: ['none', 'none', 'none', 'flex'],
|
|
79881
|
-
}, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
79882
|
-
num: remainingTokensUsd(bond).toNumber(),
|
|
79883
|
-
isPrice: true,
|
|
79884
|
-
})})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId, isSoldOut: isSoldOut }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
|
|
79885
|
-
};
|
|
79886
|
-
|
|
79887
|
-
const HotBondCard = ({ bond }) => {
|
|
79888
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
79889
|
-
const bonus = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bond)) === null || _a === void 0 ? void 0 : _a.bonus;
|
|
79890
|
-
const SDKConfig = useSDKConfig();
|
|
79891
|
-
// Modal
|
|
79892
|
-
const [openBuyModal] = useModal(jsx$2(BuyBondModal, { bondAddress: bond.billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${bond.billAddress}-${bond.chainId}`);
|
|
79893
|
-
const handleOpenModal = () => {
|
|
79894
|
-
openBuyModal();
|
|
79895
|
-
track({
|
|
79896
|
-
event: 'hotClick',
|
|
79897
|
-
chain: bond.chainId,
|
|
79898
|
-
data: {
|
|
79899
|
-
cat: 'hotClick',
|
|
79900
|
-
bond: bond.earnToken.symbol,
|
|
79901
|
-
},
|
|
79902
|
-
});
|
|
79903
79789
|
};
|
|
79904
|
-
|
|
79790
|
+
const day = finishDate.getDate();
|
|
79791
|
+
const formattedFinishDate = `${month} ${getDayWithSuffix(day)} at 11 UTC.`;
|
|
79792
|
+
const initialRelease = userAllocation * ((launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
79793
|
+
const initialReleaseUsd = initialRelease * ((_c = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _c !== void 0 ? _c : 0);
|
|
79794
|
+
const vestedAmount = userAllocation * (1 - (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
79795
|
+
const vestedAmountUsd = vestedAmount * ((_d = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _d !== void 0 ? _d : 0);
|
|
79796
|
+
return (jsxs(Modal, { children: [jsx$2(ModalHeader, { hideDivider: true }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '15px' }, children: jsx$2(Text, { sx: { fontSize: '22px', fontWeight: 700 }, children: "Participation Details" }) }), jsxs(Flex, { sx: {
|
|
79797
|
+
fontSize: '14px',
|
|
79798
|
+
fontWeight: 400,
|
|
79799
|
+
flexDirection: 'column',
|
|
79800
|
+
}, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Your Deposit" }), jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: [getFirstNonZeroDigits(inputValue, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.token.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", depositAmountUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Your Allocation" }), jsxs(Flex, { sx: {
|
|
79801
|
+
fontSize: '12px',
|
|
79802
|
+
fontWeight: 500,
|
|
79803
|
+
}, children: [getFirstNonZeroDigits(userAllocation, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", userAllocationUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Initial Release", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `You'll be able to claim an initial release of ${launchBond.initialRelease / 100}%
|
|
79804
|
+
of your allocation on ${formattedFinishDate}` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
79805
|
+
fontSize: '12px',
|
|
79806
|
+
fontWeight: 500,
|
|
79807
|
+
}, children: [getFirstNonZeroDigits(initialRelease, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: {
|
|
79808
|
+
color: 'textDisabledButton',
|
|
79809
|
+
ml: '5px',
|
|
79810
|
+
}, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods(parseInt(launchBond.vestingTerm)).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
79811
|
+
fontSize: '12px',
|
|
79812
|
+
fontWeight: 500,
|
|
79813
|
+
}, children: [getFirstNonZeroDigits(vestedAmount, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", vestedAmountUsd.toFixed(2), ")"] })] })] }), jsx$2(Flex, { sx: { mt: '10px' }, children: `Your purchased bond can be found under the "Your Bonds" tab.` })] }), jsx$2(Button, { onClick: onDismiss, sx: { fontSize: '16px', width: '100%', mt: '15px' }, children: "Close" })] })] }));
|
|
79814
|
+
};
|
|
79815
|
+
|
|
79816
|
+
const BuyAction = ({ launchBond, inputValue, selectedCurrency, soldout, }) => {
|
|
79817
|
+
var _a, _b;
|
|
79818
|
+
// Local state
|
|
79819
|
+
const [loading, setLoading] = useState(false);
|
|
79820
|
+
// Hooks
|
|
79821
|
+
const { switchChain: onSelectChain } = useSwitchChain();
|
|
79822
|
+
const { address: account, chainId } = useAccount();
|
|
79823
|
+
const { data: currencyBalanceString } = useCurrencyBalance(selectedCurrency, account, launchBond.chainId);
|
|
79824
|
+
const exceedsBalance = parseFloat(inputValue) > parseFloat(currencyBalanceString !== null && currencyBalanceString !== void 0 ? currencyBalanceString : '0');
|
|
79825
|
+
usePopups();
|
|
79826
|
+
// Buy confirm modal
|
|
79827
|
+
const [onOpenPurchaseModal] = useModal(jsx$2(ParticipationSuccessful, { launchBond: launchBond, inputAmount: inputValue }), true, true, `confirm buy modal`);
|
|
79828
|
+
// Approve logic
|
|
79829
|
+
const [approvalState, approveCallback] = useApproval(inputValue, selectedCurrency, launchBond === null || launchBond === void 0 ? void 0 : launchBond.contractAddress, account, chainId);
|
|
79830
|
+
const handleApprove = () => {
|
|
79831
|
+
setLoading(true);
|
|
79832
|
+
approveCallback().finally(() => setLoading(false));
|
|
79833
|
+
};
|
|
79834
|
+
const { writeContractAsync } = useWriteContract();
|
|
79835
|
+
const onBuyBill = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79836
|
+
var _a, _b;
|
|
79837
|
+
const amount = new BigNumber$1(inputValue)
|
|
79838
|
+
.times(new BigNumber$1(10).pow((_a = selectedCurrency.decimals[launchBond.chainId]) !== null && _a !== void 0 ? _a : 18))
|
|
79839
|
+
.toString();
|
|
79840
|
+
const maxPrice = new BigNumber$1((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.trueBillPrice) !== null && _b !== void 0 ? _b : '0').times(102).div(100).toFixed(0);
|
|
79841
|
+
const args = [amount, maxPrice, account];
|
|
79842
|
+
yield writeContractAsync({
|
|
79843
|
+
address: launchBond === null || launchBond === void 0 ? void 0 : launchBond.contractAddress,
|
|
79844
|
+
abi: launchBondsABI_V2_2_0,
|
|
79845
|
+
functionName: 'deposit',
|
|
79846
|
+
args: args,
|
|
79847
|
+
chain: launchBond.chainId,
|
|
79848
|
+
account,
|
|
79849
|
+
});
|
|
79850
|
+
});
|
|
79851
|
+
const handleBuyBill = () => {
|
|
79852
|
+
setLoading(true);
|
|
79853
|
+
onBuyBill()
|
|
79854
|
+
.then(() => {
|
|
79855
|
+
if (chainId && account) {
|
|
79856
|
+
console.log('Purchase successful, open purchase modal');
|
|
79857
|
+
onOpenPurchaseModal();
|
|
79858
|
+
track({
|
|
79859
|
+
event: 'bond',
|
|
79860
|
+
chain: chainId,
|
|
79861
|
+
data: {
|
|
79862
|
+
cat: 'buy',
|
|
79863
|
+
type: launchBond.billVersion === types.BillVersion.FlashTieredSale ? 'flash' : 'launch',
|
|
79864
|
+
principalToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.token.symbol,
|
|
79865
|
+
earnToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol,
|
|
79866
|
+
amount: inputValue,
|
|
79867
|
+
usdAmount: inputValue, // TODO: fix usdAmount here because this assumes principal token is stablecoin
|
|
79868
|
+
},
|
|
79869
|
+
});
|
|
79870
|
+
}
|
|
79871
|
+
})
|
|
79872
|
+
.catch((e) => {
|
|
79873
|
+
console.log(e);
|
|
79874
|
+
// addToastError(e)
|
|
79875
|
+
})
|
|
79876
|
+
.finally(() => {
|
|
79877
|
+
setLoading(false);
|
|
79878
|
+
});
|
|
79879
|
+
};
|
|
79880
|
+
const saleStartTime = ((_a = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initTime) !== null && _a !== void 0 ? _a : 0) * 1000;
|
|
79881
|
+
const saleFinishTime = ((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.finishTime) !== null && _b !== void 0 ? _b : 0) * 1000;
|
|
79882
|
+
const now = new Date().getTime();
|
|
79883
|
+
const saleHasStarted = now > saleStartTime;
|
|
79884
|
+
const saleHasFinished = now > saleFinishTime || launchBond.finalized;
|
|
79885
|
+
const error = !saleHasStarted
|
|
79886
|
+
? `Sale hasn't started`
|
|
79887
|
+
: saleHasFinished
|
|
79888
|
+
? 'Sale Finished'
|
|
79889
|
+
: exceedsBalance
|
|
79890
|
+
? 'Exceeds balance'
|
|
79891
|
+
: soldout
|
|
79892
|
+
? 'Soldout'
|
|
79893
|
+
: chainId !== launchBond.chainId
|
|
79894
|
+
? `Switch to ${NETWORK_LABEL[launchBond.chainId]}`
|
|
79895
|
+
: !inputValue || parseFloat(inputValue) === 0
|
|
79896
|
+
? 'Insert amount'
|
|
79897
|
+
: null;
|
|
79898
|
+
return (jsx$2(Flex, { sx: { width: '100%', ml: ['0', '0', '0', '10px'], mb: ['10px', '10px', '10px', '0'] }, children: !account ? (jsx$2(ConnectButton, {})) : chainId !== launchBond.chainId ? (jsx$2(Button, { fullWidth: true, onClick: () => {
|
|
79899
|
+
onSelectChain({ chainId: launchBond.chainId });
|
|
79900
|
+
}, children: `Switch to ${NETWORK_LABEL[launchBond.chainId]}` })) : approvalState === ApprovalState.NOT_APPROVED || approvalState === ApprovalState.PENDING ? (jsx$2(Button, { fullWidth: true, onClick: handleApprove, disabled: approvalState === ApprovalState.PENDING || loading || !!error, load: approvalState === ApprovalState.PENDING || loading, children: error ? error : approvalState === ApprovalState.PENDING ? 'Enabling' : 'Enable' })) : (jsx$2(Button, { fullWidth: true, onClick: handleBuyBill, disabled: loading || !!error, load: loading, children: error ? error : 'Buy' })) }));
|
|
79901
|
+
};
|
|
79902
|
+
|
|
79903
|
+
const BondCards = ({ bond }) => {
|
|
79904
|
+
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", sx: {
|
|
79905
|
+
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79906
|
+
'&:first-of-type': {
|
|
79907
|
+
borderTopRightRadius: 'normal',
|
|
79908
|
+
borderTopLeftRadius: 'normal',
|
|
79909
|
+
},
|
|
79910
|
+
'&:last-of-type': {
|
|
79911
|
+
borderBottomRightRadius: 'normal',
|
|
79912
|
+
borderBottomLeftRadius: 'normal',
|
|
79913
|
+
},
|
|
79914
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", sx: { alignItems: 'center' }, children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the percentage of additional tokens you\u2019ll get compared to buying at market price." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: { color: 'success' }, children: [((bond.tgePrice / bond.initPrice) * 100 - 100).toFixed(0), "%"] })] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
79915
|
+
fontSize: '13px !important',
|
|
79916
|
+
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79917
|
+
'&:first-of-type': {
|
|
79918
|
+
borderTopRightRadius: 'normal',
|
|
79919
|
+
borderTopLeftRadius: 'normal',
|
|
79920
|
+
},
|
|
79921
|
+
'&:last-of-type': {
|
|
79922
|
+
borderBottomRightRadius: 'normal',
|
|
79923
|
+
borderBottomLeftRadius: 'normal',
|
|
79924
|
+
},
|
|
79925
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["TGE", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the date and time when this token will become tradeable and officially live on-chain." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "May 25th, 13:00 UTC"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
79926
|
+
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79927
|
+
'&:first-of-type': {
|
|
79928
|
+
borderTopRightRadius: 'normal',
|
|
79929
|
+
borderTopLeftRadius: 'normal',
|
|
79930
|
+
},
|
|
79931
|
+
'&:last-of-type': {
|
|
79932
|
+
borderBottomRightRadius: 'normal',
|
|
79933
|
+
borderBottomLeftRadius: 'normal',
|
|
79934
|
+
},
|
|
79935
|
+
}, children: [jsxs("div", { className: "bond-card-title", children: ["Initial Release", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the percentage of tokens you can claim immediately on May 25th at 11:00 UTC. The rest follows the vesting schedule." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "25%"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
79936
|
+
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79937
|
+
'&:first-of-type': {
|
|
79938
|
+
borderTopRightRadius: 'normal',
|
|
79939
|
+
borderTopLeftRadius: 'normal',
|
|
79940
|
+
},
|
|
79941
|
+
'&:last-of-type': {
|
|
79942
|
+
borderBottomRightRadius: 'normal',
|
|
79943
|
+
borderBottomLeftRadius: 'normal',
|
|
79944
|
+
},
|
|
79945
|
+
}, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods(parseInt(bond.vestingTerm)).months, " months after claiming the initial release."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), getTimePeriods(parseInt(bond.vestingTerm)).months, " M"] })] }));
|
|
79946
|
+
};
|
|
79947
|
+
|
|
79948
|
+
const BuyComponent = ({ bond, onDismiss }) => {
|
|
79949
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
79950
|
+
// Hooks
|
|
79951
|
+
const { data: userEscrowWeight } = useTierPoints();
|
|
79952
|
+
const userTier = getUserTier(userEscrowWeight);
|
|
79953
|
+
const { address, chainId } = useAccount();
|
|
79954
|
+
const { data: principalTokenBalance } = useCurrencyBalance(bond.token, address, bond.chainId);
|
|
79955
|
+
// Local state
|
|
79956
|
+
const [inputValue, setInputValue] = useState('');
|
|
79957
|
+
// Display Values
|
|
79958
|
+
const raiseGoal = getBalanceNumber(new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.totalRaise) !== null && _a !== void 0 ? _a : '0'), 18);
|
|
79959
|
+
const totalPrincipalBilled = getBalanceNumber(new BigNumber$1((_b = bond === null || bond === void 0 ? void 0 : bond.totalPrincipalBilled) !== null && _b !== void 0 ? _b : '0'), 18);
|
|
79960
|
+
const percentageSold = (totalPrincipalBilled * 100) / raiseGoal;
|
|
79961
|
+
const inputValueToDisplay = parseFloat(inputValue).toFixed(2);
|
|
79962
|
+
const inputValueToDisplayUSD = parseFloat(inputValueToDisplay) * bond.principalTokenPrice;
|
|
79963
|
+
const youGet = parseFloat(inputValue) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
79964
|
+
const youGetUSD = youGet * (bond === null || bond === void 0 ? void 0 : bond.tgePrice);
|
|
79965
|
+
const bonusUSD = youGetUSD - inputValueToDisplayUSD;
|
|
79966
|
+
const airdropBonus = (_c = bond === null || bond === void 0 ? void 0 : bond.tiersAirdrop) === null || _c === void 0 ? void 0 : _c[userTier !== null && userTier !== void 0 ? userTier : 'noTier'];
|
|
79967
|
+
(parseFloat(inputValue) * airdropBonus) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
79968
|
+
`${bond === null || bond === void 0 ? void 0 : bond.totalAllocation}`;
|
|
79969
|
+
new Date().getTime();
|
|
79970
|
+
((_d = bond === null || bond === void 0 ? void 0 : bond.initTime) !== null && _d !== void 0 ? _d : 0) * 1000;
|
|
79971
|
+
((_e = bond === null || bond === void 0 ? void 0 : bond.finishTime) !== null && _e !== void 0 ? _e : 0) * 1000;
|
|
79972
|
+
const handleClose = () => {
|
|
79973
|
+
if (typeof window !== 'undefined') {
|
|
79974
|
+
window.history.pushState({}, '', `/bonds`);
|
|
79975
|
+
}
|
|
79976
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
79977
|
+
};
|
|
79978
|
+
return (jsxs(Modal, { onDismiss: handleClose, sx: { width: '740px' }, children: [jsx$2(ModalHeader, { onDismiss: handleClose, hideDivider: true }), jsx$2(Flex, { sx: styles$9.buyContainer, children: jsxs(Flex, { sx: styles$9.cardContainer, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: jsxs(Flex, { children: [jsxs(Flex, { children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: bond.earnToken.symbol, size: 50, chain: bond.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bond.earnToken.symbol, jsx$2(ListTag, { text: (_f = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _f === void 0 ? void 0 : _f[0] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '15px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", bond.tgePrice] }), jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", bond.initPrice] })] })] }) }), jsx$2(ProjectDescription, { description: bond.shortDescription, isProjectView: true }), jsx$2(BondCards, { bond: bond }), jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$9.infoRowsContainer), { mt: '10px' }), children: [jsxs(Flex, { sx: styles$9.infoRow, children: [jsx$2(Text, { sx: styles$9.infoTitle, children: "You Spend:" }), jsxs(Text, { sx: styles$9.infoData, children: [isNaN(parseFloat(inputValueToDisplay)) ? 0 : inputValueToDisplay, " ", bond === null || bond === void 0 ? void 0 : bond.token.symbol, " = $", isNaN(inputValueToDisplayUSD) ? '0' : inputValueToDisplayUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$9.infoRow, children: [jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$9.infoTitle), { alignItems: 'center' }), children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Text, { sx: Object.assign(Object.assign({}, styles$9.infoData), { color: 'success' }), children: ["$", isNaN(bonusUSD) ? '0' : bonusUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$9.infoRow, children: [jsx$2(Text, { sx: styles$9.infoTitle, children: "You Get:" }), jsxs(Text, { sx: styles$9.infoData, children: [isNaN(youGet) ? 0 : formatNumberSI(youGet, 0), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, " = $", isNaN(youGetUSD) ? '0' : youGetUSD.toFixed(2)] })] })] }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: bond === null || bond === void 0 ? void 0 : bond.token, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(principalTokenBalance !== null && principalTokenBalance !== void 0 ? principalTokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: () => null, chainId: bond === null || bond === void 0 ? void 0 : bond.chainId, enableZap: false, bondPrincipalToken: bond === null || bond === void 0 ? void 0 : bond.token, tokenBalance: principalTokenBalance, selectedTokenPrice: bond.principalTokenPrice, inputDisabled: false }), jsxs(Flex, { sx: {
|
|
79979
|
+
width: '100%',
|
|
79980
|
+
background: '#DE62F366',
|
|
79981
|
+
justifyContent: 'center',
|
|
79982
|
+
mt: '10px',
|
|
79983
|
+
borderRadius: 'normal',
|
|
79984
|
+
p: '2px 10px',
|
|
79985
|
+
fontSize: '12px',
|
|
79986
|
+
fontWeight: 400,
|
|
79987
|
+
}, children: ["This is a Pre-TGE Bond - Tokens will be tradeable upon listing.", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Pre-TGE Bonds are a pre-sale for tokens before their Token Generation Event (TGE), when tokens are officially launched to the public." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Flex, { sx: { ml: '4px', minWidth: '14px' }, children: jsx$2(Svg, { icon: "questionCircle", width: 12 }) }) })] }), jsxs(Flex, { sx: {
|
|
79988
|
+
width: '100%',
|
|
79989
|
+
mt: '10px',
|
|
79990
|
+
justifyContent: 'space-between',
|
|
79991
|
+
height: ['unset', 'unset', 'unset', '40px'],
|
|
79992
|
+
flexDirection: ['column-reverse', 'column-reverse', 'column-reverse', 'row'],
|
|
79993
|
+
}, children: [jsx$2(Flex, { sx: { width: ['100%', '100%', '100%', '45%'], justifyContent: 'center' }, children: jsxs(Button, { variant: "secondary", onClick: () => {
|
|
79994
|
+
var _a;
|
|
79995
|
+
return window.open(`/swap?outputCurrency=${(_a = bond === null || bond === void 0 ? void 0 : bond.token) === null || _a === void 0 ? void 0 : _a.address[bond === null || bond === void 0 ? void 0 : bond.chainId]}&outputChain=${bond === null || bond === void 0 ? void 0 : bond.chainId}`, '_blank');
|
|
79996
|
+
}, fullWidth: true, children: ["Get ", (_g = bond === null || bond === void 0 ? void 0 : bond.token) === null || _g === void 0 ? void 0 : _g.symbol] }) }), (bond === null || bond === void 0 ? void 0 : bond.contractAddress) ? (jsx$2(BuyAction, { launchBond: bond, inputValue: inputValue, selectedCurrency: bond === null || bond === void 0 ? void 0 : bond.token, soldout: (bond === null || bond === void 0 ? void 0 : bond.billType) === 'fcfs' && percentageSold === 100 })) : (jsx$2(Button, { disabled: true, fullWidth: true, sx: { ml: ['0', '0', '0', '10px'] }, children: `Sale hasn't started` }))] })] }) })] }));
|
|
79997
|
+
};
|
|
79998
|
+
|
|
79999
|
+
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
80000
|
+
const CheckUrl = () => {
|
|
80001
|
+
var _a, _b;
|
|
80002
|
+
if (typeof window === 'undefined')
|
|
80003
|
+
return null;
|
|
80004
|
+
const { data: bonds } = useBondsData();
|
|
80005
|
+
const { data: preTGEBonds } = usePreTGEBondsData();
|
|
80006
|
+
const asPath = window.location.search;
|
|
80007
|
+
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
80008
|
+
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
80009
|
+
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
80010
|
+
const preTGEBond = useMemo(() => {
|
|
80011
|
+
if (!bondAddress)
|
|
80012
|
+
return undefined;
|
|
80013
|
+
return preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
80014
|
+
}, [preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length]);
|
|
80015
|
+
const [onPresentBuyBillsModal] = useModal(jsx$2(ModalHandler, { bondAddress: bondAddress, bondChain: parseInt(bondChain) }), true, true, `BuyBondModal:${bondAddress.toLowerCase()}-${bondChain}}`);
|
|
80016
|
+
const [onPresentPreTGEBondModal] = useModal(jsx$2(BuyComponent, { bond: preTGEBond }), true, true, `buyBondModal${preTGEBond === null || preTGEBond === void 0 ? void 0 : preTGEBond.contractAddress}-${preTGEBond === null || preTGEBond === void 0 ? void 0 : preTGEBond.chainId}-${preTGEBond === null || preTGEBond === void 0 ? void 0 : preTGEBond.index}`);
|
|
80017
|
+
useEffect(() => {
|
|
80018
|
+
const bond = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
80019
|
+
if (bond && bondChain && bondAddress) {
|
|
80020
|
+
onPresentBuyBillsModal();
|
|
80021
|
+
track({
|
|
80022
|
+
event: 'buyModalOpen',
|
|
80023
|
+
chain: bondChain,
|
|
80024
|
+
data: {
|
|
80025
|
+
cat: 'customURL',
|
|
80026
|
+
bond: bond.earnToken.symbol,
|
|
80027
|
+
bondChain: bondChain,
|
|
80028
|
+
},
|
|
80029
|
+
});
|
|
80030
|
+
}
|
|
80031
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
80032
|
+
useEffect(() => {
|
|
80033
|
+
if (preTGEBond && bondChain && bondAddress) {
|
|
80034
|
+
onPresentPreTGEBondModal();
|
|
80035
|
+
}
|
|
80036
|
+
}, [preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length]);
|
|
80037
|
+
return jsx$2(Fragment$1, {});
|
|
80038
|
+
};
|
|
80039
|
+
|
|
80040
|
+
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
80041
|
+
var _a;
|
|
80042
|
+
const isMobile = useIsMobile();
|
|
80043
|
+
return (jsxs(Flex, { id: `${NETWORK_LABEL[chain].toLowerCase().replace(/\s+/g, '')}`, className: "chaintitle", sx: {
|
|
80044
|
+
pt,
|
|
80045
|
+
pb: '10px',
|
|
80046
|
+
color: 'textDisabledButton',
|
|
80047
|
+
fontSize: '13px',
|
|
80048
|
+
fontWeight: 500,
|
|
80049
|
+
cursor: 'pointer',
|
|
80050
|
+
textTransform: 'uppercase',
|
|
80051
|
+
display: hideTitles ? 'none' : 'flex',
|
|
80052
|
+
width: '300px',
|
|
80053
|
+
alignItems: 'center',
|
|
80054
|
+
}, children: [NETWORK_LABEL[chain], " Bonds", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'down' : 'up', width: 8, color: "textDisabledButton" }) }), ((_a = NETWORK_LABEL[chain]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('testnet')) && (jsxs(Flex, { sx: { ml: '15px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', color: '#DE62F3', fontWeight: 700, mr: '7px' }, children: "TESTNET" }), jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Testnet Bonds let you experiment with fake tokens for free on upcoming chains still in development." }), width: isMobile ? '272px' : '280px', placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(10%, -5%)' : 'translate(-5%, -5%)', children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) })] }))] }));
|
|
80055
|
+
};
|
|
80056
|
+
|
|
80057
|
+
const ProgressBar = ({ value, color = 'text' }) => {
|
|
80058
|
+
return (jsx$2(Flex$1, { sx: { width: ['100px', '100px', '100px', '100%'], alignItems: 'center', flexDirection: 'row', mt: '5px' }, children: jsx$2(Box$1, { className: "progressbar-background", children: jsx$2(Box$1, { className: "progressbar-completed", style: {
|
|
80059
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
80060
|
+
} }) }) }));
|
|
80061
|
+
};
|
|
80062
|
+
|
|
80063
|
+
const styles$8 = {
|
|
80064
|
+
titleText: {
|
|
80065
|
+
opacity: 0.6,
|
|
80066
|
+
fontSize: '12px',
|
|
80067
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
80068
|
+
fontWeight: 400,
|
|
80069
|
+
},
|
|
80070
|
+
skeleton: {
|
|
80071
|
+
width: ['45px', '45px', '60px'],
|
|
80072
|
+
maxHeight: '18px',
|
|
80073
|
+
minHeight: '18px',
|
|
80074
|
+
}};
|
|
80075
|
+
|
|
80076
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
80077
|
+
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$8.titleText, children: `${title}` }) }), showTooltip ? (jsx$2(Flex, { sx: { alignItems: 'center', width: '100%' }, children: jsx$2(TooltipBubble, { placement: toolTipPlacement, transformTip: toolTipTransform, body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: toolTip }), width: "250px", children: jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', width: '127px' }, children: value ? value : jsx$2(Skeleton, { sx: styles$8.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$8.skeleton }) }))] }));
|
|
80078
|
+
};
|
|
80079
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
80080
|
+
|
|
80081
|
+
const BonusContainer = ({ bond, tooltipPosition = 'bottomRight', }) => {
|
|
80082
|
+
var _a, _b;
|
|
80083
|
+
const SDKConfig = useSDKConfig();
|
|
80084
|
+
const isMobile = useIsMobile();
|
|
80085
|
+
return (jsx$2("div", { className: `discount-column`, children: 'trueBondPrices' in bond ? (((_b = (_a = findHighestTrueBondPrice((SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) > 0 ? (jsx$2(BonusComponent, { bond: bond, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }));
|
|
80086
|
+
};
|
|
80087
|
+
|
|
80088
|
+
const NETWORK_COLORS$1 = {
|
|
80089
|
+
[types.ChainId.BSC]: '#F3BA2F4d',
|
|
80090
|
+
[types.ChainId.MAINNET]: '#627eea4d',
|
|
80091
|
+
[types.ChainId.MATIC]: '#8247e54d',
|
|
80092
|
+
[types.ChainId.LIGHTLINK]: '#6087ff4d',
|
|
80093
|
+
[types.ChainId.BASE]: '#0052ff4d',
|
|
80094
|
+
[types.ChainId.ARBITRUM]: '#289fef4d',
|
|
80095
|
+
[types.ChainId.LINEA]: '#ffffff4d',
|
|
80096
|
+
[types.ChainId.IOTA]: '#ffffff4d',
|
|
80097
|
+
[types.ChainId.GRAPHLINQ]: '#ded2ff4d',
|
|
80098
|
+
[types.ChainId.AVAX]: '#e743444d',
|
|
80099
|
+
[types.ChainId.BLAST]: '#fcfc034d',
|
|
80100
|
+
[types.ChainId.CROSSFI]: '#7c80844d',
|
|
80101
|
+
[types.ChainId.MONAD_TESTNET]: '#836EF94d',
|
|
80102
|
+
[types.ChainId.SONIC]: '#fb9a4c4d',
|
|
80103
|
+
[types.ChainId.BERACHAIN]: '#783e244d',
|
|
80104
|
+
};
|
|
80105
|
+
const BondRow = ({ bond }) => {
|
|
80106
|
+
var _a, _b, _c, _d, _e;
|
|
80107
|
+
const locationPath = window.location.pathname.replace('/', '');
|
|
80108
|
+
const isMobile = useIsMobile();
|
|
80109
|
+
const rangeColorNetworkRow = isMobile ? { from: '0%', to: '20%' } : { from: '3%', to: '8%' };
|
|
80110
|
+
const billAddress = 'billAddress' in bond
|
|
80111
|
+
? bond.billAddress
|
|
80112
|
+
: 'contractAddress' in bond
|
|
80113
|
+
? bond.contractAddress[bond.chainId]
|
|
80114
|
+
: undefined;
|
|
80115
|
+
const isGoldRush = 'billArt' in bond ? bond.billArt.collection === types.BillArtCollection.GoldenTicket_Collection1 : false;
|
|
80116
|
+
const isSoldOut = isBondSoldOut(bond);
|
|
80117
|
+
// Modal
|
|
80118
|
+
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress.toLowerCase()}-${bond.chainId}`);
|
|
80119
|
+
const handleOpenModal = () => {
|
|
80120
|
+
if (isSoldOut)
|
|
80121
|
+
return;
|
|
80122
|
+
openBuyModal();
|
|
80123
|
+
if (typeof window !== 'undefined') {
|
|
80124
|
+
window.history.pushState({}, '', `${locationPath}?bondAddress=${billAddress}&bondChain=${bond.chainId}`);
|
|
80125
|
+
}
|
|
80126
|
+
track({
|
|
80127
|
+
event: 'buyModalOpen',
|
|
80128
|
+
chain: bond.chainId,
|
|
80129
|
+
data: {
|
|
80130
|
+
cat: 'Row',
|
|
80131
|
+
bond: bond.earnToken.symbol,
|
|
80132
|
+
bondChain: bond.chainId,
|
|
80133
|
+
},
|
|
80134
|
+
});
|
|
80135
|
+
};
|
|
80136
|
+
const remainingPercentage = (bond) => {
|
|
80137
|
+
var _a, _b, _c;
|
|
80138
|
+
const maxTotalPayout = 'maxTotalPayout' in bond ? bond.maxTotalPayout : undefined;
|
|
80139
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : undefined;
|
|
80140
|
+
if (!maxTotalPayout)
|
|
80141
|
+
return 0;
|
|
80142
|
+
const totalMaxPayout = new BigNumber$1(maxTotalPayout !== null && maxTotalPayout !== void 0 ? maxTotalPayout : '0').div(new BigNumber$1(10).pow((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
80143
|
+
const remainingTokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
|
|
80144
|
+
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
80145
|
+
};
|
|
80146
|
+
const remainingTokensFormat = (bond) => {
|
|
80147
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
80148
|
+
return formatNumberSI(parseFloat(tokensRemaining), 0);
|
|
80149
|
+
};
|
|
80150
|
+
const remainingTokensUsd = (bond) => {
|
|
80151
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
80152
|
+
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
80153
|
+
const tokens = new BigNumber$1(tokensRemaining);
|
|
80154
|
+
return tokens.times(payoutTokenPrice);
|
|
80155
|
+
};
|
|
80156
|
+
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: {
|
|
80157
|
+
borderRadius: 'normal',
|
|
80158
|
+
background: NETWORK_COLORS$1[bond.chainId]
|
|
80159
|
+
? `linear-gradient(90deg, ${NETWORK_COLORS$1[bond.chainId]} ${rangeColorNetworkRow.from}, rgba(21,20,32,1) ${rangeColorNetworkRow.to})`
|
|
80160
|
+
: 'linear-gradient(90deg, rgba(21,20,32,0.3) 3%, rgba(21,20,32,1) 8%)',
|
|
80161
|
+
}, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['70%', '70%', '65%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond, isGoldBond: isGoldRush }) }), jsxs("div", { className: "bond-info-columns", sx: { width: '55%' }, children: [jsx$2(BonusContainer, { bond: bond }), jsxs("div", { className: "terms-column", children: [getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
80162
|
+
width: '127px',
|
|
80163
|
+
height: '25px',
|
|
80164
|
+
flexDirection: 'column',
|
|
80165
|
+
justifyContent: 'center',
|
|
80166
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
80167
|
+
}, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
80168
|
+
num: remainingTokensUsd(bond).toNumber(),
|
|
80169
|
+
isPrice: true,
|
|
80170
|
+
})})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId, isSoldOut: isSoldOut }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
|
|
80171
|
+
};
|
|
80172
|
+
|
|
80173
|
+
const HotBondCard = ({ bond }) => {
|
|
80174
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
80175
|
+
const bonus = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], bond)) === null || _a === void 0 ? void 0 : _a.bonus;
|
|
80176
|
+
const SDKConfig = useSDKConfig();
|
|
80177
|
+
// Modal
|
|
80178
|
+
const [openBuyModal] = useModal(jsx$2(BuyBondModal, { bondAddress: bond.billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${bond.billAddress}-${bond.chainId}`);
|
|
80179
|
+
const handleOpenModal = () => {
|
|
80180
|
+
openBuyModal();
|
|
80181
|
+
track({
|
|
80182
|
+
event: 'hotClick',
|
|
80183
|
+
chain: bond.chainId,
|
|
80184
|
+
data: {
|
|
80185
|
+
cat: 'hotClick',
|
|
80186
|
+
bond: bond.earnToken.symbol,
|
|
80187
|
+
},
|
|
80188
|
+
});
|
|
80189
|
+
};
|
|
80190
|
+
return (jsx$2(Flex, { sx: styles$d.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { bill: bond, isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _d !== void 0 ? _d : '', earnTokenSymbol: (_f = (_e = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _e === void 0 ? void 0 : _e.symbol) !== null && _f !== void 0 ? _f : '', bondContract: (_g = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _g !== void 0 ? _g : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond, SDKConfig.useTiers) })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_h = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _h === void 0 ? void 0 : _h.days) ? `${(_j = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _j === void 0 ? void 0 : _j.days} D` : '-' })] })] })] }) }));
|
|
79905
80191
|
};
|
|
79906
80192
|
|
|
79907
80193
|
function useHotBondContracts() {
|
|
@@ -80042,7 +80328,7 @@ const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
|
80042
80328
|
}) }));
|
|
80043
80329
|
};
|
|
80044
80330
|
|
|
80045
|
-
const styles$
|
|
80331
|
+
const styles$7 = {
|
|
80046
80332
|
smallCardContainer: {
|
|
80047
80333
|
width: '100%',
|
|
80048
80334
|
p: '6px 12px',
|
|
@@ -80053,364 +80339,98 @@ const styles$8 = {
|
|
|
80053
80339
|
cursor: 'pointer',
|
|
80054
80340
|
mr: '10px',
|
|
80055
80341
|
':last-of-type': {
|
|
80056
|
-
mr: '0px',
|
|
80057
|
-
},
|
|
80058
|
-
},
|
|
80059
|
-
subTitle: {
|
|
80060
|
-
color: 'textDisabledButton',
|
|
80061
|
-
fontSize: '12px',
|
|
80062
|
-
fontWeight: 400,
|
|
80063
|
-
lineHeight: '16px',
|
|
80064
|
-
},
|
|
80065
|
-
};
|
|
80066
|
-
|
|
80067
|
-
const SmallRecommendationCard = ({ recommendation }) => {
|
|
80068
|
-
var _a;
|
|
80069
|
-
const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
|
|
80070
|
-
return (jsxs(Flex, { sx: styles$8.smallCardContainer, onClick: () => window.open(`${window.location.origin}/bonds?bondAddress=${recommendation.contractAddress}&bondChain=${recommendation.chainId}`, '_self'), children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: recommendation.payoutTokenName, size: 32, chain: recommendation.chainId }), jsxs(Flex, { sx: { mx: '10px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { fontSize: '14px', px: '6px' }, children: recommendation.payoutTokenName }), jsxs(Flex, { sx: styles$8.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$8.subTitle, children: "Bonus" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.bonus > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.bonus.toFixed(2), "%"] })] })] }));
|
|
80071
|
-
};
|
|
80072
|
-
|
|
80073
|
-
const RecommendationCards$1 = () => {
|
|
80074
|
-
const topTags = useTopTags();
|
|
80075
|
-
const { address: account } = useAccount();
|
|
80076
|
-
const options = account ? ['For You', 'Hot', ...topTags] : ['Hot', ...topTags];
|
|
80077
|
-
const [activeOption, setActiveOption] = useState(options[0]);
|
|
80078
|
-
const { data: hotRecommendations } = useHotBonds();
|
|
80079
|
-
const { data: bonds } = useBondsData();
|
|
80080
|
-
const SDKConfig = useSDKConfig();
|
|
80081
|
-
const { data: forYouRecommendations } = useGetBondRecommendations(account, undefined, '3');
|
|
80082
|
-
const sortedBonds = bonds && (bonds === null || bonds === void 0 ? void 0 : bonds.length) > 0
|
|
80083
|
-
? [...bonds].sort((a, b) => {
|
|
80084
|
-
var _a, _b, _c, _d;
|
|
80085
|
-
return ((_b = (_a = findHighestTrueBondPrice('0', b)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) -
|
|
80086
|
-
((_d = (_c = findHighestTrueBondPrice('0', a)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0);
|
|
80087
|
-
})
|
|
80088
|
-
: undefined;
|
|
80089
|
-
const filteredBonds = sortedBonds === null || sortedBonds === void 0 ? void 0 : sortedBonds.filter((bond) => { var _a, _b; return ((_a = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _a === void 0 ? void 0 : _a.includes(activeOption)) && !(bond === null || bond === void 0 ? void 0 : bond.soldOut) && ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _b === void 0 ? void 0 : _b.includes(bond.chainId)); });
|
|
80090
|
-
const selectedBonds = activeOption === 'For You' ? forYouRecommendations : activeOption === 'Hot' ? hotRecommendations : filteredBonds;
|
|
80091
|
-
const slicedBonds = selectedBonds === null || selectedBonds === void 0 ? void 0 : selectedBonds.filter((bond) => { var _a; return (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.includes(bond.chainId); }).slice(0, 3);
|
|
80092
|
-
const parsedBondsToRender = slicedBonds === null || slicedBonds === void 0 ? void 0 : slicedBonds.map((bond) => {
|
|
80093
|
-
var _a, _b, _c;
|
|
80094
|
-
const contractAddress = bond.billAddress;
|
|
80095
|
-
const payoutTokenName = 'payoutTokenName' in bond ? bond.payoutTokenName : bond.earnToken.symbol;
|
|
80096
|
-
return {
|
|
80097
|
-
payoutTokenName: payoutTokenName,
|
|
80098
|
-
contractAddress,
|
|
80099
|
-
vestingTerm: (_a = bond.vestingTerm) !== null && _a !== void 0 ? _a : 0,
|
|
80100
|
-
bonus: 'bonus' in bond ? bond.bonus : ((_c = (_b = findHighestTrueBondPrice('0', bond)) === null || _b === void 0 ? void 0 : _b.bonusWithFee) !== null && _c !== void 0 ? _c : 0),
|
|
80101
|
-
chainId: bond.chainId,
|
|
80102
|
-
};
|
|
80103
|
-
});
|
|
80104
|
-
useEffect(() => {
|
|
80105
|
-
if (account) {
|
|
80106
|
-
setActiveOption('For You');
|
|
80107
|
-
}
|
|
80108
|
-
else {
|
|
80109
|
-
setActiveOption('Hot');
|
|
80110
|
-
}
|
|
80111
|
-
}, [account]);
|
|
80112
|
-
return (jsxs(Flex, { sx: { mt: '15px', flexDirection: 'column', width: '100%', display: ['none', 'none', 'none', 'flex'] }, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Flex, { children: [jsx$2(Flex, { sx: {
|
|
80113
|
-
width: ['60px', '60px', '60px', 'unset'],
|
|
80114
|
-
mr: ['0px', '0px', '0px', '15px'],
|
|
80115
|
-
alignItems: 'center',
|
|
80116
|
-
color: 'grey',
|
|
80117
|
-
fontSize: ['11px'],
|
|
80118
|
-
fontWeight: 500,
|
|
80119
|
-
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] } })] }), jsx$2(Flex, { sx: {
|
|
80120
|
-
my: '10px',
|
|
80121
|
-
minHeight: '47.45px',
|
|
80122
|
-
}, children: parsedBondsToRender &&
|
|
80123
|
-
parsedBondsToRender.length > 0 &&
|
|
80124
|
-
parsedBondsToRender.map((bond, index) => {
|
|
80125
|
-
return jsx$2(SmallRecommendationCard, { recommendation: bond }, `${bond.payoutTokenName}-${index}`);
|
|
80126
|
-
}) })] }));
|
|
80127
|
-
};
|
|
80128
|
-
|
|
80129
|
-
// import track from 'utils/track'
|
|
80130
|
-
const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
80131
|
-
const handleFilterOption = (newOption) => {
|
|
80132
|
-
setFilterOption(newOption);
|
|
80133
|
-
};
|
|
80134
|
-
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', minWidth: '25px', cursor: 'pointer', ml: '15px' }, className: "search-fav-icon", onClick: () => {
|
|
80135
|
-
handleFilterOption(filterOption !== 'FAVORITES' ? 'FAVORITES' : 'ALL');
|
|
80136
|
-
}, children: jsx$2(AnimatePresence, { mode: "wait", children: jsx$2(motion.div, { initial: false, animate: { opacity: 1, scale: 1.0 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, style: { display: 'flex', alignItems: 'center' }, children: filterOption === 'FAVORITES' ? (jsx$2(Svg, { icon: "StarFilled", width: 22, height: 22 })) : (jsx$2(Svg, { icon: "Star", width: 20, height: 20 })) }, filterOption === 'FAVORITES' ? 'StarFilled' : 'Star') }) }));
|
|
80137
|
-
};
|
|
80138
|
-
|
|
80139
|
-
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
80140
|
-
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsxs(Flex$1, { sx: { width: '100%', maxWidth: '340px' }, children: [jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", width: '100%', sx: {
|
|
80141
|
-
fontWeight: 600,
|
|
80142
|
-
background: 'white2',
|
|
80143
|
-
height: '30px',
|
|
80144
|
-
fontSize: '14px',
|
|
80145
|
-
color: 'white',
|
|
80146
|
-
width: ['calc(50vw - 25px)'],
|
|
80147
|
-
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
80148
|
-
};
|
|
80149
|
-
|
|
80150
|
-
const styles$7 = {
|
|
80151
|
-
buyContainer: {
|
|
80152
|
-
width: '100%',
|
|
80153
|
-
mb: ['30px', '30px', '30px', '0px'],
|
|
80154
|
-
flexDirection: 'column',
|
|
80155
|
-
},
|
|
80156
|
-
cardContainer: {
|
|
80157
|
-
width: '100%',
|
|
80158
|
-
background: 'white2',
|
|
80159
|
-
borderRadius: 'normal',
|
|
80160
|
-
flexDirection: 'column',
|
|
80161
|
-
},
|
|
80162
|
-
infoRowsContainer: {
|
|
80163
|
-
width: '100%',
|
|
80164
|
-
flexDirection: 'column',
|
|
80165
|
-
mb: '10px',
|
|
80166
|
-
},
|
|
80167
|
-
infoRow: {
|
|
80168
|
-
width: '100%',
|
|
80169
|
-
justifyContent: 'space-between',
|
|
80170
|
-
},
|
|
80171
|
-
infoTitle: {
|
|
80172
|
-
fontSize: '12px',
|
|
80173
|
-
fontWeight: 400,
|
|
80174
|
-
},
|
|
80175
|
-
infoData: {
|
|
80176
|
-
fontSize: '12px',
|
|
80177
|
-
fontWeight: 700,
|
|
80178
|
-
},
|
|
80179
|
-
};
|
|
80180
|
-
({
|
|
80181
|
-
[types.LaunchBondTiers.Bronze]: '#CD7F32',
|
|
80182
|
-
[types.LaunchBondTiers.Silver]: '#C0C0C0',
|
|
80183
|
-
[types.LaunchBondTiers.Gold]: '#FFD700',
|
|
80184
|
-
[types.LaunchBondTiers.Diamond]: '#B9F2FF',
|
|
80185
|
-
[types.LaunchBondTiers.Legend]: '#a587e6', // Replaced hex color for a violet hex
|
|
80186
|
-
});
|
|
80187
|
-
|
|
80188
|
-
const ParticipationSuccessful = ({ onDismiss, launchBond, inputAmount, }) => {
|
|
80189
|
-
var _a, _b, _c, _d;
|
|
80190
|
-
const { data: tokenPrices } = useTokenPrices();
|
|
80191
|
-
const principalTokenPrice = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.find((token) => { var _a, _b, _c; return ((_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_c = (_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.token) === null || _b === void 0 ? void 0 : _b.address[launchBond === null || launchBond === void 0 ? void 0 : launchBond.chainId]) === null || _c === void 0 ? void 0 : _c.toLowerCase()); })) === null || _a === void 0 ? void 0 : _a.price;
|
|
80192
|
-
const inputValue = parseFloat(inputAmount !== null && inputAmount !== void 0 ? inputAmount : '0');
|
|
80193
|
-
const depositAmountUsd = inputValue * (principalTokenPrice !== null && principalTokenPrice !== void 0 ? principalTokenPrice : 0);
|
|
80194
|
-
const userAllocation = depositAmountUsd / (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
80195
|
-
const userAllocationUsd = userAllocation * (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
80196
|
-
const finishTime = ((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.redeemTime) !== null && _b !== void 0 ? _b : 0) * 1000;
|
|
80197
|
-
const finishDate = new Date(finishTime);
|
|
80198
|
-
const month = finishDate.toLocaleDateString('en-US', { month: 'short' });
|
|
80199
|
-
const getDayWithSuffix = (day) => {
|
|
80200
|
-
if (day > 3 && day < 21)
|
|
80201
|
-
return `${day}th`;
|
|
80202
|
-
switch (day % 10) {
|
|
80203
|
-
case 1:
|
|
80204
|
-
return `${day}st`;
|
|
80205
|
-
case 2:
|
|
80206
|
-
return `${day}nd`;
|
|
80207
|
-
case 3:
|
|
80208
|
-
return `${day}rd`;
|
|
80209
|
-
default:
|
|
80210
|
-
return `${day}th`;
|
|
80211
|
-
}
|
|
80212
|
-
};
|
|
80213
|
-
const day = finishDate.getDate();
|
|
80214
|
-
const formattedFinishDate = `${month} ${getDayWithSuffix(day)} at 11 UTC.`;
|
|
80215
|
-
const initialRelease = userAllocation * ((launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
80216
|
-
const initialReleaseUsd = initialRelease * ((_c = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _c !== void 0 ? _c : 0);
|
|
80217
|
-
const vestedAmount = userAllocation * (1 - (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
80218
|
-
const vestedAmountUsd = vestedAmount * ((_d = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _d !== void 0 ? _d : 0);
|
|
80219
|
-
return (jsxs(Modal, { children: [jsx$2(ModalHeader, { hideDivider: true }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '15px' }, children: jsx$2(Text, { sx: { fontSize: '22px', fontWeight: 700 }, children: "Participation Details" }) }), jsxs(Flex, { sx: {
|
|
80220
|
-
fontSize: '14px',
|
|
80221
|
-
fontWeight: 400,
|
|
80222
|
-
flexDirection: 'column',
|
|
80223
|
-
}, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Your Deposit" }), jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: [getFirstNonZeroDigits(inputValue, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.token.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", depositAmountUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Your Allocation" }), jsxs(Flex, { sx: {
|
|
80224
|
-
fontSize: '12px',
|
|
80225
|
-
fontWeight: 500,
|
|
80226
|
-
}, children: [getFirstNonZeroDigits(userAllocation, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", userAllocationUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Initial Release", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `You'll be able to claim an initial release of ${launchBond.initialRelease / 100}%
|
|
80227
|
-
of your allocation on ${formattedFinishDate}` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
80228
|
-
fontSize: '12px',
|
|
80229
|
-
fontWeight: 500,
|
|
80230
|
-
}, children: [getFirstNonZeroDigits(initialRelease, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: {
|
|
80231
|
-
color: 'textDisabledButton',
|
|
80232
|
-
ml: '5px',
|
|
80233
|
-
}, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods(parseInt(launchBond.vestingTerm)).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
80234
|
-
fontSize: '12px',
|
|
80235
|
-
fontWeight: 500,
|
|
80236
|
-
}, children: [getFirstNonZeroDigits(vestedAmount, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", vestedAmountUsd.toFixed(2), ")"] })] })] }), jsx$2(Flex, { sx: { mt: '10px' }, children: `Your purchased bond can be found under the "Your Bonds" tab.` })] }), jsx$2(Button, { onClick: onDismiss, sx: { fontSize: '16px', width: '100%', mt: '15px' }, children: "Close" })] })] }));
|
|
80342
|
+
mr: '0px',
|
|
80343
|
+
},
|
|
80344
|
+
},
|
|
80345
|
+
subTitle: {
|
|
80346
|
+
color: 'textDisabledButton',
|
|
80347
|
+
fontSize: '12px',
|
|
80348
|
+
fontWeight: 400,
|
|
80349
|
+
lineHeight: '16px',
|
|
80350
|
+
},
|
|
80237
80351
|
};
|
|
80238
80352
|
|
|
80239
|
-
const
|
|
80240
|
-
var _a
|
|
80241
|
-
|
|
80242
|
-
|
|
80243
|
-
|
|
80244
|
-
|
|
80245
|
-
|
|
80246
|
-
const
|
|
80247
|
-
const
|
|
80248
|
-
|
|
80249
|
-
|
|
80250
|
-
const
|
|
80251
|
-
|
|
80252
|
-
const
|
|
80253
|
-
const
|
|
80254
|
-
|
|
80255
|
-
|
|
80256
|
-
|
|
80257
|
-
|
|
80258
|
-
|
|
80259
|
-
var _a, _b;
|
|
80260
|
-
const amount = new BigNumber$1(inputValue)
|
|
80261
|
-
.times(new BigNumber$1(10).pow((_a = selectedCurrency.decimals[launchBond.chainId]) !== null && _a !== void 0 ? _a : 18))
|
|
80262
|
-
.toString();
|
|
80263
|
-
const maxPrice = new BigNumber$1((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.trueBillPrice) !== null && _b !== void 0 ? _b : '0').times(102).div(100).toFixed(0);
|
|
80264
|
-
const args = [amount, maxPrice, account];
|
|
80265
|
-
yield writeContractAsync({
|
|
80266
|
-
address: launchBond === null || launchBond === void 0 ? void 0 : launchBond.contractAddress,
|
|
80267
|
-
abi: launchBondsABI_V2_2_0,
|
|
80268
|
-
functionName: 'deposit',
|
|
80269
|
-
args: args,
|
|
80270
|
-
chain: launchBond.chainId,
|
|
80271
|
-
account,
|
|
80272
|
-
});
|
|
80273
|
-
});
|
|
80274
|
-
const handleBuyBill = () => {
|
|
80275
|
-
setLoading(true);
|
|
80276
|
-
onBuyBill()
|
|
80277
|
-
.then(() => {
|
|
80278
|
-
if (chainId && account) {
|
|
80279
|
-
console.log('Purchase successful, open purchase modal');
|
|
80280
|
-
onOpenPurchaseModal();
|
|
80281
|
-
track({
|
|
80282
|
-
event: 'bond',
|
|
80283
|
-
chain: chainId,
|
|
80284
|
-
data: {
|
|
80285
|
-
cat: 'buy',
|
|
80286
|
-
type: launchBond.billVersion === types.BillVersion.FlashTieredSale ? 'flash' : 'launch',
|
|
80287
|
-
principalToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.token.symbol,
|
|
80288
|
-
earnToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol,
|
|
80289
|
-
amount: inputValue,
|
|
80290
|
-
usdAmount: inputValue, // TODO: fix usdAmount here because this assumes principal token is stablecoin
|
|
80291
|
-
},
|
|
80292
|
-
});
|
|
80293
|
-
}
|
|
80294
|
-
})
|
|
80295
|
-
.catch((e) => {
|
|
80296
|
-
console.log(e);
|
|
80297
|
-
// addToastError(e)
|
|
80353
|
+
const SmallRecommendationCard = ({ recommendation }) => {
|
|
80354
|
+
var _a;
|
|
80355
|
+
const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
|
|
80356
|
+
return (jsxs(Flex, { sx: styles$7.smallCardContainer, onClick: () => window.open(`${window.location.origin}/bonds?bondAddress=${recommendation.contractAddress}&bondChain=${recommendation.chainId}`, '_self'), children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: recommendation.payoutTokenName, size: 32, chain: recommendation.chainId }), jsxs(Flex, { sx: { mx: '10px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { fontSize: '14px', px: '6px' }, children: recommendation.payoutTokenName }), jsxs(Flex, { sx: styles$7.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$7.subTitle, children: "Bonus" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.bonus > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.bonus.toFixed(2), "%"] })] })] }));
|
|
80357
|
+
};
|
|
80358
|
+
|
|
80359
|
+
const RecommendationCards$1 = () => {
|
|
80360
|
+
const topTags = useTopTags();
|
|
80361
|
+
const { address: account } = useAccount();
|
|
80362
|
+
const options = account ? ['For You', 'Hot', ...topTags] : ['Hot', ...topTags];
|
|
80363
|
+
const [activeOption, setActiveOption] = useState(options[0]);
|
|
80364
|
+
const { data: hotRecommendations } = useHotBonds();
|
|
80365
|
+
const { data: bonds } = useBondsData();
|
|
80366
|
+
const SDKConfig = useSDKConfig();
|
|
80367
|
+
const { data: forYouRecommendations } = useGetBondRecommendations(account, undefined, '3');
|
|
80368
|
+
const sortedBonds = bonds && (bonds === null || bonds === void 0 ? void 0 : bonds.length) > 0
|
|
80369
|
+
? [...bonds].sort((a, b) => {
|
|
80370
|
+
var _a, _b, _c, _d;
|
|
80371
|
+
return ((_b = (_a = findHighestTrueBondPrice('0', b)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) -
|
|
80372
|
+
((_d = (_c = findHighestTrueBondPrice('0', a)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0);
|
|
80298
80373
|
})
|
|
80299
|
-
|
|
80300
|
-
|
|
80301
|
-
|
|
80302
|
-
};
|
|
80303
|
-
const
|
|
80304
|
-
|
|
80305
|
-
|
|
80306
|
-
|
|
80307
|
-
|
|
80308
|
-
|
|
80309
|
-
|
|
80310
|
-
|
|
80311
|
-
? '
|
|
80312
|
-
:
|
|
80313
|
-
|
|
80314
|
-
|
|
80315
|
-
|
|
80316
|
-
|
|
80317
|
-
|
|
80318
|
-
|
|
80319
|
-
|
|
80320
|
-
|
|
80321
|
-
|
|
80322
|
-
|
|
80323
|
-
|
|
80374
|
+
: undefined;
|
|
80375
|
+
const filteredBonds = sortedBonds === null || sortedBonds === void 0 ? void 0 : sortedBonds.filter((bond) => { var _a, _b; return ((_a = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _a === void 0 ? void 0 : _a.includes(activeOption)) && !(bond === null || bond === void 0 ? void 0 : bond.soldOut) && ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _b === void 0 ? void 0 : _b.includes(bond.chainId)); });
|
|
80376
|
+
const selectedBonds = activeOption === 'For You' ? forYouRecommendations : activeOption === 'Hot' ? hotRecommendations : filteredBonds;
|
|
80377
|
+
const slicedBonds = selectedBonds === null || selectedBonds === void 0 ? void 0 : selectedBonds.filter((bond) => { var _a; return (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.includes(bond.chainId); }).slice(0, 3);
|
|
80378
|
+
const parsedBondsToRender = slicedBonds === null || slicedBonds === void 0 ? void 0 : slicedBonds.map((bond) => {
|
|
80379
|
+
var _a, _b, _c;
|
|
80380
|
+
const contractAddress = bond.billAddress;
|
|
80381
|
+
const payoutTokenName = 'payoutTokenName' in bond ? bond.payoutTokenName : bond.earnToken.symbol;
|
|
80382
|
+
return {
|
|
80383
|
+
payoutTokenName: payoutTokenName,
|
|
80384
|
+
contractAddress,
|
|
80385
|
+
vestingTerm: (_a = bond.vestingTerm) !== null && _a !== void 0 ? _a : 0,
|
|
80386
|
+
bonus: 'bonus' in bond ? bond.bonus : ((_c = (_b = findHighestTrueBondPrice('0', bond)) === null || _b === void 0 ? void 0 : _b.bonusWithFee) !== null && _c !== void 0 ? _c : 0),
|
|
80387
|
+
chainId: bond.chainId,
|
|
80388
|
+
};
|
|
80389
|
+
});
|
|
80390
|
+
useEffect(() => {
|
|
80391
|
+
if (account) {
|
|
80392
|
+
setActiveOption('For You');
|
|
80393
|
+
}
|
|
80394
|
+
else {
|
|
80395
|
+
setActiveOption('Hot');
|
|
80396
|
+
}
|
|
80397
|
+
}, [account]);
|
|
80398
|
+
return (jsxs(Flex, { sx: { mt: '15px', flexDirection: 'column', width: '100%', display: ['none', 'none', 'none', 'flex'] }, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Flex, { children: [jsx$2(Flex, { sx: {
|
|
80399
|
+
width: ['60px', '60px', '60px', 'unset'],
|
|
80400
|
+
mr: ['0px', '0px', '0px', '15px'],
|
|
80401
|
+
alignItems: 'center',
|
|
80402
|
+
color: 'grey',
|
|
80403
|
+
fontSize: ['11px'],
|
|
80404
|
+
fontWeight: 500,
|
|
80405
|
+
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] } })] }), jsx$2(Flex, { sx: {
|
|
80406
|
+
my: '10px',
|
|
80407
|
+
minHeight: '47.45px',
|
|
80408
|
+
}, children: parsedBondsToRender &&
|
|
80409
|
+
parsedBondsToRender.length > 0 &&
|
|
80410
|
+
parsedBondsToRender.map((bond, index) => {
|
|
80411
|
+
return jsx$2(SmallRecommendationCard, { recommendation: bond }, `${bond.payoutTokenName}-${index}`);
|
|
80412
|
+
}) })] }));
|
|
80324
80413
|
};
|
|
80325
80414
|
|
|
80326
|
-
|
|
80327
|
-
|
|
80328
|
-
|
|
80329
|
-
|
|
80330
|
-
|
|
80331
|
-
|
|
80332
|
-
|
|
80333
|
-
|
|
80334
|
-
borderBottomRightRadius: 'normal',
|
|
80335
|
-
borderBottomLeftRadius: 'normal',
|
|
80336
|
-
},
|
|
80337
|
-
}, children: [jsxs(Flex, { className: "bond-card-title", sx: { alignItems: 'center' }, children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the percentage of additional tokens you\u2019ll get compared to buying at market price." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: { color: 'success' }, children: [((bond.tgePrice / bond.initPrice) * 100 - 100).toFixed(0), "%"] })] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
80338
|
-
fontSize: '13px !important',
|
|
80339
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80340
|
-
'&:first-of-type': {
|
|
80341
|
-
borderTopRightRadius: 'normal',
|
|
80342
|
-
borderTopLeftRadius: 'normal',
|
|
80343
|
-
},
|
|
80344
|
-
'&:last-of-type': {
|
|
80345
|
-
borderBottomRightRadius: 'normal',
|
|
80346
|
-
borderBottomLeftRadius: 'normal',
|
|
80347
|
-
},
|
|
80348
|
-
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["TGE", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the date and time when this token will become tradeable and officially live on-chain." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "May 25th, 13:00 UTC"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
80349
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80350
|
-
'&:first-of-type': {
|
|
80351
|
-
borderTopRightRadius: 'normal',
|
|
80352
|
-
borderTopLeftRadius: 'normal',
|
|
80353
|
-
},
|
|
80354
|
-
'&:last-of-type': {
|
|
80355
|
-
borderBottomRightRadius: 'normal',
|
|
80356
|
-
borderBottomLeftRadius: 'normal',
|
|
80357
|
-
},
|
|
80358
|
-
}, children: [jsxs("div", { className: "bond-card-title", children: ["Initial Release", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the percentage of tokens you can claim immediately on May 25th at 11:00 UTC. The rest follows the vesting schedule." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "25%"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
80359
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80360
|
-
'&:first-of-type': {
|
|
80361
|
-
borderTopRightRadius: 'normal',
|
|
80362
|
-
borderTopLeftRadius: 'normal',
|
|
80363
|
-
},
|
|
80364
|
-
'&:last-of-type': {
|
|
80365
|
-
borderBottomRightRadius: 'normal',
|
|
80366
|
-
borderBottomLeftRadius: 'normal',
|
|
80367
|
-
},
|
|
80368
|
-
}, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods(parseInt(bond.vestingTerm)).months, " months after claiming the initial release."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), getTimePeriods(parseInt(bond.vestingTerm)).months, " M"] })] }));
|
|
80415
|
+
// import track from 'utils/track'
|
|
80416
|
+
const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
80417
|
+
const handleFilterOption = (newOption) => {
|
|
80418
|
+
setFilterOption(newOption);
|
|
80419
|
+
};
|
|
80420
|
+
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', minWidth: '25px', cursor: 'pointer', ml: '15px' }, className: "search-fav-icon", onClick: () => {
|
|
80421
|
+
handleFilterOption(filterOption !== 'FAVORITES' ? 'FAVORITES' : 'ALL');
|
|
80422
|
+
}, children: jsx$2(AnimatePresence, { mode: "wait", children: jsx$2(motion.div, { initial: false, animate: { opacity: 1, scale: 1.0 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, style: { display: 'flex', alignItems: 'center' }, children: filterOption === 'FAVORITES' ? (jsx$2(Svg, { icon: "StarFilled", width: 22, height: 22 })) : (jsx$2(Svg, { icon: "Star", width: 20, height: 20 })) }, filterOption === 'FAVORITES' ? 'StarFilled' : 'Star') }) }));
|
|
80369
80423
|
};
|
|
80370
80424
|
|
|
80371
|
-
const
|
|
80372
|
-
|
|
80373
|
-
|
|
80374
|
-
|
|
80375
|
-
|
|
80376
|
-
|
|
80377
|
-
|
|
80378
|
-
|
|
80379
|
-
|
|
80380
|
-
// Display Values
|
|
80381
|
-
const raiseGoal = getBalanceNumber(new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.totalRaise) !== null && _a !== void 0 ? _a : '0'), 18);
|
|
80382
|
-
const totalPrincipalBilled = getBalanceNumber(new BigNumber$1((_b = bond === null || bond === void 0 ? void 0 : bond.totalPrincipalBilled) !== null && _b !== void 0 ? _b : '0'), 18);
|
|
80383
|
-
const percentageSold = (totalPrincipalBilled * 100) / raiseGoal;
|
|
80384
|
-
const inputValueToDisplay = parseFloat(inputValue).toFixed(2);
|
|
80385
|
-
const inputValueToDisplayUSD = parseFloat(inputValueToDisplay) * bond.principalTokenPrice;
|
|
80386
|
-
const youGet = parseFloat(inputValue) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
80387
|
-
const youGetUSD = youGet * (bond === null || bond === void 0 ? void 0 : bond.tgePrice);
|
|
80388
|
-
const bonusUSD = youGetUSD - inputValueToDisplayUSD;
|
|
80389
|
-
const airdropBonus = (_c = bond === null || bond === void 0 ? void 0 : bond.tiersAirdrop) === null || _c === void 0 ? void 0 : _c[userTier !== null && userTier !== void 0 ? userTier : 'noTier'];
|
|
80390
|
-
(parseFloat(inputValue) * airdropBonus) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
80391
|
-
`${bond === null || bond === void 0 ? void 0 : bond.totalAllocation}`;
|
|
80392
|
-
new Date().getTime();
|
|
80393
|
-
((_d = bond === null || bond === void 0 ? void 0 : bond.initTime) !== null && _d !== void 0 ? _d : 0) * 1000;
|
|
80394
|
-
((_e = bond === null || bond === void 0 ? void 0 : bond.finishTime) !== null && _e !== void 0 ? _e : 0) * 1000;
|
|
80395
|
-
return (jsxs(Modal, { onDismiss: onDismiss, sx: { width: '740px' }, children: [jsx$2(ModalHeader, { onDismiss: onDismiss, hideDivider: true }), jsx$2(Flex, { sx: styles$7.buyContainer, children: jsxs(Flex, { sx: styles$7.cardContainer, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: jsxs(Flex, { children: [jsxs(Flex, { children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: bond.earnToken.symbol, size: 50, chain: bond.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bond.earnToken.symbol, jsx$2(ListTag, { text: (_f = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _f === void 0 ? void 0 : _f[0] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '15px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", bond.tgePrice] }), jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", bond.initPrice] })] })] }) }), jsx$2(ProjectDescription, { description: bond.shortDescription, isProjectView: true }), jsx$2(BondCards, { bond: bond }), jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$7.infoRowsContainer), { mt: '10px' }), children: [jsxs(Flex, { sx: styles$7.infoRow, children: [jsx$2(Text, { sx: styles$7.infoTitle, children: "You Spend:" }), jsxs(Text, { sx: styles$7.infoData, children: [isNaN(parseFloat(inputValueToDisplay)) ? 0 : inputValueToDisplay, " ", bond === null || bond === void 0 ? void 0 : bond.token.symbol, " = $", isNaN(inputValueToDisplayUSD) ? '0' : inputValueToDisplayUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$7.infoRow, children: [jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$7.infoTitle), { alignItems: 'center' }), children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Text, { sx: Object.assign(Object.assign({}, styles$7.infoData), { color: 'success' }), children: ["$", isNaN(bonusUSD) ? '0' : bonusUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$7.infoRow, children: [jsx$2(Text, { sx: styles$7.infoTitle, children: "You Get:" }), jsxs(Text, { sx: styles$7.infoData, children: [isNaN(youGet) ? 0 : formatNumberSI(youGet, 0), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, " = $", isNaN(youGetUSD) ? '0' : youGetUSD.toFixed(2)] })] })] }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: bond === null || bond === void 0 ? void 0 : bond.token, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(principalTokenBalance !== null && principalTokenBalance !== void 0 ? principalTokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: () => null, chainId: bond === null || bond === void 0 ? void 0 : bond.chainId, enableZap: false, bondPrincipalToken: bond === null || bond === void 0 ? void 0 : bond.token, tokenBalance: principalTokenBalance, selectedTokenPrice: bond.principalTokenPrice, inputDisabled: false }), jsxs(Flex, { sx: {
|
|
80396
|
-
width: '100%',
|
|
80397
|
-
background: '#DE62F366',
|
|
80398
|
-
justifyContent: 'center',
|
|
80399
|
-
mt: '10px',
|
|
80400
|
-
borderRadius: 'normal',
|
|
80401
|
-
p: '2px 10px',
|
|
80402
|
-
fontSize: '12px',
|
|
80403
|
-
fontWeight: 400,
|
|
80404
|
-
}, children: ["This is a Pre-TGE Bond - Tokens will be tradeable upon listing.", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Pre-TGE Bonds are a pre-sale for tokens before their Token Generation Event (TGE), when tokens are officially launched to the public." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Flex, { sx: { ml: '4px', minWidth: '14px' }, children: jsx$2(Svg, { icon: "questionCircle", width: 12 }) }) })] }), jsxs(Flex, { sx: {
|
|
80405
|
-
width: '100%',
|
|
80406
|
-
mt: '10px',
|
|
80407
|
-
justifyContent: 'space-between',
|
|
80408
|
-
height: ['unset', 'unset', 'unset', '40px'],
|
|
80409
|
-
flexDirection: ['column-reverse', 'column-reverse', 'column-reverse', 'row'],
|
|
80410
|
-
}, children: [jsx$2(Flex, { sx: { width: ['100%', '100%', '100%', '45%'], justifyContent: 'center' }, children: jsxs(Button, { variant: "secondary", onClick: () => {
|
|
80411
|
-
var _a;
|
|
80412
|
-
return window.open(`/swap?outputCurrency=${(_a = bond === null || bond === void 0 ? void 0 : bond.token) === null || _a === void 0 ? void 0 : _a.address[bond === null || bond === void 0 ? void 0 : bond.chainId]}&outputChain=${bond === null || bond === void 0 ? void 0 : bond.chainId}`, '_blank');
|
|
80413
|
-
}, fullWidth: true, children: ["Get ", (_g = bond === null || bond === void 0 ? void 0 : bond.token) === null || _g === void 0 ? void 0 : _g.symbol] }) }), (bond === null || bond === void 0 ? void 0 : bond.contractAddress) ? (jsx$2(BuyAction, { launchBond: bond, inputValue: inputValue, selectedCurrency: bond === null || bond === void 0 ? void 0 : bond.token, soldout: (bond === null || bond === void 0 ? void 0 : bond.billType) === 'fcfs' && percentageSold === 100 })) : (jsx$2(Button, { disabled: true, fullWidth: true, sx: { ml: ['0', '0', '0', '10px'] }, children: `Sale hasn't started` }))] })] }) })] }));
|
|
80425
|
+
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
80426
|
+
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsxs(Flex$1, { sx: { width: '100%', maxWidth: '340px' }, children: [jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", width: '100%', sx: {
|
|
80427
|
+
fontWeight: 600,
|
|
80428
|
+
background: 'white2',
|
|
80429
|
+
height: '30px',
|
|
80430
|
+
fontSize: '14px',
|
|
80431
|
+
color: 'white',
|
|
80432
|
+
width: ['calc(50vw - 25px)'],
|
|
80433
|
+
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
80414
80434
|
};
|
|
80415
80435
|
|
|
80416
80436
|
const Row = ({ bond }) => {
|
|
@@ -80424,7 +80444,12 @@ const Row = ({ bond }) => {
|
|
|
80424
80444
|
const percentageSold = Math.floor((totalPrincipalBilled * 100) / raiseGoal);
|
|
80425
80445
|
const earnToken = (_g = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _g === void 0 ? void 0 : _g.symbol;
|
|
80426
80446
|
const tokensRemainingUSD = tokensRemaining * bond.earnTokenPrice;
|
|
80427
|
-
const [
|
|
80447
|
+
const [openBuyModal] = useModal(jsx$2(BuyComponent, { bond: bond }), true, true, `buyBondModal${bond.contractAddress}-${bond.chainId}-${bond === null || bond === void 0 ? void 0 : bond.index}`);
|
|
80448
|
+
const handleOpenModal = () => {
|
|
80449
|
+
const locationPath = window.location.pathname.replace('/', '');
|
|
80450
|
+
openBuyModal();
|
|
80451
|
+
window.history.pushState({}, '', `${locationPath}?bondAddress=${bond === null || bond === void 0 ? void 0 : bond.contractAddress}&bondChain=${bond.chainId}`);
|
|
80452
|
+
};
|
|
80428
80453
|
return (jsxs("div", { className: `bond-row`, onClick: handleOpenModal, sx: {
|
|
80429
80454
|
borderRadius: 'normal',
|
|
80430
80455
|
background: NETWORK_COLORS[bond.chainId]
|