@ape.swap/bonds-sdk 3.0.57-test.1 → 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 +542 -547
- package/dist/state/preTGEBonds/usePreTGEBondsData.d.ts +1 -2
- 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) {
|
|
@@ -74058,21 +74064,20 @@ const getPreTGEList = (apiURL) => __awaiter$9(void 0, void 0, void 0, function*
|
|
|
74058
74064
|
});
|
|
74059
74065
|
|
|
74060
74066
|
function usePreTGEBondsData() {
|
|
74061
|
-
var _a
|
|
74067
|
+
var _a;
|
|
74062
74068
|
const { data: preTGEList } = usePreTGEList();
|
|
74063
|
-
const { data: tokenPrices } = useTokenPrices();
|
|
74064
74069
|
const SDKConfig = useSDKConfig();
|
|
74065
74070
|
return useQuery({
|
|
74066
|
-
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_a = preTGEList === null || preTGEList === void 0 ? void 0 : preTGEList.length) !== null && _a !== void 0 ? _a : ''
|
|
74067
|
-
queryFn: () => getLaunchBondsPublicData(preTGEList,
|
|
74071
|
+
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_a = preTGEList === null || preTGEList === void 0 ? void 0 : preTGEList.length) !== null && _a !== void 0 ? _a : ''],
|
|
74072
|
+
queryFn: () => getLaunchBondsPublicData(preTGEList, SDKConfig.chains),
|
|
74068
74073
|
staleTime: 60000,
|
|
74069
74074
|
refetchOnWindowFocus: false,
|
|
74070
|
-
enabled: !!preTGEList && preTGEList.length > 0
|
|
74075
|
+
enabled: !!preTGEList && preTGEList.length > 0,
|
|
74071
74076
|
});
|
|
74072
74077
|
}
|
|
74073
|
-
const getLaunchBondsPublicData = (preTGEBonds,
|
|
74078
|
+
const getLaunchBondsPublicData = (preTGEBonds, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
74074
74079
|
try {
|
|
74075
|
-
if (!(preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length)
|
|
74080
|
+
if (!(preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length))
|
|
74076
74081
|
return null;
|
|
74077
74082
|
const data = [];
|
|
74078
74083
|
for (const chain of chains) {
|
|
@@ -74088,19 +74093,11 @@ const getLaunchBondsPublicData = (preTGEBonds, tokenPrices, chains) => __awaiter
|
|
|
74088
74093
|
preTGEBondsIds.push(bond.index);
|
|
74089
74094
|
const bill = bond;
|
|
74090
74095
|
return [
|
|
74091
|
-
{
|
|
74092
|
-
address: bill.contractAddress,
|
|
74093
|
-
name: 'billPrice',
|
|
74094
|
-
},
|
|
74095
74096
|
// Get bill price with principal tokens
|
|
74096
74097
|
{
|
|
74097
74098
|
address: bill.contractAddress,
|
|
74098
74099
|
name: 'trueBillPrice',
|
|
74099
74100
|
},
|
|
74100
|
-
{
|
|
74101
|
-
address: bill.contractAddress,
|
|
74102
|
-
name: 'currentFee',
|
|
74103
|
-
},
|
|
74104
74101
|
// Terms
|
|
74105
74102
|
// (1) endTime (2) startTime (3) vestingTerm (4) minimumPrice (5) oversubscription (6) initialRelease (7) totalRaise (8) maxTotalPayout
|
|
74106
74103
|
{
|
|
@@ -74129,22 +74126,14 @@ const getLaunchBondsPublicData = (preTGEBonds, tokenPrices, chains) => __awaiter
|
|
|
74129
74126
|
const vals = yield multicall(chainId, launchBondsABI_V2_2_0, launchBondsCalls);
|
|
74130
74127
|
const chunkSize = vals.length / filteredBonds.length;
|
|
74131
74128
|
const chunkedBills = lodashExports.chunk(vals, chunkSize);
|
|
74132
|
-
// const returnedBills = cleanLaunchBondData(launchBondsIds, chunkedBills, tokenPrices, chainId, launchBonds)
|
|
74133
74129
|
const returnedBills = chunkedBills === null || chunkedBills === void 0 ? void 0 : chunkedBills.map((chunk, index) => {
|
|
74134
|
-
var _a;
|
|
74135
74130
|
const bondConfig = filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.find((bill) => (bill === null || bill === void 0 ? void 0 : bill.index) === preTGEBondsIds[index]);
|
|
74136
|
-
const principalTokenPrice =
|
|
74137
|
-
var _a, _b, _c, _d;
|
|
74138
|
-
return ((_a = tokenPrice.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bondConfig === null || bondConfig === void 0 ? void 0 : bondConfig.token) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) &&
|
|
74139
|
-
tokenPrice.chainId === chainId;
|
|
74140
|
-
})) === null || _a === void 0 ? void 0 : _a.price;
|
|
74131
|
+
const principalTokenPrice = 1;
|
|
74141
74132
|
const earnTokenPrice = bondConfig.initPrice;
|
|
74142
|
-
const [
|
|
74143
|
-
const [
|
|
74144
|
-
const
|
|
74145
|
-
|
|
74146
|
-
return Object.assign(Object.assign({}, bondConfig), { oversubscription,
|
|
74147
|
-
initialRelease, priceUsd: formatedPrice, vestingTerm: vestingTerm === null || vestingTerm === void 0 ? void 0 : vestingTerm.toString(), trueBillPrice: trueBillPrice === null || trueBillPrice === void 0 ? void 0 : trueBillPrice.toString(), currentFee: currentFee === null || currentFee === void 0 ? void 0 : currentFee.toString(), maxTotalPayout: maxTotalPayout === null || maxTotalPayout === void 0 ? void 0 : maxTotalPayout.toString(), totalPrincipalBilled: totalPrincipalBilled === null || totalPrincipalBilled === void 0 ? void 0 : totalPrincipalBilled.toString(), minimumPrice: minimumPrice === null || minimumPrice === void 0 ? void 0 : minimumPrice.toString(), earnTokenPrice: earnTokenPrice, principalTokenPrice, totalRaise: totalRaise === null || totalRaise === void 0 ? void 0 : totalRaise.toString(), billPrice: billPrice.toString(), finalized: finalized[0], minPoints: minPoints.toString(), maxPoints: maxPoints.toString() });
|
|
74133
|
+
const [trueBillPrice, terms, totalPrincipalBilled, finalized, minPoints, maxPoints] = chunk;
|
|
74134
|
+
const [, , vestingTerm, , , initialRelease, totalRaise, maxTotalPayout] = terms;
|
|
74135
|
+
const data = Object.assign(Object.assign({}, bondConfig), { initialRelease, vestingTerm: vestingTerm === null || vestingTerm === void 0 ? void 0 : vestingTerm.toString(), trueBillPrice: trueBillPrice === null || trueBillPrice === void 0 ? void 0 : trueBillPrice.toString(), maxTotalPayout: maxTotalPayout === null || maxTotalPayout === void 0 ? void 0 : maxTotalPayout.toString(), totalPrincipalBilled: totalPrincipalBilled === null || totalPrincipalBilled === void 0 ? void 0 : totalPrincipalBilled.toString(), earnTokenPrice: earnTokenPrice, principalTokenPrice, totalRaise: totalRaise === null || totalRaise === void 0 ? void 0 : totalRaise.toString(), finalized: finalized[0], minPoints: minPoints.toString(), maxPoints: maxPoints.toString() });
|
|
74136
|
+
return data;
|
|
74148
74137
|
});
|
|
74149
74138
|
data.push(returnedBills);
|
|
74150
74139
|
}
|
|
@@ -79412,7 +79401,6 @@ const GetUpToComponent = ({ bond, depositAmount }) => {
|
|
|
79412
79401
|
const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
|
|
79413
79402
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
79414
79403
|
const SDKConfig = useSDKConfig();
|
|
79415
|
-
const { data: geoData } = useGeoFencing();
|
|
79416
79404
|
// Hooks
|
|
79417
79405
|
const userChainId = useChainId();
|
|
79418
79406
|
const { address: account } = useAccount();
|
|
@@ -79598,25 +79586,19 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79598
79586
|
}
|
|
79599
79587
|
});
|
|
79600
79588
|
const handleBothPurchases = () => {
|
|
79601
|
-
|
|
79602
|
-
if (
|
|
79603
|
-
|
|
79604
|
-
|
|
79605
|
-
|
|
79606
|
-
setLoadingTx(true);
|
|
79607
|
-
if (isZap) {
|
|
79608
|
-
// ignore this for SOL migration
|
|
79609
|
-
if (rateChanged) {
|
|
79610
|
-
openNewRateModal();
|
|
79611
|
-
}
|
|
79612
|
-
else {
|
|
79613
|
-
handleZapCallback().finally(() => setLoadingTx(false));
|
|
79614
|
-
}
|
|
79589
|
+
setLoadingTx(true);
|
|
79590
|
+
if (isZap) {
|
|
79591
|
+
// ignore this for SOL migration
|
|
79592
|
+
if (rateChanged) {
|
|
79593
|
+
openNewRateModal();
|
|
79615
79594
|
}
|
|
79616
79595
|
else {
|
|
79617
|
-
|
|
79596
|
+
handleZapCallback().finally(() => setLoadingTx(false));
|
|
79618
79597
|
}
|
|
79619
79598
|
}
|
|
79599
|
+
else {
|
|
79600
|
+
handleBuyCallback().finally(() => setLoadingTx(false));
|
|
79601
|
+
}
|
|
79620
79602
|
};
|
|
79621
79603
|
const handleOpenModal = () => {
|
|
79622
79604
|
var _a;
|
|
@@ -79641,13 +79623,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79641
79623
|
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, account: account, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), true, true, 'zapModal');
|
|
79642
79624
|
const [openNewRateModal] = useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError, handleZap: () => handleZapCallback().finally(() => setLoadingTx(false)) }), true, false);
|
|
79643
79625
|
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
79644
|
-
|
|
79645
|
-
const blockedBondsForAE = [
|
|
79646
|
-
'0x0719CCaF2f07f59b23DB7d80E3d2791A0836bdfD'.toLowerCase(),
|
|
79647
|
-
'0xBc48794a04777E7170bD5633E8b728f8a0945971'.toLowerCase(),
|
|
79648
|
-
'0x94A283756B70c2A77bc58Ae0E2615Caf14310186'.toLowerCase(),
|
|
79649
|
-
'0x6639D4acAe77967c253C75cBfEd7C612682E2704'.toLowerCase(),
|
|
79650
|
-
];
|
|
79626
|
+
useModal(jsx$2(RestrictedRegionModal, {}));
|
|
79651
79627
|
// Effects
|
|
79652
79628
|
const [hasChecked, setHasChecked] = useState(false);
|
|
79653
79629
|
useEffect(() => {
|
|
@@ -79748,151 +79724,431 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
79748
79724
|
} }));
|
|
79749
79725
|
};
|
|
79750
79726
|
|
|
79751
|
-
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
79752
|
-
const CheckUrl = () => {
|
|
79753
|
-
var _a, _b;
|
|
79754
|
-
if (typeof window === 'undefined')
|
|
79755
|
-
return null;
|
|
79756
|
-
const { data: bonds } = useBondsData();
|
|
79757
|
-
const asPath = window.location.search;
|
|
79758
|
-
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
79759
|
-
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
79760
|
-
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
79761
|
-
const bond = useMemo(() => {
|
|
79762
|
-
if (!bondAddress)
|
|
79763
|
-
return undefined;
|
|
79764
|
-
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()); });
|
|
79765
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
79766
|
-
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}`);
|
|
79767
|
-
useEffect(() => {
|
|
79768
|
-
if (bond && bondChain && bondAddress) {
|
|
79769
|
-
onPresentBuyBillsModal();
|
|
79770
|
-
track({
|
|
79771
|
-
event: 'buyModalOpen',
|
|
79772
|
-
chain: bondChain,
|
|
79773
|
-
data: {
|
|
79774
|
-
cat: 'customURL',
|
|
79775
|
-
bond: bond.earnToken.symbol,
|
|
79776
|
-
bondChain: bondChain,
|
|
79777
|
-
},
|
|
79778
|
-
});
|
|
79779
|
-
}
|
|
79780
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
79781
|
-
return jsx$2(Fragment$1, {});
|
|
79782
|
-
};
|
|
79783
|
-
|
|
79784
|
-
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
79785
|
-
var _a;
|
|
79786
|
-
const isMobile = useIsMobile();
|
|
79787
|
-
return (jsxs(Flex, { id: `${NETWORK_LABEL[chain].toLowerCase().replace(/\s+/g, '')}`, className: "chaintitle", sx: {
|
|
79788
|
-
pt,
|
|
79789
|
-
pb: '10px',
|
|
79790
|
-
color: 'textDisabledButton',
|
|
79791
|
-
fontSize: '13px',
|
|
79792
|
-
fontWeight: 500,
|
|
79793
|
-
cursor: 'pointer',
|
|
79794
|
-
textTransform: 'uppercase',
|
|
79795
|
-
display: hideTitles ? 'none' : 'flex',
|
|
79796
|
-
width: '300px',
|
|
79797
|
-
alignItems: 'center',
|
|
79798
|
-
}, 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" }) })] }))] }));
|
|
79799
|
-
};
|
|
79800
|
-
|
|
79801
|
-
const ProgressBar = ({ value, color = 'text' }) => {
|
|
79802
|
-
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: {
|
|
79803
|
-
width: `${value <= 3 ? 3 : value}%`,
|
|
79804
|
-
} }) }) }));
|
|
79805
|
-
};
|
|
79806
|
-
|
|
79807
79727
|
const styles$9 = {
|
|
79808
|
-
|
|
79809
|
-
|
|
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: {
|
|
79810
79749
|
fontSize: '12px',
|
|
79811
|
-
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
79812
79750
|
fontWeight: 400,
|
|
79813
79751
|
},
|
|
79814
|
-
|
|
79815
|
-
|
|
79816
|
-
|
|
79817
|
-
|
|
79818
|
-
}};
|
|
79819
|
-
|
|
79820
|
-
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
79821
|
-
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 }) }))] }));
|
|
79822
|
-
};
|
|
79823
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
79824
|
-
|
|
79825
|
-
const BonusContainer = ({ bond, tooltipPosition = 'bottomRight', }) => {
|
|
79826
|
-
var _a, _b;
|
|
79827
|
-
const SDKConfig = useSDKConfig();
|
|
79828
|
-
const isMobile = useIsMobile();
|
|
79829
|
-
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
|
+
},
|
|
79830
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
|
+
});
|
|
79831
79764
|
|
|
79832
|
-
const
|
|
79833
|
-
|
|
79834
|
-
|
|
79835
|
-
[
|
|
79836
|
-
|
|
79837
|
-
|
|
79838
|
-
|
|
79839
|
-
|
|
79840
|
-
|
|
79841
|
-
|
|
79842
|
-
|
|
79843
|
-
|
|
79844
|
-
|
|
79845
|
-
|
|
79846
|
-
|
|
79847
|
-
|
|
79848
|
-
}
|
|
79849
|
-
|
|
79850
|
-
|
|
79851
|
-
|
|
79852
|
-
|
|
79853
|
-
|
|
79854
|
-
|
|
79855
|
-
? bond.billAddress
|
|
79856
|
-
: 'contractAddress' in bond
|
|
79857
|
-
? bond.contractAddress[bond.chainId]
|
|
79858
|
-
: undefined;
|
|
79859
|
-
const isGoldRush = 'billArt' in bond ? bond.billArt.collection === types.BillArtCollection.GoldenTicket_Collection1 : false;
|
|
79860
|
-
const isSoldOut = isBondSoldOut(bond);
|
|
79861
|
-
// Modal
|
|
79862
|
-
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
|
|
79863
|
-
const handleOpenModal = () => {
|
|
79864
|
-
if (isSoldOut)
|
|
79865
|
-
return;
|
|
79866
|
-
openBuyModal();
|
|
79867
|
-
if (typeof window !== 'undefined') {
|
|
79868
|
-
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`;
|
|
79869
79788
|
}
|
|
79870
|
-
track({
|
|
79871
|
-
event: 'buyModalOpen',
|
|
79872
|
-
chain: bond.chainId,
|
|
79873
|
-
data: {
|
|
79874
|
-
cat: 'Row',
|
|
79875
|
-
bond: bond.earnToken.symbol,
|
|
79876
|
-
bondChain: bond.chainId,
|
|
79877
|
-
},
|
|
79878
|
-
});
|
|
79879
|
-
};
|
|
79880
|
-
const remainingPercentage = (bond) => {
|
|
79881
|
-
var _a, _b, _c;
|
|
79882
|
-
const maxTotalPayout = 'maxTotalPayout' in bond ? bond.maxTotalPayout : undefined;
|
|
79883
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : undefined;
|
|
79884
|
-
if (!maxTotalPayout)
|
|
79885
|
-
return 0;
|
|
79886
|
-
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));
|
|
79887
|
-
const remainingTokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
|
|
79888
|
-
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
79889
79789
|
};
|
|
79890
|
-
const
|
|
79891
|
-
|
|
79892
|
-
|
|
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));
|
|
79893
79833
|
};
|
|
79894
|
-
const
|
|
79895
|
-
|
|
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';
|
|
79896
80152
|
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
79897
80153
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
79898
80154
|
return tokens.times(payoutTokenPrice);
|
|
@@ -80068,11 +80324,11 @@ const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
|
80068
80324
|
const SDKConfig = useSDKConfig();
|
|
80069
80325
|
const validatedChains = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains) === null || _a === void 0 ? void 0 : _a.filter((chain) => MAINNET_CHAINS.includes(chain));
|
|
80070
80326
|
return (jsx$2(Flex$1, { className: "bondrowsbychain", children: validatedChains === null || validatedChains === void 0 ? void 0 : validatedChains.map((chain) => {
|
|
80071
|
-
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: hideTitles ? false : SDKConfig.useHotBonds ? chain === types.ChainId.BSC || chain === types.ChainId.
|
|
80327
|
+
return (jsx$2(BondRowsWithTitle, { chain: chain, bonds: bonds, hideTitles: hideTitles, showHotBonds: hideTitles ? false : SDKConfig.useHotBonds ? chain === types.ChainId.BSC || chain === types.ChainId.ARBITRUM : false }, chain));
|
|
80072
80328
|
}) }));
|
|
80073
80329
|
};
|
|
80074
80330
|
|
|
80075
|
-
const styles$
|
|
80331
|
+
const styles$7 = {
|
|
80076
80332
|
smallCardContainer: {
|
|
80077
80333
|
width: '100%',
|
|
80078
80334
|
p: '6px 12px',
|
|
@@ -80081,366 +80337,100 @@ const styles$8 = {
|
|
|
80081
80337
|
justifyContent: 'space-between',
|
|
80082
80338
|
alignItems: 'center',
|
|
80083
80339
|
cursor: 'pointer',
|
|
80084
|
-
mr: '10px',
|
|
80085
|
-
':last-of-type': {
|
|
80086
|
-
mr: '0px',
|
|
80087
|
-
},
|
|
80088
|
-
},
|
|
80089
|
-
subTitle: {
|
|
80090
|
-
color: 'textDisabledButton',
|
|
80091
|
-
fontSize: '12px',
|
|
80092
|
-
fontWeight: 400,
|
|
80093
|
-
lineHeight: '16px',
|
|
80094
|
-
},
|
|
80095
|
-
};
|
|
80096
|
-
|
|
80097
|
-
const SmallRecommendationCard = ({ recommendation }) => {
|
|
80098
|
-
var _a;
|
|
80099
|
-
const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
|
|
80100
|
-
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), "%"] })] })] }));
|
|
80101
|
-
};
|
|
80102
|
-
|
|
80103
|
-
const RecommendationCards$1 = () => {
|
|
80104
|
-
const topTags = useTopTags();
|
|
80105
|
-
const { address: account } = useAccount();
|
|
80106
|
-
const options = account ? ['For You', 'Hot', ...topTags] : ['Hot', ...topTags];
|
|
80107
|
-
const [activeOption, setActiveOption] = useState(options[0]);
|
|
80108
|
-
const { data: hotRecommendations } = useHotBonds();
|
|
80109
|
-
const { data: bonds } = useBondsData();
|
|
80110
|
-
const SDKConfig = useSDKConfig();
|
|
80111
|
-
const { data: forYouRecommendations } = useGetBondRecommendations(account, undefined, '3');
|
|
80112
|
-
const sortedBonds = bonds && (bonds === null || bonds === void 0 ? void 0 : bonds.length) > 0
|
|
80113
|
-
? [...bonds].sort((a, b) => {
|
|
80114
|
-
var _a, _b, _c, _d;
|
|
80115
|
-
return ((_b = (_a = findHighestTrueBondPrice('0', b)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) -
|
|
80116
|
-
((_d = (_c = findHighestTrueBondPrice('0', a)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0);
|
|
80117
|
-
})
|
|
80118
|
-
: undefined;
|
|
80119
|
-
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)); });
|
|
80120
|
-
const selectedBonds = activeOption === 'For You' ? forYouRecommendations : activeOption === 'Hot' ? hotRecommendations : filteredBonds;
|
|
80121
|
-
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);
|
|
80122
|
-
const parsedBondsToRender = slicedBonds === null || slicedBonds === void 0 ? void 0 : slicedBonds.map((bond) => {
|
|
80123
|
-
var _a, _b, _c;
|
|
80124
|
-
const contractAddress = bond.billAddress;
|
|
80125
|
-
const payoutTokenName = 'payoutTokenName' in bond ? bond.payoutTokenName : bond.earnToken.symbol;
|
|
80126
|
-
return {
|
|
80127
|
-
payoutTokenName: payoutTokenName,
|
|
80128
|
-
contractAddress,
|
|
80129
|
-
vestingTerm: (_a = bond.vestingTerm) !== null && _a !== void 0 ? _a : 0,
|
|
80130
|
-
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),
|
|
80131
|
-
chainId: bond.chainId,
|
|
80132
|
-
};
|
|
80133
|
-
});
|
|
80134
|
-
useEffect(() => {
|
|
80135
|
-
if (account) {
|
|
80136
|
-
setActiveOption('For You');
|
|
80137
|
-
}
|
|
80138
|
-
else {
|
|
80139
|
-
setActiveOption('Hot');
|
|
80140
|
-
}
|
|
80141
|
-
}, [account]);
|
|
80142
|
-
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: {
|
|
80143
|
-
width: ['60px', '60px', '60px', 'unset'],
|
|
80144
|
-
mr: ['0px', '0px', '0px', '15px'],
|
|
80145
|
-
alignItems: 'center',
|
|
80146
|
-
color: 'grey',
|
|
80147
|
-
fontSize: ['11px'],
|
|
80148
|
-
fontWeight: 500,
|
|
80149
|
-
}, 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: {
|
|
80150
|
-
my: '10px',
|
|
80151
|
-
minHeight: '47.45px',
|
|
80152
|
-
}, children: parsedBondsToRender &&
|
|
80153
|
-
parsedBondsToRender.length > 0 &&
|
|
80154
|
-
parsedBondsToRender.map((bond, index) => {
|
|
80155
|
-
return jsx$2(SmallRecommendationCard, { recommendation: bond }, `${bond.payoutTokenName}-${index}`);
|
|
80156
|
-
}) })] }));
|
|
80157
|
-
};
|
|
80158
|
-
|
|
80159
|
-
// import track from 'utils/track'
|
|
80160
|
-
const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
80161
|
-
const handleFilterOption = (newOption) => {
|
|
80162
|
-
setFilterOption(newOption);
|
|
80163
|
-
};
|
|
80164
|
-
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', minWidth: '25px', cursor: 'pointer', ml: '15px' }, className: "search-fav-icon", onClick: () => {
|
|
80165
|
-
handleFilterOption(filterOption !== 'FAVORITES' ? 'FAVORITES' : 'ALL');
|
|
80166
|
-
}, 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') }) }));
|
|
80167
|
-
};
|
|
80168
|
-
|
|
80169
|
-
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
80170
|
-
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: {
|
|
80171
|
-
fontWeight: 600,
|
|
80172
|
-
background: 'white2',
|
|
80173
|
-
height: '30px',
|
|
80174
|
-
fontSize: '14px',
|
|
80175
|
-
color: 'white',
|
|
80176
|
-
width: ['calc(50vw - 25px)'],
|
|
80177
|
-
}, 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" })] })] })] }));
|
|
80178
|
-
};
|
|
80179
|
-
|
|
80180
|
-
const styles$7 = {
|
|
80181
|
-
buyContainer: {
|
|
80182
|
-
width: '100%',
|
|
80183
|
-
mb: ['30px', '30px', '30px', '0px'],
|
|
80184
|
-
flexDirection: 'column',
|
|
80185
|
-
},
|
|
80186
|
-
cardContainer: {
|
|
80187
|
-
width: '100%',
|
|
80188
|
-
background: 'white2',
|
|
80189
|
-
borderRadius: 'normal',
|
|
80190
|
-
flexDirection: 'column',
|
|
80191
|
-
},
|
|
80192
|
-
infoRowsContainer: {
|
|
80193
|
-
width: '100%',
|
|
80194
|
-
flexDirection: 'column',
|
|
80195
|
-
mb: '10px',
|
|
80196
|
-
},
|
|
80197
|
-
infoRow: {
|
|
80198
|
-
width: '100%',
|
|
80199
|
-
justifyContent: 'space-between',
|
|
80200
|
-
},
|
|
80201
|
-
infoTitle: {
|
|
80202
|
-
fontSize: '12px',
|
|
80203
|
-
fontWeight: 400,
|
|
80204
|
-
},
|
|
80205
|
-
infoData: {
|
|
80206
|
-
fontSize: '12px',
|
|
80207
|
-
fontWeight: 700,
|
|
80208
|
-
},
|
|
80209
|
-
};
|
|
80210
|
-
({
|
|
80211
|
-
[types.LaunchBondTiers.Bronze]: '#CD7F32',
|
|
80212
|
-
[types.LaunchBondTiers.Silver]: '#C0C0C0',
|
|
80213
|
-
[types.LaunchBondTiers.Gold]: '#FFD700',
|
|
80214
|
-
[types.LaunchBondTiers.Diamond]: '#B9F2FF',
|
|
80215
|
-
[types.LaunchBondTiers.Legend]: '#a587e6', // Replaced hex color for a violet hex
|
|
80216
|
-
});
|
|
80217
|
-
|
|
80218
|
-
const ParticipationSuccessful = ({ onDismiss, launchBond, inputAmount, }) => {
|
|
80219
|
-
var _a, _b, _c, _d;
|
|
80220
|
-
const { data: tokenPrices } = useTokenPrices();
|
|
80221
|
-
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;
|
|
80222
|
-
const inputValue = parseFloat(inputAmount !== null && inputAmount !== void 0 ? inputAmount : '0');
|
|
80223
|
-
const depositAmountUsd = inputValue * (principalTokenPrice !== null && principalTokenPrice !== void 0 ? principalTokenPrice : 0);
|
|
80224
|
-
const userAllocation = depositAmountUsd / (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
80225
|
-
const userAllocationUsd = userAllocation * (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice);
|
|
80226
|
-
const finishTime = ((_b = launchBond === null || launchBond === void 0 ? void 0 : launchBond.redeemTime) !== null && _b !== void 0 ? _b : 0) * 1000;
|
|
80227
|
-
const finishDate = new Date(finishTime);
|
|
80228
|
-
const month = finishDate.toLocaleDateString('en-US', { month: 'short' });
|
|
80229
|
-
const getDayWithSuffix = (day) => {
|
|
80230
|
-
if (day > 3 && day < 21)
|
|
80231
|
-
return `${day}th`;
|
|
80232
|
-
switch (day % 10) {
|
|
80233
|
-
case 1:
|
|
80234
|
-
return `${day}st`;
|
|
80235
|
-
case 2:
|
|
80236
|
-
return `${day}nd`;
|
|
80237
|
-
case 3:
|
|
80238
|
-
return `${day}rd`;
|
|
80239
|
-
default:
|
|
80240
|
-
return `${day}th`;
|
|
80241
|
-
}
|
|
80242
|
-
};
|
|
80243
|
-
const day = finishDate.getDate();
|
|
80244
|
-
const formattedFinishDate = `${month} ${getDayWithSuffix(day)} at 11 UTC.`;
|
|
80245
|
-
const initialRelease = userAllocation * ((launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
80246
|
-
const initialReleaseUsd = initialRelease * ((_c = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _c !== void 0 ? _c : 0);
|
|
80247
|
-
const vestedAmount = userAllocation * (1 - (launchBond === null || launchBond === void 0 ? void 0 : launchBond.initialRelease) / 10000);
|
|
80248
|
-
const vestedAmountUsd = vestedAmount * ((_d = launchBond === null || launchBond === void 0 ? void 0 : launchBond.initPrice) !== null && _d !== void 0 ? _d : 0);
|
|
80249
|
-
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: {
|
|
80250
|
-
fontSize: '14px',
|
|
80251
|
-
fontWeight: 400,
|
|
80252
|
-
flexDirection: 'column',
|
|
80253
|
-
}, 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: {
|
|
80254
|
-
fontSize: '12px',
|
|
80255
|
-
fontWeight: 500,
|
|
80256
|
-
}, 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}%
|
|
80257
|
-
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: {
|
|
80258
|
-
fontSize: '12px',
|
|
80259
|
-
fontWeight: 500,
|
|
80260
|
-
}, children: [getFirstNonZeroDigits(initialRelease, 2), " ", launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol, jsxs(Flex, { sx: {
|
|
80261
|
-
color: 'textDisabledButton',
|
|
80262
|
-
ml: '5px',
|
|
80263
|
-
}, 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: {
|
|
80264
|
-
fontSize: '12px',
|
|
80265
|
-
fontWeight: 500,
|
|
80266
|
-
}, 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" })] })] }));
|
|
80340
|
+
mr: '10px',
|
|
80341
|
+
':last-of-type': {
|
|
80342
|
+
mr: '0px',
|
|
80343
|
+
},
|
|
80344
|
+
},
|
|
80345
|
+
subTitle: {
|
|
80346
|
+
color: 'textDisabledButton',
|
|
80347
|
+
fontSize: '12px',
|
|
80348
|
+
fontWeight: 400,
|
|
80349
|
+
lineHeight: '16px',
|
|
80350
|
+
},
|
|
80267
80351
|
};
|
|
80268
80352
|
|
|
80269
|
-
const
|
|
80270
|
-
var _a
|
|
80271
|
-
|
|
80272
|
-
|
|
80273
|
-
|
|
80274
|
-
|
|
80275
|
-
|
|
80276
|
-
const
|
|
80277
|
-
const
|
|
80278
|
-
|
|
80279
|
-
|
|
80280
|
-
const
|
|
80281
|
-
|
|
80282
|
-
const
|
|
80283
|
-
const
|
|
80284
|
-
|
|
80285
|
-
|
|
80286
|
-
|
|
80287
|
-
|
|
80288
|
-
|
|
80289
|
-
var _a, _b;
|
|
80290
|
-
const amount = new BigNumber$1(inputValue)
|
|
80291
|
-
.times(new BigNumber$1(10).pow((_a = selectedCurrency.decimals[launchBond.chainId]) !== null && _a !== void 0 ? _a : 18))
|
|
80292
|
-
.toString();
|
|
80293
|
-
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);
|
|
80294
|
-
const args = [amount, maxPrice, account];
|
|
80295
|
-
yield writeContractAsync({
|
|
80296
|
-
address: launchBond === null || launchBond === void 0 ? void 0 : launchBond.contractAddress,
|
|
80297
|
-
abi: launchBondsABI_V2_2_0,
|
|
80298
|
-
functionName: 'deposit',
|
|
80299
|
-
args: args,
|
|
80300
|
-
chain: launchBond.chainId,
|
|
80301
|
-
account,
|
|
80302
|
-
});
|
|
80303
|
-
});
|
|
80304
|
-
const handleBuyBill = () => {
|
|
80305
|
-
setLoading(true);
|
|
80306
|
-
onBuyBill()
|
|
80307
|
-
.then(() => {
|
|
80308
|
-
if (chainId && account) {
|
|
80309
|
-
console.log('Purchase successful, open purchase modal');
|
|
80310
|
-
onOpenPurchaseModal();
|
|
80311
|
-
track({
|
|
80312
|
-
event: 'bond',
|
|
80313
|
-
chain: chainId,
|
|
80314
|
-
data: {
|
|
80315
|
-
cat: 'buy',
|
|
80316
|
-
type: launchBond.billVersion === types.BillVersion.FlashTieredSale ? 'flash' : 'launch',
|
|
80317
|
-
principalToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.token.symbol,
|
|
80318
|
-
earnToken: launchBond === null || launchBond === void 0 ? void 0 : launchBond.earnToken.symbol,
|
|
80319
|
-
amount: inputValue,
|
|
80320
|
-
usdAmount: inputValue, // TODO: fix usdAmount here because this assumes principal token is stablecoin
|
|
80321
|
-
},
|
|
80322
|
-
});
|
|
80323
|
-
}
|
|
80324
|
-
})
|
|
80325
|
-
.catch((e) => {
|
|
80326
|
-
console.log(e);
|
|
80327
|
-
// 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);
|
|
80328
80373
|
})
|
|
80329
|
-
|
|
80330
|
-
|
|
80331
|
-
|
|
80332
|
-
};
|
|
80333
|
-
const
|
|
80334
|
-
|
|
80335
|
-
|
|
80336
|
-
|
|
80337
|
-
|
|
80338
|
-
|
|
80339
|
-
|
|
80340
|
-
|
|
80341
|
-
? '
|
|
80342
|
-
:
|
|
80343
|
-
|
|
80344
|
-
|
|
80345
|
-
|
|
80346
|
-
|
|
80347
|
-
|
|
80348
|
-
|
|
80349
|
-
|
|
80350
|
-
|
|
80351
|
-
|
|
80352
|
-
|
|
80353
|
-
|
|
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
|
+
}) })] }));
|
|
80354
80413
|
};
|
|
80355
80414
|
|
|
80356
|
-
|
|
80357
|
-
|
|
80358
|
-
|
|
80359
|
-
|
|
80360
|
-
|
|
80361
|
-
|
|
80362
|
-
|
|
80363
|
-
|
|
80364
|
-
borderBottomRightRadius: 'normal',
|
|
80365
|
-
borderBottomLeftRadius: 'normal',
|
|
80366
|
-
},
|
|
80367
|
-
}, 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: {
|
|
80368
|
-
fontSize: '13px !important',
|
|
80369
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80370
|
-
'&:first-of-type': {
|
|
80371
|
-
borderTopRightRadius: 'normal',
|
|
80372
|
-
borderTopLeftRadius: 'normal',
|
|
80373
|
-
},
|
|
80374
|
-
'&:last-of-type': {
|
|
80375
|
-
borderBottomRightRadius: 'normal',
|
|
80376
|
-
borderBottomLeftRadius: 'normal',
|
|
80377
|
-
},
|
|
80378
|
-
}, 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: {
|
|
80379
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80380
|
-
'&:first-of-type': {
|
|
80381
|
-
borderTopRightRadius: 'normal',
|
|
80382
|
-
borderTopLeftRadius: 'normal',
|
|
80383
|
-
},
|
|
80384
|
-
'&:last-of-type': {
|
|
80385
|
-
borderBottomRightRadius: 'normal',
|
|
80386
|
-
borderBottomLeftRadius: 'normal',
|
|
80387
|
-
},
|
|
80388
|
-
}, 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 at May 25th, 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: {
|
|
80389
|
-
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
80390
|
-
'&:first-of-type': {
|
|
80391
|
-
borderTopRightRadius: 'normal',
|
|
80392
|
-
borderTopLeftRadius: 'normal',
|
|
80393
|
-
},
|
|
80394
|
-
'&:last-of-type': {
|
|
80395
|
-
borderBottomRightRadius: 'normal',
|
|
80396
|
-
borderBottomLeftRadius: 'normal',
|
|
80397
|
-
},
|
|
80398
|
-
}, 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') }) }));
|
|
80399
80423
|
};
|
|
80400
80424
|
|
|
80401
|
-
const
|
|
80402
|
-
|
|
80403
|
-
|
|
80404
|
-
|
|
80405
|
-
|
|
80406
|
-
|
|
80407
|
-
|
|
80408
|
-
|
|
80409
|
-
|
|
80410
|
-
// Display Values
|
|
80411
|
-
const raiseGoal = getBalanceNumber(new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.totalRaise) !== null && _a !== void 0 ? _a : '0'), 18);
|
|
80412
|
-
const totalPrincipalBilled = getBalanceNumber(new BigNumber$1((_b = bond === null || bond === void 0 ? void 0 : bond.totalPrincipalBilled) !== null && _b !== void 0 ? _b : '0'), 18);
|
|
80413
|
-
const percentageSold = (totalPrincipalBilled * 100) / raiseGoal;
|
|
80414
|
-
const inputValueToDisplay = parseFloat(inputValue).toFixed(2);
|
|
80415
|
-
const inputValueToDisplayUSD = parseFloat(inputValueToDisplay) * bond.principalTokenPrice;
|
|
80416
|
-
const youGet = parseFloat(inputValue) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
80417
|
-
const youGetUSD = youGet * (bond === null || bond === void 0 ? void 0 : bond.tgePrice);
|
|
80418
|
-
const bonusUSD = youGetUSD - inputValueToDisplayUSD;
|
|
80419
|
-
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'];
|
|
80420
|
-
(parseFloat(inputValue) * airdropBonus) / (bond === null || bond === void 0 ? void 0 : bond.initPrice);
|
|
80421
|
-
`${bond === null || bond === void 0 ? void 0 : bond.totalAllocation}`;
|
|
80422
|
-
new Date().getTime();
|
|
80423
|
-
((_d = bond === null || bond === void 0 ? void 0 : bond.initTime) !== null && _d !== void 0 ? _d : 0) * 1000;
|
|
80424
|
-
((_e = bond === null || bond === void 0 ? void 0 : bond.finishTime) !== null && _e !== void 0 ? _e : 0) * 1000;
|
|
80425
|
-
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: {
|
|
80426
|
-
width: '100%',
|
|
80427
|
-
background: '#DE62F366',
|
|
80428
|
-
justifyContent: 'center',
|
|
80429
|
-
mt: '10px',
|
|
80430
|
-
borderRadius: 'normal',
|
|
80431
|
-
p: '2px 10px',
|
|
80432
|
-
fontSize: '12px',
|
|
80433
|
-
fontWeight: 400,
|
|
80434
|
-
}, 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: {
|
|
80435
|
-
width: '100%',
|
|
80436
|
-
mt: '10px',
|
|
80437
|
-
justifyContent: 'space-between',
|
|
80438
|
-
height: ['unset', 'unset', 'unset', '40px'],
|
|
80439
|
-
flexDirection: ['column-reverse', 'column-reverse', 'column-reverse', 'row'],
|
|
80440
|
-
}, children: [jsx$2(Flex, { sx: { width: ['100%', '100%', '100%', '45%'], justifyContent: 'center' }, children: jsxs(Button, { variant: "secondary", onClick: () => {
|
|
80441
|
-
var _a;
|
|
80442
|
-
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');
|
|
80443
|
-
}, 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" })] })] })] }));
|
|
80444
80434
|
};
|
|
80445
80435
|
|
|
80446
80436
|
const Row = ({ bond }) => {
|
|
@@ -80454,7 +80444,12 @@ const Row = ({ bond }) => {
|
|
|
80454
80444
|
const percentageSold = Math.floor((totalPrincipalBilled * 100) / raiseGoal);
|
|
80455
80445
|
const earnToken = (_g = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _g === void 0 ? void 0 : _g.symbol;
|
|
80456
80446
|
const tokensRemainingUSD = tokensRemaining * bond.earnTokenPrice;
|
|
80457
|
-
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
|
+
};
|
|
80458
80453
|
return (jsxs("div", { className: `bond-row`, onClick: handleOpenModal, sx: {
|
|
80459
80454
|
borderRadius: 'normal',
|
|
80460
80455
|
background: NETWORK_COLORS[bond.chainId]
|
|
@@ -80507,8 +80502,8 @@ const PreTGERows = () => {
|
|
|
80507
80502
|
|
|
80508
80503
|
const Bonds = () => {
|
|
80509
80504
|
// Fetch data
|
|
80505
|
+
usePreTGEBondsData();
|
|
80510
80506
|
useHotBonds();
|
|
80511
|
-
useGeoFencing();
|
|
80512
80507
|
const { favTokens } = useFavoriteTokens();
|
|
80513
80508
|
const { data: bondData, refetch: refetchBondsData } = useBondsData();
|
|
80514
80509
|
const { data: allBonds } = useBondsList();
|