@goodaofi/bonds-sdk 3.0.175 → 3.0.177
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 +190 -485
- package/dist/views/ZapModal/index.d.ts +3 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -59494,9 +59494,7 @@ const QUERY_KEYS = {
|
|
|
59494
59494
|
ACTIVE_VIEW: 'Goomoney-SDK-activeView',
|
|
59495
59495
|
PRE_TGE_LIST: 'Goomoney-SDK-preTGEList',
|
|
59496
59496
|
PRE_TGE_USER_BONDS: 'Goomoney-SDK-preTGEUserBonds',
|
|
59497
|
-
USER_TOKENS_BALANCES: 'Goomoney-SDK-userTokensBalances'
|
|
59498
|
-
REFUND_DATA: 'Goomoney-SDK-refundData',
|
|
59499
|
-
};
|
|
59497
|
+
USER_TOKENS_BALANCES: 'Goomoney-SDK-userTokensBalances'};
|
|
59500
59498
|
|
|
59501
59499
|
// Prod URLS. Do not make changes here
|
|
59502
59500
|
const defaultUrls = {
|
|
@@ -65974,7 +65972,6 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
65974
65972
|
const lastBlockTimestamp = parseInt(userBill?.lastBlockTimestamp ?? '0');
|
|
65975
65973
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
65976
65974
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff ?? 0) - currentTime, true);
|
|
65977
|
-
const showImage = false;
|
|
65978
65975
|
const handleClaim = async (billId, billAddress) => {
|
|
65979
65976
|
const address = billAddress;
|
|
65980
65977
|
const isVestingNft = billAddress?.toLowerCase() === VESTING_NFT_ADDRESS.toLowerCase();
|
|
@@ -66028,7 +66025,10 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
66028
66025
|
};
|
|
66029
66026
|
const earnTokenPrice = useCurrencyPrice(userBill?.bond?.earnToken ?? null, userBill?.bond?.chainId ?? null);
|
|
66030
66027
|
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
66031
|
-
bondNFTData?.attributes?.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
66028
|
+
const attributes = bondNFTData?.attributes?.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
66029
|
+
const handleImageLoad = () => {
|
|
66030
|
+
setImgLoaded(true);
|
|
66031
|
+
};
|
|
66032
66032
|
const [onTransferBondModal] = useModal(jsx$2(TransferBondModal, { userBill: userBill }), true, true, `transferModal${userBill?.id}}`);
|
|
66033
66033
|
useEffect(() => {
|
|
66034
66034
|
if (isConfirmed) {
|
|
@@ -66037,9 +66037,32 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
66037
66037
|
}
|
|
66038
66038
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
66039
66039
|
}, [isConfirmed]);
|
|
66040
|
-
return (jsx$2(Modal, { className: "modal", children: jsxs(Flex$1, { className: "yourbondsmodal-content", children: [jsx$2(Flex$1, { className: "yourbondsmodal-header", children: jsx$2(Flex$1, { className: "svg-close", onClick: onDismiss, children: jsx$2(Svg, { icon: "close" }) }) }), jsxs(Flex$1, { className: "yourbondsmodal table-container", children: [
|
|
66040
|
+
return (jsx$2(Modal, { className: "modal", children: jsxs(Flex$1, { className: "yourbondsmodal-content", children: [jsx$2(Flex$1, { className: "yourbondsmodal-header", children: jsx$2(Flex$1, { className: "svg-close", onClick: onDismiss, children: jsx$2(Svg, { icon: "close" }) }) }), jsxs(Flex$1, { className: "yourbondsmodal table-container", children: [(jsxs(Flex$1, { className: "yourbondsmodal bondimage", children: [bondNFTData?.image && (jsx$2("img", { src: `${bondNFTData?.image}?img-width=720`, onLoad: handleImageLoad, style: { zIndex: 2 } })), !imgLoaded && (jsx$2(Flex$1, { sx: {
|
|
66041
|
+
position: 'absolute',
|
|
66042
|
+
top: 'calc(50% - 24px)',
|
|
66043
|
+
right: 'calc(50% - 50px)',
|
|
66044
|
+
justifyContent: 'center',
|
|
66045
|
+
alignItems: 'center',
|
|
66046
|
+
zIndex: 1,
|
|
66047
|
+
}, children: jsx$2(Spinner, { width: 100 }) }))] })), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: userBill?.bond?.showcaseTokenName ?? userBill?.bond?.earnToken?.symbol, size: 40, chain: userBill?.bond?.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: userBill?.bond?.showcaseTokenName ?? userBill?.bond?.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: userBill?.bond?.tags?.slice(0, 1).map((tag) => {
|
|
66041
66048
|
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag?.toUpperCase() }) }, tag));
|
|
66042
|
-
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["#", userBill?.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [
|
|
66049
|
+
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["#", userBill?.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [(jsxs(Flex$1, { className: "attributes-container", children: [jsxs(Flex$1, { className: "attributes-header", sx: {
|
|
66050
|
+
borderRadius: `${isOpenTraits ? '6px 6px 0px 0px' : 'normal'}`,
|
|
66051
|
+
}, onClick: () => setIsOpenTraits(!isOpenTraits), children: [jsxs(Flex$1, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), userBill?.bond?.billType === 'staking' && (jsxs(Flex$1, { sx: {
|
|
66052
|
+
p: '5px 10px',
|
|
66053
|
+
width: '100%',
|
|
66054
|
+
background: '#8E568F',
|
|
66055
|
+
borderRadius: 'normal',
|
|
66056
|
+
mt: '10px',
|
|
66057
|
+
fontSize: '12px',
|
|
66058
|
+
fontWeight: 400,
|
|
66059
|
+
justifyContent: 'center',
|
|
66060
|
+
display: 'block',
|
|
66061
|
+
}, children: ["Tokens bought through this bond went directly to the", ' ', jsx$2("span", { onClick: () => window.open('https://basepad.finance/earn', '_blank'), style: { textDecoration: 'underline', cursor: 'pointer', color: 'blue' }, children: "$BPAD staking pool" }), ' ', "with a 365 days lock."] })), jsx$2(AnimatePresence, { children: isOpenTraits && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%' }, children: jsx$2(Flex$1, { sx: { flexDirection: 'column', gap: '1px' }, children: attributes
|
|
66062
|
+
? attributes.map((a) => (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a?.trait_type }), jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a?.value })] }, a.value)))
|
|
66063
|
+
: BILL_ATTRIBUTES.map((attrib) => {
|
|
66064
|
+
return (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
66065
|
+
}) }) })) })] })), bondNFTData?.data?.deposit && (jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "You Spent" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.YouSpent }), width: "270px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsx$2(Flex$1, { className: "yourbondinfo-block info", children: jsx$2(Flex$1, { className: "block-info text", children: jsxs(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: ["$", bondNFTData?.data?.dollarValue.toFixed(2)] }) }) })] })), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children: jsxs(Flex$1, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: [vestingTimeRemainingString(userBill), isPendingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex$1, { children: ["Bond will be claimable in", ' ', `${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`, "."] }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex$1, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }) })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-pending", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Pending" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: userBill?.bond?.showcaseTokenName ?? userBill?.bond?.earnToken?.symbol, size: 25, chain: userBill?.bond?.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4) }), jsx$2(Text, { sx: {
|
|
66043
66066
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
66044
66067
|
fontWeight: [500, 500, 500, 400],
|
|
66045
66068
|
paddingLeft: '10px',
|
|
@@ -66538,7 +66561,7 @@ const YourBondsMenu = ({ handleSort, }) => {
|
|
|
66538
66561
|
return (jsx$2("div", { className: "bonds-menu", children: jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' } }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] }) }));
|
|
66539
66562
|
};
|
|
66540
66563
|
|
|
66541
|
-
var
|
|
66564
|
+
var launchBondsABI_V2_2_0 = [
|
|
66542
66565
|
{
|
|
66543
66566
|
anonymous: false,
|
|
66544
66567
|
inputs: [
|
|
@@ -68968,7 +68991,7 @@ const fetchPreTGEUserBonds = async (chains, tokenPrices, preTGEList, account, ap
|
|
|
68968
68991
|
name: 'trueBillPrice',
|
|
68969
68992
|
},
|
|
68970
68993
|
];
|
|
68971
|
-
const res = await multicall(bond.chainId,
|
|
68994
|
+
const res = await multicall(bond.chainId, launchBondsABI_V2_2_0, calls);
|
|
68972
68995
|
const billId = res[0][0][0]?.toString();
|
|
68973
68996
|
let userOwnedBillsData;
|
|
68974
68997
|
if (billId) {
|
|
@@ -68988,7 +69011,7 @@ const fetchPreTGEUserBonds = async (chains, tokenPrices, preTGEList, account, ap
|
|
|
68988
69011
|
params: [billId],
|
|
68989
69012
|
},
|
|
68990
69013
|
];
|
|
68991
|
-
const billData = await multicall(bond.chainId,
|
|
69014
|
+
const billData = await multicall(bond.chainId, launchBondsABI_V2_2_0, billDataCalls);
|
|
68992
69015
|
userOwnedBillsData = {
|
|
68993
69016
|
address: bond.contractAddress[bond.chainId] ?? '',
|
|
68994
69017
|
id: billId,
|
|
@@ -69071,7 +69094,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
69071
69094
|
setLoading(true);
|
|
69072
69095
|
writeContractAsync({
|
|
69073
69096
|
address: userBond.contractAddress[userBond.chainId],
|
|
69074
|
-
abi:
|
|
69097
|
+
abi: launchBondsABI_V2_2_0,
|
|
69075
69098
|
functionName: 'redeem',
|
|
69076
69099
|
chain: userBond.chainId,
|
|
69077
69100
|
account,
|
|
@@ -69099,7 +69122,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
69099
69122
|
return;
|
|
69100
69123
|
writeContractAsync({
|
|
69101
69124
|
address: userBond.contractAddress[userBond.chainId],
|
|
69102
|
-
abi:
|
|
69125
|
+
abi: launchBondsABI_V2_2_0,
|
|
69103
69126
|
functionName: 'claim',
|
|
69104
69127
|
args: [userBond?.userOwnedBillsData?.id],
|
|
69105
69128
|
chain: userBond.chainId,
|
|
@@ -69364,7 +69387,7 @@ const fetchGooPreTGEUserBonds = async (chains, tokenPrices, gooContracts, accoun
|
|
|
69364
69387
|
name: 'trueBillPrice',
|
|
69365
69388
|
},
|
|
69366
69389
|
];
|
|
69367
|
-
const res = await multicall(contract.chainId,
|
|
69390
|
+
const res = await multicall(contract.chainId, launchBondsABI_V2_2_0, calls);
|
|
69368
69391
|
const billId = res[0][0][0]?.toString();
|
|
69369
69392
|
let userOwnedBillsData;
|
|
69370
69393
|
if (billId) {
|
|
@@ -69384,7 +69407,7 @@ const fetchGooPreTGEUserBonds = async (chains, tokenPrices, gooContracts, accoun
|
|
|
69384
69407
|
params: [billId],
|
|
69385
69408
|
},
|
|
69386
69409
|
];
|
|
69387
|
-
const billData = await multicall(contract.chainId,
|
|
69410
|
+
const billData = await multicall(contract.chainId, launchBondsABI_V2_2_0, billDataCalls);
|
|
69388
69411
|
userOwnedBillsData = {
|
|
69389
69412
|
address: contract.address,
|
|
69390
69413
|
id: billId,
|
|
@@ -72496,7 +72519,7 @@ const getPreTGEBondsData = async (chain, tokenPrices, preTGEBonds, apiUrl) => {
|
|
|
72496
72519
|
},
|
|
72497
72520
|
];
|
|
72498
72521
|
});
|
|
72499
|
-
const vals = await multicall(chainId,
|
|
72522
|
+
const vals = await multicall(chainId, launchBondsABI_V2_2_0, launchBondsCalls);
|
|
72500
72523
|
const chunkSize = vals.length / preTGEBonds.length;
|
|
72501
72524
|
const chunkedBills = lodashExports.chunk(vals, chunkSize);
|
|
72502
72525
|
const returnedBills = chunkedBills?.map((chunk, index) => {
|
|
@@ -73119,7 +73142,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
|
|
|
73119
73142
|
const contractAddress = outputToken?.address[chainId];
|
|
73120
73143
|
const chain = getChainParam(chainId);
|
|
73121
73144
|
const isLP = outputToken?.lpToken ?? false;
|
|
73122
|
-
const liquidityDex = outputToken?.liquidityDex?.[chainId];
|
|
73145
|
+
const liquidityDex = outputToken?.liquiditySource?.[chainId] ?? outputToken?.liquidityDex?.[chainId];
|
|
73123
73146
|
const protocol = main.dexFactories[chainId]?.[liquidityDex]?.protocol;
|
|
73124
73147
|
const lpType = outputToken?.lpToken ? getLpType(protocol) : 'single';
|
|
73125
73148
|
const ichiUnderlyingDex = outputToken?.ichiUnderlyingDex;
|
|
@@ -73220,6 +73243,139 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
|
|
|
73220
73243
|
return [isLoading, response, estimateOutput, zapError];
|
|
73221
73244
|
};
|
|
73222
73245
|
|
|
73246
|
+
const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProofSig) => {
|
|
73247
|
+
const debouncedInput = useDebounce(typedValue, 400);
|
|
73248
|
+
const [slippage] = useSlippage();
|
|
73249
|
+
const principalToken = bond?.lpToken;
|
|
73250
|
+
const bondContractAddress = bond?.contractAddress[bond?.chainId];
|
|
73251
|
+
const chainId = bond?.chainId;
|
|
73252
|
+
const inputCurrencyString = inputCurrency === 'NATIVE' ? '0x0000000000000000000000000000000000000000' : inputCurrency?.address[chainId];
|
|
73253
|
+
const inputCurrencyDecimals = inputCurrency === 'NATIVE' ? 18 : inputCurrency?.decimals[chainId];
|
|
73254
|
+
const principalContractAddress = principalToken?.address[chainId];
|
|
73255
|
+
const chainName = getChainParam(chainId);
|
|
73256
|
+
const isReserveBond = bond?.billType === 'reserve' || bond?.billType === 'staking';
|
|
73257
|
+
const liquidityDex = principalToken?.liquiditySource?.[chainId] ?? principalToken?.liquidityDex?.[chainId];
|
|
73258
|
+
const protocol = main.dexFactories[chainId]?.[liquidityDex]?.protocol;
|
|
73259
|
+
const lpType = isReserveBond ? 'single' : getLpType(protocol);
|
|
73260
|
+
const ichiUnderlyingDex = principalToken?.ichiUnderlyingDex;
|
|
73261
|
+
const vault = principalToken?.address?.[chainId];
|
|
73262
|
+
const router = main.dexFactories[chainId]?.[liquidityDex]?.router;
|
|
73263
|
+
// Validates that the user did not pass an amount with 19 decimals or more
|
|
73264
|
+
const validated18DecimalAmount = new BigNumber$1(debouncedInput ?? '0').toFixed(18, 5);
|
|
73265
|
+
const bigishInputAmount = new BigNumber$1(validated18DecimalAmount ?? '0')
|
|
73266
|
+
.times(new BigNumber$1(10).pow(inputCurrencyDecimals ?? 18))
|
|
73267
|
+
.toString();
|
|
73268
|
+
const zapInputData = useMemo(() => {
|
|
73269
|
+
if (inputCurrencyString &&
|
|
73270
|
+
inputCurrencyDecimals &&
|
|
73271
|
+
bigishInputAmount !== 'NaN' &&
|
|
73272
|
+
bigishInputAmount !== '0' &&
|
|
73273
|
+
principalContractAddress &&
|
|
73274
|
+
chainName &&
|
|
73275
|
+
bondContractAddress &&
|
|
73276
|
+
(inputCurrency === 'NATIVE' || inputCurrency?.address[chainId] !== principalToken.address[chainId])) {
|
|
73277
|
+
return {
|
|
73278
|
+
chain: chainName,
|
|
73279
|
+
recipient: account ?? '0x0000000000000000000000000000000000000000',
|
|
73280
|
+
user: account ?? '0x0000000000000000000000000000000000000000',
|
|
73281
|
+
lpData: {
|
|
73282
|
+
lpType,
|
|
73283
|
+
fromToken: inputCurrencyString,
|
|
73284
|
+
fromAmount: bigishInputAmount,
|
|
73285
|
+
underlyingDex: ichiUnderlyingDex,
|
|
73286
|
+
vault: isReserveBond ? undefined : vault,
|
|
73287
|
+
slippage: slippage,
|
|
73288
|
+
lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
|
|
73289
|
+
router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
|
|
73290
|
+
toToken: isReserveBond ? vault : undefined,
|
|
73291
|
+
},
|
|
73292
|
+
protocolData: {
|
|
73293
|
+
protocol: 'ApeBond',
|
|
73294
|
+
bond: bondContractAddress,
|
|
73295
|
+
depositer: account ?? '0x0000000000000000000000000000000000000000',
|
|
73296
|
+
tierProofSignature: bond.billVersion === main.BillVersion.V4 && tierProofSig ? tierProofSig : undefined,
|
|
73297
|
+
},
|
|
73298
|
+
};
|
|
73299
|
+
}
|
|
73300
|
+
else {
|
|
73301
|
+
return null;
|
|
73302
|
+
}
|
|
73303
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
73304
|
+
}, [
|
|
73305
|
+
bigishInputAmount,
|
|
73306
|
+
principalContractAddress,
|
|
73307
|
+
chainName,
|
|
73308
|
+
account,
|
|
73309
|
+
ichiUnderlyingDex,
|
|
73310
|
+
vault,
|
|
73311
|
+
lpType,
|
|
73312
|
+
router,
|
|
73313
|
+
slippage,
|
|
73314
|
+
]);
|
|
73315
|
+
const queryKey = useMemo(() => {
|
|
73316
|
+
if (!zapInputData)
|
|
73317
|
+
return null;
|
|
73318
|
+
return [
|
|
73319
|
+
'zapBondDetails',
|
|
73320
|
+
zapInputData.chain,
|
|
73321
|
+
zapInputData.user,
|
|
73322
|
+
zapInputData.lpData.lpType,
|
|
73323
|
+
zapInputData.lpData.fromToken,
|
|
73324
|
+
zapInputData.lpData.fromAmount,
|
|
73325
|
+
zapInputData.lpData.underlyingDex ?? '',
|
|
73326
|
+
zapInputData.lpData.vault,
|
|
73327
|
+
zapInputData.lpData.slippage,
|
|
73328
|
+
zapInputData.lpData.lpAddress,
|
|
73329
|
+
zapInputData.lpData.router ?? '',
|
|
73330
|
+
];
|
|
73331
|
+
}, [zapInputData]);
|
|
73332
|
+
const fetchZapDetails = async () => {
|
|
73333
|
+
const response = await axios.post(SOUL_ZAP_API, {
|
|
73334
|
+
'0': zapInputData,
|
|
73335
|
+
});
|
|
73336
|
+
return response.data?.[0]?.result?.data;
|
|
73337
|
+
};
|
|
73338
|
+
const { data: response, isLoading, isFetching, error, } = useQuery({
|
|
73339
|
+
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
73340
|
+
queryFn: fetchZapDetails,
|
|
73341
|
+
refetchInterval: 60000, // i.e. 60 sec
|
|
73342
|
+
enabled: !!queryKey,
|
|
73343
|
+
retry: 1,
|
|
73344
|
+
});
|
|
73345
|
+
const zapError = !!error;
|
|
73346
|
+
const tokenList = zapInputTokens[chainId] ? zapInputTokens[chainId] : [];
|
|
73347
|
+
// toToken0 data
|
|
73348
|
+
const toToken0Estimate = response?.lpQuote?.token0?.fromAmountEstimate;
|
|
73349
|
+
const toToken0 = [...tokenList, principalToken]?.find((token) => token?.address?.[chainId]?.toLowerCase() === response?.lpQuote?.token0?.address?.toLowerCase());
|
|
73350
|
+
const toToken0Price = useCurrencyPrice(toToken0 ?? null, chainId);
|
|
73351
|
+
// toToken1 data
|
|
73352
|
+
const toToken1Estimate = response?.lpQuote?.token1?.fromAmountEstimate;
|
|
73353
|
+
const toToken1 = zapInputTokens[chainId]?.find((token) => token.address[chainId]?.toLowerCase() === response?.lpQuote?.token1?.address?.toLowerCase());
|
|
73354
|
+
const toToken1Price = useCurrencyPrice(toToken1 ?? null, chainId);
|
|
73355
|
+
let toToken0USD = new BigNumber$1(toToken0Estimate ?? '0')
|
|
73356
|
+
?.div(new BigNumber$1(10).pow(toToken0?.decimals[chainId] ?? 18)) // this is amount of swap output
|
|
73357
|
+
?.times(new BigNumber$1(toToken0Price?.price ?? 0)); // convert it to usd price
|
|
73358
|
+
if (response?.lpQuote?.token0?.fromAmountUSD) {
|
|
73359
|
+
toToken0USD = new BigNumber$1(response?.lpQuote?.token0?.fromAmountUSD);
|
|
73360
|
+
}
|
|
73361
|
+
let toToken1USD = new BigNumber$1(toToken1Estimate ?? '0')
|
|
73362
|
+
?.div(new BigNumber$1(10).pow(toToken1?.decimals[chainId] ?? 18)) // this is amount of swap output
|
|
73363
|
+
?.times(new BigNumber$1(toToken1Price?.price ?? 0)); // convert it to usd price
|
|
73364
|
+
if (response?.lpQuote?.token1?.fromAmountUSD) {
|
|
73365
|
+
toToken1USD = new BigNumber$1(response?.lpQuote?.token1?.fromAmountUSD);
|
|
73366
|
+
}
|
|
73367
|
+
const youSpendUSD = toToken0USD.plus(toToken1USD); // youSpendUSD
|
|
73368
|
+
const estimatedDepositAmount = youSpendUSD.div(bond?.principalTokenPrice ?? '0');
|
|
73369
|
+
const isWrap = inputCurrency === 'NATIVE' &&
|
|
73370
|
+
bond?.lpToken?.address?.[chainId]?.toLowerCase() === WNATIVE[chainId]?.address?.[chainId]?.toLowerCase();
|
|
73371
|
+
const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
|
|
73372
|
+
const trueBondPrice = response?.protocolQuote?.trueBondPrice;
|
|
73373
|
+
const zapLoading = isLoading || isFetching;
|
|
73374
|
+
if (zapLoading)
|
|
73375
|
+
return [true, undefined, '', false, undefined];
|
|
73376
|
+
return [zapLoading, response, estimatedDepositAmountToReturn, zapError, trueBondPrice];
|
|
73377
|
+
};
|
|
73378
|
+
|
|
73223
73379
|
function useCurrencyBalance(currency, account, chainId) {
|
|
73224
73380
|
return useQuery({
|
|
73225
73381
|
queryKey: [
|
|
@@ -74296,7 +74452,7 @@ const SlippageModal = () => {
|
|
|
74296
74452
|
}, children: jsx$2(Text, { weight: 700, children: "%" }) })] })] })] }) }) }) }));
|
|
74297
74453
|
};
|
|
74298
74454
|
|
|
74299
|
-
const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
74455
|
+
const ZapModal = ({ onDismiss, outputToken, account, chainId, bondData }) => {
|
|
74300
74456
|
// State
|
|
74301
74457
|
const [pendingTx, setPendingTx] = useState(false);
|
|
74302
74458
|
const [typedValue, setTypedValue] = useState('');
|
|
@@ -74320,8 +74476,14 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
74320
74476
|
const isWrap = inputTokenString === 'NATIVE' &&
|
|
74321
74477
|
outputToken?.address?.[chainId]?.toLowerCase() === WNATIVE[chainId]?.address?.[chainId]?.toLowerCase();
|
|
74322
74478
|
const outputTokenBalanceString = outputTokenBalance ? new BigNumber$1(outputTokenBalance).toPrecision(5) : 'loading';
|
|
74323
|
-
// Zap Quote
|
|
74324
|
-
const [
|
|
74479
|
+
// Zap Quote - use bond quote when bondData is present, token quote otherwise
|
|
74480
|
+
const [tokenFetchingQuote, tokenZapData, tokenOutputValue, tokenZapError] = useSoulZapTokenQuote(typedValue, inputToken, bondData ? undefined : outputToken, chainId, account);
|
|
74481
|
+
const [bondFetchingQuote, bondZapData, bondDepositAmount, bondZapError] = useSoulZapBondQuote(typedValue, inputToken, bondData, account);
|
|
74482
|
+
const isBondZap = !!bondData;
|
|
74483
|
+
const fetchingQuote = isBondZap ? bondFetchingQuote : tokenFetchingQuote;
|
|
74484
|
+
const zapData = isBondZap ? bondZapData : tokenZapData;
|
|
74485
|
+
const outputValue = isBondZap ? parseFloat(bondDepositAmount || '0') : tokenOutputValue;
|
|
74486
|
+
const zapError = isBondZap ? bondZapError : tokenZapError;
|
|
74325
74487
|
// Functions
|
|
74326
74488
|
const handleCurrencySelect = useCallback((newInputToken) => {
|
|
74327
74489
|
setTypedValue('');
|
|
@@ -74409,139 +74571,6 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
74409
74571
|
: 'BUY' })) }), jsx$2(Flex, { sx: { marginTop: '10px', justifyContent: 'center' }, children: jsx$2(Link, { href: "https://docs.ape.bond/apebond/products-and-features/zap", target: "_blank", rel: "noopener noreferrer", sx: { textDecoration: 'none' }, children: jsxs(Text, { style: { fontSize: '12px', lineHeight: '18px', fontWeight: 400, borderBottom: '1px solid' }, children: ["Learn more", '>'] }) }) })] })] }));
|
|
74410
74572
|
};
|
|
74411
74573
|
|
|
74412
|
-
const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProofSig) => {
|
|
74413
|
-
const debouncedInput = useDebounce(typedValue, 400);
|
|
74414
|
-
const [slippage] = useSlippage();
|
|
74415
|
-
const principalToken = bond?.lpToken;
|
|
74416
|
-
const bondContractAddress = bond?.contractAddress[bond?.chainId];
|
|
74417
|
-
const chainId = bond?.chainId;
|
|
74418
|
-
const inputCurrencyString = inputCurrency === 'NATIVE' ? '0x0000000000000000000000000000000000000000' : inputCurrency?.address[chainId];
|
|
74419
|
-
const inputCurrencyDecimals = inputCurrency === 'NATIVE' ? 18 : inputCurrency?.decimals[chainId];
|
|
74420
|
-
const principalContractAddress = principalToken?.address[chainId];
|
|
74421
|
-
const chainName = getChainParam(chainId);
|
|
74422
|
-
const isReserveBond = bond?.billType === 'reserve' || bond?.billType === 'staking';
|
|
74423
|
-
const liquidityDex = principalToken?.liquiditySource?.[chainId] ?? principalToken?.liquidityDex?.[chainId];
|
|
74424
|
-
const protocol = main.dexFactories[chainId]?.[liquidityDex]?.protocol;
|
|
74425
|
-
const lpType = isReserveBond ? 'single' : getLpType(protocol);
|
|
74426
|
-
const ichiUnderlyingDex = principalToken?.ichiUnderlyingDex;
|
|
74427
|
-
const vault = principalToken?.address?.[chainId];
|
|
74428
|
-
const router = main.dexFactories[chainId]?.[liquidityDex]?.router;
|
|
74429
|
-
// Validates that the user did not pass an amount with 19 decimals or more
|
|
74430
|
-
const validated18DecimalAmount = new BigNumber$1(debouncedInput ?? '0').toFixed(18, 5);
|
|
74431
|
-
const bigishInputAmount = new BigNumber$1(validated18DecimalAmount ?? '0')
|
|
74432
|
-
.times(new BigNumber$1(10).pow(inputCurrencyDecimals ?? 18))
|
|
74433
|
-
.toString();
|
|
74434
|
-
const zapInputData = useMemo(() => {
|
|
74435
|
-
if (inputCurrencyString &&
|
|
74436
|
-
inputCurrencyDecimals &&
|
|
74437
|
-
bigishInputAmount !== 'NaN' &&
|
|
74438
|
-
bigishInputAmount !== '0' &&
|
|
74439
|
-
principalContractAddress &&
|
|
74440
|
-
chainName &&
|
|
74441
|
-
bondContractAddress &&
|
|
74442
|
-
(inputCurrency === 'NATIVE' || inputCurrency?.address[chainId] !== principalToken.address[chainId])) {
|
|
74443
|
-
return {
|
|
74444
|
-
chain: chainName,
|
|
74445
|
-
recipient: account ?? '0x0000000000000000000000000000000000000000',
|
|
74446
|
-
user: account ?? '0x0000000000000000000000000000000000000000',
|
|
74447
|
-
lpData: {
|
|
74448
|
-
lpType,
|
|
74449
|
-
fromToken: inputCurrencyString,
|
|
74450
|
-
fromAmount: bigishInputAmount,
|
|
74451
|
-
underlyingDex: ichiUnderlyingDex,
|
|
74452
|
-
vault: isReserveBond ? undefined : vault,
|
|
74453
|
-
slippage: slippage,
|
|
74454
|
-
lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
|
|
74455
|
-
router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
|
|
74456
|
-
toToken: isReserveBond ? vault : undefined,
|
|
74457
|
-
},
|
|
74458
|
-
protocolData: {
|
|
74459
|
-
protocol: 'ApeBond',
|
|
74460
|
-
bond: bondContractAddress,
|
|
74461
|
-
depositer: account ?? '0x0000000000000000000000000000000000000000',
|
|
74462
|
-
tierProofSignature: bond.billVersion === main.BillVersion.V4 && tierProofSig ? tierProofSig : undefined,
|
|
74463
|
-
},
|
|
74464
|
-
};
|
|
74465
|
-
}
|
|
74466
|
-
else {
|
|
74467
|
-
return null;
|
|
74468
|
-
}
|
|
74469
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
74470
|
-
}, [
|
|
74471
|
-
bigishInputAmount,
|
|
74472
|
-
principalContractAddress,
|
|
74473
|
-
chainName,
|
|
74474
|
-
account,
|
|
74475
|
-
ichiUnderlyingDex,
|
|
74476
|
-
vault,
|
|
74477
|
-
lpType,
|
|
74478
|
-
router,
|
|
74479
|
-
slippage,
|
|
74480
|
-
]);
|
|
74481
|
-
const queryKey = useMemo(() => {
|
|
74482
|
-
if (!zapInputData)
|
|
74483
|
-
return null;
|
|
74484
|
-
return [
|
|
74485
|
-
'zapBondDetails',
|
|
74486
|
-
zapInputData.chain,
|
|
74487
|
-
zapInputData.user,
|
|
74488
|
-
zapInputData.lpData.lpType,
|
|
74489
|
-
zapInputData.lpData.fromToken,
|
|
74490
|
-
zapInputData.lpData.fromAmount,
|
|
74491
|
-
zapInputData.lpData.underlyingDex ?? '',
|
|
74492
|
-
zapInputData.lpData.vault,
|
|
74493
|
-
zapInputData.lpData.slippage,
|
|
74494
|
-
zapInputData.lpData.lpAddress,
|
|
74495
|
-
zapInputData.lpData.router ?? '',
|
|
74496
|
-
];
|
|
74497
|
-
}, [zapInputData]);
|
|
74498
|
-
const fetchZapDetails = async () => {
|
|
74499
|
-
const response = await axios.post(SOUL_ZAP_API, {
|
|
74500
|
-
'0': zapInputData,
|
|
74501
|
-
});
|
|
74502
|
-
return response.data?.[0]?.result?.data;
|
|
74503
|
-
};
|
|
74504
|
-
const { data: response, isLoading, isFetching, error, } = useQuery({
|
|
74505
|
-
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
74506
|
-
queryFn: fetchZapDetails,
|
|
74507
|
-
refetchInterval: 60000, // i.e. 60 sec
|
|
74508
|
-
enabled: !!queryKey,
|
|
74509
|
-
retry: 1,
|
|
74510
|
-
});
|
|
74511
|
-
const zapError = !!error;
|
|
74512
|
-
const tokenList = zapInputTokens[chainId] ? zapInputTokens[chainId] : [];
|
|
74513
|
-
// toToken0 data
|
|
74514
|
-
const toToken0Estimate = response?.lpQuote?.token0?.fromAmountEstimate;
|
|
74515
|
-
const toToken0 = [...tokenList, principalToken]?.find((token) => token?.address?.[chainId]?.toLowerCase() === response?.lpQuote?.token0?.address?.toLowerCase());
|
|
74516
|
-
const toToken0Price = useCurrencyPrice(toToken0 ?? null, chainId);
|
|
74517
|
-
// toToken1 data
|
|
74518
|
-
const toToken1Estimate = response?.lpQuote?.token1?.fromAmountEstimate;
|
|
74519
|
-
const toToken1 = zapInputTokens[chainId]?.find((token) => token.address[chainId]?.toLowerCase() === response?.lpQuote?.token1?.address?.toLowerCase());
|
|
74520
|
-
const toToken1Price = useCurrencyPrice(toToken1 ?? null, chainId);
|
|
74521
|
-
let toToken0USD = new BigNumber$1(toToken0Estimate ?? '0')
|
|
74522
|
-
?.div(new BigNumber$1(10).pow(toToken0?.decimals[chainId] ?? 18)) // this is amount of swap output
|
|
74523
|
-
?.times(new BigNumber$1(toToken0Price?.price ?? 0)); // convert it to usd price
|
|
74524
|
-
if (response?.lpQuote?.token0?.fromAmountUSD) {
|
|
74525
|
-
toToken0USD = new BigNumber$1(response?.lpQuote?.token0?.fromAmountUSD);
|
|
74526
|
-
}
|
|
74527
|
-
let toToken1USD = new BigNumber$1(toToken1Estimate ?? '0')
|
|
74528
|
-
?.div(new BigNumber$1(10).pow(toToken1?.decimals[chainId] ?? 18)) // this is amount of swap output
|
|
74529
|
-
?.times(new BigNumber$1(toToken1Price?.price ?? 0)); // convert it to usd price
|
|
74530
|
-
if (response?.lpQuote?.token1?.fromAmountUSD) {
|
|
74531
|
-
toToken1USD = new BigNumber$1(response?.lpQuote?.token1?.fromAmountUSD);
|
|
74532
|
-
}
|
|
74533
|
-
const youSpendUSD = toToken0USD.plus(toToken1USD); // youSpendUSD
|
|
74534
|
-
const estimatedDepositAmount = youSpendUSD.div(bond?.principalTokenPrice ?? '0');
|
|
74535
|
-
const isWrap = inputCurrency === 'NATIVE' &&
|
|
74536
|
-
bond?.lpToken?.address?.[chainId]?.toLowerCase() === WNATIVE[chainId]?.address?.[chainId]?.toLowerCase();
|
|
74537
|
-
const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
|
|
74538
|
-
const trueBondPrice = response?.protocolQuote?.trueBondPrice;
|
|
74539
|
-
const zapLoading = isLoading || isFetching;
|
|
74540
|
-
if (zapLoading)
|
|
74541
|
-
return [true, undefined, '', false, undefined];
|
|
74542
|
-
return [zapLoading, response, estimatedDepositAmountToReturn, zapError, trueBondPrice];
|
|
74543
|
-
};
|
|
74544
|
-
|
|
74545
74574
|
const useSendReferenceId = () => {
|
|
74546
74575
|
const config = useSDKConfig();
|
|
74547
74576
|
const apiV2URL = useURLByEnvironment('apiV2');
|
|
@@ -75425,7 +75454,7 @@ const BuyBond$1 = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isP
|
|
|
75425
75454
|
// Modals
|
|
75426
75455
|
const [openNewRateModal] = useModal(jsx$2(NewRateModal$1, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), true, false, 'newRateModal');
|
|
75427
75456
|
const [openTxModal] = useModal(jsx$2(TransactionModal$2, { txChain: bondChain, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleBothPurchases, bondData: bondData, inputToken: inputToken, inputValue: inputValue, depositAmount: depositAmount, buyTxHash: buyTxHash, rateChanged: rateChanged }), false, true, 'transactionModal');
|
|
75428
|
-
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData?.lpToken, account: account, chainId: bondData?.chainId }), true, true, 'zapModal');
|
|
75457
|
+
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData?.lpToken, account: account, chainId: bondData?.chainId, bondData: bondData }), true, true, 'zapModal');
|
|
75429
75458
|
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: openTxModal, showcaseTokenName: bondData?.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
75430
75459
|
// Effects
|
|
75431
75460
|
const [hasChecked, setHasChecked] = useState(false);
|
|
@@ -75678,7 +75707,7 @@ const PreTGEBuyComponent = ({ bondAddress, bondChain, onDismiss, handlePurchased
|
|
|
75678
75707
|
const args = [amount, maxPrice, address];
|
|
75679
75708
|
await writeContractAsync({
|
|
75680
75709
|
address: bond?.contractAddress?.[bond.chainId],
|
|
75681
|
-
abi:
|
|
75710
|
+
abi: launchBondsABI_V2_2_0,
|
|
75682
75711
|
functionName: 'deposit',
|
|
75683
75712
|
args: args,
|
|
75684
75713
|
chain: bond.chainId,
|
|
@@ -99885,7 +99914,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
99885
99914
|
// Modals
|
|
99886
99915
|
useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), true, false, 'newRateModal');
|
|
99887
99916
|
const [openTxModal] = useModal(jsx$2(TransactionModal$1, { txChain: bondChain, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleBothPurchases, bondData: bondData, inputToken: inputToken, inputValue: inputValue, depositAmount: depositAmount, buyTxHash: buyTxHash, rateChanged: rateChanged, onDismiss: onDismiss }), false, true, 'transactionModal');
|
|
99888
|
-
useModal(jsx$2(ZapModal, { outputToken: bondData?.lpToken, account: account, chainId: bondData?.chainId }), true, true, 'zapModal');
|
|
99917
|
+
useModal(jsx$2(ZapModal, { outputToken: bondData?.lpToken, account: account, chainId: bondData?.chainId, bondData: bondData }), true, true, 'zapModal');
|
|
99889
99918
|
// Effects
|
|
99890
99919
|
const [hasChecked, setHasChecked] = useState(false);
|
|
99891
99920
|
const [hasCheckedTrack, setHasCheckedTrack] = useState(false);
|
|
@@ -100376,283 +100405,6 @@ const getUserGooData = async (userAddress, apiAddress) => {
|
|
|
100376
100405
|
}
|
|
100377
100406
|
};
|
|
100378
100407
|
|
|
100379
|
-
// eslint-disable-next-line react/prop-types
|
|
100380
|
-
const CounterCard = ({ digit, text }) => {
|
|
100381
|
-
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }, children: [jsx$2(Flex, { sx: {
|
|
100382
|
-
background: 'linear-gradient(-45deg, #251c22 0%, #3a2327 100%)',
|
|
100383
|
-
borderRadius: 'normal',
|
|
100384
|
-
border: '1px solid #FE9E0450',
|
|
100385
|
-
justifyContent: 'center',
|
|
100386
|
-
alignItems: 'center',
|
|
100387
|
-
p: '20px',
|
|
100388
|
-
fontSize: ['24px', '24px', '26px', '36px'],
|
|
100389
|
-
width: ['55px', '55px', '65px', '85px'],
|
|
100390
|
-
height: ['60px', '60px', '70px', '90px'],
|
|
100391
|
-
fontWeight: 700,
|
|
100392
|
-
}, children: digit.toString().padStart(2, '0') }), jsx$2(Text, { color: "textNavbar", sx: {
|
|
100393
|
-
fontSize: ['12px', '12px', '12px', '14px'],
|
|
100394
|
-
fontWeight: 400,
|
|
100395
|
-
mt: '10px',
|
|
100396
|
-
}, children: text })] }));
|
|
100397
|
-
};
|
|
100398
|
-
const Colon = () => {
|
|
100399
|
-
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsx$2(Text, { sx: {
|
|
100400
|
-
fontSize: '34px',
|
|
100401
|
-
fontWeight: 700,
|
|
100402
|
-
lineHeight: '90px',
|
|
100403
|
-
background: 'linear-gradient(to bottom, #fe9e0420 40%, #FE9E04 60%)',
|
|
100404
|
-
WebkitBackgroundClip: 'text',
|
|
100405
|
-
WebkitTextFillColor: 'transparent',
|
|
100406
|
-
backgroundClip: 'text',
|
|
100407
|
-
}, children: ":" }), jsx$2(Text, { color: "transparent", sx: { fontSize: '14px', fontWeight: 400, mt: '10px' }, children: "t" })] }));
|
|
100408
|
-
};
|
|
100409
|
-
const interval = 1000; // 1 sec
|
|
100410
|
-
const getCountdownObject = (targetIsoTime) => {
|
|
100411
|
-
// Detect if timestamp is in seconds or milliseconds
|
|
100412
|
-
// Timestamps in seconds are typically < 10^10, milliseconds are > 10^12
|
|
100413
|
-
const isSeconds = targetIsoTime < 10000000000;
|
|
100414
|
-
const targetTimeMs = isSeconds ? targetIsoTime * 1000 : targetIsoTime;
|
|
100415
|
-
const targetTime = new Date(targetTimeMs);
|
|
100416
|
-
const now = new Date();
|
|
100417
|
-
let delta = (targetTime.getTime() - now.getTime()) / 1000; // difference in seconds
|
|
100418
|
-
// If the target time has passed, return zero countdown
|
|
100419
|
-
if (delta <= 0)
|
|
100420
|
-
return {
|
|
100421
|
-
days: 0,
|
|
100422
|
-
hours: 0,
|
|
100423
|
-
minutes: 0,
|
|
100424
|
-
seconds: 0,
|
|
100425
|
-
};
|
|
100426
|
-
const days = Math.floor(delta / 86400);
|
|
100427
|
-
delta -= days * 86400;
|
|
100428
|
-
const hours = Math.floor(delta / 3600) % 24;
|
|
100429
|
-
delta -= hours * 3600;
|
|
100430
|
-
const minutes = Math.floor(delta / 60) % 60;
|
|
100431
|
-
const seconds = Math.floor(delta % 60);
|
|
100432
|
-
return {
|
|
100433
|
-
days,
|
|
100434
|
-
hours,
|
|
100435
|
-
minutes,
|
|
100436
|
-
seconds,
|
|
100437
|
-
};
|
|
100438
|
-
};
|
|
100439
|
-
const CountdownTimer = ({ targetTime }) => {
|
|
100440
|
-
const [show, setShow] = useState(false);
|
|
100441
|
-
const [countdown, setCountdown] = useState(getCountdownObject(targetTime));
|
|
100442
|
-
useEffect(() => {
|
|
100443
|
-
if (!show)
|
|
100444
|
-
setShow(true);
|
|
100445
|
-
const intervalId = setInterval(() => {
|
|
100446
|
-
setCountdown(getCountdownObject(targetTime));
|
|
100447
|
-
}, interval);
|
|
100448
|
-
return () => {
|
|
100449
|
-
clearInterval(intervalId);
|
|
100450
|
-
};
|
|
100451
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
100452
|
-
}, [targetTime]);
|
|
100453
|
-
// Render a countdown
|
|
100454
|
-
return (show && (jsxs(Flex, { sx: {
|
|
100455
|
-
flexDirection: 'row',
|
|
100456
|
-
justifyContent: 'center',
|
|
100457
|
-
alignItems: 'center',
|
|
100458
|
-
gap: ['10px', '10px', '20px', '20px'],
|
|
100459
|
-
}, children: [jsx$2(CounterCard, { digit: countdown?.days || 0, text: "Days" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.hours || 0, text: "Hours" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.minutes || 0, text: "Minutes" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.seconds || 0, text: "Seconds" })] })));
|
|
100460
|
-
};
|
|
100461
|
-
|
|
100462
|
-
function useRefundData() {
|
|
100463
|
-
const { address } = useAccount();
|
|
100464
|
-
const { chains } = useSDKConfig();
|
|
100465
|
-
const apiUrl = useSDKConfig()?.urls?.apiV2;
|
|
100466
|
-
const { data: saleInfo, isLoading: isSaleInfoLoading } = useSaleInfo();
|
|
100467
|
-
// Get stage 1 and stage 2 contracts (refundable stages)
|
|
100468
|
-
// Check by stageNumber since key naming may vary
|
|
100469
|
-
const refundableStages = saleInfo?.stages?.filter((stage) => stage.stageNumber === 1 || stage.stageNumber === 2);
|
|
100470
|
-
console.log('Refundable stages:', refundableStages);
|
|
100471
|
-
console.log('All stages from saleInfo:', saleInfo?.stages);
|
|
100472
|
-
// Flatten ALL contracts from refundable stages across ALL chains
|
|
100473
|
-
const allContracts = [];
|
|
100474
|
-
refundableStages?.forEach((stage) => {
|
|
100475
|
-
console.log(`Stage ${stage.stageNumber} (${stage.key}) contractsByChain:`, stage.contractsByChain);
|
|
100476
|
-
Object.entries(stage.contractsByChain).forEach(([chainId, contracts]) => {
|
|
100477
|
-
contracts.forEach((contract) => {
|
|
100478
|
-
console.log(`Adding contract: ${contract.address} on chain ${chainId} for stage ${stage.stageNumber}`);
|
|
100479
|
-
allContracts.push({
|
|
100480
|
-
...contract,
|
|
100481
|
-
chainId: parseInt(chainId),
|
|
100482
|
-
stageKey: stage.key,
|
|
100483
|
-
stageNumber: stage.stageNumber,
|
|
100484
|
-
});
|
|
100485
|
-
});
|
|
100486
|
-
});
|
|
100487
|
-
});
|
|
100488
|
-
console.log('All contracts to check for refund:', allContracts);
|
|
100489
|
-
return useQuery({
|
|
100490
|
-
queryKey: [QUERY_KEYS.REFUND_DATA, address, allContracts?.length],
|
|
100491
|
-
queryFn: () => fetchRefundData(chains, allContracts, address, apiUrl),
|
|
100492
|
-
refetchInterval: 30000,
|
|
100493
|
-
refetchOnWindowFocus: true,
|
|
100494
|
-
enabled: !isSaleInfoLoading && allContracts.length > 0 && !!address,
|
|
100495
|
-
});
|
|
100496
|
-
}
|
|
100497
|
-
const fetchRefundData = async (chains, contracts, account, apiUrl) => {
|
|
100498
|
-
try {
|
|
100499
|
-
console.log('fetchRefundData called with:', { chains, contractCount: contracts.length, account });
|
|
100500
|
-
// Filter out invalid contracts
|
|
100501
|
-
const validContracts = contracts.filter((contract) => contract.address !== '0x0000000000000000000000000000000000000000' && contract.address !== '');
|
|
100502
|
-
console.log('Valid contracts after filtering:', validContracts.length, validContracts);
|
|
100503
|
-
const results = await Promise.all(validContracts.map(async (contract) => {
|
|
100504
|
-
try {
|
|
100505
|
-
const calls = [
|
|
100506
|
-
{
|
|
100507
|
-
address: contract.address,
|
|
100508
|
-
name: 'accountInfo',
|
|
100509
|
-
params: [account],
|
|
100510
|
-
},
|
|
100511
|
-
{
|
|
100512
|
-
address: contract.address,
|
|
100513
|
-
name: 'accountStatus',
|
|
100514
|
-
params: [account],
|
|
100515
|
-
},
|
|
100516
|
-
];
|
|
100517
|
-
console.log(`Calling multicall for ${contract.address} on chain ${contract.chainId}`);
|
|
100518
|
-
const res = await multicall(contract.chainId, launchBondsABI, calls);
|
|
100519
|
-
console.log(`Multicall result for ${contract.address}:`, res);
|
|
100520
|
-
const depositAmount = res[0].depositAmount.toString();
|
|
100521
|
-
const hasRefunded = res[1].hasRefunded;
|
|
100522
|
-
console.log(`Contract ${contract.address}: depositAmount=${depositAmount}, hasRefunded=${hasRefunded}`);
|
|
100523
|
-
return {
|
|
100524
|
-
address: contract.address,
|
|
100525
|
-
chainId: contract.chainId,
|
|
100526
|
-
type: contract.type,
|
|
100527
|
-
stageKey: contract.stageKey,
|
|
100528
|
-
stageNumber: contract.stageNumber,
|
|
100529
|
-
depositAmount,
|
|
100530
|
-
depositAmountBTC: Number(depositAmount) / 100000000,
|
|
100531
|
-
hasRefunded,
|
|
100532
|
-
principalToken: contract.principalToken,
|
|
100533
|
-
};
|
|
100534
|
-
}
|
|
100535
|
-
catch (error) {
|
|
100536
|
-
console.error(`Error fetching refund data for ${contract.address} on chain ${contract.chainId}:`, error);
|
|
100537
|
-
return null;
|
|
100538
|
-
}
|
|
100539
|
-
}));
|
|
100540
|
-
const validResults = results.filter((r) => r !== null);
|
|
100541
|
-
// Filter to only show contracts with deposits
|
|
100542
|
-
const contractsWithDeposits = validResults.filter((r) => r.depositAmountBTC > 0.00000001);
|
|
100543
|
-
const totalDepositBTC = contractsWithDeposits.reduce((sum, c) => sum + c.depositAmountBTC, 0);
|
|
100544
|
-
return {
|
|
100545
|
-
contracts: contractsWithDeposits,
|
|
100546
|
-
totalDepositBTC,
|
|
100547
|
-
};
|
|
100548
|
-
}
|
|
100549
|
-
catch (e) {
|
|
100550
|
-
console.error('fetchRefundData error:', e);
|
|
100551
|
-
reportError$1({
|
|
100552
|
-
apiUrl,
|
|
100553
|
-
error: e,
|
|
100554
|
-
extraInfo: { type: 'fetchRefundData', contracts, e },
|
|
100555
|
-
account,
|
|
100556
|
-
});
|
|
100557
|
-
return {
|
|
100558
|
-
contracts: [],
|
|
100559
|
-
totalDepositBTC: 0,
|
|
100560
|
-
};
|
|
100561
|
-
}
|
|
100562
|
-
};
|
|
100563
|
-
|
|
100564
|
-
const RefundRow = ({ contract, onRefundSuccess }) => {
|
|
100565
|
-
const { address: account } = useAccount();
|
|
100566
|
-
const chainId = useChainId();
|
|
100567
|
-
const { switchChain } = useSwitchChain();
|
|
100568
|
-
const { writeContractAsync } = useWriteContract();
|
|
100569
|
-
const { addToastError, addToastSuccess } = usePopups();
|
|
100570
|
-
const [txHash, setTxHash] = useState();
|
|
100571
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
100572
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTxHash(txHash, contract.chainId);
|
|
100573
|
-
const needsChainSwitch = chainId !== contract.chainId;
|
|
100574
|
-
const chainName = NETWORK_LABEL[contract.chainId] || `Chain ${contract.chainId}`;
|
|
100575
|
-
const tokenSymbol = contract.type === 'goo' ? 'GOO' : 'sGOO';
|
|
100576
|
-
const handleRefund = async () => {
|
|
100577
|
-
if (needsChainSwitch) {
|
|
100578
|
-
switchChain?.({ chainId: contract.chainId });
|
|
100579
|
-
return;
|
|
100580
|
-
}
|
|
100581
|
-
setIsLoading(true);
|
|
100582
|
-
try {
|
|
100583
|
-
const hash = await writeContractAsync({
|
|
100584
|
-
address: contract.address,
|
|
100585
|
-
abi: launchBondsABI,
|
|
100586
|
-
functionName: 'redeemRefund',
|
|
100587
|
-
args: [],
|
|
100588
|
-
chain: contract.chainId,
|
|
100589
|
-
account,
|
|
100590
|
-
});
|
|
100591
|
-
if (hash) {
|
|
100592
|
-
setTxHash(hash);
|
|
100593
|
-
addToastSuccess('Refund transaction submitted!');
|
|
100594
|
-
onRefundSuccess();
|
|
100595
|
-
}
|
|
100596
|
-
}
|
|
100597
|
-
catch (error) {
|
|
100598
|
-
console.error('Refund error:', error);
|
|
100599
|
-
addToastError(error?.shortMessage || 'Failed to process refund');
|
|
100600
|
-
}
|
|
100601
|
-
finally {
|
|
100602
|
-
setIsLoading(false);
|
|
100603
|
-
}
|
|
100604
|
-
};
|
|
100605
|
-
const loading = isLoading || (isConfirming && !isConfirmed);
|
|
100606
|
-
if (contract.hasRefunded) {
|
|
100607
|
-
return (jsxs(Flex, { sx: {
|
|
100608
|
-
width: '100%',
|
|
100609
|
-
background: 'white2',
|
|
100610
|
-
p: '20px',
|
|
100611
|
-
borderRadius: 'normal',
|
|
100612
|
-
mb: '10px',
|
|
100613
|
-
alignItems: 'center',
|
|
100614
|
-
justifyContent: 'space-between',
|
|
100615
|
-
opacity: 0.6,
|
|
100616
|
-
}, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '15px' }, children: [jsx$2(TokenImage, { symbol: tokenSymbol, size: 40, chain: contract.chainId }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: tokenSymbol }), jsxs(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: ["Stage ", contract.stageNumber, " \u2022 ", chainName] })] })] }), jsxs(Flex, { sx: { alignItems: 'center', gap: '20px' }, children: [jsxs(Text, { sx: { fontSize: '14px', fontWeight: 500 }, children: [contract.depositAmountBTC.toFixed(8), " BTC"] }), jsx$2(Button, { disabled: true, sx: { minWidth: '120px' }, children: "REFUNDED" })] })] }));
|
|
100617
|
-
}
|
|
100618
|
-
return (jsxs(Flex, { sx: {
|
|
100619
|
-
width: '100%',
|
|
100620
|
-
background: 'white2',
|
|
100621
|
-
p: '20px',
|
|
100622
|
-
borderRadius: 'normal',
|
|
100623
|
-
mb: '10px',
|
|
100624
|
-
alignItems: 'center',
|
|
100625
|
-
justifyContent: 'space-between',
|
|
100626
|
-
flexDirection: ['column', 'column', 'row', 'row'],
|
|
100627
|
-
gap: ['15px', '15px', '0', '0'],
|
|
100628
|
-
}, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '15px' }, children: [jsx$2(TokenImage, { symbol: tokenSymbol, size: 40, chain: contract.chainId }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: tokenSymbol }), jsxs(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: ["Stage ", contract.stageNumber, " \u2022 ", chainName] })] })] }), jsxs(Flex, { sx: { alignItems: 'center', gap: '20px', flexDirection: ['column', 'column', 'row', 'row'] }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: ['center', 'center', 'flex-end', 'flex-end'] }, children: [jsxs(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: [contract.depositAmountBTC.toFixed(8), " BTC"] }), jsx$2(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: "Deposited" })] }), jsx$2(Button, { onClick: handleRefund, disabled: loading, load: loading, sx: { minWidth: '140px' }, variant: needsChainSwitch ? 'secondary' : 'primary', children: loading ? 'PROCESSING...' : needsChainSwitch ? `SWITCH CHAIN` : 'REFUND' })] })] }));
|
|
100629
|
-
};
|
|
100630
|
-
const RefundView = () => {
|
|
100631
|
-
const { address } = useAccount();
|
|
100632
|
-
const { data: refundData, isLoading, refetch } = useRefundData();
|
|
100633
|
-
const handleRefundSuccess = () => {
|
|
100634
|
-
// Refetch data after successful refund
|
|
100635
|
-
setTimeout(() => refetch(), 2000);
|
|
100636
|
-
};
|
|
100637
|
-
if (!address) {
|
|
100638
|
-
return (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', alignItems: 'center', p: '40px' }, children: [jsx$2(Text, { sx: { fontSize: '18px', fontWeight: 'bold', mb: '20px' }, children: "Connect wallet to view your refundable deposits" }), jsx$2(ConnectButton, {})] }));
|
|
100639
|
-
}
|
|
100640
|
-
if (isLoading) {
|
|
100641
|
-
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', p: '60px', width: '100%' }, children: jsx$2(Spinner, {}) }));
|
|
100642
|
-
}
|
|
100643
|
-
const contracts = refundData?.contracts || [];
|
|
100644
|
-
const hasDeposits = contracts.length > 0;
|
|
100645
|
-
return (jsx$2(Flex, { sx: { width: '100%', flexDirection: 'column', p: ['10px', '20px', '20px', '40px'] }, children: !hasDeposits ? (jsxs(Flex, { sx: {
|
|
100646
|
-
width: '100%',
|
|
100647
|
-
background: 'white2',
|
|
100648
|
-
p: '40px',
|
|
100649
|
-
borderRadius: 'normal',
|
|
100650
|
-
alignItems: 'center',
|
|
100651
|
-
justifyContent: 'center',
|
|
100652
|
-
flexDirection: 'column',
|
|
100653
|
-
}, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 500, opacity: 0.7 }, children: "No refundable deposits found" }), jsx$2(Text, { sx: { fontSize: '14px', opacity: 0.5, mt: '10px' }, children: "You have not participated in Stage 1 or Stage 2 on the selected chain." })] })) : (jsx$2(Fragment$1, { children: contracts.map((contract) => (jsx$2(RefundRow, { contract: contract, onRefundSuccess: handleRefundSuccess }, `${contract.address}-${contract.chainId}`))) })) }));
|
|
100654
|
-
};
|
|
100655
|
-
|
|
100656
100408
|
var BondsViewOptions;
|
|
100657
100409
|
(function (BondsViewOptions) {
|
|
100658
100410
|
BondsViewOptions["BONDSMARKET"] = "Bonds Market";
|
|
@@ -100663,25 +100415,16 @@ const GooSale = () => {
|
|
|
100663
100415
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
100664
100416
|
const { data: saleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
|
|
100665
100417
|
const SDKConfig = useSDKConfig();
|
|
100666
|
-
|
|
100418
|
+
saleInfo?.isInBreakPeriod
|
|
100667
100419
|
? saleInfo?.nextStage?.stageNumber || 1
|
|
100668
100420
|
: saleInfo?.currentStage?.stageNumber || 1;
|
|
100669
100421
|
const { address } = useAccount();
|
|
100670
100422
|
const { data: yourGoo, isLoading, isFetching } = useYourGoo(address);
|
|
100671
100423
|
const userParticipated = address && !isLoading && !isFetching && (yourGoo?.depositToGooBond !== '0' || yourGoo?.depositToSGooBond !== '0');
|
|
100672
100424
|
const chainId = useChainId();
|
|
100673
|
-
|
|
100425
|
+
useGooEligibility();
|
|
100674
100426
|
const [checkButtonPushed, setCheckButtonPushed] = useState(false);
|
|
100675
|
-
|
|
100676
|
-
// Handle check eligibility button click
|
|
100677
|
-
const handleCheckEligibility = async () => {
|
|
100678
|
-
setCheckButtonPushed(true);
|
|
100679
|
-
if (elegibleForSale === null || elegibleForSale === undefined) {
|
|
100680
|
-
// If not eligible, check cbBTC balance
|
|
100681
|
-
await checkCbBTCBalance();
|
|
100682
|
-
}
|
|
100683
|
-
};
|
|
100684
|
-
const currentStageSoldOut = saleInfo?.currentStage?.progressPercentage === 100;
|
|
100427
|
+
saleInfo?.currentStage?.progressPercentage === 100;
|
|
100685
100428
|
// // Wrapper function that sets chain filter AND switches wallet chain
|
|
100686
100429
|
// const handleChainFilterChange = useCallback(
|
|
100687
100430
|
// (newChainFilter: string[]) => {
|
|
@@ -100720,59 +100463,21 @@ const GooSale = () => {
|
|
|
100720
100463
|
// return filtered
|
|
100721
100464
|
// }, [saleInfo?.currentStage?.contractsByChain, chainFilterOption])
|
|
100722
100465
|
// Dynamic title based on current period (hidden during refund period)
|
|
100723
|
-
|
|
100466
|
+
useMemo(() => {
|
|
100724
100467
|
if (saleInfo?.isRefundPeriod)
|
|
100725
100468
|
return null;
|
|
100726
100469
|
if (saleInfo?.currentStage?.key === 'TGE')
|
|
100727
100470
|
return 'GOO Token Generation Event';
|
|
100728
100471
|
return 'Buy GOO at a discount';
|
|
100729
100472
|
}, [saleInfo?.isRefundPeriod, saleInfo?.currentStage?.key]);
|
|
100730
|
-
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), !SDKConfig.bondsComingSoon &&
|
|
100731
|
-
saleInfo?.nextStage &&
|
|
100732
|
-
!isLoadingSaleInfo &&
|
|
100733
|
-
!saleInfo?.isSaleEnded && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'center', mt: '40px', flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Text, { sx: { fontSize: '20px', fontWeight: 'bold', mb: '20px' }, children: [saleInfo?.nextStage?.key === 'refund'
|
|
100734
|
-
? 'Refund Period '
|
|
100735
|
-
: saleInfo?.nextStage?.key === 'TGE'
|
|
100736
|
-
? 'TGE '
|
|
100737
|
-
: 'Stage ' + saleInfo?.nextStage?.stageNumber + ' ', "starts in:"] }), jsx$2(CountdownTimer, { targetTime: saleInfo?.nextStage?.startTime || 0 }), !(saleInfo?.nextStage?.key === 'refund' || saleInfo?.nextStage?.key === 'TGE') ? (jsxs(Fragment$1, { children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', mt: '30px' }, children: [address && (jsxs(Flex, { sx: {
|
|
100738
|
-
mr: '1rem',
|
|
100739
|
-
p: '10px',
|
|
100740
|
-
borderRadius: 'normal',
|
|
100741
|
-
background: 'white3',
|
|
100742
|
-
alignItems: 'center',
|
|
100743
|
-
}, children: [jsx$2(Flex, { sx: { mr: '10px' }, children: jsx$2(Svg, { icon: "wallet" }) }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400 }, children: [address?.slice(0, 4), "...", address?.slice(address?.length - 4, address?.length)] })] })), jsx$2(Flex, { sx: { fontSize: '18px', fontWeight: 500 }, children: "Are You Eligible?" })] }), !address ? (jsx$2(Flex, { sx: { my: '20px', width: '100%' }, children: jsx$2(ConnectButton, {}) })) : (whitelisted === null ||
|
|
100744
|
-
(whitelisted === undefined && !cbBTCBalanceChecked && (jsx$2(Button, { sx: { m: '20px', width: '100%' }, onClick: handleCheckEligibility, children: "CHECK ELIGIBILITY" }))))] }), whitelisted !== null && whitelisted !== undefined && (jsxs(Flex, { sx: {
|
|
100745
|
-
flexDirection: 'row',
|
|
100746
|
-
alignItems: 'center',
|
|
100747
|
-
mt: '20px',
|
|
100748
|
-
background: 'white2',
|
|
100749
|
-
p: '20px',
|
|
100750
|
-
m: '20px',
|
|
100751
|
-
borderRadius: 'normal',
|
|
100752
|
-
}, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are whitelisted for Stage ", whitelisted, " and beyond!"] }), jsxs(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 400, pl: '1rem' }, children: ["Tier ", whitelisted, " Access"] })] })), whitelisted === null && (jsx$2(Flex, { sx: {
|
|
100753
|
-
flexDirection: 'column',
|
|
100754
|
-
alignItems: 'center',
|
|
100755
|
-
gap: '10px',
|
|
100756
|
-
background: 'white2',
|
|
100757
|
-
p: '20px',
|
|
100758
|
-
m: '20px',
|
|
100759
|
-
borderRadius: 'normal',
|
|
100760
|
-
}, children: cbBTCBalanceChecked && (jsx$2(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px', mt: '10px' }, children: isCbBTCBalanceLoading ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Checking BTC balance across all chains..." })) : cbBTCBalance ? (jsxs(Fragment$1, { children: [cbBTCBalance.isEligible ? (addToWhitelistSuccess ? (jsx$2(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 700 }, children: "\u2713 Successfully added to whitelist! Please refresh to see your tier." })) : addToWhitelistError ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "Failed to add to whitelist. Please try again." })) : (jsx$2(Fragment$1, { children: jsx$2(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You ", jsx$2("span", { sx: { fontWeight: 700 }, children: "ARE" }), " eligible for the sale"] }) }) }))) : (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are ", jsx$2("span", { sx: { fontWeight: 700 }, children: "NOT" }), " eligible for the sale"] }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "You need at least 0.001 BTC to be whitelisted" })] })), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Total BTC Balance: ", cbBTCBalance.balance] }), cbBTCBalance.chainsWithBalance && cbBTCBalance.chainsWithBalance.length > 0 && (jsx$2(Flex, { sx: { flexDirection: 'column', gap: '5px', mt: '5px' }, children: cbBTCBalance.chainsWithBalance.map((chain) => (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', gap: '10px' }, children: [jsx$2(TokenImage, { symbol: chain.symbol, size: 25, chain: chain.chainId }), jsxs(Text, { sx: { fontSize: '10px', fontWeight: 400, opacity: 0.7 }, children: [chain.balance, " ", chain.symbol] })] }, chain.chainId))) })), cbBTCBalance.isEligible && (jsx$2(Button, { sx: { width: '100%' }, onClick: () => addToWhitelist(), disabled: isAddingToWhitelist, children: isAddingToWhitelist ? 'ADDING TO WHITELIST...' : 'ADD ME TO WHITELIST' }))] })) : (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Unable to fetch BTC balance. Please try again." })) })) }))] })) : (jsx$2(Fragment$1, {}))] })), !SDKConfig.bondsComingSoon && (jsx$2(Flex, { sx: {
|
|
100473
|
+
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), !SDKConfig.bondsComingSoon && (jsx$2(Flex, { sx: {
|
|
100761
100474
|
display: 'flex',
|
|
100762
100475
|
flexDirection: 'column',
|
|
100763
100476
|
alignItems: 'center',
|
|
100764
100477
|
justifyContent: 'center',
|
|
100765
100478
|
width: '100%',
|
|
100766
100479
|
p: '6%',
|
|
100767
|
-
}, children: jsx$2(Button, { sx: { width: '230px' }, onClick: () => (window.location.href = `${window.location.origin}/bonds`), children: "Start Bonding" }) })),
|
|
100768
|
-
width: '100%',
|
|
100769
|
-
alignItems: 'center',
|
|
100770
|
-
px: '12%',
|
|
100771
|
-
pt: (saleInfo?.isInBreakPeriod || currentStageSoldOut) && saleInfo?.nextStage ? '4rem' : '1rem',
|
|
100772
|
-
pb: '4rem',
|
|
100773
|
-
}, children: [jsx$2(StepBubble, { number: 1, title: 'STAGE 1', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 2, title: 'STAGE 2', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 3, title: 'REFUND', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 4, title: 'TGE', currentStep: currentStageNumber, loading: false, hideBar: true })] }), jsx$2(Divider, { sx: { width: '100%', height: '2px', backgroundColor: 'white2' } }), saleInfo?.isRefundPeriod ? (
|
|
100774
|
-
// Refund period - show refund view for ALL chains
|
|
100775
|
-
jsx$2(RefundView, {})) : userParticipated ? (
|
|
100480
|
+
}, children: jsx$2(Button, { sx: { width: '230px' }, onClick: () => (window.location.href = `${window.location.origin}/bonds`), children: "Start Bonding" }) })), userParticipated ? (
|
|
100776
100481
|
// Break period but user has participated - show their goo
|
|
100777
100482
|
jsx$2(Fragment$1, { children: jsx$2(YourGoo, { yourGoo: yourGoo, isLoading: isLoading, isFetching: isFetching }) })) : (jsx$2(Fragment$1, {}))] }));
|
|
100778
100483
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ChainId, Token } from '@ape.swap/apeswap-lists';
|
|
3
|
+
import { BondsData } from '../../types/bonds';
|
|
3
4
|
/**
|
|
4
5
|
* @param chainId this is the chainId of the outputToken
|
|
5
6
|
*/
|
|
@@ -8,6 +9,7 @@ interface ZapModalProps {
|
|
|
8
9
|
outputToken: Token;
|
|
9
10
|
chainId: ChainId;
|
|
10
11
|
account?: string;
|
|
12
|
+
bondData?: BondsData;
|
|
11
13
|
}
|
|
12
|
-
declare const ZapModal: ({ onDismiss, outputToken, account, chainId }: ZapModalProps) => React.JSX.Element;
|
|
14
|
+
declare const ZapModal: ({ onDismiss, outputToken, account, chainId, bondData }: ZapModalProps) => React.JSX.Element;
|
|
13
15
|
export default ZapModal;
|