@tokemak/queries 0.1.6 → 0.1.7
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/functions/getAutopoolHistory.d.ts +24 -0
- package/dist/functions/getAutopoolHistory.d.ts.map +1 -0
- package/dist/functions/getAutopoolUser.d.ts +166 -0
- package/dist/functions/getAutopoolUser.d.ts.map +1 -0
- package/dist/functions/getAutopoolUserActivity.d.ts +18 -0
- package/dist/functions/getAutopoolUserActivity.d.ts.map +1 -0
- package/dist/functions/getAutopoolUserHistory.d.ts +22 -0
- package/dist/functions/getAutopoolUserHistory.d.ts.map +1 -0
- package/dist/functions/getAutopools.d.ts +15 -15
- package/dist/functions/getChainAutopools.d.ts +15 -15
- package/dist/functions/getChainUserActivity.d.ts +2 -3
- package/dist/functions/getChainUserActivity.d.ts.map +1 -1
- package/dist/functions/getTokenPrices.d.ts +71 -71
- package/dist/functions/getUserAutopoolBalanceChanges.d.ts.map +1 -1
- package/dist/functions/getUserSushiLP.d.ts +1 -1
- package/dist/functions/index.d.ts +4 -0
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/index.js +813 -481
- package/dist/index.mjs +590 -258
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1127,13 +1127,74 @@ var getAutopoolsRebalances = async (chainId = 1) => {
|
|
|
1127
1127
|
return rebalances.flat().sort((a, b) => b.timestamp - a.timestamp);
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
|
+
// functions/getAutopoolDayData.ts
|
|
1131
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1132
|
+
import { formatEtherNum as formatEtherNum3 } from "@tokemak/utils";
|
|
1133
|
+
import { TOKEMAK_LAUNCH_TIMESTAMP } from "@tokemak/constants";
|
|
1134
|
+
import { getSdkByChainId as getSdkByChainId4 } from "@tokemak/graph-cli";
|
|
1135
|
+
var getAutopoolDayData = async (address, chainId = 1, startTimestamp = TOKEMAK_LAUNCH_TIMESTAMP) => {
|
|
1136
|
+
try {
|
|
1137
|
+
const { GetAutopoolDayData } = getSdkByChainId4(chainId);
|
|
1138
|
+
const { autopoolDayDatas } = await GetAutopoolDayData({
|
|
1139
|
+
address,
|
|
1140
|
+
timestamp: startTimestamp
|
|
1141
|
+
});
|
|
1142
|
+
const formattedDayDatas = autopoolDayDatas.map((autoPoolDayData) => {
|
|
1143
|
+
const navPerShare = autoPoolDayData.nav / autoPoolDayData.totalSupply;
|
|
1144
|
+
let baseApy = autoPoolDayData.autopoolApy;
|
|
1145
|
+
let rewarderApy = 0;
|
|
1146
|
+
const formattedRewarder7DayMAApy = formatEtherNum3(
|
|
1147
|
+
BigInt(Number(autoPoolDayData.rewarderDay7MAApy) || 0)
|
|
1148
|
+
);
|
|
1149
|
+
const formattedRewarder30DayMAApy = formatEtherNum3(
|
|
1150
|
+
BigInt(Number(autoPoolDayData.rewarderDay30MAApy) || 0)
|
|
1151
|
+
);
|
|
1152
|
+
if (formattedRewarder7DayMAApy) {
|
|
1153
|
+
rewarderApy = formattedRewarder7DayMAApy;
|
|
1154
|
+
}
|
|
1155
|
+
if (formattedRewarder30DayMAApy) {
|
|
1156
|
+
rewarderApy = formattedRewarder30DayMAApy;
|
|
1157
|
+
}
|
|
1158
|
+
if (!baseApy) {
|
|
1159
|
+
baseApy = 0;
|
|
1160
|
+
} else {
|
|
1161
|
+
baseApy = Number(
|
|
1162
|
+
formatUnits3(BigInt(baseApy), autoPoolDayData.baseAsset.decimals)
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1165
|
+
if (baseApy < 0) {
|
|
1166
|
+
baseApy = 0;
|
|
1167
|
+
}
|
|
1168
|
+
const combinedApy = rewarderApy + baseApy;
|
|
1169
|
+
return {
|
|
1170
|
+
...autoPoolDayData,
|
|
1171
|
+
navPerShare,
|
|
1172
|
+
rewarderApy,
|
|
1173
|
+
baseApy,
|
|
1174
|
+
combinedApy,
|
|
1175
|
+
date: new Date(Number(autoPoolDayData.timestamp) * 1e3)
|
|
1176
|
+
};
|
|
1177
|
+
});
|
|
1178
|
+
const filledDayDatas = fillMissingDates(formattedDayDatas);
|
|
1179
|
+
return filledDayDatas;
|
|
1180
|
+
} catch (e) {
|
|
1181
|
+
console.log(e);
|
|
1182
|
+
return [];
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
// functions/getAutopoolHistory.ts
|
|
1187
|
+
var getAutopoolHistory = async (autopool) => {
|
|
1188
|
+
return getAutopoolDayData(autopool.poolAddress, autopool.chain?.chainId);
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1130
1191
|
// functions/getAutopoolsHistory.ts
|
|
1131
1192
|
import { getAddress as getAddress3 } from "viem";
|
|
1132
1193
|
|
|
1133
1194
|
// functions/getAutopoolsDayData.ts
|
|
1134
|
-
import { getSdkByChainId as
|
|
1195
|
+
import { getSdkByChainId as getSdkByChainId5 } from "@tokemak/graph-cli";
|
|
1135
1196
|
var getAutopoolsDayData = async (chainId, timestamp) => {
|
|
1136
|
-
const { GetAutopoolsDayData } =
|
|
1197
|
+
const { GetAutopoolsDayData } = getSdkByChainId5(chainId);
|
|
1137
1198
|
const PAGE_SIZE = 1e3;
|
|
1138
1199
|
let allResults = [];
|
|
1139
1200
|
let hasMore = true;
|
|
@@ -1209,6 +1270,329 @@ var getAutopoolsHistory = async (autopools, days, includeTestnet = false) => {
|
|
|
1209
1270
|
}
|
|
1210
1271
|
};
|
|
1211
1272
|
|
|
1273
|
+
// functions/getAutopoolUser.ts
|
|
1274
|
+
import { erc20Abi } from "viem";
|
|
1275
|
+
import { readContract as readContract2, readContracts } from "@wagmi/core";
|
|
1276
|
+
import { autopoolEthAbi } from "@tokemak/abis";
|
|
1277
|
+
import {
|
|
1278
|
+
convertTimestampToDate as convertTimestampToDate2,
|
|
1279
|
+
formatEtherNum as formatEtherNum4,
|
|
1280
|
+
formatUnitsNum as formatUnitsNum2
|
|
1281
|
+
} from "@tokemak/utils";
|
|
1282
|
+
var getAutopoolUser = async (config, {
|
|
1283
|
+
autopool,
|
|
1284
|
+
address,
|
|
1285
|
+
userActivity,
|
|
1286
|
+
prices
|
|
1287
|
+
}) => {
|
|
1288
|
+
const autopoolContract = {
|
|
1289
|
+
address: autopool?.poolAddress,
|
|
1290
|
+
abi: autopoolEthAbi,
|
|
1291
|
+
chainId: autopool?.chain?.chainId
|
|
1292
|
+
};
|
|
1293
|
+
const [
|
|
1294
|
+
{ result: autopoolRewarderContract },
|
|
1295
|
+
{ result: unstakedPoolShares, error: unstakedPoolSharesError }
|
|
1296
|
+
] = await readContracts(config, {
|
|
1297
|
+
contracts: [
|
|
1298
|
+
{
|
|
1299
|
+
...autopoolContract,
|
|
1300
|
+
functionName: "rewarder",
|
|
1301
|
+
args: []
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
...autopoolContract,
|
|
1305
|
+
functionName: "balanceOf",
|
|
1306
|
+
args: [address]
|
|
1307
|
+
}
|
|
1308
|
+
]
|
|
1309
|
+
});
|
|
1310
|
+
if (!autopoolRewarderContract) {
|
|
1311
|
+
throw new Error("No rewarder contract found");
|
|
1312
|
+
}
|
|
1313
|
+
if (unstakedPoolSharesError) {
|
|
1314
|
+
throw new Error("Error fetching unstaked pool shares");
|
|
1315
|
+
}
|
|
1316
|
+
const stakedPoolShares = await readContract2(config, {
|
|
1317
|
+
address: autopoolRewarderContract,
|
|
1318
|
+
abi: erc20Abi,
|
|
1319
|
+
functionName: "balanceOf",
|
|
1320
|
+
args: [address],
|
|
1321
|
+
chainId: autopool?.chain?.chainId
|
|
1322
|
+
});
|
|
1323
|
+
const stakedShares = formatEtherNum4(stakedPoolShares);
|
|
1324
|
+
const staked = convertBaseAssetToTokenPricesAndDenom(
|
|
1325
|
+
stakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
1326
|
+
autopool?.baseAsset.price,
|
|
1327
|
+
autopool?.denomination.price,
|
|
1328
|
+
prices
|
|
1329
|
+
);
|
|
1330
|
+
const unstakedShares = formatEtherNum4(unstakedPoolShares || 0n);
|
|
1331
|
+
const unstaked = convertBaseAssetToTokenPricesAndDenom(
|
|
1332
|
+
unstakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
1333
|
+
autopool?.baseAsset.price,
|
|
1334
|
+
autopool?.denomination.price,
|
|
1335
|
+
prices
|
|
1336
|
+
);
|
|
1337
|
+
const shares = unstakedShares + stakedShares;
|
|
1338
|
+
const nav = convertBaseAssetToTokenPricesAndDenom(
|
|
1339
|
+
shares * (autopool?.navPerShare.baseAsset || 0),
|
|
1340
|
+
autopool?.baseAsset.price,
|
|
1341
|
+
autopool?.denomination.price,
|
|
1342
|
+
prices
|
|
1343
|
+
);
|
|
1344
|
+
const totalDeposits = convertBaseAssetToTokenPricesAndDenom(
|
|
1345
|
+
formatUnitsNum2(
|
|
1346
|
+
userActivity?.totals[autopool?.poolAddress]?.totalDeposits || 0n,
|
|
1347
|
+
autopool?.baseAsset.decimals
|
|
1348
|
+
),
|
|
1349
|
+
autopool?.baseAsset.price,
|
|
1350
|
+
autopool?.denomination.price,
|
|
1351
|
+
prices
|
|
1352
|
+
);
|
|
1353
|
+
const totalWithdrawals = convertBaseAssetToTokenPricesAndDenom(
|
|
1354
|
+
formatUnitsNum2(
|
|
1355
|
+
userActivity?.totals[autopool?.poolAddress]?.totalWithdrawals || 0n,
|
|
1356
|
+
autopool?.baseAsset.decimals
|
|
1357
|
+
),
|
|
1358
|
+
autopool?.baseAsset.price,
|
|
1359
|
+
autopool?.denomination.price,
|
|
1360
|
+
prices
|
|
1361
|
+
);
|
|
1362
|
+
const returns = convertBaseAssetToTokenPricesAndDenom(
|
|
1363
|
+
nav.baseAsset + totalWithdrawals.baseAsset - totalDeposits.baseAsset,
|
|
1364
|
+
autopool?.baseAsset.price,
|
|
1365
|
+
autopool?.denomination.price,
|
|
1366
|
+
prices
|
|
1367
|
+
);
|
|
1368
|
+
const supplied = convertBaseAssetToTokenPricesAndDenom(
|
|
1369
|
+
totalDeposits.baseAsset - totalWithdrawals.baseAsset,
|
|
1370
|
+
autopool?.baseAsset.price,
|
|
1371
|
+
autopool?.denomination.price,
|
|
1372
|
+
prices
|
|
1373
|
+
);
|
|
1374
|
+
const poolEvents = userActivity?.events.filter(
|
|
1375
|
+
(event) => event.vaultAddress === autopool?.poolAddress
|
|
1376
|
+
);
|
|
1377
|
+
let lastDeposit;
|
|
1378
|
+
if (poolEvents && poolEvents?.length > 0) {
|
|
1379
|
+
lastDeposit = convertTimestampToDate2(
|
|
1380
|
+
poolEvents[poolEvents.length - 1].timestamp
|
|
1381
|
+
).toLocaleDateString("en-US", {
|
|
1382
|
+
day: "2-digit",
|
|
1383
|
+
month: "short",
|
|
1384
|
+
year: "numeric"
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
return {
|
|
1388
|
+
symbol: autopool?.symbol,
|
|
1389
|
+
poolAddress: autopool?.poolAddress,
|
|
1390
|
+
userAddress: address,
|
|
1391
|
+
shares: {
|
|
1392
|
+
unstaked: unstakedShares,
|
|
1393
|
+
staked: stakedShares,
|
|
1394
|
+
total: shares
|
|
1395
|
+
},
|
|
1396
|
+
balance: {
|
|
1397
|
+
unstaked,
|
|
1398
|
+
staked,
|
|
1399
|
+
total: nav
|
|
1400
|
+
},
|
|
1401
|
+
returns,
|
|
1402
|
+
activity: {
|
|
1403
|
+
totalDeposits,
|
|
1404
|
+
totalWithdrawals,
|
|
1405
|
+
lastDeposit,
|
|
1406
|
+
supplied
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
// functions/getAutopoolUserActivity.ts
|
|
1412
|
+
import { getSdkByChainId as getSdkByChainId6 } from "@tokemak/graph-cli";
|
|
1413
|
+
import { formatUnitsNum as formatUnitsNum3 } from "@tokemak/utils";
|
|
1414
|
+
var getAutopoolUserActivity = async ({
|
|
1415
|
+
autopool,
|
|
1416
|
+
userAddress
|
|
1417
|
+
}) => {
|
|
1418
|
+
if (!autopool || !autopool.chain?.chainId) {
|
|
1419
|
+
throw new Error("Autopool not found");
|
|
1420
|
+
}
|
|
1421
|
+
const { GetUserAutopoolBalanceChangeHistory } = getSdkByChainId6(
|
|
1422
|
+
autopool.chain?.chainId
|
|
1423
|
+
);
|
|
1424
|
+
try {
|
|
1425
|
+
const userAutopoolBalanceChanges = await paginateQuery(
|
|
1426
|
+
(vars) => GetUserAutopoolBalanceChangeHistory({
|
|
1427
|
+
userAddress,
|
|
1428
|
+
vaultAddress: autopool.poolAddress,
|
|
1429
|
+
first: vars?.first || 1e3,
|
|
1430
|
+
skip: vars?.skip || 0
|
|
1431
|
+
}),
|
|
1432
|
+
"userSpecificAutopoolBalanceChanges",
|
|
1433
|
+
{
|
|
1434
|
+
first: 1e3,
|
|
1435
|
+
maxPages: 100
|
|
1436
|
+
}
|
|
1437
|
+
);
|
|
1438
|
+
let userActivityTotals = {};
|
|
1439
|
+
let events = [];
|
|
1440
|
+
userAutopoolBalanceChanges.forEach((activity) => {
|
|
1441
|
+
if (!userActivityTotals[activity.vaultAddress]) {
|
|
1442
|
+
userActivityTotals[activity.vaultAddress] = {
|
|
1443
|
+
totalDeposits: 0n,
|
|
1444
|
+
totalWithdrawals: 0n,
|
|
1445
|
+
totalStakes: 0n,
|
|
1446
|
+
totalUnstakes: 0n,
|
|
1447
|
+
chainId: autopool.chain?.chainId
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
activity.items.forEach((item) => {
|
|
1451
|
+
let eventType;
|
|
1452
|
+
if (item.staked && item.assetChange > 0n) {
|
|
1453
|
+
userActivityTotals[activity.vaultAddress].totalStakes += BigInt(
|
|
1454
|
+
item.assetChange
|
|
1455
|
+
);
|
|
1456
|
+
eventType = "Stake";
|
|
1457
|
+
} else if (item.staked && item.assetChange < 0n) {
|
|
1458
|
+
userActivityTotals[activity.vaultAddress].totalUnstakes += BigInt(
|
|
1459
|
+
BigInt(item.assetChange) * -1n
|
|
1460
|
+
);
|
|
1461
|
+
eventType = "Unstake";
|
|
1462
|
+
} else if (!item.staked && item.assetChange > 0n) {
|
|
1463
|
+
userActivityTotals[activity.vaultAddress].totalDeposits += BigInt(
|
|
1464
|
+
item.assetChange
|
|
1465
|
+
);
|
|
1466
|
+
eventType = "Deposit";
|
|
1467
|
+
} else if (!item.staked && item.assetChange < 0n) {
|
|
1468
|
+
userActivityTotals[activity.vaultAddress].totalWithdrawals += BigInt(
|
|
1469
|
+
BigInt(item.assetChange) * -1n
|
|
1470
|
+
);
|
|
1471
|
+
eventType = "Withdrawal";
|
|
1472
|
+
} else {
|
|
1473
|
+
eventType = "Unknown";
|
|
1474
|
+
}
|
|
1475
|
+
const netDeposits = formatUnitsNum3(
|
|
1476
|
+
userActivityTotals[activity.vaultAddress].totalDeposits - userActivityTotals[activity.vaultAddress].totalWithdrawals,
|
|
1477
|
+
autopool.baseAsset.decimals
|
|
1478
|
+
);
|
|
1479
|
+
if (!item.staked) {
|
|
1480
|
+
events.push({
|
|
1481
|
+
timestamp: activity.timestamp,
|
|
1482
|
+
shareChange: item.shareChange,
|
|
1483
|
+
assetChange: item.assetChange,
|
|
1484
|
+
vaultAddress: activity.vaultAddress,
|
|
1485
|
+
netDeposits,
|
|
1486
|
+
eventType
|
|
1487
|
+
// staked: item.staked,
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
});
|
|
1492
|
+
return { events, totals: userActivityTotals };
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
console.error(error);
|
|
1495
|
+
return [];
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
// functions/getAutopoolUserHistory.ts
|
|
1500
|
+
import { getSdkByChainId as getSdkByChainId7 } from "@tokemak/graph-cli";
|
|
1501
|
+
import { TOKEMAK_LAUNCH_TIMESTAMP as TOKEMAK_LAUNCH_TIMESTAMP2 } from "@tokemak/constants";
|
|
1502
|
+
import { base } from "viem/chains";
|
|
1503
|
+
import { formatEtherNum as formatEtherNum5, formatUnitsNum as formatUnitsNum4 } from "@tokemak/utils";
|
|
1504
|
+
var getAutopoolUserHistory = async ({
|
|
1505
|
+
userAddress,
|
|
1506
|
+
autopool,
|
|
1507
|
+
userActivity
|
|
1508
|
+
}) => {
|
|
1509
|
+
const { GetUserVaultDayData } = getSdkByChainId7(
|
|
1510
|
+
autopool?.chain?.chainId || base.id
|
|
1511
|
+
);
|
|
1512
|
+
try {
|
|
1513
|
+
if (userAddress) {
|
|
1514
|
+
const { userVaultDayDatas } = await GetUserVaultDayData({
|
|
1515
|
+
address: userAddress,
|
|
1516
|
+
timestamp: TOKEMAK_LAUNCH_TIMESTAMP2,
|
|
1517
|
+
vaultAddress: autopool?.poolAddress
|
|
1518
|
+
});
|
|
1519
|
+
const autopoolDayData = await getAutopoolHistory(autopool);
|
|
1520
|
+
if (!autopoolDayData) {
|
|
1521
|
+
throw new Error("No autopool history found");
|
|
1522
|
+
}
|
|
1523
|
+
const formattedUserVaultDayDatas = userVaultDayDatas.map((dayData) => {
|
|
1524
|
+
if (!dayData.timestamp) {
|
|
1525
|
+
throw new Error("Missing timestamp in userVaultDayData");
|
|
1526
|
+
}
|
|
1527
|
+
return {
|
|
1528
|
+
...dayData,
|
|
1529
|
+
date: new Date(Number(dayData.timestamp) * 1e3),
|
|
1530
|
+
timestamp: dayData.timestamp.toString()
|
|
1531
|
+
};
|
|
1532
|
+
});
|
|
1533
|
+
const filledMissingDates = fillMissingDates(formattedUserVaultDayDatas);
|
|
1534
|
+
if (filledMissingDates.length > 0) {
|
|
1535
|
+
const firstEntry = filledMissingDates[0];
|
|
1536
|
+
const dayBefore = new Date(firstEntry.date);
|
|
1537
|
+
dayBefore.setDate(dayBefore.getDate() - 1);
|
|
1538
|
+
const dayBeforeTimestamp = Math.floor(
|
|
1539
|
+
dayBefore.getTime() / 1e3
|
|
1540
|
+
).toString();
|
|
1541
|
+
const dayBeforeEntry = {
|
|
1542
|
+
...firstEntry,
|
|
1543
|
+
date: dayBefore,
|
|
1544
|
+
timestamp: dayBeforeTimestamp,
|
|
1545
|
+
totalShares: 0
|
|
1546
|
+
};
|
|
1547
|
+
filledMissingDates.unshift(dayBeforeEntry);
|
|
1548
|
+
}
|
|
1549
|
+
let lastKnownNetDeposits = null;
|
|
1550
|
+
const matchedData = filledMissingDates.map((userVaultDayData) => {
|
|
1551
|
+
const matchingAutopoolDayData = autopoolDayData.find(
|
|
1552
|
+
(autopoolDay) => autopoolDay.date.toDateString() === userVaultDayData.date.toDateString()
|
|
1553
|
+
);
|
|
1554
|
+
const userPortionOfVault = formatEtherNum5(userVaultDayData.totalShares) / formatEtherNum5(matchingAutopoolDayData?.totalSupply);
|
|
1555
|
+
const userNav = userPortionOfVault * formatUnitsNum4(
|
|
1556
|
+
BigInt(matchingAutopoolDayData?.nav || 0),
|
|
1557
|
+
autopool?.baseAsset.decimals
|
|
1558
|
+
);
|
|
1559
|
+
const eventsForDay = userActivity.events?.filter((event) => {
|
|
1560
|
+
const eventDate = new Date(Number(event.timestamp) * 1e3);
|
|
1561
|
+
const windowStart = new Date(userVaultDayData.date.getTime());
|
|
1562
|
+
const windowEnd = new Date(
|
|
1563
|
+
userVaultDayData.date.getTime() + 24 * 60 * 60 * 1e3
|
|
1564
|
+
);
|
|
1565
|
+
const matches = eventDate.getTime() > windowStart.getTime() && eventDate.getTime() <= windowEnd.getTime();
|
|
1566
|
+
return matches;
|
|
1567
|
+
});
|
|
1568
|
+
const lastEventForDay = eventsForDay && eventsForDay.length > 0 ? eventsForDay.sort(
|
|
1569
|
+
(a, b) => Number(b.timestamp) - Number(a.timestamp)
|
|
1570
|
+
)[0] : 0;
|
|
1571
|
+
let netDeposits = 0;
|
|
1572
|
+
if (lastEventForDay && "netDeposits" in lastEventForDay && typeof lastEventForDay.netDeposits === "number") {
|
|
1573
|
+
netDeposits = lastEventForDay.netDeposits;
|
|
1574
|
+
lastKnownNetDeposits = netDeposits;
|
|
1575
|
+
} else {
|
|
1576
|
+
netDeposits = lastKnownNetDeposits;
|
|
1577
|
+
}
|
|
1578
|
+
return {
|
|
1579
|
+
date: userVaultDayData.date,
|
|
1580
|
+
timestamp: userVaultDayData.timestamp,
|
|
1581
|
+
baseAsset: autopool?.baseAsset.symbol,
|
|
1582
|
+
nav: userNav,
|
|
1583
|
+
events: eventsForDay,
|
|
1584
|
+
netDeposits
|
|
1585
|
+
};
|
|
1586
|
+
});
|
|
1587
|
+
return matchedData;
|
|
1588
|
+
}
|
|
1589
|
+
return [];
|
|
1590
|
+
} catch (e) {
|
|
1591
|
+
console.error(e);
|
|
1592
|
+
return [];
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1212
1596
|
// functions/getCurveLP.ts
|
|
1213
1597
|
import { getMainnetConfig } from "@tokemak/config";
|
|
1214
1598
|
import { CURVE_API_URL, TOKE_CURVE_POOL_ID } from "@tokemak/constants";
|
|
@@ -1246,7 +1630,7 @@ var getCurveLP = async () => {
|
|
|
1246
1630
|
// functions/getSushiLP.ts
|
|
1247
1631
|
import { sushiPoolAbi } from "@tokemak/abis";
|
|
1248
1632
|
import { getMainnetConfig as getMainnetConfig2 } from "@tokemak/config";
|
|
1249
|
-
import { readContracts } from "@wagmi/core";
|
|
1633
|
+
import { readContracts as readContracts2 } from "@wagmi/core";
|
|
1250
1634
|
import { formatEther } from "viem";
|
|
1251
1635
|
import { mainnet } from "viem/chains";
|
|
1252
1636
|
var getSushiLP = async (wagmiConfig, { ethPrice }) => {
|
|
@@ -1256,7 +1640,7 @@ var getSushiLP = async (wagmiConfig, { ethPrice }) => {
|
|
|
1256
1640
|
abi: sushiPoolAbi
|
|
1257
1641
|
};
|
|
1258
1642
|
try {
|
|
1259
|
-
const [{ result: reserves }, { result: totalSupply }] = await
|
|
1643
|
+
const [{ result: reserves }, { result: totalSupply }] = await readContracts2(
|
|
1260
1644
|
wagmiConfig,
|
|
1261
1645
|
{
|
|
1262
1646
|
contracts: [
|
|
@@ -1298,8 +1682,8 @@ var getSushiLP = async (wagmiConfig, { ethPrice }) => {
|
|
|
1298
1682
|
};
|
|
1299
1683
|
|
|
1300
1684
|
// functions/getUniV4Pool.ts
|
|
1301
|
-
import { readContracts as
|
|
1302
|
-
import { formatUnits as
|
|
1685
|
+
import { readContracts as readContracts3 } from "@wagmi/core";
|
|
1686
|
+
import { formatUnits as formatUnits4, keccak256, encodeAbiParameters } from "viem";
|
|
1303
1687
|
import { mainnet as mainnet2 } from "viem/chains";
|
|
1304
1688
|
import {
|
|
1305
1689
|
UNISWAP_V4_POOL_MANAGER,
|
|
@@ -1326,7 +1710,7 @@ var stateViewAbi = [
|
|
|
1326
1710
|
type: "function"
|
|
1327
1711
|
}
|
|
1328
1712
|
];
|
|
1329
|
-
var
|
|
1713
|
+
var erc20Abi2 = [
|
|
1330
1714
|
{
|
|
1331
1715
|
inputs: [],
|
|
1332
1716
|
name: "decimals",
|
|
@@ -1409,7 +1793,7 @@ async function getUniV4Pool(wagmiConfig, {
|
|
|
1409
1793
|
const poolManager = UNISWAP_V4_POOL_MANAGER[chainId];
|
|
1410
1794
|
const poolId = computePoolId(poolKey);
|
|
1411
1795
|
try {
|
|
1412
|
-
const [{ result: slot0 }, { result: liquidity }] = await
|
|
1796
|
+
const [{ result: slot0 }, { result: liquidity }] = await readContracts3(
|
|
1413
1797
|
wagmiConfig,
|
|
1414
1798
|
{
|
|
1415
1799
|
contracts: [
|
|
@@ -1440,19 +1824,19 @@ async function getUniV4Pool(wagmiConfig, {
|
|
|
1440
1824
|
tokenContracts.push(
|
|
1441
1825
|
{
|
|
1442
1826
|
address: poolKey.currency0,
|
|
1443
|
-
abi:
|
|
1827
|
+
abi: erc20Abi2,
|
|
1444
1828
|
functionName: "decimals",
|
|
1445
1829
|
chainId
|
|
1446
1830
|
},
|
|
1447
1831
|
{
|
|
1448
1832
|
address: poolKey.currency0,
|
|
1449
|
-
abi:
|
|
1833
|
+
abi: erc20Abi2,
|
|
1450
1834
|
functionName: "symbol",
|
|
1451
1835
|
chainId
|
|
1452
1836
|
},
|
|
1453
1837
|
{
|
|
1454
1838
|
address: poolKey.currency0,
|
|
1455
|
-
abi:
|
|
1839
|
+
abi: erc20Abi2,
|
|
1456
1840
|
functionName: "balanceOf",
|
|
1457
1841
|
args: [poolManager],
|
|
1458
1842
|
chainId
|
|
@@ -1463,26 +1847,26 @@ async function getUniV4Pool(wagmiConfig, {
|
|
|
1463
1847
|
tokenContracts.push(
|
|
1464
1848
|
{
|
|
1465
1849
|
address: poolKey.currency1,
|
|
1466
|
-
abi:
|
|
1850
|
+
abi: erc20Abi2,
|
|
1467
1851
|
functionName: "decimals",
|
|
1468
1852
|
chainId
|
|
1469
1853
|
},
|
|
1470
1854
|
{
|
|
1471
1855
|
address: poolKey.currency1,
|
|
1472
|
-
abi:
|
|
1856
|
+
abi: erc20Abi2,
|
|
1473
1857
|
functionName: "symbol",
|
|
1474
1858
|
chainId
|
|
1475
1859
|
},
|
|
1476
1860
|
{
|
|
1477
1861
|
address: poolKey.currency1,
|
|
1478
|
-
abi:
|
|
1862
|
+
abi: erc20Abi2,
|
|
1479
1863
|
functionName: "balanceOf",
|
|
1480
1864
|
args: [poolManager],
|
|
1481
1865
|
chainId
|
|
1482
1866
|
}
|
|
1483
1867
|
);
|
|
1484
1868
|
}
|
|
1485
|
-
const tokenResults = tokenContracts.length > 0 ? await
|
|
1869
|
+
const tokenResults = tokenContracts.length > 0 ? await readContracts3(wagmiConfig, { contracts: tokenContracts }) : [];
|
|
1486
1870
|
let decimals0 = 18;
|
|
1487
1871
|
let symbol0 = "ETH";
|
|
1488
1872
|
let balance0 = 0n;
|
|
@@ -1502,8 +1886,8 @@ async function getUniV4Pool(wagmiConfig, {
|
|
|
1502
1886
|
}
|
|
1503
1887
|
const [sqrtPriceX96, tick] = slot0;
|
|
1504
1888
|
const price = sqrtPriceX96ToPrice(sqrtPriceX96, decimals0, decimals1);
|
|
1505
|
-
const balance0Formatted = Number(
|
|
1506
|
-
const balance1Formatted = Number(
|
|
1889
|
+
const balance0Formatted = Number(formatUnits4(balance0, decimals0));
|
|
1890
|
+
const balance1Formatted = Number(formatUnits4(balance1, decimals1));
|
|
1507
1891
|
const liquidityAmounts = calculateAmountsFromLiquidity(
|
|
1508
1892
|
liquidity ?? 0n,
|
|
1509
1893
|
sqrtPriceX96,
|
|
@@ -1587,7 +1971,7 @@ async function getUniV4PoolById(wagmiConfig, {
|
|
|
1587
1971
|
}
|
|
1588
1972
|
const poolManager = UNISWAP_V4_POOL_MANAGER[chainId];
|
|
1589
1973
|
try {
|
|
1590
|
-
const [{ result: slot0 }, { result: liquidity }] = await
|
|
1974
|
+
const [{ result: slot0 }, { result: liquidity }] = await readContracts3(
|
|
1591
1975
|
wagmiConfig,
|
|
1592
1976
|
{
|
|
1593
1977
|
contracts: [
|
|
@@ -1618,19 +2002,19 @@ async function getUniV4PoolById(wagmiConfig, {
|
|
|
1618
2002
|
tokenContracts.push(
|
|
1619
2003
|
{
|
|
1620
2004
|
address: currency0,
|
|
1621
|
-
abi:
|
|
2005
|
+
abi: erc20Abi2,
|
|
1622
2006
|
functionName: "decimals",
|
|
1623
2007
|
chainId
|
|
1624
2008
|
},
|
|
1625
2009
|
{
|
|
1626
2010
|
address: currency0,
|
|
1627
|
-
abi:
|
|
2011
|
+
abi: erc20Abi2,
|
|
1628
2012
|
functionName: "symbol",
|
|
1629
2013
|
chainId
|
|
1630
2014
|
},
|
|
1631
2015
|
{
|
|
1632
2016
|
address: currency0,
|
|
1633
|
-
abi:
|
|
2017
|
+
abi: erc20Abi2,
|
|
1634
2018
|
functionName: "balanceOf",
|
|
1635
2019
|
args: [poolManager],
|
|
1636
2020
|
chainId
|
|
@@ -1641,26 +2025,26 @@ async function getUniV4PoolById(wagmiConfig, {
|
|
|
1641
2025
|
tokenContracts.push(
|
|
1642
2026
|
{
|
|
1643
2027
|
address: currency1,
|
|
1644
|
-
abi:
|
|
2028
|
+
abi: erc20Abi2,
|
|
1645
2029
|
functionName: "decimals",
|
|
1646
2030
|
chainId
|
|
1647
2031
|
},
|
|
1648
2032
|
{
|
|
1649
2033
|
address: currency1,
|
|
1650
|
-
abi:
|
|
2034
|
+
abi: erc20Abi2,
|
|
1651
2035
|
functionName: "symbol",
|
|
1652
2036
|
chainId
|
|
1653
2037
|
},
|
|
1654
2038
|
{
|
|
1655
2039
|
address: currency1,
|
|
1656
|
-
abi:
|
|
2040
|
+
abi: erc20Abi2,
|
|
1657
2041
|
functionName: "balanceOf",
|
|
1658
2042
|
args: [poolManager],
|
|
1659
2043
|
chainId
|
|
1660
2044
|
}
|
|
1661
2045
|
);
|
|
1662
2046
|
}
|
|
1663
|
-
const tokenResults = tokenContracts.length > 0 ? await
|
|
2047
|
+
const tokenResults = tokenContracts.length > 0 ? await readContracts3(wagmiConfig, { contracts: tokenContracts }) : [];
|
|
1664
2048
|
let decimals0 = 18;
|
|
1665
2049
|
let symbol0 = "ETH";
|
|
1666
2050
|
let balance0 = 0n;
|
|
@@ -1680,8 +2064,8 @@ async function getUniV4PoolById(wagmiConfig, {
|
|
|
1680
2064
|
}
|
|
1681
2065
|
const [sqrtPriceX96, tick] = slot0;
|
|
1682
2066
|
const price = sqrtPriceX96ToPrice(sqrtPriceX96, decimals0, decimals1);
|
|
1683
|
-
const balance0Formatted = Number(
|
|
1684
|
-
const balance1Formatted = Number(
|
|
2067
|
+
const balance0Formatted = Number(formatUnits4(balance0, decimals0));
|
|
2068
|
+
const balance1Formatted = Number(formatUnits4(balance1, decimals1));
|
|
1685
2069
|
const liquidityAmounts = calculateAmountsFromLiquidity(
|
|
1686
2070
|
liquidity ?? 0n,
|
|
1687
2071
|
sqrtPriceX96,
|
|
@@ -1732,8 +2116,8 @@ async function getUniV4PoolById(wagmiConfig, {
|
|
|
1732
2116
|
}
|
|
1733
2117
|
|
|
1734
2118
|
// functions/getUserUniV4Positions.ts
|
|
1735
|
-
import { readContracts as
|
|
1736
|
-
import { formatUnits as
|
|
2119
|
+
import { readContracts as readContracts4 } from "@wagmi/core";
|
|
2120
|
+
import { formatUnits as formatUnits5 } from "viem";
|
|
1737
2121
|
import { mainnet as mainnet3 } from "viem/chains";
|
|
1738
2122
|
import { GraphQLClient, gql } from "graphql-request";
|
|
1739
2123
|
import {
|
|
@@ -1800,7 +2184,7 @@ var stateViewAbi2 = [
|
|
|
1800
2184
|
type: "function"
|
|
1801
2185
|
}
|
|
1802
2186
|
];
|
|
1803
|
-
var
|
|
2187
|
+
var erc20Abi3 = [
|
|
1804
2188
|
{
|
|
1805
2189
|
inputs: [],
|
|
1806
2190
|
name: "decimals",
|
|
@@ -1850,8 +2234,8 @@ function getTokenAmountsFromLiquidity(liquidity, sqrtPriceX96, tickLower, tickUp
|
|
|
1850
2234
|
amount1 = liquidity * (sqrtPriceX96 - sqrtPriceLower) / Q96;
|
|
1851
2235
|
}
|
|
1852
2236
|
return {
|
|
1853
|
-
amount0: Number(
|
|
1854
|
-
amount1: Number(
|
|
2237
|
+
amount0: Number(formatUnits5(amount0, token0Decimals)),
|
|
2238
|
+
amount1: Number(formatUnits5(amount1, token1Decimals))
|
|
1855
2239
|
};
|
|
1856
2240
|
}
|
|
1857
2241
|
function feeToTierString2(fee) {
|
|
@@ -1930,7 +2314,7 @@ async function getUserUniV4PositionsById(wagmiConfig, {
|
|
|
1930
2314
|
chainId
|
|
1931
2315
|
}
|
|
1932
2316
|
]);
|
|
1933
|
-
const positionResults = await
|
|
2317
|
+
const positionResults = await readContracts4(wagmiConfig, {
|
|
1934
2318
|
contracts: positionInfoCalls
|
|
1935
2319
|
});
|
|
1936
2320
|
const matchingPositions = [];
|
|
@@ -1980,13 +2364,13 @@ async function getUserUniV4PositionsById(wagmiConfig, {
|
|
|
1980
2364
|
...!isToken0Native ? [
|
|
1981
2365
|
{
|
|
1982
2366
|
address: currency0,
|
|
1983
|
-
abi:
|
|
2367
|
+
abi: erc20Abi3,
|
|
1984
2368
|
functionName: "decimals",
|
|
1985
2369
|
chainId
|
|
1986
2370
|
},
|
|
1987
2371
|
{
|
|
1988
2372
|
address: currency0,
|
|
1989
|
-
abi:
|
|
2373
|
+
abi: erc20Abi3,
|
|
1990
2374
|
functionName: "symbol",
|
|
1991
2375
|
chainId
|
|
1992
2376
|
}
|
|
@@ -1994,19 +2378,19 @@ async function getUserUniV4PositionsById(wagmiConfig, {
|
|
|
1994
2378
|
...!isToken1Native ? [
|
|
1995
2379
|
{
|
|
1996
2380
|
address: currency1,
|
|
1997
|
-
abi:
|
|
2381
|
+
abi: erc20Abi3,
|
|
1998
2382
|
functionName: "decimals",
|
|
1999
2383
|
chainId
|
|
2000
2384
|
},
|
|
2001
2385
|
{
|
|
2002
2386
|
address: currency1,
|
|
2003
|
-
abi:
|
|
2387
|
+
abi: erc20Abi3,
|
|
2004
2388
|
functionName: "symbol",
|
|
2005
2389
|
chainId
|
|
2006
2390
|
}
|
|
2007
2391
|
] : []
|
|
2008
2392
|
];
|
|
2009
|
-
const infoResults = await
|
|
2393
|
+
const infoResults = await readContracts4(wagmiConfig, {
|
|
2010
2394
|
contracts: infoCalls
|
|
2011
2395
|
});
|
|
2012
2396
|
const slot0 = infoResults[0]?.result;
|
|
@@ -2269,9 +2653,9 @@ async function getUserEthAutoLP(wagmiConfig, {
|
|
|
2269
2653
|
}
|
|
2270
2654
|
|
|
2271
2655
|
// functions/getChainUserActivity.ts
|
|
2272
|
-
import { getSdkByChainId as
|
|
2656
|
+
import { getSdkByChainId as getSdkByChainId8 } from "@tokemak/graph-cli";
|
|
2273
2657
|
var getChainUserActivity = async (address, chainId = 1) => {
|
|
2274
|
-
const { GetUserBalanceChangeHistory } =
|
|
2658
|
+
const { GetUserBalanceChangeHistory } = getSdkByChainId8(chainId);
|
|
2275
2659
|
try {
|
|
2276
2660
|
const userAutopoolBalanceChanges = await paginateQuery(
|
|
2277
2661
|
(vars) => GetUserBalanceChangeHistory({
|
|
@@ -2359,7 +2743,7 @@ var getRewardsPayloadV1 = async (cycleHash, account, rewardsV1Url) => {
|
|
|
2359
2743
|
|
|
2360
2744
|
// functions/getUserAutoEthRewards.ts
|
|
2361
2745
|
import { autoEthRewardsHashAbi } from "@tokemak/abis";
|
|
2362
|
-
import { readContract as
|
|
2746
|
+
import { readContract as readContract3 } from "@wagmi/core";
|
|
2363
2747
|
import { convertChainCycleToUnix, formatCurrency } from "@tokemak/utils";
|
|
2364
2748
|
var getAutoEthRewards = async (wagmiConfig, {
|
|
2365
2749
|
account,
|
|
@@ -2369,14 +2753,14 @@ var getAutoEthRewards = async (wagmiConfig, {
|
|
|
2369
2753
|
chainId
|
|
2370
2754
|
}) => {
|
|
2371
2755
|
try {
|
|
2372
|
-
const [, drippingHash] = await
|
|
2756
|
+
const [, drippingHash] = await readContract3(wagmiConfig, {
|
|
2373
2757
|
address: rewardsHash,
|
|
2374
2758
|
abi: autoEthRewardsHashAbi,
|
|
2375
2759
|
functionName: "cycleHashes",
|
|
2376
2760
|
args: [currentCycleIndex - 306n],
|
|
2377
2761
|
chainId
|
|
2378
2762
|
});
|
|
2379
|
-
const [, lastWeekHash] = await
|
|
2763
|
+
const [, lastWeekHash] = await readContract3(wagmiConfig, {
|
|
2380
2764
|
address: rewardsHash,
|
|
2381
2765
|
abi: autoEthRewardsHashAbi,
|
|
2382
2766
|
functionName: "cycleHashes",
|
|
@@ -2427,7 +2811,7 @@ var getUserAutoEthRewards = async (wagmiConfig, rewardsV1Url, rewardsHash, addre
|
|
|
2427
2811
|
|
|
2428
2812
|
// functions/getUserRewardsV1.ts
|
|
2429
2813
|
import { rewardsV1Abi, rewardsV1HashAbi } from "@tokemak/abis";
|
|
2430
|
-
import { readContract as
|
|
2814
|
+
import { readContract as readContract4 } from "@wagmi/core";
|
|
2431
2815
|
var getUserRewardsV1 = async (wagmiConfig, {
|
|
2432
2816
|
address,
|
|
2433
2817
|
rewardsCycleIndex,
|
|
@@ -2437,7 +2821,7 @@ var getUserRewardsV1 = async (wagmiConfig, {
|
|
|
2437
2821
|
chainId
|
|
2438
2822
|
}) => {
|
|
2439
2823
|
try {
|
|
2440
|
-
const [latestClaimableHash, cycleRewardsHash] = await
|
|
2824
|
+
const [latestClaimableHash, cycleRewardsHash] = await readContract4(
|
|
2441
2825
|
wagmiConfig,
|
|
2442
2826
|
{
|
|
2443
2827
|
address: rewardsV1Hash,
|
|
@@ -2461,7 +2845,7 @@ var getUserRewardsV1 = async (wagmiConfig, {
|
|
|
2461
2845
|
const {
|
|
2462
2846
|
payload: { chainId: payloadChainId, cycle, wallet, amount }
|
|
2463
2847
|
} = latestClaimablePayload;
|
|
2464
|
-
const claimable = await
|
|
2848
|
+
const claimable = await readContract4(wagmiConfig, {
|
|
2465
2849
|
address: rewardsV1,
|
|
2466
2850
|
abi: rewardsV1Abi,
|
|
2467
2851
|
functionName: "getClaimableAmount",
|
|
@@ -2478,7 +2862,7 @@ var getUserRewardsV1 = async (wagmiConfig, {
|
|
|
2478
2862
|
|
|
2479
2863
|
// functions/getUserV1.ts
|
|
2480
2864
|
import { rewardsV1Abi as rewardsV1Abi2, stakingV1Abi } from "@tokemak/abis";
|
|
2481
|
-
import { readContract as
|
|
2865
|
+
import { readContract as readContract5 } from "@wagmi/core";
|
|
2482
2866
|
import { getMainnetConfig as getMainnetConfig3 } from "@tokemak/config";
|
|
2483
2867
|
import { mainnet as mainnet6 } from "viem/chains";
|
|
2484
2868
|
var getUserV1 = async (wagmiConfig, {
|
|
@@ -2497,7 +2881,7 @@ var getUserV1 = async (wagmiConfig, {
|
|
|
2497
2881
|
missedTokeRewards
|
|
2498
2882
|
} = getMainnetConfig3(mainnet6.id);
|
|
2499
2883
|
try {
|
|
2500
|
-
const userStakedTokeV1 = await
|
|
2884
|
+
const userStakedTokeV1 = await readContract5(wagmiConfig, {
|
|
2501
2885
|
address: stakingV1,
|
|
2502
2886
|
abi: stakingV1Abi,
|
|
2503
2887
|
functionName: "availableForWithdrawal",
|
|
@@ -2529,7 +2913,7 @@ var getUserV1 = async (wagmiConfig, {
|
|
|
2529
2913
|
const cycle = autoEthGuardedRewardsPayload?.payload?.cycle;
|
|
2530
2914
|
const wallet = autoEthGuardedRewardsPayload?.payload?.wallet;
|
|
2531
2915
|
const amount = autoEthGuardedRewardsPayload?.payload?.amount;
|
|
2532
|
-
const claimableAutoEth = await
|
|
2916
|
+
const claimableAutoEth = await readContract5(wagmiConfig, {
|
|
2533
2917
|
address: autoEthGuardedRewards,
|
|
2534
2918
|
abi: rewardsV1Abi2,
|
|
2535
2919
|
functionName: "getClaimableAmount",
|
|
@@ -2553,7 +2937,7 @@ var getUserV1 = async (wagmiConfig, {
|
|
|
2553
2937
|
const {
|
|
2554
2938
|
payload: { chainId: payloadChainId2, cycle: cycle2, wallet: wallet2, amount: amount2 }
|
|
2555
2939
|
} = missedTokeRewardsPayload;
|
|
2556
|
-
claimableMissedToke = await
|
|
2940
|
+
claimableMissedToke = await readContract5(wagmiConfig, {
|
|
2557
2941
|
address: missedTokeRewards,
|
|
2558
2942
|
abi: rewardsV1Abi2,
|
|
2559
2943
|
functionName: "getClaimableAmount",
|
|
@@ -2584,18 +2968,18 @@ var getUserV1 = async (wagmiConfig, {
|
|
|
2584
2968
|
};
|
|
2585
2969
|
|
|
2586
2970
|
// functions/getChainUserAutopoolsHistory.tsx
|
|
2587
|
-
import { getSdkByChainId as
|
|
2588
|
-
import { TOKEMAK_LAUNCH_TIMESTAMP } from "@tokemak/constants";
|
|
2971
|
+
import { getSdkByChainId as getSdkByChainId9 } from "@tokemak/graph-cli";
|
|
2972
|
+
import { TOKEMAK_LAUNCH_TIMESTAMP as TOKEMAK_LAUNCH_TIMESTAMP3 } from "@tokemak/constants";
|
|
2589
2973
|
var getChainUserAutopoolsHistory = async ({
|
|
2590
2974
|
address,
|
|
2591
2975
|
chainId = 1
|
|
2592
2976
|
}) => {
|
|
2593
|
-
const { GetUserVaultsDayData } =
|
|
2977
|
+
const { GetUserVaultsDayData } = getSdkByChainId9(chainId);
|
|
2594
2978
|
try {
|
|
2595
2979
|
if (address) {
|
|
2596
2980
|
const { userVaultDayDatas } = await GetUserVaultsDayData({
|
|
2597
2981
|
address,
|
|
2598
|
-
timestamp:
|
|
2982
|
+
timestamp: TOKEMAK_LAUNCH_TIMESTAMP3
|
|
2599
2983
|
});
|
|
2600
2984
|
return userVaultDayDatas;
|
|
2601
2985
|
}
|
|
@@ -2609,25 +2993,25 @@ var getChainUserAutopoolsHistory = async ({
|
|
|
2609
2993
|
// functions/getUserAutopoolsHistory.ts
|
|
2610
2994
|
import {
|
|
2611
2995
|
formatDateToReadable as formatDateToReadable2,
|
|
2612
|
-
formatUnitsNum as
|
|
2996
|
+
formatUnitsNum as formatUnitsNum5
|
|
2613
2997
|
} from "@tokemak/utils";
|
|
2614
2998
|
|
|
2615
2999
|
// functions/getTokenValueDayDatas.ts
|
|
2616
3000
|
import { mainnet as mainnet7 } from "viem/chains";
|
|
2617
|
-
import { convertTimestampToDate as
|
|
2618
|
-
import { formatUnits as
|
|
2619
|
-
import { getSdkByChainId as
|
|
3001
|
+
import { convertTimestampToDate as convertTimestampToDate3 } from "@tokemak/utils";
|
|
3002
|
+
import { formatUnits as formatUnits6 } from "viem";
|
|
3003
|
+
import { getSdkByChainId as getSdkByChainId10 } from "@tokemak/graph-cli";
|
|
2620
3004
|
var getTokenValueDayDatas = async (tokenAddress, chainId = mainnet7.id) => {
|
|
2621
|
-
const { GetTokenValueDayDatas } =
|
|
3005
|
+
const { GetTokenValueDayDatas } = getSdkByChainId10(chainId);
|
|
2622
3006
|
try {
|
|
2623
3007
|
const { tokenValueDayDatas } = await GetTokenValueDayDatas({
|
|
2624
3008
|
tokenAddress: tokenAddress.toLowerCase()
|
|
2625
3009
|
});
|
|
2626
3010
|
const historicalPrice = tokenValueDayDatas.map((tokenValueDayData) => {
|
|
2627
|
-
const date =
|
|
3011
|
+
const date = convertTimestampToDate3(
|
|
2628
3012
|
tokenValueDayData.lastSnapshotTimestamp
|
|
2629
3013
|
);
|
|
2630
|
-
const usdPrice =
|
|
3014
|
+
const usdPrice = formatUnits6(tokenValueDayData.priceInUsd, 8);
|
|
2631
3015
|
return {
|
|
2632
3016
|
timestamp: Number(tokenValueDayData.lastSnapshotTimestamp),
|
|
2633
3017
|
date,
|
|
@@ -2907,7 +3291,7 @@ var getUserAutopoolsHistory = async (address, autopoolsHistory, events, includeT
|
|
|
2907
3291
|
Math.floor(sharesRatio * Number(SCALE))
|
|
2908
3292
|
);
|
|
2909
3293
|
const navBigInt = sharesRatioBigInt * BigInt(dayData.nav) / SCALE;
|
|
2910
|
-
const navNum =
|
|
3294
|
+
const navNum = formatUnitsNum5(
|
|
2911
3295
|
navBigInt,
|
|
2912
3296
|
dayData.baseAsset.decimals
|
|
2913
3297
|
);
|
|
@@ -3026,7 +3410,7 @@ var getUserAutopoolsHistory = async (address, autopoolsHistory, events, includeT
|
|
|
3026
3410
|
return sum;
|
|
3027
3411
|
}
|
|
3028
3412
|
const decimals = vault.baseAsset.decimals;
|
|
3029
|
-
const assetChangeNum =
|
|
3413
|
+
const assetChangeNum = formatUnitsNum5(
|
|
3030
3414
|
BigInt(event.assetChange || 0n),
|
|
3031
3415
|
decimals
|
|
3032
3416
|
);
|
|
@@ -3050,7 +3434,7 @@ var getUserAutopoolsHistory = async (address, autopoolsHistory, events, includeT
|
|
|
3050
3434
|
};
|
|
3051
3435
|
|
|
3052
3436
|
// functions/getUserSushiLP.ts
|
|
3053
|
-
import { readContracts as
|
|
3437
|
+
import { readContracts as readContracts5 } from "@wagmi/core";
|
|
3054
3438
|
import { poolV1Abi, sushiPoolAbi as sushiPoolAbi2 } from "@tokemak/abis";
|
|
3055
3439
|
import { getMainnetConfig as getMainnetConfig4 } from "@tokemak/config";
|
|
3056
3440
|
var getUserSushiLP = async (wagmiConfig, {
|
|
@@ -3067,7 +3451,7 @@ var getUserSushiLP = async (wagmiConfig, {
|
|
|
3067
3451
|
{ result: sushiLPBalance },
|
|
3068
3452
|
{ result: tSushiLPBalance },
|
|
3069
3453
|
{ result: tSushiLPRequested }
|
|
3070
|
-
] = await
|
|
3454
|
+
] = await readContracts5(wagmiConfig, {
|
|
3071
3455
|
contracts: [
|
|
3072
3456
|
{
|
|
3073
3457
|
address: sushiPool,
|
|
@@ -3095,7 +3479,7 @@ var getUserSushiLP = async (wagmiConfig, {
|
|
|
3095
3479
|
const [
|
|
3096
3480
|
{ result: startTSushiLPBalance },
|
|
3097
3481
|
{ result: startTSushiLPRequested }
|
|
3098
|
-
] = await
|
|
3482
|
+
] = await readContracts5(wagmiConfig, {
|
|
3099
3483
|
contracts: [
|
|
3100
3484
|
{
|
|
3101
3485
|
address: tSushiLP,
|
|
@@ -3149,7 +3533,7 @@ var getUserSushiLP = async (wagmiConfig, {
|
|
|
3149
3533
|
};
|
|
3150
3534
|
|
|
3151
3535
|
// functions/getUserCurveLP.ts
|
|
3152
|
-
import { readContracts as
|
|
3536
|
+
import { readContracts as readContracts6 } from "@wagmi/core";
|
|
3153
3537
|
import { poolV1Abi as poolV1Abi2 } from "@tokemak/abis";
|
|
3154
3538
|
import { getMainnetConfig as getMainnetConfig5 } from "@tokemak/config";
|
|
3155
3539
|
var getUserCurveLP = async (wagmiConfig, {
|
|
@@ -3160,7 +3544,7 @@ var getUserCurveLP = async (wagmiConfig, {
|
|
|
3160
3544
|
try {
|
|
3161
3545
|
const { curvePool, convexRewarder } = getMainnetConfig5();
|
|
3162
3546
|
if (address && curveLP && curvePool && convexRewarder) {
|
|
3163
|
-
const [{ result: userCurveLPBalance }, { result: userConvexLPBalance }] = await
|
|
3547
|
+
const [{ result: userCurveLPBalance }, { result: userConvexLPBalance }] = await readContracts6(wagmiConfig, {
|
|
3164
3548
|
contracts: [
|
|
3165
3549
|
{
|
|
3166
3550
|
address: curvePool,
|
|
@@ -3197,9 +3581,9 @@ var getUserCurveLP = async (wagmiConfig, {
|
|
|
3197
3581
|
};
|
|
3198
3582
|
|
|
3199
3583
|
// functions/getMultipleAutopoolRebalances.ts
|
|
3200
|
-
import { getSdkByChainId as
|
|
3584
|
+
import { getSdkByChainId as getSdkByChainId11 } from "@tokemak/graph-cli";
|
|
3201
3585
|
var getMutlipleAutopoolRebalances = async (ids, chainId = 1) => {
|
|
3202
|
-
const { GetMutlipleAutopoolRebalances } =
|
|
3586
|
+
const { GetMutlipleAutopoolRebalances } = getSdkByChainId11(chainId);
|
|
3203
3587
|
const { autopools } = await GetMutlipleAutopoolRebalances({
|
|
3204
3588
|
addresses: ids
|
|
3205
3589
|
});
|
|
@@ -3207,64 +3591,8 @@ var getMutlipleAutopoolRebalances = async (ids, chainId = 1) => {
|
|
|
3207
3591
|
return rebalances.flat().sort((a, b) => b.timestamp - a.timestamp);
|
|
3208
3592
|
};
|
|
3209
3593
|
|
|
3210
|
-
// functions/getAutopoolDayData.ts
|
|
3211
|
-
import { formatUnits as formatUnits6 } from "viem";
|
|
3212
|
-
import { formatEtherNum as formatEtherNum4 } from "@tokemak/utils";
|
|
3213
|
-
import { TOKEMAK_LAUNCH_TIMESTAMP as TOKEMAK_LAUNCH_TIMESTAMP2 } from "@tokemak/constants";
|
|
3214
|
-
import { getSdkByChainId as getSdkByChainId9 } from "@tokemak/graph-cli";
|
|
3215
|
-
var getAutopoolDayData = async (address, chainId = 1, startTimestamp = TOKEMAK_LAUNCH_TIMESTAMP2) => {
|
|
3216
|
-
try {
|
|
3217
|
-
const { GetAutopoolDayData } = getSdkByChainId9(chainId);
|
|
3218
|
-
const { autopoolDayDatas } = await GetAutopoolDayData({
|
|
3219
|
-
address,
|
|
3220
|
-
timestamp: startTimestamp
|
|
3221
|
-
});
|
|
3222
|
-
const formattedDayDatas = autopoolDayDatas.map((autoPoolDayData) => {
|
|
3223
|
-
const navPerShare = autoPoolDayData.nav / autoPoolDayData.totalSupply;
|
|
3224
|
-
let baseApy = autoPoolDayData.autopoolApy;
|
|
3225
|
-
let rewarderApy = 0;
|
|
3226
|
-
const formattedRewarder7DayMAApy = formatEtherNum4(
|
|
3227
|
-
BigInt(Number(autoPoolDayData.rewarderDay7MAApy) || 0)
|
|
3228
|
-
);
|
|
3229
|
-
const formattedRewarder30DayMAApy = formatEtherNum4(
|
|
3230
|
-
BigInt(Number(autoPoolDayData.rewarderDay30MAApy) || 0)
|
|
3231
|
-
);
|
|
3232
|
-
if (formattedRewarder7DayMAApy) {
|
|
3233
|
-
rewarderApy = formattedRewarder7DayMAApy;
|
|
3234
|
-
}
|
|
3235
|
-
if (formattedRewarder30DayMAApy) {
|
|
3236
|
-
rewarderApy = formattedRewarder30DayMAApy;
|
|
3237
|
-
}
|
|
3238
|
-
if (!baseApy) {
|
|
3239
|
-
baseApy = 0;
|
|
3240
|
-
} else {
|
|
3241
|
-
baseApy = Number(
|
|
3242
|
-
formatUnits6(BigInt(baseApy), autoPoolDayData.baseAsset.decimals)
|
|
3243
|
-
);
|
|
3244
|
-
}
|
|
3245
|
-
if (baseApy < 0) {
|
|
3246
|
-
baseApy = 0;
|
|
3247
|
-
}
|
|
3248
|
-
const combinedApy = rewarderApy + baseApy;
|
|
3249
|
-
return {
|
|
3250
|
-
...autoPoolDayData,
|
|
3251
|
-
navPerShare,
|
|
3252
|
-
rewarderApy,
|
|
3253
|
-
baseApy,
|
|
3254
|
-
combinedApy,
|
|
3255
|
-
date: new Date(Number(autoPoolDayData.timestamp) * 1e3)
|
|
3256
|
-
};
|
|
3257
|
-
});
|
|
3258
|
-
const filledDayDatas = fillMissingDates(formattedDayDatas);
|
|
3259
|
-
return filledDayDatas;
|
|
3260
|
-
} catch (e) {
|
|
3261
|
-
console.log(e);
|
|
3262
|
-
return [];
|
|
3263
|
-
}
|
|
3264
|
-
};
|
|
3265
|
-
|
|
3266
3594
|
// functions/getSystemConfig.ts
|
|
3267
|
-
import { readContracts as
|
|
3595
|
+
import { readContracts as readContracts7 } from "@wagmi/core";
|
|
3268
3596
|
import { systemRegistryAbi } from "@tokemak/abis";
|
|
3269
3597
|
var systemRegistryFunctionNames = [
|
|
3270
3598
|
"asyncSwapperRegistry",
|
|
@@ -3290,7 +3618,7 @@ var getSystemConfig = async (wagmiConfig, { systemRegistry }) => {
|
|
|
3290
3618
|
{ result: autopoolRouter },
|
|
3291
3619
|
{ result: autopoolRegistry },
|
|
3292
3620
|
{ result: swapRouter }
|
|
3293
|
-
] = await
|
|
3621
|
+
] = await readContracts7(wagmiConfig, {
|
|
3294
3622
|
contracts: systemRegistryCalls
|
|
3295
3623
|
});
|
|
3296
3624
|
return {
|
|
@@ -3305,12 +3633,12 @@ var getSystemConfig = async (wagmiConfig, { systemRegistry }) => {
|
|
|
3305
3633
|
};
|
|
3306
3634
|
|
|
3307
3635
|
// functions/getChainUserAutopools.tsx
|
|
3308
|
-
import { getSdkByChainId as
|
|
3636
|
+
import { getSdkByChainId as getSdkByChainId12 } from "@tokemak/graph-cli";
|
|
3309
3637
|
var getChainUserAutopools = async ({
|
|
3310
3638
|
address,
|
|
3311
3639
|
chainId = 1
|
|
3312
3640
|
}) => {
|
|
3313
|
-
const { GetUserVaultInfo } =
|
|
3641
|
+
const { GetUserVaultInfo } = getSdkByChainId12(chainId);
|
|
3314
3642
|
try {
|
|
3315
3643
|
if (address) {
|
|
3316
3644
|
const { userInfo } = await GetUserVaultInfo({
|
|
@@ -3327,17 +3655,17 @@ var getChainUserAutopools = async ({
|
|
|
3327
3655
|
|
|
3328
3656
|
// functions/getUserAutopools.ts
|
|
3329
3657
|
import {
|
|
3330
|
-
convertTimestampToDate as
|
|
3331
|
-
formatEtherNum as
|
|
3332
|
-
formatUnitsNum as
|
|
3658
|
+
convertTimestampToDate as convertTimestampToDate4,
|
|
3659
|
+
formatEtherNum as formatEtherNum8,
|
|
3660
|
+
formatUnitsNum as formatUnitsNum6
|
|
3333
3661
|
} from "@tokemak/utils";
|
|
3334
3662
|
import { ETH_TOKEN as ETH_TOKEN6 } from "@tokemak/tokenlist";
|
|
3335
3663
|
|
|
3336
3664
|
// functions/getUserAutopool.tsx
|
|
3337
|
-
import { erc20Abi as
|
|
3338
|
-
import { readContract as
|
|
3339
|
-
import { formatEtherNum as
|
|
3340
|
-
import { autopoolEthAbi } from "@tokemak/abis";
|
|
3665
|
+
import { erc20Abi as erc20Abi4 } from "viem";
|
|
3666
|
+
import { readContract as readContract6, readContracts as readContracts8 } from "@wagmi/core";
|
|
3667
|
+
import { formatEtherNum as formatEtherNum7 } from "@tokemak/utils";
|
|
3668
|
+
import { autopoolEthAbi as autopoolEthAbi2 } from "@tokemak/abis";
|
|
3341
3669
|
var getUserAutopool = async (wagmiConfig, {
|
|
3342
3670
|
address,
|
|
3343
3671
|
autopool
|
|
@@ -3346,14 +3674,14 @@ var getUserAutopool = async (wagmiConfig, {
|
|
|
3346
3674
|
if (autopool && address) {
|
|
3347
3675
|
const autopoolContract = {
|
|
3348
3676
|
address: autopool?.poolAddress,
|
|
3349
|
-
abi:
|
|
3677
|
+
abi: autopoolEthAbi2,
|
|
3350
3678
|
chainId: autopool?.chain?.chainId
|
|
3351
3679
|
};
|
|
3352
3680
|
const [
|
|
3353
3681
|
{ result: autopoolRewarderContract },
|
|
3354
3682
|
{ result: pastRewarders },
|
|
3355
3683
|
{ result: unstakedPoolShares, error: unstakedPoolSharesError }
|
|
3356
|
-
] = await
|
|
3684
|
+
] = await readContracts8(wagmiConfig, {
|
|
3357
3685
|
contracts: [
|
|
3358
3686
|
{
|
|
3359
3687
|
...autopoolContract,
|
|
@@ -3378,17 +3706,17 @@ var getUserAutopool = async (wagmiConfig, {
|
|
|
3378
3706
|
if (unstakedPoolSharesError) {
|
|
3379
3707
|
throw new Error("Error fetching unstaked pool shares");
|
|
3380
3708
|
}
|
|
3381
|
-
const stakedPoolShares = await
|
|
3709
|
+
const stakedPoolShares = await readContract6(wagmiConfig, {
|
|
3382
3710
|
address: autopoolRewarderContract,
|
|
3383
|
-
abi:
|
|
3711
|
+
abi: erc20Abi4,
|
|
3384
3712
|
functionName: "balanceOf",
|
|
3385
3713
|
args: [address],
|
|
3386
3714
|
chainId: autopool?.chain?.chainId
|
|
3387
3715
|
});
|
|
3388
|
-
const stakedShares =
|
|
3716
|
+
const stakedShares = formatEtherNum7(stakedPoolShares);
|
|
3389
3717
|
const stakedNav = stakedShares * (autopool?.navPerShare.baseAsset || 0);
|
|
3390
3718
|
const stakedNavUsd = stakedShares * (autopool?.navPerShare.USD || 0);
|
|
3391
|
-
const unstakedShares =
|
|
3719
|
+
const unstakedShares = formatEtherNum7(unstakedPoolShares || 0n);
|
|
3392
3720
|
const unstakedNav = unstakedShares * (autopool?.navPerShare.USD || 0);
|
|
3393
3721
|
const unstakedNavUsd = unstakedShares * (autopool?.navPerShare.USD || 0);
|
|
3394
3722
|
const totalShares = unstakedShares + stakedShares;
|
|
@@ -3399,17 +3727,17 @@ var getUserAutopool = async (wagmiConfig, {
|
|
|
3399
3727
|
if (pastRewarders && pastRewarders?.length > 0) {
|
|
3400
3728
|
const pastRewardBalances = pastRewarders.map((rewarder) => ({
|
|
3401
3729
|
address: rewarder,
|
|
3402
|
-
abi:
|
|
3730
|
+
abi: erc20Abi4,
|
|
3403
3731
|
functionName: "balanceOf",
|
|
3404
3732
|
args: [address],
|
|
3405
3733
|
chainId: autopool?.chain?.chainId
|
|
3406
3734
|
}));
|
|
3407
|
-
const pastRewards = await
|
|
3735
|
+
const pastRewards = await readContracts8(wagmiConfig, {
|
|
3408
3736
|
contracts: pastRewardBalances
|
|
3409
3737
|
});
|
|
3410
3738
|
pastRewarderBalances = pastRewards.map(({ result }, index) => {
|
|
3411
3739
|
const balance = result;
|
|
3412
|
-
const shares =
|
|
3740
|
+
const shares = formatEtherNum7(result);
|
|
3413
3741
|
const nav = shares * (autopool?.navPerShare.baseAsset || 0);
|
|
3414
3742
|
const navUsd = shares * (autopool?.navPerShare.USD || 0);
|
|
3415
3743
|
return {
|
|
@@ -3527,14 +3855,14 @@ var getUserAutopools = async ({
|
|
|
3527
3855
|
);
|
|
3528
3856
|
if (autopoolData) {
|
|
3529
3857
|
const isDOLA = autopoolData.symbol === "autoDOLA" && userAutoDOLA;
|
|
3530
|
-
const userShares = isDOLA ? userAutoDOLA?.totalShares :
|
|
3531
|
-
const totalVaultShares =
|
|
3858
|
+
const userShares = isDOLA ? userAutoDOLA?.totalShares : formatEtherNum8(userAutopool?.totalShares);
|
|
3859
|
+
const totalVaultShares = formatEtherNum8(autopoolData?.totalSupply);
|
|
3532
3860
|
const userShareOfVault = userShares / totalVaultShares;
|
|
3533
|
-
const totalDeposits =
|
|
3861
|
+
const totalDeposits = formatUnitsNum6(
|
|
3534
3862
|
userActivity?.totals[userAutopool.vaultAddress]?.totalDeposits || 0n,
|
|
3535
3863
|
autopoolData?.baseAsset.decimals
|
|
3536
3864
|
);
|
|
3537
|
-
const totalWithdrawals =
|
|
3865
|
+
const totalWithdrawals = formatUnitsNum6(
|
|
3538
3866
|
userActivity?.totals[userAutopool.vaultAddress]?.totalWithdrawals || 0n,
|
|
3539
3867
|
autopoolData?.baseAsset.decimals
|
|
3540
3868
|
);
|
|
@@ -3543,7 +3871,7 @@ var getUserAutopools = async ({
|
|
|
3543
3871
|
);
|
|
3544
3872
|
let lastDeposit;
|
|
3545
3873
|
if (poolEvents && poolEvents?.length > 0) {
|
|
3546
|
-
lastDeposit =
|
|
3874
|
+
lastDeposit = convertTimestampToDate4(
|
|
3547
3875
|
poolEvents[poolEvents.length - 1].timestamp
|
|
3548
3876
|
).toLocaleDateString("en-US", {
|
|
3549
3877
|
day: "2-digit",
|
|
@@ -3643,7 +3971,7 @@ var getUserAutopools = async ({
|
|
|
3643
3971
|
totalWithdrawals: prev.totalWithdrawals + totalWithdrawals
|
|
3644
3972
|
};
|
|
3645
3973
|
const stakedBalance = isDOLA ? userAutoDOLA?.staked.balance : BigInt(userAutopool?.stakedShares);
|
|
3646
|
-
const stakedShares = isDOLA ? userAutoDOLA?.staked.shares :
|
|
3974
|
+
const stakedShares = isDOLA ? userAutoDOLA?.staked.shares : formatEtherNum8(stakedBalance);
|
|
3647
3975
|
const stakedNav = stakedShares * (autopoolData?.navPerShare.baseAsset || 0);
|
|
3648
3976
|
const staked = convertBaseAssetToTokenPrices(
|
|
3649
3977
|
stakedNav,
|
|
@@ -3651,7 +3979,7 @@ var getUserAutopools = async ({
|
|
|
3651
3979
|
prices
|
|
3652
3980
|
);
|
|
3653
3981
|
const unstakedBalance = isDOLA ? userAutoDOLA?.unstaked.balance : BigInt(userAutopool?.walletShares);
|
|
3654
|
-
const unstakedShares = isDOLA ? userAutoDOLA?.unstaked.shares :
|
|
3982
|
+
const unstakedShares = isDOLA ? userAutoDOLA?.unstaked.shares : formatEtherNum8(unstakedBalance);
|
|
3655
3983
|
const unstakedNav = unstakedShares * (autopoolData?.navPerShare.baseAsset || 0);
|
|
3656
3984
|
const unstaked = convertBaseAssetToTokenPrices(
|
|
3657
3985
|
unstakedNav,
|
|
@@ -3844,12 +4172,12 @@ var getUserAutopools = async ({
|
|
|
3844
4172
|
|
|
3845
4173
|
// functions/getUserTokenBalances.ts
|
|
3846
4174
|
import { hexToBigInt } from "viem";
|
|
3847
|
-
import { base, mainnet as mainnet8, sonic as sonic2 } from "viem/chains";
|
|
4175
|
+
import { base as base2, mainnet as mainnet8, sonic as sonic2 } from "viem/chains";
|
|
3848
4176
|
var networkToAlchemyUrl = (chainId, apiKey) => {
|
|
3849
4177
|
switch (chainId) {
|
|
3850
4178
|
case mainnet8.id:
|
|
3851
4179
|
return `https://eth-mainnet.g.alchemy.com/v2/${apiKey}`;
|
|
3852
|
-
case
|
|
4180
|
+
case base2.id:
|
|
3853
4181
|
return `https://base-mainnet.g.alchemy.com/v2/${apiKey}`;
|
|
3854
4182
|
case sonic2.id:
|
|
3855
4183
|
return `https://sonic-mainnet.g.alchemy.com/v2/${apiKey}`;
|
|
@@ -3910,10 +4238,10 @@ var getTokenList = async () => {
|
|
|
3910
4238
|
};
|
|
3911
4239
|
|
|
3912
4240
|
// functions/getTopAutopoolHolders.ts
|
|
3913
|
-
import { getSdkByChainId as
|
|
4241
|
+
import { getSdkByChainId as getSdkByChainId13 } from "@tokemak/graph-cli";
|
|
3914
4242
|
var getTopAutopoolHolders = async (autopoolAddress, chainId = 1) => {
|
|
3915
4243
|
try {
|
|
3916
|
-
const { GetTopAutopoolHolders } =
|
|
4244
|
+
const { GetTopAutopoolHolders } = getSdkByChainId13(chainId);
|
|
3917
4245
|
const { holders } = await GetTopAutopoolHolders({
|
|
3918
4246
|
address: autopoolAddress
|
|
3919
4247
|
});
|
|
@@ -3925,17 +4253,17 @@ var getTopAutopoolHolders = async (autopoolAddress, chainId = 1) => {
|
|
|
3925
4253
|
};
|
|
3926
4254
|
|
|
3927
4255
|
// functions/getAllowance.ts
|
|
3928
|
-
import { readContract as
|
|
3929
|
-
import { erc20Abi as
|
|
4256
|
+
import { readContract as readContract7 } from "@wagmi/core";
|
|
4257
|
+
import { erc20Abi as erc20Abi5 } from "viem";
|
|
3930
4258
|
var getAllowance = async (wagmiConfig, {
|
|
3931
4259
|
token,
|
|
3932
4260
|
address,
|
|
3933
4261
|
spender
|
|
3934
4262
|
}) => {
|
|
3935
4263
|
try {
|
|
3936
|
-
const allowance = await
|
|
4264
|
+
const allowance = await readContract7(wagmiConfig, {
|
|
3937
4265
|
address: token,
|
|
3938
|
-
abi:
|
|
4266
|
+
abi: erc20Abi5,
|
|
3939
4267
|
functionName: "allowance",
|
|
3940
4268
|
args: [address || "0x0", spender]
|
|
3941
4269
|
});
|
|
@@ -3980,7 +4308,7 @@ import { getAddress as getAddress4 } from "viem";
|
|
|
3980
4308
|
|
|
3981
4309
|
// functions/getChainUserAutopoolsRewards.ts
|
|
3982
4310
|
import { getCoreConfig as getCoreConfig2 } from "@tokemak/config";
|
|
3983
|
-
import { readContract as
|
|
4311
|
+
import { readContract as readContract8 } from "@wagmi/core";
|
|
3984
4312
|
import { lensAbi as lensAbi2 } from "@tokemak/abis";
|
|
3985
4313
|
var getChainUserAutopoolsRewards = async (wagmiConfig, {
|
|
3986
4314
|
chainId,
|
|
@@ -3988,7 +4316,7 @@ var getChainUserAutopoolsRewards = async (wagmiConfig, {
|
|
|
3988
4316
|
}) => {
|
|
3989
4317
|
try {
|
|
3990
4318
|
const coreConfig = getCoreConfig2(chainId);
|
|
3991
|
-
const userRewardsInfo = await
|
|
4319
|
+
const userRewardsInfo = await readContract8(wagmiConfig, {
|
|
3992
4320
|
address: coreConfig.lens,
|
|
3993
4321
|
abi: lensAbi2,
|
|
3994
4322
|
functionName: "getUserRewardInfo",
|
|
@@ -4020,7 +4348,7 @@ var getChainUserAutopoolsRewards = async (wagmiConfig, {
|
|
|
4020
4348
|
};
|
|
4021
4349
|
|
|
4022
4350
|
// functions/getUserAutopoolsRewards.ts
|
|
4023
|
-
import { formatUnitsNum as
|
|
4351
|
+
import { formatUnitsNum as formatUnitsNum7, getToken as getToken2 } from "@tokemak/utils";
|
|
4024
4352
|
import { SILO_TOKEN as SILO_TOKEN2, TOKE_TOKEN as TOKE_TOKEN3 } from "@tokemak/tokenlist";
|
|
4025
4353
|
import { plasma } from "viem/chains";
|
|
4026
4354
|
var getUserAutopoolsRewards = async (wagmiConfig, {
|
|
@@ -4060,7 +4388,7 @@ var getUserAutopoolsRewards = async (wagmiConfig, {
|
|
|
4060
4388
|
if (rewarderToken.symbol === "XSILO") {
|
|
4061
4389
|
price = tokenPrices[SILO_TOKEN2.symbol] || 0;
|
|
4062
4390
|
}
|
|
4063
|
-
const formattedAmount =
|
|
4391
|
+
const formattedAmount = formatUnitsNum7(
|
|
4064
4392
|
claimableAmount,
|
|
4065
4393
|
rewarderToken.decimals || 18
|
|
4066
4394
|
);
|
|
@@ -4098,7 +4426,7 @@ var getUserAutopoolsRewards = async (wagmiConfig, {
|
|
|
4098
4426
|
if (tokenSymbol === "XSILO") {
|
|
4099
4427
|
price = tokenPrices[SILO_TOKEN2.symbol] || 0;
|
|
4100
4428
|
}
|
|
4101
|
-
const formattedAmount =
|
|
4429
|
+
const formattedAmount = formatUnitsNum7(amount, decimals || 18);
|
|
4102
4430
|
tokenRewards[tokenSymbol] = {
|
|
4103
4431
|
amount,
|
|
4104
4432
|
formattedAmount,
|
|
@@ -4178,7 +4506,7 @@ import {
|
|
|
4178
4506
|
import { TOKEMAK_SWAP_QUOTE_URL } from "@tokemak/constants";
|
|
4179
4507
|
|
|
4180
4508
|
// functions/getAddressFromSystemRegistry.ts
|
|
4181
|
-
import { readContract as
|
|
4509
|
+
import { readContract as readContract9 } from "@wagmi/core";
|
|
4182
4510
|
import { getCoreConfig as getCoreConfig3 } from "@tokemak/config";
|
|
4183
4511
|
import { systemRegistryAbi as systemRegistryAbi2 } from "@tokemak/abis";
|
|
4184
4512
|
var getAddressFromSystemRegistry = async (wagmiConfig, {
|
|
@@ -4186,7 +4514,7 @@ var getAddressFromSystemRegistry = async (wagmiConfig, {
|
|
|
4186
4514
|
functionName
|
|
4187
4515
|
}) => {
|
|
4188
4516
|
const { systemRegistry } = getCoreConfig3(chainId);
|
|
4189
|
-
return await
|
|
4517
|
+
return await readContract9(wagmiConfig, {
|
|
4190
4518
|
address: systemRegistry,
|
|
4191
4519
|
abi: systemRegistryAbi2,
|
|
4192
4520
|
functionName,
|
|
@@ -4246,8 +4574,8 @@ var getSwapQuote = async (config, { chainId, ...params }) => {
|
|
|
4246
4574
|
};
|
|
4247
4575
|
|
|
4248
4576
|
// functions/getDynamicSwap.ts
|
|
4249
|
-
import { getPublicClient, readContract as
|
|
4250
|
-
import { autopilotRouterAbi, autopoolEthAbi as
|
|
4577
|
+
import { getPublicClient, readContract as readContract10 } from "@wagmi/core";
|
|
4578
|
+
import { autopilotRouterAbi, autopoolEthAbi as autopoolEthAbi3 } from "@tokemak/abis";
|
|
4251
4579
|
import { getCoreConfig as getCoreConfig5 } from "@tokemak/config";
|
|
4252
4580
|
import { getLiquidations } from "@tokemak/autopilot-swap-route-calc";
|
|
4253
4581
|
import {
|
|
@@ -4342,9 +4670,9 @@ var getDynamicSwap = async ({
|
|
|
4342
4670
|
console.log(e);
|
|
4343
4671
|
}
|
|
4344
4672
|
}
|
|
4345
|
-
const previewRedeemOnChain = await
|
|
4673
|
+
const previewRedeemOnChain = await readContract10(config, {
|
|
4346
4674
|
address,
|
|
4347
|
-
abi:
|
|
4675
|
+
abi: autopoolEthAbi3,
|
|
4348
4676
|
functionName: "previewRedeem",
|
|
4349
4677
|
args: [amount],
|
|
4350
4678
|
chainId,
|
|
@@ -4364,8 +4692,8 @@ var getDynamicSwap = async ({
|
|
|
4364
4692
|
// functions/getAmountWithdrawn.ts
|
|
4365
4693
|
import { ETH_TOKEN as ETH_TOKEN8 } from "@tokemak/tokenlist";
|
|
4366
4694
|
import { getCoreConfig as getCoreConfig6 } from "@tokemak/config";
|
|
4367
|
-
import { readContract as
|
|
4368
|
-
import { autopoolEthAbi as
|
|
4695
|
+
import { readContract as readContract11 } from "@wagmi/core";
|
|
4696
|
+
import { autopoolEthAbi as autopoolEthAbi4 } from "@tokemak/abis";
|
|
4369
4697
|
var getAmountWithdrawn = async ({
|
|
4370
4698
|
address,
|
|
4371
4699
|
slippage,
|
|
@@ -4404,9 +4732,9 @@ var getAmountWithdrawn = async ({
|
|
|
4404
4732
|
const weth = getCoreConfig6(chainId).weth;
|
|
4405
4733
|
buyToken = weth;
|
|
4406
4734
|
}
|
|
4407
|
-
convertedAssets = await
|
|
4735
|
+
convertedAssets = await readContract11(config, {
|
|
4408
4736
|
address: autopool,
|
|
4409
|
-
abi:
|
|
4737
|
+
abi: autopoolEthAbi4,
|
|
4410
4738
|
functionName: "convertToAssets",
|
|
4411
4739
|
args: [amount],
|
|
4412
4740
|
chainId
|
|
@@ -4444,9 +4772,9 @@ var getAmountWithdrawn = async ({
|
|
|
4444
4772
|
};
|
|
4445
4773
|
|
|
4446
4774
|
// functions/getAmountDeposited.ts
|
|
4447
|
-
import { readContract as
|
|
4448
|
-
import { autopoolEthAbi as
|
|
4449
|
-
import { calculateMinAmountWithSlippage as calculateMinAmountWithSlippage2, formatEtherNum as
|
|
4775
|
+
import { readContract as readContract12 } from "@wagmi/core";
|
|
4776
|
+
import { autopoolEthAbi as autopoolEthAbi5 } from "@tokemak/abis";
|
|
4777
|
+
import { calculateMinAmountWithSlippage as calculateMinAmountWithSlippage2, formatEtherNum as formatEtherNum9 } from "@tokemak/utils";
|
|
4450
4778
|
var getAmountDeposited = async ({
|
|
4451
4779
|
address,
|
|
4452
4780
|
chainId,
|
|
@@ -4459,9 +4787,9 @@ var getAmountDeposited = async ({
|
|
|
4459
4787
|
if (!address || !chainId || !amount || typeof slippage !== "number") {
|
|
4460
4788
|
throw new Error("Invalid parameters");
|
|
4461
4789
|
}
|
|
4462
|
-
const previewDeposit = await
|
|
4790
|
+
const previewDeposit = await readContract12(config, {
|
|
4463
4791
|
address,
|
|
4464
|
-
abi:
|
|
4792
|
+
abi: autopoolEthAbi5,
|
|
4465
4793
|
functionName: "previewDeposit",
|
|
4466
4794
|
args: [amount],
|
|
4467
4795
|
chainId
|
|
@@ -4471,9 +4799,9 @@ var getAmountDeposited = async ({
|
|
|
4471
4799
|
previewDeposit,
|
|
4472
4800
|
slippage
|
|
4473
4801
|
);
|
|
4474
|
-
return
|
|
4802
|
+
return formatEtherNum9(minAmountWithSlippage);
|
|
4475
4803
|
} else {
|
|
4476
|
-
return
|
|
4804
|
+
return formatEtherNum9(previewDeposit);
|
|
4477
4805
|
}
|
|
4478
4806
|
} catch (e) {
|
|
4479
4807
|
console.error(e);
|
|
@@ -4483,7 +4811,7 @@ var getAmountDeposited = async ({
|
|
|
4483
4811
|
};
|
|
4484
4812
|
|
|
4485
4813
|
// functions/getBridgeFee.ts
|
|
4486
|
-
import { readContract as
|
|
4814
|
+
import { readContract as readContract13 } from "@wagmi/core";
|
|
4487
4815
|
import { layerZeroEndpointAbi, oftAdapterAbi } from "@tokemak/abis";
|
|
4488
4816
|
import { toHex } from "viem";
|
|
4489
4817
|
import { addressToBytes32 } from "@layerzerolabs/lz-v2-utilities";
|
|
@@ -4496,13 +4824,13 @@ var getBridgeFee = async (wagmiConfig, {
|
|
|
4496
4824
|
from
|
|
4497
4825
|
}) => {
|
|
4498
4826
|
try {
|
|
4499
|
-
const endpoint = await
|
|
4827
|
+
const endpoint = await readContract13(wagmiConfig, {
|
|
4500
4828
|
address: destAddress,
|
|
4501
4829
|
abi: oftAdapterAbi,
|
|
4502
4830
|
functionName: "endpoint",
|
|
4503
4831
|
chainId: destChainId
|
|
4504
4832
|
});
|
|
4505
|
-
const eid = await
|
|
4833
|
+
const eid = await readContract13(wagmiConfig, {
|
|
4506
4834
|
address: endpoint,
|
|
4507
4835
|
abi: layerZeroEndpointAbi,
|
|
4508
4836
|
functionName: "eid",
|
|
@@ -4520,7 +4848,7 @@ var getBridgeFee = async (wagmiConfig, {
|
|
|
4520
4848
|
composeMsg: "0x",
|
|
4521
4849
|
oftCmd: "0x"
|
|
4522
4850
|
};
|
|
4523
|
-
const feeQuote = await
|
|
4851
|
+
const feeQuote = await readContract13(wagmiConfig, {
|
|
4524
4852
|
address: sourceAddress,
|
|
4525
4853
|
abi: oftAdapterAbi,
|
|
4526
4854
|
functionName: "quoteSend",
|
|
@@ -4595,20 +4923,20 @@ import {
|
|
|
4595
4923
|
convertChainCycleToUnix as convertChainCycleToUnix2,
|
|
4596
4924
|
convertSecondsToRemainingTime,
|
|
4597
4925
|
formatCurrency as formatCurrency2,
|
|
4598
|
-
formatEtherNum as
|
|
4926
|
+
formatEtherNum as formatEtherNum10
|
|
4599
4927
|
} from "@tokemak/utils";
|
|
4600
|
-
import { readContracts as
|
|
4928
|
+
import { readContracts as readContracts9 } from "@wagmi/core";
|
|
4601
4929
|
import { formatEther as formatEther2 } from "viem";
|
|
4602
4930
|
import { sepolia as sepolia2 } from "viem/chains";
|
|
4603
4931
|
|
|
4604
4932
|
// functions/getCurrentCycleId.ts
|
|
4605
4933
|
import { accTokeV1Abi } from "@tokemak/abis";
|
|
4606
|
-
import { readContract as
|
|
4934
|
+
import { readContract as readContract14 } from "@wagmi/core";
|
|
4607
4935
|
var getCurrentCycleId = async (wagmiConfig, {
|
|
4608
4936
|
stoke,
|
|
4609
4937
|
chainId
|
|
4610
4938
|
}) => {
|
|
4611
|
-
return
|
|
4939
|
+
return readContract14(wagmiConfig, {
|
|
4612
4940
|
address: stoke,
|
|
4613
4941
|
abi: accTokeV1Abi,
|
|
4614
4942
|
chainId,
|
|
@@ -4617,7 +4945,7 @@ var getCurrentCycleId = async (wagmiConfig, {
|
|
|
4617
4945
|
};
|
|
4618
4946
|
|
|
4619
4947
|
// functions/getChainUserSToke.ts
|
|
4620
|
-
import { getSdkByChainId as
|
|
4948
|
+
import { getSdkByChainId as getSdkByChainId14 } from "@tokemak/graph-cli";
|
|
4621
4949
|
var getChainUserSToke = async (wagmiConfig, {
|
|
4622
4950
|
address,
|
|
4623
4951
|
tokePrice,
|
|
@@ -4627,7 +4955,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4627
4955
|
const { stoke } = getCoreConfig7(chainId);
|
|
4628
4956
|
const cycleIndex = await getCurrentCycleId(wagmiConfig, { chainId, stoke });
|
|
4629
4957
|
if (address && cycleIndex && stoke && tokePrice) {
|
|
4630
|
-
const { GetUserSTokeBalance } =
|
|
4958
|
+
const { GetUserSTokeBalance } = getSdkByChainId14(
|
|
4631
4959
|
chainId
|
|
4632
4960
|
);
|
|
4633
4961
|
const { accountBalanceV1S } = await GetUserSTokeBalance({
|
|
@@ -4642,7 +4970,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4642
4970
|
{ result: balance },
|
|
4643
4971
|
{ result: depositInfoResult },
|
|
4644
4972
|
{ result: withdrawalInfoResult }
|
|
4645
|
-
] = await
|
|
4973
|
+
] = await readContracts9(wagmiConfig, {
|
|
4646
4974
|
contracts: [
|
|
4647
4975
|
{
|
|
4648
4976
|
...stokeContract,
|
|
@@ -4673,7 +5001,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4673
5001
|
balanceExcludingWithdrawal = balanceExcludingWithdrawal - withdrawalAmount;
|
|
4674
5002
|
}
|
|
4675
5003
|
const withdrawalAmountUsd = formatCurrency2(
|
|
4676
|
-
|
|
5004
|
+
formatEtherNum10(withdrawalAmount) * tokePrice
|
|
4677
5005
|
);
|
|
4678
5006
|
const lockDuration = Number(depositLockDuration);
|
|
4679
5007
|
const lockCycle = Number(depositLockCycle);
|
|
@@ -4698,7 +5026,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4698
5026
|
Number(formatEther2(balanceExcludingWithdrawal)) * tokePrice
|
|
4699
5027
|
);
|
|
4700
5028
|
const balanceExcludingWithdrawalUsd = formatCurrency2(
|
|
4701
|
-
|
|
5029
|
+
formatEtherNum10(balanceExcludingWithdrawal) * tokePrice
|
|
4702
5030
|
);
|
|
4703
5031
|
const isUnlockRequestAvailable = currentCycle === withdrawAvailable;
|
|
4704
5032
|
const hasRequestedUnlock = withdrawalAmount > 0n;
|
|
@@ -4726,8 +5054,8 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4726
5054
|
unlockPeriodDateRangeArray,
|
|
4727
5055
|
chainId === sepolia2.id ? "time" : "date"
|
|
4728
5056
|
);
|
|
4729
|
-
const totalActiveUserCredits =
|
|
4730
|
-
const totalUserCredits =
|
|
5057
|
+
const totalActiveUserCredits = formatEtherNum10(balanceExcludingWithdrawal) * lockDurationInMonths;
|
|
5058
|
+
const totalUserCredits = formatEtherNum10(balance) * lockDurationInMonths;
|
|
4731
5059
|
return {
|
|
4732
5060
|
balance,
|
|
4733
5061
|
balanceUSD,
|
|
@@ -4754,7 +5082,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4754
5082
|
unlockRenewalDate,
|
|
4755
5083
|
lockDurationInMonths,
|
|
4756
5084
|
boost: lockDuration,
|
|
4757
|
-
points:
|
|
5085
|
+
points: formatEtherNum10(balanceExcludingWithdrawal) * lockDuration,
|
|
4758
5086
|
totalActiveCredits: totalActiveUserCredits,
|
|
4759
5087
|
totalCredits: totalUserCredits
|
|
4760
5088
|
};
|
|
@@ -4766,7 +5094,7 @@ var getChainUserSToke = async (wagmiConfig, {
|
|
|
4766
5094
|
};
|
|
4767
5095
|
|
|
4768
5096
|
// functions/getUserSToke.ts
|
|
4769
|
-
import { formatCurrency as formatCurrency3, formatEtherNum as
|
|
5097
|
+
import { formatCurrency as formatCurrency3, formatEtherNum as formatEtherNum11 } from "@tokemak/utils";
|
|
4770
5098
|
var getUserSToke = async (wagmiConfig, {
|
|
4771
5099
|
address,
|
|
4772
5100
|
tokePrice,
|
|
@@ -4793,7 +5121,7 @@ var getUserSToke = async (wagmiConfig, {
|
|
|
4793
5121
|
}
|
|
4794
5122
|
return acc;
|
|
4795
5123
|
}, 0n);
|
|
4796
|
-
const totalBalance =
|
|
5124
|
+
const totalBalance = formatEtherNum11(totalBalanceRaw || 0n);
|
|
4797
5125
|
const totalBalanceUsd = formatCurrency3(totalBalance * tokePrice);
|
|
4798
5126
|
const hasBalance = totalBalance > 0;
|
|
4799
5127
|
return {
|
|
@@ -4809,7 +5137,7 @@ var getUserSToke = async (wagmiConfig, {
|
|
|
4809
5137
|
|
|
4810
5138
|
// functions/getChainSToke.ts
|
|
4811
5139
|
import { formatEther as formatEther3 } from "viem";
|
|
4812
|
-
import { readContracts as
|
|
5140
|
+
import { readContracts as readContracts10 } from "@wagmi/core";
|
|
4813
5141
|
import { accTokeV1Abi as accTokeV1Abi3 } from "@tokemak/abis";
|
|
4814
5142
|
import {
|
|
4815
5143
|
convertChainCycleToUnix as convertChainCycleToUnix3,
|
|
@@ -4831,7 +5159,7 @@ var getChainSToke = async (wagmiConfig, {
|
|
|
4831
5159
|
chainId
|
|
4832
5160
|
};
|
|
4833
5161
|
if (stoke && tokePrice) {
|
|
4834
|
-
const [{ result: totalSupply }, { result: currentCycle }] = await
|
|
5162
|
+
const [{ result: totalSupply }, { result: currentCycle }] = await readContracts10(wagmiConfig, {
|
|
4835
5163
|
contracts: [
|
|
4836
5164
|
{
|
|
4837
5165
|
...baseConfig,
|
|
@@ -4903,7 +5231,7 @@ import { accTokeV1Abi as accTokeV1Abi4, managerV1Abi } from "@tokemak/abis";
|
|
|
4903
5231
|
import {
|
|
4904
5232
|
getBlockNumber,
|
|
4905
5233
|
getPublicClient as getPublicClient2,
|
|
4906
|
-
readContract as
|
|
5234
|
+
readContract as readContract15
|
|
4907
5235
|
} from "@wagmi/core";
|
|
4908
5236
|
var getChainCycleRolloverBlockNumber = async (wagmiConfig, {
|
|
4909
5237
|
stoke,
|
|
@@ -4917,7 +5245,7 @@ var getChainCycleRolloverBlockNumber = async (wagmiConfig, {
|
|
|
4917
5245
|
const blockNumber = await getBlockNumber(wagmiConfig, {
|
|
4918
5246
|
chainId
|
|
4919
5247
|
});
|
|
4920
|
-
const manager = await
|
|
5248
|
+
const manager = await readContract15(wagmiConfig, {
|
|
4921
5249
|
functionName: "manager",
|
|
4922
5250
|
address: stoke,
|
|
4923
5251
|
abi: accTokeV1Abi4,
|
|
@@ -4948,13 +5276,13 @@ var getChainCycleRolloverBlockNumber = async (wagmiConfig, {
|
|
|
4948
5276
|
// functions/getChainSTokeRewards.ts
|
|
4949
5277
|
import { AUTOPOOLS_WHITELIST_PROD as AUTOPOOLS_WHITELIST_PROD2 } from "@tokemak/config";
|
|
4950
5278
|
import { formatUnits as formatUnits8 } from "viem";
|
|
4951
|
-
import { formatEtherNum as
|
|
4952
|
-
import { getSdkByChainId as
|
|
5279
|
+
import { formatEtherNum as formatEtherNum12 } from "@tokemak/utils";
|
|
5280
|
+
import { getSdkByChainId as getSdkByChainId15 } from "@tokemak/graph-cli";
|
|
4953
5281
|
var getChainSTokeRewards = async ({
|
|
4954
5282
|
chainId
|
|
4955
5283
|
}) => {
|
|
4956
5284
|
try {
|
|
4957
|
-
const { GetSTokeRewards } =
|
|
5285
|
+
const { GetSTokeRewards } = getSdkByChainId15(chainId);
|
|
4958
5286
|
const { poolRewardsBalances } = await GetSTokeRewards();
|
|
4959
5287
|
const allPoolRewardsBalanceDayDatas = await paginateQuery(
|
|
4960
5288
|
GetSTokeRewards,
|
|
@@ -4972,9 +5300,9 @@ var getChainSTokeRewards = async ({
|
|
|
4972
5300
|
if (!whitelistedPools.includes(pool.id.toLowerCase())) {
|
|
4973
5301
|
continue;
|
|
4974
5302
|
}
|
|
4975
|
-
const convertedBalance =
|
|
5303
|
+
const convertedBalance = formatEtherNum12(pool.balance);
|
|
4976
5304
|
const convertedBalanceUSD = Number(formatUnits8(pool.balanceUSD, 8));
|
|
4977
|
-
const convertedApr =
|
|
5305
|
+
const convertedApr = formatEtherNum12(pool.currentAprPerCredit);
|
|
4978
5306
|
if (minApr === null || convertedApr < minApr) {
|
|
4979
5307
|
minApr = convertedApr;
|
|
4980
5308
|
}
|
|
@@ -5050,7 +5378,7 @@ import {
|
|
|
5050
5378
|
getCoreConfig as getCoreConfig9,
|
|
5051
5379
|
getMainnetConfig as getMainnetConfig6
|
|
5052
5380
|
} from "@tokemak/config";
|
|
5053
|
-
import { formatEtherNum as
|
|
5381
|
+
import { formatEtherNum as formatEtherNum13 } from "@tokemak/utils";
|
|
5054
5382
|
var getChainUserSTokeRewards = async (wagmiConfig, {
|
|
5055
5383
|
address,
|
|
5056
5384
|
chainId,
|
|
@@ -5101,14 +5429,14 @@ var getChainUserSTokeRewards = async (wagmiConfig, {
|
|
|
5101
5429
|
throw fallbackError;
|
|
5102
5430
|
}
|
|
5103
5431
|
}
|
|
5104
|
-
const claimableNum =
|
|
5432
|
+
const claimableNum = formatEtherNum13(tokeRewards?.claimable || 0n);
|
|
5105
5433
|
const claimableUsd = tokePrice * claimableNum;
|
|
5106
5434
|
const hasClaimable = claimableNum > 0n;
|
|
5107
|
-
const pendingRewards =
|
|
5435
|
+
const pendingRewards = formatEtherNum13(
|
|
5108
5436
|
tokeRewards?.rewardsPayload.breakdown?.totalRewardAmount || 0n
|
|
5109
5437
|
);
|
|
5110
5438
|
const pendingRewardsUsd = tokePrice * pendingRewards;
|
|
5111
|
-
const totalRewardsReceived =
|
|
5439
|
+
const totalRewardsReceived = formatEtherNum13(
|
|
5112
5440
|
tokeRewards.rewardsPayload.payload.amount || 0n
|
|
5113
5441
|
);
|
|
5114
5442
|
const totalRewardsReceivedUsd = tokePrice * totalRewardsReceived;
|
|
@@ -5125,11 +5453,11 @@ var getChainUserSTokeRewards = async (wagmiConfig, {
|
|
|
5125
5453
|
};
|
|
5126
5454
|
|
|
5127
5455
|
// functions/getChainSubgraphStatus.ts
|
|
5128
|
-
import { getSdkByChainId as
|
|
5456
|
+
import { getSdkByChainId as getSdkByChainId16 } from "@tokemak/graph-cli";
|
|
5129
5457
|
var getChainSubgraphStatus = async (chain) => {
|
|
5130
5458
|
const currentTimestamp = Math.floor(Date.now() / 1e3);
|
|
5131
5459
|
try {
|
|
5132
|
-
const { GetLatestSubgraphTimestamp } =
|
|
5460
|
+
const { GetLatestSubgraphTimestamp } = getSdkByChainId16(
|
|
5133
5461
|
chain.chainId
|
|
5134
5462
|
);
|
|
5135
5463
|
const { _meta } = await GetLatestSubgraphTimestamp();
|
|
@@ -5181,7 +5509,7 @@ var getSubgraphStatus = async (includeTestnet = false) => {
|
|
|
5181
5509
|
};
|
|
5182
5510
|
|
|
5183
5511
|
// functions/getCycleV1.ts
|
|
5184
|
-
import { readContract as
|
|
5512
|
+
import { readContract as readContract16 } from "@wagmi/core";
|
|
5185
5513
|
import { managerV1Abi as managerV1Abi2 } from "@tokemak/abis";
|
|
5186
5514
|
import { createPublicClient, http } from "viem";
|
|
5187
5515
|
import {
|
|
@@ -5203,7 +5531,7 @@ var getCycleV1 = async (wagmiConfig, {
|
|
|
5203
5531
|
const { managerV1 } = getMainnetConfig7();
|
|
5204
5532
|
try {
|
|
5205
5533
|
if (currentBlockNumber && managerV1) {
|
|
5206
|
-
const currentCycleIndex = await
|
|
5534
|
+
const currentCycleIndex = await readContract16(wagmiConfig, {
|
|
5207
5535
|
address: managerV1,
|
|
5208
5536
|
abi: managerV1Abi2,
|
|
5209
5537
|
functionName: "getCurrentCycleIndex",
|
|
@@ -5236,7 +5564,7 @@ var getCycleV1 = async (wagmiConfig, {
|
|
|
5236
5564
|
};
|
|
5237
5565
|
|
|
5238
5566
|
// functions/getProtocolStats.ts
|
|
5239
|
-
import { formatLargeNumber as formatLargeNumber3, formatTVL as formatTVL3, formatEtherNum as
|
|
5567
|
+
import { formatLargeNumber as formatLargeNumber3, formatTVL as formatTVL3, formatEtherNum as formatEtherNum14 } from "@tokemak/utils";
|
|
5240
5568
|
var getProtocolStats = async (autopools, stoke, sushiLP, sauto, EthAutoLP) => {
|
|
5241
5569
|
try {
|
|
5242
5570
|
if (!autopools || !stoke || !sushiLP) {
|
|
@@ -5281,7 +5609,7 @@ var getProtocolStats = async (autopools, stoke, sushiLP, sauto, EthAutoLP) => {
|
|
|
5281
5609
|
const totalDestinations = uniqueVaultAddresses.length;
|
|
5282
5610
|
const stakedTVL = {
|
|
5283
5611
|
totalSupply: formatLargeNumber3(
|
|
5284
|
-
|
|
5612
|
+
formatEtherNum14(
|
|
5285
5613
|
(sauto?.rawTotalSupply || 0n) + (stoke.rawTotalSupply || 0n)
|
|
5286
5614
|
)
|
|
5287
5615
|
),
|
|
@@ -5321,11 +5649,11 @@ var getProtocolStats = async (autopools, stoke, sushiLP, sauto, EthAutoLP) => {
|
|
|
5321
5649
|
};
|
|
5322
5650
|
|
|
5323
5651
|
// functions/getRebalanceStats.ts
|
|
5324
|
-
import { getSdkByChainId as
|
|
5652
|
+
import { getSdkByChainId as getSdkByChainId17 } from "@tokemak/graph-cli";
|
|
5325
5653
|
|
|
5326
5654
|
// functions/getEthPriceAtBlock.ts
|
|
5327
5655
|
import { getCoreConfig as getCoreConfig10 } from "@tokemak/config";
|
|
5328
|
-
import { readContract as
|
|
5656
|
+
import { readContract as readContract17 } from "@wagmi/core";
|
|
5329
5657
|
import { rootPriceOracleAbi } from "@tokemak/abis";
|
|
5330
5658
|
import { USDC_TOKEN as USDC_TOKEN2 } from "@tokemak/tokenlist";
|
|
5331
5659
|
var getEthPriceAtBlock = async (wagmiConfig, blockNumber, chainId) => {
|
|
@@ -5333,7 +5661,7 @@ var getEthPriceAtBlock = async (wagmiConfig, blockNumber, chainId) => {
|
|
|
5333
5661
|
const rootPriceOracle = config.rootPriceOracle;
|
|
5334
5662
|
const weth = config.weth;
|
|
5335
5663
|
const usdc = USDC_TOKEN2.extensions?.bridgeInfo?.[chainId]?.tokenAddress || USDC_TOKEN2.address;
|
|
5336
|
-
const priceAtBlock = await
|
|
5664
|
+
const priceAtBlock = await readContract17(wagmiConfig, {
|
|
5337
5665
|
address: rootPriceOracle,
|
|
5338
5666
|
abi: rootPriceOracleAbi,
|
|
5339
5667
|
functionName: "getPriceInQuote",
|
|
@@ -5345,12 +5673,12 @@ var getEthPriceAtBlock = async (wagmiConfig, blockNumber, chainId) => {
|
|
|
5345
5673
|
};
|
|
5346
5674
|
|
|
5347
5675
|
// functions/getRebalanceStats.ts
|
|
5348
|
-
import { formatEtherNum as
|
|
5676
|
+
import { formatEtherNum as formatEtherNum15, formatUnitsNum as formatUnitsNum8 } from "@tokemak/utils";
|
|
5349
5677
|
import { USDC_TOKEN as USDC_TOKEN3 } from "@tokemak/tokenlist";
|
|
5350
5678
|
import { sonic as sonic4 } from "viem/chains";
|
|
5351
5679
|
var BATCH_SIZE = 500;
|
|
5352
5680
|
var fetchChainRebalances = async (chainId) => {
|
|
5353
|
-
const { GetAllAutopoolRebalances } =
|
|
5681
|
+
const { GetAllAutopoolRebalances } = getSdkByChainId17(chainId);
|
|
5354
5682
|
const allRebalances = await paginateQuery(
|
|
5355
5683
|
GetAllAutopoolRebalances,
|
|
5356
5684
|
"autopoolRebalances"
|
|
@@ -5378,8 +5706,8 @@ var getRebalanceValueUsd = async (rebalance, chainId, wagmiConfig) => {
|
|
|
5378
5706
|
BigInt(rebalance.blockNumber),
|
|
5379
5707
|
chainId
|
|
5380
5708
|
);
|
|
5381
|
-
const ethUsd = Number(
|
|
5382
|
-
const ethAmt = Number(
|
|
5709
|
+
const ethUsd = Number(formatUnitsNum8(price, USDC_TOKEN3.decimals));
|
|
5710
|
+
const ethAmt = Number(formatEtherNum15(ethWei));
|
|
5383
5711
|
const usd = ethAmt * ethUsd;
|
|
5384
5712
|
return usd;
|
|
5385
5713
|
} catch (e) {
|
|
@@ -5390,7 +5718,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, wagmiConfig) => {
|
|
|
5390
5718
|
var processRebalance = async (rebalance, chainId, wagmiConfig) => {
|
|
5391
5719
|
const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
|
|
5392
5720
|
const baseAssetAmount = Number(
|
|
5393
|
-
|
|
5721
|
+
formatUnitsNum8(
|
|
5394
5722
|
BigInt(rebalance.tokenOutValueBaseAsset || "0"),
|
|
5395
5723
|
baseDecimals
|
|
5396
5724
|
)
|
|
@@ -5504,9 +5832,9 @@ import {
|
|
|
5504
5832
|
convertSecondsToRemainingTime as convertSecondsToRemainingTime4,
|
|
5505
5833
|
formatAmount,
|
|
5506
5834
|
formatCurrency as formatCurrency4,
|
|
5507
|
-
formatEtherNum as
|
|
5835
|
+
formatEtherNum as formatEtherNum16
|
|
5508
5836
|
} from "@tokemak/utils";
|
|
5509
|
-
import { readContracts as
|
|
5837
|
+
import { readContracts as readContracts11 } from "@wagmi/core";
|
|
5510
5838
|
import { formatEther as formatEther5 } from "viem";
|
|
5511
5839
|
import { mainnet as mainnet10 } from "viem/chains";
|
|
5512
5840
|
var getUserSAuto = async (wagmiConfig, {
|
|
@@ -5531,7 +5859,7 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5531
5859
|
{ result: depositInfoResult },
|
|
5532
5860
|
{ result: withdrawalInfoResult },
|
|
5533
5861
|
{ result: cycleIndex }
|
|
5534
|
-
] = await
|
|
5862
|
+
] = await readContracts11(wagmiConfig, {
|
|
5535
5863
|
contracts: [
|
|
5536
5864
|
{
|
|
5537
5865
|
...sAutoContract,
|
|
@@ -5568,7 +5896,7 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5568
5896
|
balanceExcludingWithdrawal = balanceExcludingWithdrawal - withdrawalAmount;
|
|
5569
5897
|
}
|
|
5570
5898
|
const withdrawalAmountUsd = formatCurrency4(
|
|
5571
|
-
|
|
5899
|
+
formatEtherNum16(withdrawalAmount) * autoPrice
|
|
5572
5900
|
);
|
|
5573
5901
|
const lockDuration = Number(depositLockDuration);
|
|
5574
5902
|
const lockCycle = Number(depositLockCycle);
|
|
@@ -5582,7 +5910,7 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5582
5910
|
Number(formatEther5(balanceExcludingWithdrawal)) * autoPrice
|
|
5583
5911
|
);
|
|
5584
5912
|
const balanceExcludingWithdrawalUsd = formatCurrency4(
|
|
5585
|
-
|
|
5913
|
+
formatEtherNum16(balanceExcludingWithdrawal) * autoPrice
|
|
5586
5914
|
);
|
|
5587
5915
|
const isUnlockRequestAvailable = currentCycle === withdrawAvailable;
|
|
5588
5916
|
const hasRequestedUnlock = withdrawalAmount > 0n;
|
|
@@ -5604,8 +5932,8 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5604
5932
|
unlockPeriodStartDate,
|
|
5605
5933
|
unlockRenewalDate
|
|
5606
5934
|
} = formatDateRange(unlockPeriodDateRangeArray, "date");
|
|
5607
|
-
const totalActiveUserCredits =
|
|
5608
|
-
const totalUserCredits =
|
|
5935
|
+
const totalActiveUserCredits = formatEtherNum16(balanceExcludingWithdrawal) * lockDurationInMonths;
|
|
5936
|
+
const totalUserCredits = formatEtherNum16(balance) * lockDurationInMonths;
|
|
5609
5937
|
const hasAddedLockedAuto = depositAmount > 0n;
|
|
5610
5938
|
const addedLockedAuto = depositAmount;
|
|
5611
5939
|
return {
|
|
@@ -5634,7 +5962,7 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5634
5962
|
unlockRenewalDate,
|
|
5635
5963
|
lockDurationInMonths,
|
|
5636
5964
|
boost: lockDuration,
|
|
5637
|
-
points:
|
|
5965
|
+
points: formatEtherNum16(balanceExcludingWithdrawal) * lockDuration,
|
|
5638
5966
|
totalActiveCredits: totalActiveUserCredits,
|
|
5639
5967
|
totalCredits: totalUserCredits,
|
|
5640
5968
|
hasBalance
|
|
@@ -5647,7 +5975,7 @@ var getUserSAuto = async (wagmiConfig, {
|
|
|
5647
5975
|
|
|
5648
5976
|
// functions/getSAuto.ts
|
|
5649
5977
|
import { formatEther as formatEther6 } from "viem";
|
|
5650
|
-
import { readContracts as
|
|
5978
|
+
import { readContracts as readContracts12 } from "@wagmi/core";
|
|
5651
5979
|
import { sAutoAbi as sAutoAbi2 } from "@tokemak/abis";
|
|
5652
5980
|
import {
|
|
5653
5981
|
convertAutoCycleToUnix as convertAutoCycleToUnix2,
|
|
@@ -5669,7 +5997,7 @@ var getSAuto = async (wagmiConfig, {
|
|
|
5669
5997
|
chainId
|
|
5670
5998
|
};
|
|
5671
5999
|
if (sAuto && autoPrice) {
|
|
5672
|
-
const [{ result: totalSupply }, { result: currentCycle }] = await
|
|
6000
|
+
const [{ result: totalSupply }, { result: currentCycle }] = await readContracts12(wagmiConfig, {
|
|
5673
6001
|
contracts: [
|
|
5674
6002
|
{
|
|
5675
6003
|
...baseConfig,
|
|
@@ -5702,22 +6030,22 @@ var getSAuto = async (wagmiConfig, {
|
|
|
5702
6030
|
// functions/getSAutoRewards.ts
|
|
5703
6031
|
import { formatUnits as formatUnits9 } from "viem";
|
|
5704
6032
|
import {
|
|
5705
|
-
convertTimestampToDate as
|
|
6033
|
+
convertTimestampToDate as convertTimestampToDate5,
|
|
5706
6034
|
formatDateToReadable as formatDateToReadable3,
|
|
5707
|
-
formatEtherNum as
|
|
6035
|
+
formatEtherNum as formatEtherNum17
|
|
5708
6036
|
} from "@tokemak/utils";
|
|
5709
|
-
import { getSdkByChainId as
|
|
6037
|
+
import { getSdkByChainId as getSdkByChainId18 } from "@tokemak/graph-cli";
|
|
5710
6038
|
import { mainnet as mainnet12 } from "viem/chains";
|
|
5711
6039
|
var getSAutoRewards = async () => {
|
|
5712
6040
|
try {
|
|
5713
|
-
const { GetSAutoRewards } =
|
|
6041
|
+
const { GetSAutoRewards } = getSdkByChainId18(mainnet12.id);
|
|
5714
6042
|
const { globalRewardsBalances } = await GetSAutoRewards();
|
|
5715
6043
|
const allGlobalRewardsBalanceDayDatas = await paginateQuery(
|
|
5716
6044
|
GetSAutoRewards,
|
|
5717
6045
|
"globalRewardsBalanceDayDatas"
|
|
5718
6046
|
);
|
|
5719
6047
|
const totalEarnings = globalRewardsBalances.reduce((acc, balance) => {
|
|
5720
|
-
return acc +
|
|
6048
|
+
return acc + formatEtherNum17(balance.balance);
|
|
5721
6049
|
}, 0);
|
|
5722
6050
|
const totalEarningsUsd = globalRewardsBalances.reduce((acc, balance) => {
|
|
5723
6051
|
return acc + Number(formatUnits9(balance.balanceUSD, 8));
|
|
@@ -5725,13 +6053,13 @@ var getSAutoRewards = async () => {
|
|
|
5725
6053
|
const historicalRewards = allGlobalRewardsBalanceDayDatas.map(
|
|
5726
6054
|
(dayData) => ({
|
|
5727
6055
|
timestamp: String(dayData.timestamp),
|
|
5728
|
-
balance:
|
|
6056
|
+
balance: formatEtherNum17(dayData.balance),
|
|
5729
6057
|
balanceUSD: Number(formatUnits9(dayData.balanceUSD, 8)),
|
|
5730
|
-
earned:
|
|
6058
|
+
earned: formatEtherNum17(dayData.earned),
|
|
5731
6059
|
earnedUSD: Number(formatUnits9(dayData.earnedUSD, 8)),
|
|
5732
|
-
dayAprPerCredit:
|
|
6060
|
+
dayAprPerCredit: formatEtherNum17(dayData.dayAprPerCredit),
|
|
5733
6061
|
formattedDate: formatDateToReadable3(
|
|
5734
|
-
|
|
6062
|
+
convertTimestampToDate5(Number(dayData.timestamp))
|
|
5735
6063
|
)
|
|
5736
6064
|
})
|
|
5737
6065
|
);
|
|
@@ -5748,7 +6076,7 @@ var getSAutoRewards = async () => {
|
|
|
5748
6076
|
|
|
5749
6077
|
// functions/getUserSAutoRewards.ts
|
|
5750
6078
|
import { getMainnetConfig as getMainnetConfig10 } from "@tokemak/config";
|
|
5751
|
-
import { formatEtherNum as
|
|
6079
|
+
import { formatEtherNum as formatEtherNum18 } from "@tokemak/utils";
|
|
5752
6080
|
var getUserSAutoRewards = async (wagmiConfig, { address, autoPrice }) => {
|
|
5753
6081
|
const { rewardsV1Url, sAutoRewardsHash, sAutoRewards, sAuto } = getMainnetConfig10();
|
|
5754
6082
|
const currentCycle = await getCurrentCycleId(wagmiConfig, {
|
|
@@ -5794,19 +6122,19 @@ var getUserSAutoRewards = async (wagmiConfig, { address, autoPrice }) => {
|
|
|
5794
6122
|
return null;
|
|
5795
6123
|
}
|
|
5796
6124
|
}
|
|
5797
|
-
const claimableNum =
|
|
6125
|
+
const claimableNum = formatEtherNum18(autoRewards?.claimable || 0n);
|
|
5798
6126
|
const claimableUsd = autoPrice * claimableNum;
|
|
5799
6127
|
const hasClaimable = claimableNum > 0;
|
|
5800
|
-
let pendingRewards =
|
|
6128
|
+
let pendingRewards = formatEtherNum18(
|
|
5801
6129
|
autoRewards?.rewardsPayload.breakdown?.totalRewardAmount || 0n
|
|
5802
6130
|
);
|
|
5803
6131
|
if (currentCycle === 4242n) {
|
|
5804
|
-
pendingRewards =
|
|
6132
|
+
pendingRewards = formatEtherNum18(
|
|
5805
6133
|
autoRewards?.rewardsPayload.payload.amount || 0n
|
|
5806
6134
|
);
|
|
5807
6135
|
}
|
|
5808
6136
|
const pendingRewardsUsd = autoPrice * pendingRewards;
|
|
5809
|
-
const totalRewardsReceived =
|
|
6137
|
+
const totalRewardsReceived = formatEtherNum18(
|
|
5810
6138
|
autoRewards.rewardsPayload.payload.amount || 0n
|
|
5811
6139
|
);
|
|
5812
6140
|
const totalRewardsReceivedUsd = autoPrice * totalRewardsReceived;
|
|
@@ -5841,7 +6169,7 @@ var getUserMerklRewards = async (address) => {
|
|
|
5841
6169
|
|
|
5842
6170
|
// functions/getUserEthAutoLPRewards.ts
|
|
5843
6171
|
import { getAddress as getAddress5 } from "viem";
|
|
5844
|
-
import { formatAmount as formatAmount2, formatUnitsNum as
|
|
6172
|
+
import { formatAmount as formatAmount2, formatUnitsNum as formatUnitsNum9 } from "@tokemak/utils";
|
|
5845
6173
|
import {
|
|
5846
6174
|
TOKE_TOKEN as TOKE_TOKEN4
|
|
5847
6175
|
} from "@tokemak/tokenlist";
|
|
@@ -5855,7 +6183,7 @@ var getUserEthAutoLPRewards = async (address) => {
|
|
|
5855
6183
|
const claimed = autoRewards?.claimed;
|
|
5856
6184
|
const claimable = Number(amount) - Number(claimed);
|
|
5857
6185
|
const formattedClaimable = formatAmount2(
|
|
5858
|
-
|
|
6186
|
+
formatUnitsNum9(BigInt(claimable || 0), 18)
|
|
5859
6187
|
);
|
|
5860
6188
|
const users = [];
|
|
5861
6189
|
const tokens = [];
|
|
@@ -5907,12 +6235,12 @@ async function getMerklPoolApr({
|
|
|
5907
6235
|
}
|
|
5908
6236
|
|
|
5909
6237
|
// functions/getSAutoApr.ts
|
|
5910
|
-
import { getSdkByChainId as
|
|
6238
|
+
import { getSdkByChainId as getSdkByChainId19 } from "@tokemak/graph-cli";
|
|
5911
6239
|
import { mainnet as mainnet13 } from "viem/chains";
|
|
5912
|
-
import { formatEtherNum as
|
|
6240
|
+
import { formatEtherNum as formatEtherNum19, formatPercent } from "@tokemak/utils";
|
|
5913
6241
|
var getSAutoApr = async () => {
|
|
5914
6242
|
try {
|
|
5915
|
-
const { GetSAutoApr } =
|
|
6243
|
+
const { GetSAutoApr } = getSdkByChainId19(mainnet13.id);
|
|
5916
6244
|
const { globalRewardsBalances } = await GetSAutoApr();
|
|
5917
6245
|
if (!globalRewardsBalances || globalRewardsBalances.length === 0) {
|
|
5918
6246
|
return {
|
|
@@ -5928,7 +6256,7 @@ var getSAutoApr = async () => {
|
|
|
5928
6256
|
aprFormatted: void 0
|
|
5929
6257
|
};
|
|
5930
6258
|
}
|
|
5931
|
-
const aprPerCredit =
|
|
6259
|
+
const aprPerCredit = formatEtherNum19(rawApr);
|
|
5932
6260
|
const lockDuration = 16;
|
|
5933
6261
|
const apr = aprPerCredit * lockDuration;
|
|
5934
6262
|
return {
|
|
@@ -6019,8 +6347,12 @@ export {
|
|
|
6019
6347
|
getAutopilotRouter,
|
|
6020
6348
|
getAutopoolCategory,
|
|
6021
6349
|
getAutopoolDayData,
|
|
6350
|
+
getAutopoolHistory,
|
|
6022
6351
|
getAutopoolInfo,
|
|
6023
6352
|
getAutopoolRebalances,
|
|
6353
|
+
getAutopoolUser,
|
|
6354
|
+
getAutopoolUserActivity,
|
|
6355
|
+
getAutopoolUserHistory,
|
|
6024
6356
|
getAutopools,
|
|
6025
6357
|
getAutopoolsHistory,
|
|
6026
6358
|
getAutopoolsRebalances,
|