@tokemak/queries 0.0.13 → 0.0.15
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/index.cjs +216 -0
- package/dist/index.d.ts +238 -70
- package/dist/index.js +218 -0
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -3144,6 +3144,8 @@ __export(queries_exports, {
|
|
|
3144
3144
|
getAutopoolDayData: () => getAutopoolDayData,
|
|
3145
3145
|
getAutopoolInfo: () => getAutopoolInfo,
|
|
3146
3146
|
getAutopoolRebalances: () => getAutopoolRebalances,
|
|
3147
|
+
getAutopoolUser: () => getAutopoolUser,
|
|
3148
|
+
getAutopoolUserActivity: () => getAutopoolUserActivity,
|
|
3147
3149
|
getAutopools: () => getAutopools,
|
|
3148
3150
|
getAutopoolsHistory: () => getAutopoolsHistory,
|
|
3149
3151
|
getAutopoolsRebalances: () => getAutopoolsRebalances,
|
|
@@ -8589,6 +8591,218 @@ var updateRebalanceStats = async (wagmiConfig, {
|
|
|
8589
8591
|
const allRebalances = [...currentRebalances, ...allNewRebalances];
|
|
8590
8592
|
return calculateRebalanceStats(allRebalances);
|
|
8591
8593
|
};
|
|
8594
|
+
|
|
8595
|
+
// functions/getAutopoolUserActivity.ts
|
|
8596
|
+
var import_graph_cli18 = require("@tokemak/graph-cli");
|
|
8597
|
+
var getAutopoolUserActivity = async ({
|
|
8598
|
+
autopoolAddress,
|
|
8599
|
+
userAddress,
|
|
8600
|
+
chainId = 1
|
|
8601
|
+
}) => {
|
|
8602
|
+
const { GetUserBalanceChangeHistory } = (0, import_graph_cli18.getSdkByChainId)(chainId);
|
|
8603
|
+
try {
|
|
8604
|
+
const userAutopoolBalanceChanges = await paginateQuery(
|
|
8605
|
+
(vars) => GetUserBalanceChangeHistory({
|
|
8606
|
+
userAddress,
|
|
8607
|
+
vaultAddress: autopoolAddress,
|
|
8608
|
+
first: vars?.first || 1e3,
|
|
8609
|
+
skip: vars?.skip || 0
|
|
8610
|
+
}),
|
|
8611
|
+
"userAutopoolBalanceChanges",
|
|
8612
|
+
{
|
|
8613
|
+
first: 1e3,
|
|
8614
|
+
maxPages: 100
|
|
8615
|
+
}
|
|
8616
|
+
);
|
|
8617
|
+
let userActivityTotals = {};
|
|
8618
|
+
let events = [];
|
|
8619
|
+
userAutopoolBalanceChanges.forEach((activity) => {
|
|
8620
|
+
if (!userActivityTotals[activity.vaultAddress]) {
|
|
8621
|
+
userActivityTotals[activity.vaultAddress] = {
|
|
8622
|
+
totalDeposits: 0n,
|
|
8623
|
+
totalWithdrawals: 0n,
|
|
8624
|
+
totalStakes: 0n,
|
|
8625
|
+
totalUnstakes: 0n,
|
|
8626
|
+
chainId
|
|
8627
|
+
};
|
|
8628
|
+
}
|
|
8629
|
+
activity.items.forEach((item) => {
|
|
8630
|
+
let eventType;
|
|
8631
|
+
if (item.staked && item.assetChange > 0n) {
|
|
8632
|
+
userActivityTotals[activity.vaultAddress].totalStakes += BigInt(
|
|
8633
|
+
item.assetChange
|
|
8634
|
+
);
|
|
8635
|
+
eventType = "Stake";
|
|
8636
|
+
} else if (item.staked && item.assetChange < 0n) {
|
|
8637
|
+
userActivityTotals[activity.vaultAddress].totalUnstakes += BigInt(
|
|
8638
|
+
BigInt(item.assetChange) * -1n
|
|
8639
|
+
);
|
|
8640
|
+
eventType = "Unstake";
|
|
8641
|
+
} else if (!item.staked && item.assetChange > 0n) {
|
|
8642
|
+
userActivityTotals[activity.vaultAddress].totalDeposits += BigInt(
|
|
8643
|
+
item.assetChange
|
|
8644
|
+
);
|
|
8645
|
+
eventType = "Deposit";
|
|
8646
|
+
} else if (!item.staked && item.assetChange < 0n) {
|
|
8647
|
+
userActivityTotals[activity.vaultAddress].totalWithdrawals += BigInt(
|
|
8648
|
+
BigInt(item.assetChange) * -1n
|
|
8649
|
+
);
|
|
8650
|
+
eventType = "Withdrawal";
|
|
8651
|
+
} else {
|
|
8652
|
+
eventType = "Unknown";
|
|
8653
|
+
}
|
|
8654
|
+
if (!item.staked) {
|
|
8655
|
+
events.push({
|
|
8656
|
+
timestamp: activity.timestamp,
|
|
8657
|
+
shareChange: item.shareChange,
|
|
8658
|
+
assetChange: item.assetChange,
|
|
8659
|
+
vaultAddress: activity.vaultAddress,
|
|
8660
|
+
eventType
|
|
8661
|
+
// staked: item.staked,
|
|
8662
|
+
});
|
|
8663
|
+
}
|
|
8664
|
+
});
|
|
8665
|
+
});
|
|
8666
|
+
return { events, totals: userActivityTotals };
|
|
8667
|
+
} catch (error) {
|
|
8668
|
+
console.error(error);
|
|
8669
|
+
return [];
|
|
8670
|
+
}
|
|
8671
|
+
};
|
|
8672
|
+
|
|
8673
|
+
// functions/getAutopoolUser.ts
|
|
8674
|
+
var import_viem21 = require("viem");
|
|
8675
|
+
var import_core23 = require("@wagmi/core");
|
|
8676
|
+
var import_abis22 = require("@tokemak/abis");
|
|
8677
|
+
var import_utils52 = require("@tokemak/utils");
|
|
8678
|
+
var getAutopoolUser = async (config, {
|
|
8679
|
+
autopool,
|
|
8680
|
+
address,
|
|
8681
|
+
userActivity,
|
|
8682
|
+
prices
|
|
8683
|
+
}) => {
|
|
8684
|
+
const autopoolContract = {
|
|
8685
|
+
address: autopool?.poolAddress,
|
|
8686
|
+
abi: import_abis22.autopoolEthAbi,
|
|
8687
|
+
chainId: autopool?.chain?.chainId
|
|
8688
|
+
};
|
|
8689
|
+
const [
|
|
8690
|
+
{ result: autopoolRewarderContract },
|
|
8691
|
+
{ result: unstakedPoolShares, error: unstakedPoolSharesError }
|
|
8692
|
+
] = await (0, import_core23.readContracts)(config, {
|
|
8693
|
+
contracts: [
|
|
8694
|
+
{
|
|
8695
|
+
...autopoolContract,
|
|
8696
|
+
functionName: "rewarder",
|
|
8697
|
+
args: []
|
|
8698
|
+
},
|
|
8699
|
+
{
|
|
8700
|
+
...autopoolContract,
|
|
8701
|
+
functionName: "balanceOf",
|
|
8702
|
+
args: [address]
|
|
8703
|
+
}
|
|
8704
|
+
]
|
|
8705
|
+
});
|
|
8706
|
+
if (!autopoolRewarderContract) {
|
|
8707
|
+
throw new Error("No rewarder contract found");
|
|
8708
|
+
}
|
|
8709
|
+
if (unstakedPoolSharesError) {
|
|
8710
|
+
throw new Error("Error fetching unstaked pool shares");
|
|
8711
|
+
}
|
|
8712
|
+
const stakedPoolShares = await (0, import_core23.readContract)(config, {
|
|
8713
|
+
address: autopoolRewarderContract,
|
|
8714
|
+
abi: import_viem21.erc20Abi,
|
|
8715
|
+
functionName: "balanceOf",
|
|
8716
|
+
args: [address],
|
|
8717
|
+
chainId: autopool?.chain?.chainId
|
|
8718
|
+
});
|
|
8719
|
+
const stakedShares = (0, import_utils52.formatEtherNum)(stakedPoolShares);
|
|
8720
|
+
const staked = convertBaseAssetToTokenPricesAndDenom(
|
|
8721
|
+
stakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
8722
|
+
autopool?.baseAsset.price,
|
|
8723
|
+
autopool?.denomination.price,
|
|
8724
|
+
prices
|
|
8725
|
+
);
|
|
8726
|
+
const unstakedShares = (0, import_utils52.formatEtherNum)(unstakedPoolShares || 0n);
|
|
8727
|
+
const unstaked = convertBaseAssetToTokenPricesAndDenom(
|
|
8728
|
+
unstakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
8729
|
+
autopool?.baseAsset.price,
|
|
8730
|
+
autopool?.denomination.price,
|
|
8731
|
+
prices
|
|
8732
|
+
);
|
|
8733
|
+
const shares = unstakedShares + stakedShares;
|
|
8734
|
+
const nav = convertBaseAssetToTokenPricesAndDenom(
|
|
8735
|
+
shares * (autopool?.navPerShare.baseAsset || 0),
|
|
8736
|
+
autopool?.baseAsset.price,
|
|
8737
|
+
autopool?.denomination.price,
|
|
8738
|
+
prices
|
|
8739
|
+
);
|
|
8740
|
+
const totalDeposits = convertBaseAssetToTokenPricesAndDenom(
|
|
8741
|
+
(0, import_utils52.formatUnitsNum)(
|
|
8742
|
+
userActivity?.totals[autopool?.poolAddress]?.totalDeposits || 0n,
|
|
8743
|
+
autopool?.baseAsset.decimals
|
|
8744
|
+
),
|
|
8745
|
+
autopool?.baseAsset.price,
|
|
8746
|
+
autopool?.denomination.price,
|
|
8747
|
+
prices
|
|
8748
|
+
);
|
|
8749
|
+
const totalWithdrawals = convertBaseAssetToTokenPricesAndDenom(
|
|
8750
|
+
(0, import_utils52.formatUnitsNum)(
|
|
8751
|
+
userActivity?.totals[autopool?.poolAddress]?.totalWithdrawals || 0n,
|
|
8752
|
+
autopool?.baseAsset.decimals
|
|
8753
|
+
),
|
|
8754
|
+
autopool?.baseAsset.price,
|
|
8755
|
+
autopool?.denomination.price,
|
|
8756
|
+
prices
|
|
8757
|
+
);
|
|
8758
|
+
const returns = convertBaseAssetToTokenPricesAndDenom(
|
|
8759
|
+
nav.baseAsset + totalWithdrawals.baseAsset - totalDeposits.baseAsset,
|
|
8760
|
+
autopool?.baseAsset.price,
|
|
8761
|
+
autopool?.denomination.price,
|
|
8762
|
+
prices
|
|
8763
|
+
);
|
|
8764
|
+
const supplied = convertBaseAssetToTokenPricesAndDenom(
|
|
8765
|
+
totalDeposits.baseAsset - totalWithdrawals.baseAsset,
|
|
8766
|
+
autopool?.baseAsset.price,
|
|
8767
|
+
autopool?.denomination.price,
|
|
8768
|
+
prices
|
|
8769
|
+
);
|
|
8770
|
+
const poolEvents = userActivity?.events.filter(
|
|
8771
|
+
(event) => event.vaultAddress === autopool?.poolAddress
|
|
8772
|
+
);
|
|
8773
|
+
let lastDeposit;
|
|
8774
|
+
if (poolEvents && poolEvents?.length > 0) {
|
|
8775
|
+
lastDeposit = (0, import_utils52.convertTimestampToDate)(
|
|
8776
|
+
poolEvents[poolEvents.length - 1].timestamp
|
|
8777
|
+
).toLocaleDateString("en-US", {
|
|
8778
|
+
day: "2-digit",
|
|
8779
|
+
month: "short",
|
|
8780
|
+
year: "numeric"
|
|
8781
|
+
});
|
|
8782
|
+
}
|
|
8783
|
+
return {
|
|
8784
|
+
symbol: autopool?.symbol,
|
|
8785
|
+
poolAddress: autopool?.poolAddress,
|
|
8786
|
+
userAddress: address,
|
|
8787
|
+
shares: {
|
|
8788
|
+
unstaked: unstakedShares,
|
|
8789
|
+
staked: stakedShares,
|
|
8790
|
+
total: shares
|
|
8791
|
+
},
|
|
8792
|
+
balance: {
|
|
8793
|
+
unstaked,
|
|
8794
|
+
staked,
|
|
8795
|
+
total: nav
|
|
8796
|
+
},
|
|
8797
|
+
returns,
|
|
8798
|
+
activity: {
|
|
8799
|
+
totalDeposits,
|
|
8800
|
+
totalWithdrawals,
|
|
8801
|
+
lastDeposit,
|
|
8802
|
+
supplied
|
|
8803
|
+
}
|
|
8804
|
+
};
|
|
8805
|
+
};
|
|
8592
8806
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8593
8807
|
0 && (module.exports = {
|
|
8594
8808
|
AutopoolCategory,
|
|
@@ -8620,6 +8834,8 @@ var updateRebalanceStats = async (wagmiConfig, {
|
|
|
8620
8834
|
getAutopoolDayData,
|
|
8621
8835
|
getAutopoolInfo,
|
|
8622
8836
|
getAutopoolRebalances,
|
|
8837
|
+
getAutopoolUser,
|
|
8838
|
+
getAutopoolUserActivity,
|
|
8623
8839
|
getAutopools,
|
|
8624
8840
|
getAutopoolsHistory,
|
|
8625
8841
|
getAutopoolsRebalances,
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import * as viem from 'viem';
|
|
|
2
2
|
import { Address } from 'viem';
|
|
3
3
|
import * as _tokemak_tokenlist from '@tokemak/tokenlist';
|
|
4
4
|
import { INetwork, IToken, IProtocol } from '@tokemak/tokenlist';
|
|
5
|
-
import * as abitype from 'abitype';
|
|
6
5
|
import { Config } from '@wagmi/core';
|
|
7
6
|
import { SupportedChainIds } from '@tokemak/config';
|
|
8
7
|
import { Config as Config$1 } from 'wagmi';
|
|
@@ -138,17 +137,17 @@ declare const getAutopoolCategory: (baseAsset: string) => AutopoolCategory;
|
|
|
138
137
|
declare const BASE_ASSETS: readonly [{
|
|
139
138
|
readonly symbol: "ETH";
|
|
140
139
|
readonly coinGeckoId: "ethereum";
|
|
141
|
-
readonly address:
|
|
140
|
+
readonly address: viem.Address;
|
|
142
141
|
readonly chainId: number;
|
|
143
142
|
readonly decimals: number;
|
|
144
143
|
readonly logoURI: string;
|
|
145
144
|
readonly name: string;
|
|
146
145
|
readonly audits?: string;
|
|
147
146
|
readonly extensions?: {
|
|
148
|
-
bridgeMainnetAdapter?:
|
|
147
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
149
148
|
bridgeInfo?: {
|
|
150
149
|
[chainId: number]: {
|
|
151
|
-
tokenAddress:
|
|
150
|
+
tokenAddress: viem.Address;
|
|
152
151
|
};
|
|
153
152
|
};
|
|
154
153
|
rebasing?: boolean;
|
|
@@ -157,17 +156,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
157
156
|
}, {
|
|
158
157
|
readonly symbol: "PXETH";
|
|
159
158
|
readonly coinGeckoId: "dinero-staked-eth";
|
|
160
|
-
readonly address:
|
|
159
|
+
readonly address: viem.Address;
|
|
161
160
|
readonly chainId: number;
|
|
162
161
|
readonly decimals: number;
|
|
163
162
|
readonly logoURI: string;
|
|
164
163
|
readonly name: string;
|
|
165
164
|
readonly audits?: string;
|
|
166
165
|
readonly extensions?: {
|
|
167
|
-
bridgeMainnetAdapter?:
|
|
166
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
168
167
|
bridgeInfo?: {
|
|
169
168
|
[chainId: number]: {
|
|
170
|
-
tokenAddress:
|
|
169
|
+
tokenAddress: viem.Address;
|
|
171
170
|
};
|
|
172
171
|
};
|
|
173
172
|
rebasing?: boolean;
|
|
@@ -176,17 +175,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
176
175
|
}, {
|
|
177
176
|
readonly symbol: "USDC";
|
|
178
177
|
readonly coinGeckoId: "usd-coin";
|
|
179
|
-
readonly address:
|
|
178
|
+
readonly address: viem.Address;
|
|
180
179
|
readonly chainId: number;
|
|
181
180
|
readonly decimals: number;
|
|
182
181
|
readonly logoURI: string;
|
|
183
182
|
readonly name: string;
|
|
184
183
|
readonly audits?: string;
|
|
185
184
|
readonly extensions?: {
|
|
186
|
-
bridgeMainnetAdapter?:
|
|
185
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
187
186
|
bridgeInfo?: {
|
|
188
187
|
[chainId: number]: {
|
|
189
|
-
tokenAddress:
|
|
188
|
+
tokenAddress: viem.Address;
|
|
190
189
|
};
|
|
191
190
|
};
|
|
192
191
|
rebasing?: boolean;
|
|
@@ -195,17 +194,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
195
194
|
}, {
|
|
196
195
|
readonly symbol: "DOLA";
|
|
197
196
|
readonly coinGeckoId: "dola-usd";
|
|
198
|
-
readonly address:
|
|
197
|
+
readonly address: viem.Address;
|
|
199
198
|
readonly chainId: number;
|
|
200
199
|
readonly decimals: number;
|
|
201
200
|
readonly logoURI: string;
|
|
202
201
|
readonly name: string;
|
|
203
202
|
readonly audits?: string;
|
|
204
203
|
readonly extensions?: {
|
|
205
|
-
bridgeMainnetAdapter?:
|
|
204
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
206
205
|
bridgeInfo?: {
|
|
207
206
|
[chainId: number]: {
|
|
208
|
-
tokenAddress:
|
|
207
|
+
tokenAddress: viem.Address;
|
|
209
208
|
};
|
|
210
209
|
};
|
|
211
210
|
rebasing?: boolean;
|
|
@@ -213,17 +212,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
213
212
|
};
|
|
214
213
|
}, {
|
|
215
214
|
readonly symbol: "S";
|
|
216
|
-
readonly address:
|
|
215
|
+
readonly address: viem.Address;
|
|
217
216
|
readonly chainId: number;
|
|
218
217
|
readonly decimals: number;
|
|
219
218
|
readonly logoURI: string;
|
|
220
219
|
readonly name: string;
|
|
221
220
|
readonly audits?: string;
|
|
222
221
|
readonly extensions?: {
|
|
223
|
-
bridgeMainnetAdapter?:
|
|
222
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
224
223
|
bridgeInfo?: {
|
|
225
224
|
[chainId: number]: {
|
|
226
|
-
tokenAddress:
|
|
225
|
+
tokenAddress: viem.Address;
|
|
227
226
|
};
|
|
228
227
|
};
|
|
229
228
|
rebasing?: boolean;
|
|
@@ -232,17 +231,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
232
231
|
}, {
|
|
233
232
|
readonly symbol: "EURC";
|
|
234
233
|
readonly coinGeckoId: "euro-coin";
|
|
235
|
-
readonly address:
|
|
234
|
+
readonly address: viem.Address;
|
|
236
235
|
readonly chainId: number;
|
|
237
236
|
readonly decimals: number;
|
|
238
237
|
readonly logoURI: string;
|
|
239
238
|
readonly name: string;
|
|
240
239
|
readonly audits?: string;
|
|
241
240
|
readonly extensions?: {
|
|
242
|
-
bridgeMainnetAdapter?:
|
|
241
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
243
242
|
bridgeInfo?: {
|
|
244
243
|
[chainId: number]: {
|
|
245
|
-
tokenAddress:
|
|
244
|
+
tokenAddress: viem.Address;
|
|
246
245
|
};
|
|
247
246
|
};
|
|
248
247
|
rebasing?: boolean;
|
|
@@ -251,17 +250,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
251
250
|
}, {
|
|
252
251
|
readonly symbol: "USDT";
|
|
253
252
|
readonly coinGeckoId: "tether";
|
|
254
|
-
readonly address:
|
|
253
|
+
readonly address: viem.Address;
|
|
255
254
|
readonly chainId: number;
|
|
256
255
|
readonly decimals: number;
|
|
257
256
|
readonly logoURI: string;
|
|
258
257
|
readonly name: string;
|
|
259
258
|
readonly audits?: string;
|
|
260
259
|
readonly extensions?: {
|
|
261
|
-
bridgeMainnetAdapter?:
|
|
260
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
262
261
|
bridgeInfo?: {
|
|
263
262
|
[chainId: number]: {
|
|
264
|
-
tokenAddress:
|
|
263
|
+
tokenAddress: viem.Address;
|
|
265
264
|
};
|
|
266
265
|
};
|
|
267
266
|
rebasing?: boolean;
|
|
@@ -270,17 +269,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
270
269
|
}, {
|
|
271
270
|
readonly symbol: "USDT0";
|
|
272
271
|
readonly coinGeckoId: "tether";
|
|
273
|
-
readonly address:
|
|
272
|
+
readonly address: viem.Address;
|
|
274
273
|
readonly chainId: number;
|
|
275
274
|
readonly decimals: number;
|
|
276
275
|
readonly logoURI: string;
|
|
277
276
|
readonly name: string;
|
|
278
277
|
readonly audits?: string;
|
|
279
278
|
readonly extensions?: {
|
|
280
|
-
bridgeMainnetAdapter?:
|
|
279
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
281
280
|
bridgeInfo?: {
|
|
282
281
|
[chainId: number]: {
|
|
283
|
-
tokenAddress:
|
|
282
|
+
tokenAddress: viem.Address;
|
|
284
283
|
};
|
|
285
284
|
};
|
|
286
285
|
rebasing?: boolean;
|
|
@@ -290,17 +289,17 @@ declare const BASE_ASSETS: readonly [{
|
|
|
290
289
|
declare const PRICED_TOKENS: readonly [{
|
|
291
290
|
readonly symbol: "ETH";
|
|
292
291
|
readonly coinGeckoId: "ethereum";
|
|
293
|
-
readonly address:
|
|
292
|
+
readonly address: viem.Address;
|
|
294
293
|
readonly chainId: number;
|
|
295
294
|
readonly decimals: number;
|
|
296
295
|
readonly logoURI: string;
|
|
297
296
|
readonly name: string;
|
|
298
297
|
readonly audits?: string;
|
|
299
298
|
readonly extensions?: {
|
|
300
|
-
bridgeMainnetAdapter?:
|
|
299
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
301
300
|
bridgeInfo?: {
|
|
302
301
|
[chainId: number]: {
|
|
303
|
-
tokenAddress:
|
|
302
|
+
tokenAddress: viem.Address;
|
|
304
303
|
};
|
|
305
304
|
};
|
|
306
305
|
rebasing?: boolean;
|
|
@@ -309,17 +308,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
309
308
|
}, {
|
|
310
309
|
readonly symbol: "PXETH";
|
|
311
310
|
readonly coinGeckoId: "dinero-staked-eth";
|
|
312
|
-
readonly address:
|
|
311
|
+
readonly address: viem.Address;
|
|
313
312
|
readonly chainId: number;
|
|
314
313
|
readonly decimals: number;
|
|
315
314
|
readonly logoURI: string;
|
|
316
315
|
readonly name: string;
|
|
317
316
|
readonly audits?: string;
|
|
318
317
|
readonly extensions?: {
|
|
319
|
-
bridgeMainnetAdapter?:
|
|
318
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
320
319
|
bridgeInfo?: {
|
|
321
320
|
[chainId: number]: {
|
|
322
|
-
tokenAddress:
|
|
321
|
+
tokenAddress: viem.Address;
|
|
323
322
|
};
|
|
324
323
|
};
|
|
325
324
|
rebasing?: boolean;
|
|
@@ -328,17 +327,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
328
327
|
}, {
|
|
329
328
|
readonly symbol: "USDC";
|
|
330
329
|
readonly coinGeckoId: "usd-coin";
|
|
331
|
-
readonly address:
|
|
330
|
+
readonly address: viem.Address;
|
|
332
331
|
readonly chainId: number;
|
|
333
332
|
readonly decimals: number;
|
|
334
333
|
readonly logoURI: string;
|
|
335
334
|
readonly name: string;
|
|
336
335
|
readonly audits?: string;
|
|
337
336
|
readonly extensions?: {
|
|
338
|
-
bridgeMainnetAdapter?:
|
|
337
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
339
338
|
bridgeInfo?: {
|
|
340
339
|
[chainId: number]: {
|
|
341
|
-
tokenAddress:
|
|
340
|
+
tokenAddress: viem.Address;
|
|
342
341
|
};
|
|
343
342
|
};
|
|
344
343
|
rebasing?: boolean;
|
|
@@ -347,17 +346,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
347
346
|
}, {
|
|
348
347
|
readonly symbol: "DOLA";
|
|
349
348
|
readonly coinGeckoId: "dola-usd";
|
|
350
|
-
readonly address:
|
|
349
|
+
readonly address: viem.Address;
|
|
351
350
|
readonly chainId: number;
|
|
352
351
|
readonly decimals: number;
|
|
353
352
|
readonly logoURI: string;
|
|
354
353
|
readonly name: string;
|
|
355
354
|
readonly audits?: string;
|
|
356
355
|
readonly extensions?: {
|
|
357
|
-
bridgeMainnetAdapter?:
|
|
356
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
358
357
|
bridgeInfo?: {
|
|
359
358
|
[chainId: number]: {
|
|
360
|
-
tokenAddress:
|
|
359
|
+
tokenAddress: viem.Address;
|
|
361
360
|
};
|
|
362
361
|
};
|
|
363
362
|
rebasing?: boolean;
|
|
@@ -365,17 +364,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
365
364
|
};
|
|
366
365
|
}, {
|
|
367
366
|
readonly symbol: "S";
|
|
368
|
-
readonly address:
|
|
367
|
+
readonly address: viem.Address;
|
|
369
368
|
readonly chainId: number;
|
|
370
369
|
readonly decimals: number;
|
|
371
370
|
readonly logoURI: string;
|
|
372
371
|
readonly name: string;
|
|
373
372
|
readonly audits?: string;
|
|
374
373
|
readonly extensions?: {
|
|
375
|
-
bridgeMainnetAdapter?:
|
|
374
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
376
375
|
bridgeInfo?: {
|
|
377
376
|
[chainId: number]: {
|
|
378
|
-
tokenAddress:
|
|
377
|
+
tokenAddress: viem.Address;
|
|
379
378
|
};
|
|
380
379
|
};
|
|
381
380
|
rebasing?: boolean;
|
|
@@ -384,17 +383,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
384
383
|
}, {
|
|
385
384
|
readonly symbol: "EURC";
|
|
386
385
|
readonly coinGeckoId: "euro-coin";
|
|
387
|
-
readonly address:
|
|
386
|
+
readonly address: viem.Address;
|
|
388
387
|
readonly chainId: number;
|
|
389
388
|
readonly decimals: number;
|
|
390
389
|
readonly logoURI: string;
|
|
391
390
|
readonly name: string;
|
|
392
391
|
readonly audits?: string;
|
|
393
392
|
readonly extensions?: {
|
|
394
|
-
bridgeMainnetAdapter?:
|
|
393
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
395
394
|
bridgeInfo?: {
|
|
396
395
|
[chainId: number]: {
|
|
397
|
-
tokenAddress:
|
|
396
|
+
tokenAddress: viem.Address;
|
|
398
397
|
};
|
|
399
398
|
};
|
|
400
399
|
rebasing?: boolean;
|
|
@@ -403,17 +402,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
403
402
|
}, {
|
|
404
403
|
readonly symbol: "USDT";
|
|
405
404
|
readonly coinGeckoId: "tether";
|
|
406
|
-
readonly address:
|
|
405
|
+
readonly address: viem.Address;
|
|
407
406
|
readonly chainId: number;
|
|
408
407
|
readonly decimals: number;
|
|
409
408
|
readonly logoURI: string;
|
|
410
409
|
readonly name: string;
|
|
411
410
|
readonly audits?: string;
|
|
412
411
|
readonly extensions?: {
|
|
413
|
-
bridgeMainnetAdapter?:
|
|
412
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
414
413
|
bridgeInfo?: {
|
|
415
414
|
[chainId: number]: {
|
|
416
|
-
tokenAddress:
|
|
415
|
+
tokenAddress: viem.Address;
|
|
417
416
|
};
|
|
418
417
|
};
|
|
419
418
|
rebasing?: boolean;
|
|
@@ -422,17 +421,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
422
421
|
}, {
|
|
423
422
|
readonly symbol: "USDT0";
|
|
424
423
|
readonly coinGeckoId: "tether";
|
|
425
|
-
readonly address:
|
|
424
|
+
readonly address: viem.Address;
|
|
426
425
|
readonly chainId: number;
|
|
427
426
|
readonly decimals: number;
|
|
428
427
|
readonly logoURI: string;
|
|
429
428
|
readonly name: string;
|
|
430
429
|
readonly audits?: string;
|
|
431
430
|
readonly extensions?: {
|
|
432
|
-
bridgeMainnetAdapter?:
|
|
431
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
433
432
|
bridgeInfo?: {
|
|
434
433
|
[chainId: number]: {
|
|
435
|
-
tokenAddress:
|
|
434
|
+
tokenAddress: viem.Address;
|
|
436
435
|
};
|
|
437
436
|
};
|
|
438
437
|
rebasing?: boolean;
|
|
@@ -440,17 +439,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
440
439
|
};
|
|
441
440
|
}, {
|
|
442
441
|
readonly symbol: "TOKE";
|
|
443
|
-
readonly address:
|
|
442
|
+
readonly address: viem.Address;
|
|
444
443
|
readonly chainId: number;
|
|
445
444
|
readonly decimals: number;
|
|
446
445
|
readonly logoURI: string;
|
|
447
446
|
readonly name: string;
|
|
448
447
|
readonly audits?: string;
|
|
449
448
|
readonly extensions?: {
|
|
450
|
-
bridgeMainnetAdapter?:
|
|
449
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
451
450
|
bridgeInfo?: {
|
|
452
451
|
[chainId: number]: {
|
|
453
|
-
tokenAddress:
|
|
452
|
+
tokenAddress: viem.Address;
|
|
454
453
|
};
|
|
455
454
|
};
|
|
456
455
|
rebasing?: boolean;
|
|
@@ -458,17 +457,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
458
457
|
};
|
|
459
458
|
}, {
|
|
460
459
|
readonly symbol: "SILO";
|
|
461
|
-
readonly address:
|
|
460
|
+
readonly address: viem.Address;
|
|
462
461
|
readonly chainId: number;
|
|
463
462
|
readonly decimals: number;
|
|
464
463
|
readonly logoURI: string;
|
|
465
464
|
readonly name: string;
|
|
466
465
|
readonly audits?: string;
|
|
467
466
|
readonly extensions?: {
|
|
468
|
-
bridgeMainnetAdapter?:
|
|
467
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
469
468
|
bridgeInfo?: {
|
|
470
469
|
[chainId: number]: {
|
|
471
|
-
tokenAddress:
|
|
470
|
+
tokenAddress: viem.Address;
|
|
472
471
|
};
|
|
473
472
|
};
|
|
474
473
|
rebasing?: boolean;
|
|
@@ -483,10 +482,10 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
483
482
|
readonly name: string;
|
|
484
483
|
readonly audits?: string;
|
|
485
484
|
readonly extensions?: {
|
|
486
|
-
bridgeMainnetAdapter?:
|
|
485
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
487
486
|
bridgeInfo?: {
|
|
488
487
|
[chainId: number]: {
|
|
489
|
-
tokenAddress:
|
|
488
|
+
tokenAddress: viem.Address;
|
|
490
489
|
};
|
|
491
490
|
};
|
|
492
491
|
rebasing?: boolean;
|
|
@@ -494,17 +493,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
494
493
|
};
|
|
495
494
|
}, {
|
|
496
495
|
readonly symbol: "USDT0";
|
|
497
|
-
readonly address:
|
|
496
|
+
readonly address: viem.Address;
|
|
498
497
|
readonly chainId: number;
|
|
499
498
|
readonly decimals: number;
|
|
500
499
|
readonly logoURI: string;
|
|
501
500
|
readonly name: string;
|
|
502
501
|
readonly audits?: string;
|
|
503
502
|
readonly extensions?: {
|
|
504
|
-
bridgeMainnetAdapter?:
|
|
503
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
505
504
|
bridgeInfo?: {
|
|
506
505
|
[chainId: number]: {
|
|
507
|
-
tokenAddress:
|
|
506
|
+
tokenAddress: viem.Address;
|
|
508
507
|
};
|
|
509
508
|
};
|
|
510
509
|
rebasing?: boolean;
|
|
@@ -514,17 +513,17 @@ declare const PRICED_TOKENS: readonly [{
|
|
|
514
513
|
type BaseAsset = (typeof BASE_ASSETS)[number]["symbol"];
|
|
515
514
|
declare const WRAPPED_TOKENS: readonly [{
|
|
516
515
|
readonly symbol: "WETH";
|
|
517
|
-
readonly address:
|
|
516
|
+
readonly address: viem.Address;
|
|
518
517
|
readonly chainId: number;
|
|
519
518
|
readonly decimals: number;
|
|
520
519
|
readonly logoURI: string;
|
|
521
520
|
readonly name: string;
|
|
522
521
|
readonly audits?: string;
|
|
523
522
|
readonly extensions?: {
|
|
524
|
-
bridgeMainnetAdapter?:
|
|
523
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
525
524
|
bridgeInfo?: {
|
|
526
525
|
[chainId: number]: {
|
|
527
|
-
tokenAddress:
|
|
526
|
+
tokenAddress: viem.Address;
|
|
528
527
|
};
|
|
529
528
|
};
|
|
530
529
|
rebasing?: boolean;
|
|
@@ -532,17 +531,17 @@ declare const WRAPPED_TOKENS: readonly [{
|
|
|
532
531
|
};
|
|
533
532
|
}, {
|
|
534
533
|
readonly symbol: "WS";
|
|
535
|
-
readonly address:
|
|
534
|
+
readonly address: viem.Address;
|
|
536
535
|
readonly chainId: number;
|
|
537
536
|
readonly decimals: number;
|
|
538
537
|
readonly logoURI: string;
|
|
539
538
|
readonly name: string;
|
|
540
539
|
readonly audits?: string;
|
|
541
540
|
readonly extensions?: {
|
|
542
|
-
bridgeMainnetAdapter?:
|
|
541
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
543
542
|
bridgeInfo?: {
|
|
544
543
|
[chainId: number]: {
|
|
545
|
-
tokenAddress:
|
|
544
|
+
tokenAddress: viem.Address;
|
|
546
545
|
};
|
|
547
546
|
};
|
|
548
547
|
rebasing?: boolean;
|
|
@@ -550,17 +549,17 @@ declare const WRAPPED_TOKENS: readonly [{
|
|
|
550
549
|
};
|
|
551
550
|
}, {
|
|
552
551
|
readonly symbol: "WXPL";
|
|
553
|
-
readonly address:
|
|
552
|
+
readonly address: viem.Address;
|
|
554
553
|
readonly chainId: number;
|
|
555
554
|
readonly decimals: number;
|
|
556
555
|
readonly logoURI: string;
|
|
557
556
|
readonly name: string;
|
|
558
557
|
readonly audits?: string;
|
|
559
558
|
readonly extensions?: {
|
|
560
|
-
bridgeMainnetAdapter?:
|
|
559
|
+
bridgeMainnetAdapter?: viem.Address;
|
|
561
560
|
bridgeInfo?: {
|
|
562
561
|
[chainId: number]: {
|
|
563
|
-
tokenAddress:
|
|
562
|
+
tokenAddress: viem.Address;
|
|
564
563
|
};
|
|
565
564
|
};
|
|
566
565
|
rebasing?: boolean;
|
|
@@ -3146,4 +3145,173 @@ declare const getChainAutopoolsApr: (chainId: number) => Promise<ChainAutopoolsA
|
|
|
3146
3145
|
|
|
3147
3146
|
declare const getBlobData: (blobName: string) => Promise<any>;
|
|
3148
3147
|
|
|
3149
|
-
|
|
3148
|
+
declare const getAutopoolUserActivity: ({ autopoolAddress, userAddress, chainId, }: {
|
|
3149
|
+
autopoolAddress: Address;
|
|
3150
|
+
userAddress: Address;
|
|
3151
|
+
chainId?: SupportedChainIds;
|
|
3152
|
+
}) => Promise<never[] | {
|
|
3153
|
+
events: {
|
|
3154
|
+
timestamp: number;
|
|
3155
|
+
shareChange: string;
|
|
3156
|
+
assetChange: string;
|
|
3157
|
+
vaultAddress: string;
|
|
3158
|
+
eventType: EventType;
|
|
3159
|
+
}[];
|
|
3160
|
+
totals: UserActivityTotalsType;
|
|
3161
|
+
}>;
|
|
3162
|
+
|
|
3163
|
+
declare const getAutopoolUser: (config: Config, { autopool, address, userActivity, prices, }: {
|
|
3164
|
+
autopool: IAutopool;
|
|
3165
|
+
address: Address;
|
|
3166
|
+
userActivity: IUserActivity;
|
|
3167
|
+
prices: TokenPrices;
|
|
3168
|
+
}) => Promise<{
|
|
3169
|
+
symbol: string;
|
|
3170
|
+
poolAddress: `0x${string}`;
|
|
3171
|
+
userAddress: `0x${string}`;
|
|
3172
|
+
shares: {
|
|
3173
|
+
unstaked: number;
|
|
3174
|
+
staked: number;
|
|
3175
|
+
total: number;
|
|
3176
|
+
};
|
|
3177
|
+
balance: {
|
|
3178
|
+
unstaked: {
|
|
3179
|
+
denom: number;
|
|
3180
|
+
ETH: number;
|
|
3181
|
+
WETH: number;
|
|
3182
|
+
USDC: number;
|
|
3183
|
+
DOLA: number;
|
|
3184
|
+
USDT0: number;
|
|
3185
|
+
EURC: number;
|
|
3186
|
+
PXETH: number;
|
|
3187
|
+
S: number;
|
|
3188
|
+
USDT: number;
|
|
3189
|
+
TOKE: number;
|
|
3190
|
+
SILO: number;
|
|
3191
|
+
XPL: number;
|
|
3192
|
+
WS: number;
|
|
3193
|
+
WXPL: number;
|
|
3194
|
+
baseAsset: number;
|
|
3195
|
+
USD: number;
|
|
3196
|
+
};
|
|
3197
|
+
staked: {
|
|
3198
|
+
denom: number;
|
|
3199
|
+
ETH: number;
|
|
3200
|
+
WETH: number;
|
|
3201
|
+
USDC: number;
|
|
3202
|
+
DOLA: number;
|
|
3203
|
+
USDT0: number;
|
|
3204
|
+
EURC: number;
|
|
3205
|
+
PXETH: number;
|
|
3206
|
+
S: number;
|
|
3207
|
+
USDT: number;
|
|
3208
|
+
TOKE: number;
|
|
3209
|
+
SILO: number;
|
|
3210
|
+
XPL: number;
|
|
3211
|
+
WS: number;
|
|
3212
|
+
WXPL: number;
|
|
3213
|
+
baseAsset: number;
|
|
3214
|
+
USD: number;
|
|
3215
|
+
};
|
|
3216
|
+
total: {
|
|
3217
|
+
denom: number;
|
|
3218
|
+
ETH: number;
|
|
3219
|
+
WETH: number;
|
|
3220
|
+
USDC: number;
|
|
3221
|
+
DOLA: number;
|
|
3222
|
+
USDT0: number;
|
|
3223
|
+
EURC: number;
|
|
3224
|
+
PXETH: number;
|
|
3225
|
+
S: number;
|
|
3226
|
+
USDT: number;
|
|
3227
|
+
TOKE: number;
|
|
3228
|
+
SILO: number;
|
|
3229
|
+
XPL: number;
|
|
3230
|
+
WS: number;
|
|
3231
|
+
WXPL: number;
|
|
3232
|
+
baseAsset: number;
|
|
3233
|
+
USD: number;
|
|
3234
|
+
};
|
|
3235
|
+
};
|
|
3236
|
+
returns: {
|
|
3237
|
+
denom: number;
|
|
3238
|
+
ETH: number;
|
|
3239
|
+
WETH: number;
|
|
3240
|
+
USDC: number;
|
|
3241
|
+
DOLA: number;
|
|
3242
|
+
USDT0: number;
|
|
3243
|
+
EURC: number;
|
|
3244
|
+
PXETH: number;
|
|
3245
|
+
S: number;
|
|
3246
|
+
USDT: number;
|
|
3247
|
+
TOKE: number;
|
|
3248
|
+
SILO: number;
|
|
3249
|
+
XPL: number;
|
|
3250
|
+
WS: number;
|
|
3251
|
+
WXPL: number;
|
|
3252
|
+
baseAsset: number;
|
|
3253
|
+
USD: number;
|
|
3254
|
+
};
|
|
3255
|
+
activity: {
|
|
3256
|
+
totalDeposits: {
|
|
3257
|
+
denom: number;
|
|
3258
|
+
ETH: number;
|
|
3259
|
+
WETH: number;
|
|
3260
|
+
USDC: number;
|
|
3261
|
+
DOLA: number;
|
|
3262
|
+
USDT0: number;
|
|
3263
|
+
EURC: number;
|
|
3264
|
+
PXETH: number;
|
|
3265
|
+
S: number;
|
|
3266
|
+
USDT: number;
|
|
3267
|
+
TOKE: number;
|
|
3268
|
+
SILO: number;
|
|
3269
|
+
XPL: number;
|
|
3270
|
+
WS: number;
|
|
3271
|
+
WXPL: number;
|
|
3272
|
+
baseAsset: number;
|
|
3273
|
+
USD: number;
|
|
3274
|
+
};
|
|
3275
|
+
totalWithdrawals: {
|
|
3276
|
+
denom: number;
|
|
3277
|
+
ETH: number;
|
|
3278
|
+
WETH: number;
|
|
3279
|
+
USDC: number;
|
|
3280
|
+
DOLA: number;
|
|
3281
|
+
USDT0: number;
|
|
3282
|
+
EURC: number;
|
|
3283
|
+
PXETH: number;
|
|
3284
|
+
S: number;
|
|
3285
|
+
USDT: number;
|
|
3286
|
+
TOKE: number;
|
|
3287
|
+
SILO: number;
|
|
3288
|
+
XPL: number;
|
|
3289
|
+
WS: number;
|
|
3290
|
+
WXPL: number;
|
|
3291
|
+
baseAsset: number;
|
|
3292
|
+
USD: number;
|
|
3293
|
+
};
|
|
3294
|
+
lastDeposit: string | undefined;
|
|
3295
|
+
supplied: {
|
|
3296
|
+
denom: number;
|
|
3297
|
+
ETH: number;
|
|
3298
|
+
WETH: number;
|
|
3299
|
+
USDC: number;
|
|
3300
|
+
DOLA: number;
|
|
3301
|
+
USDT0: number;
|
|
3302
|
+
EURC: number;
|
|
3303
|
+
PXETH: number;
|
|
3304
|
+
S: number;
|
|
3305
|
+
USDT: number;
|
|
3306
|
+
TOKE: number;
|
|
3307
|
+
SILO: number;
|
|
3308
|
+
XPL: number;
|
|
3309
|
+
WS: number;
|
|
3310
|
+
WXPL: number;
|
|
3311
|
+
baseAsset: number;
|
|
3312
|
+
USD: number;
|
|
3313
|
+
};
|
|
3314
|
+
};
|
|
3315
|
+
}>;
|
|
3316
|
+
|
|
3317
|
+
export { AggregatedDayData, AutopoolCategory, AutopoolsApr, BASE_ASSETS, BATCH_SIZE, BaseAsset, BaseAssetWithUsd, BaseDataEntry, ChainAutopoolsAprResponse, ChainSTokeRewardsType, ChainSTokeType, ChainSTokeVotes, Currencies, CurveLP, ETH_BASE_ASSETS, EUR_BASE_ASSETS, EnhancedUserHistoryEntry, EventType, ExtraReward, FillData, GetLayerzeroStatusConfig, HistoricalTokenPrices, IAutopool, IAutopools, IAutopoolsHistory, IRebalance, IStoke, IStokeRewards, ISushiLP, ITopAutopoolHolder, ITopAutopoolHolders, IUserActivity, IUserAutopool, IUserAutopools, IUserAutopoolsRewards, IUserExtraRewards, IUserReward, LayerzeroStatus, MessageStatus, Order, PRICED_TOKENS, PoolRewardsBalanceDayData, QuoteAndPriceBaseConfig, QuoteAndPriceBaseResult, QuoteResult, RawRebalance, Reward, RewardDetails, STokeVotes, SendParam, SwapQuoteParams, SwapQuoteResponse, TokenPrices, USD_BASE_ASSETS, UserActivity, UserActivityTotalsType, UserAutopoolsVotes, UserDayDataEntry, UserSTokeVotes, VaultAddedMapping, aggregateSTokeRewardsDayData, arraysToObject, calculateRebalanceStats, convertBaseAssetToTokenPrices, convertBaseAssetToTokenPricesAndDenom, fetchChainDataMap, fetchChainRebalances, fillMissingDates, findClosestDateEntry, findClosestEntry, findClosestTimestampEntry, formatDateRange, getAddressFromSystemRegistry, getAllowance, getAmountDeposited, getAmountWithdrawn, getAutopilotRouter, getAutopoolCategory, getAutopoolDayData, getAutopoolInfo, getAutopoolRebalances, getAutopoolUser, getAutopoolUserActivity, getAutopools, getAutopoolsHistory, getAutopoolsRebalances, getBlobData, getBlobHistoricalTokenPrices, getBridgeFee, getChainAutopools, getChainAutopoolsApr, getChainCycleRolloverBlockNumber, getChainSToke, getChainSTokeRewards, getChainSubgraphStatus, getChainUserActivity, getChainUserAutopools, getChainUserSToke, getChainUserSTokeRewards, getChainUserSTokeVotes, getChainsForEnv, getCurrentCycleId, getCurveLP, getCycleV1, getDefillamaPrice, getDynamicSwap, getEthPrice, getEthPriceAtBlock, getExchangeNames, getGenStratAprs, getHistoricalTokenPrices, getLayerzeroStatus, getMutlipleAutopoolRebalances, getPoolStats, getPoolsAndDestinations, getPoolsAndDestinationsReturnType, getProtocolStats, getRebalanceStats, getRebalanceValueUsd, getRewardsPayloadV1, getSToke, getSTokeChainsForEnv, getSTokeRewards, getSTokeVotes, getSubgraphStatus, getSushiLP, getSwapQuote, getSystemConfig, getTimestampDaysFromStart, getTokePrice, getTokenList, getTokenPrice, getTokenPrices, getTopAutopoolHolders, getUserActivity, getUserAutoEthRewards, getUserAutopool, getUserAutopools, getUserAutopoolsHistory, getUserAutopoolsRewards, getUserCurveLP, getUserRewardsV1, getUserSToke, getUserSTokeVotes, getUserSushiLP, getUserTokenBalances, getUserV1, mergeArrays, mergeArraysWithKey, mergeStringArrays, minAmountDepositedBaseConfig, minAmountDepositedFunctionConfig, minAmountWithdrawnBaseConfig, minAmountWithdrawnFunctionConfig, modifyAutopoolName, nestedArrayToObject, paginateQuery, processRebalance, processRebalancesInBatches, rewardsData, systemRegistryFunctionNames, updateRebalanceStats, waitForMessageReceived };
|
package/dist/index.js
CHANGED
|
@@ -8555,6 +8555,222 @@ var updateRebalanceStats = async (wagmiConfig, {
|
|
|
8555
8555
|
const allRebalances = [...currentRebalances, ...allNewRebalances];
|
|
8556
8556
|
return calculateRebalanceStats(allRebalances);
|
|
8557
8557
|
};
|
|
8558
|
+
|
|
8559
|
+
// functions/getAutopoolUserActivity.ts
|
|
8560
|
+
import { getSdkByChainId as getSdkByChainId18 } from "@tokemak/graph-cli";
|
|
8561
|
+
var getAutopoolUserActivity = async ({
|
|
8562
|
+
autopoolAddress,
|
|
8563
|
+
userAddress,
|
|
8564
|
+
chainId = 1
|
|
8565
|
+
}) => {
|
|
8566
|
+
const { GetUserBalanceChangeHistory } = getSdkByChainId18(chainId);
|
|
8567
|
+
try {
|
|
8568
|
+
const userAutopoolBalanceChanges = await paginateQuery(
|
|
8569
|
+
(vars) => GetUserBalanceChangeHistory({
|
|
8570
|
+
userAddress,
|
|
8571
|
+
vaultAddress: autopoolAddress,
|
|
8572
|
+
first: vars?.first || 1e3,
|
|
8573
|
+
skip: vars?.skip || 0
|
|
8574
|
+
}),
|
|
8575
|
+
"userAutopoolBalanceChanges",
|
|
8576
|
+
{
|
|
8577
|
+
first: 1e3,
|
|
8578
|
+
maxPages: 100
|
|
8579
|
+
}
|
|
8580
|
+
);
|
|
8581
|
+
let userActivityTotals = {};
|
|
8582
|
+
let events = [];
|
|
8583
|
+
userAutopoolBalanceChanges.forEach((activity) => {
|
|
8584
|
+
if (!userActivityTotals[activity.vaultAddress]) {
|
|
8585
|
+
userActivityTotals[activity.vaultAddress] = {
|
|
8586
|
+
totalDeposits: 0n,
|
|
8587
|
+
totalWithdrawals: 0n,
|
|
8588
|
+
totalStakes: 0n,
|
|
8589
|
+
totalUnstakes: 0n,
|
|
8590
|
+
chainId
|
|
8591
|
+
};
|
|
8592
|
+
}
|
|
8593
|
+
activity.items.forEach((item) => {
|
|
8594
|
+
let eventType;
|
|
8595
|
+
if (item.staked && item.assetChange > 0n) {
|
|
8596
|
+
userActivityTotals[activity.vaultAddress].totalStakes += BigInt(
|
|
8597
|
+
item.assetChange
|
|
8598
|
+
);
|
|
8599
|
+
eventType = "Stake";
|
|
8600
|
+
} else if (item.staked && item.assetChange < 0n) {
|
|
8601
|
+
userActivityTotals[activity.vaultAddress].totalUnstakes += BigInt(
|
|
8602
|
+
BigInt(item.assetChange) * -1n
|
|
8603
|
+
);
|
|
8604
|
+
eventType = "Unstake";
|
|
8605
|
+
} else if (!item.staked && item.assetChange > 0n) {
|
|
8606
|
+
userActivityTotals[activity.vaultAddress].totalDeposits += BigInt(
|
|
8607
|
+
item.assetChange
|
|
8608
|
+
);
|
|
8609
|
+
eventType = "Deposit";
|
|
8610
|
+
} else if (!item.staked && item.assetChange < 0n) {
|
|
8611
|
+
userActivityTotals[activity.vaultAddress].totalWithdrawals += BigInt(
|
|
8612
|
+
BigInt(item.assetChange) * -1n
|
|
8613
|
+
);
|
|
8614
|
+
eventType = "Withdrawal";
|
|
8615
|
+
} else {
|
|
8616
|
+
eventType = "Unknown";
|
|
8617
|
+
}
|
|
8618
|
+
if (!item.staked) {
|
|
8619
|
+
events.push({
|
|
8620
|
+
timestamp: activity.timestamp,
|
|
8621
|
+
shareChange: item.shareChange,
|
|
8622
|
+
assetChange: item.assetChange,
|
|
8623
|
+
vaultAddress: activity.vaultAddress,
|
|
8624
|
+
eventType
|
|
8625
|
+
// staked: item.staked,
|
|
8626
|
+
});
|
|
8627
|
+
}
|
|
8628
|
+
});
|
|
8629
|
+
});
|
|
8630
|
+
return { events, totals: userActivityTotals };
|
|
8631
|
+
} catch (error) {
|
|
8632
|
+
console.error(error);
|
|
8633
|
+
return [];
|
|
8634
|
+
}
|
|
8635
|
+
};
|
|
8636
|
+
|
|
8637
|
+
// functions/getAutopoolUser.ts
|
|
8638
|
+
import { erc20Abi as erc20Abi3 } from "viem";
|
|
8639
|
+
import { readContract as readContract17, readContracts as readContracts8 } from "@wagmi/core";
|
|
8640
|
+
import { autopoolEthAbi as autopoolEthAbi5 } from "@tokemak/abis";
|
|
8641
|
+
import {
|
|
8642
|
+
convertTimestampToDate as convertTimestampToDate4,
|
|
8643
|
+
formatEtherNum as formatEtherNum15,
|
|
8644
|
+
formatUnitsNum as formatUnitsNum6
|
|
8645
|
+
} from "@tokemak/utils";
|
|
8646
|
+
var getAutopoolUser = async (config, {
|
|
8647
|
+
autopool,
|
|
8648
|
+
address,
|
|
8649
|
+
userActivity,
|
|
8650
|
+
prices
|
|
8651
|
+
}) => {
|
|
8652
|
+
const autopoolContract = {
|
|
8653
|
+
address: autopool?.poolAddress,
|
|
8654
|
+
abi: autopoolEthAbi5,
|
|
8655
|
+
chainId: autopool?.chain?.chainId
|
|
8656
|
+
};
|
|
8657
|
+
const [
|
|
8658
|
+
{ result: autopoolRewarderContract },
|
|
8659
|
+
{ result: unstakedPoolShares, error: unstakedPoolSharesError }
|
|
8660
|
+
] = await readContracts8(config, {
|
|
8661
|
+
contracts: [
|
|
8662
|
+
{
|
|
8663
|
+
...autopoolContract,
|
|
8664
|
+
functionName: "rewarder",
|
|
8665
|
+
args: []
|
|
8666
|
+
},
|
|
8667
|
+
{
|
|
8668
|
+
...autopoolContract,
|
|
8669
|
+
functionName: "balanceOf",
|
|
8670
|
+
args: [address]
|
|
8671
|
+
}
|
|
8672
|
+
]
|
|
8673
|
+
});
|
|
8674
|
+
if (!autopoolRewarderContract) {
|
|
8675
|
+
throw new Error("No rewarder contract found");
|
|
8676
|
+
}
|
|
8677
|
+
if (unstakedPoolSharesError) {
|
|
8678
|
+
throw new Error("Error fetching unstaked pool shares");
|
|
8679
|
+
}
|
|
8680
|
+
const stakedPoolShares = await readContract17(config, {
|
|
8681
|
+
address: autopoolRewarderContract,
|
|
8682
|
+
abi: erc20Abi3,
|
|
8683
|
+
functionName: "balanceOf",
|
|
8684
|
+
args: [address],
|
|
8685
|
+
chainId: autopool?.chain?.chainId
|
|
8686
|
+
});
|
|
8687
|
+
const stakedShares = formatEtherNum15(stakedPoolShares);
|
|
8688
|
+
const staked = convertBaseAssetToTokenPricesAndDenom(
|
|
8689
|
+
stakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
8690
|
+
autopool?.baseAsset.price,
|
|
8691
|
+
autopool?.denomination.price,
|
|
8692
|
+
prices
|
|
8693
|
+
);
|
|
8694
|
+
const unstakedShares = formatEtherNum15(unstakedPoolShares || 0n);
|
|
8695
|
+
const unstaked = convertBaseAssetToTokenPricesAndDenom(
|
|
8696
|
+
unstakedShares * (autopool?.navPerShare.baseAsset || 0),
|
|
8697
|
+
autopool?.baseAsset.price,
|
|
8698
|
+
autopool?.denomination.price,
|
|
8699
|
+
prices
|
|
8700
|
+
);
|
|
8701
|
+
const shares = unstakedShares + stakedShares;
|
|
8702
|
+
const nav = convertBaseAssetToTokenPricesAndDenom(
|
|
8703
|
+
shares * (autopool?.navPerShare.baseAsset || 0),
|
|
8704
|
+
autopool?.baseAsset.price,
|
|
8705
|
+
autopool?.denomination.price,
|
|
8706
|
+
prices
|
|
8707
|
+
);
|
|
8708
|
+
const totalDeposits = convertBaseAssetToTokenPricesAndDenom(
|
|
8709
|
+
formatUnitsNum6(
|
|
8710
|
+
userActivity?.totals[autopool?.poolAddress]?.totalDeposits || 0n,
|
|
8711
|
+
autopool?.baseAsset.decimals
|
|
8712
|
+
),
|
|
8713
|
+
autopool?.baseAsset.price,
|
|
8714
|
+
autopool?.denomination.price,
|
|
8715
|
+
prices
|
|
8716
|
+
);
|
|
8717
|
+
const totalWithdrawals = convertBaseAssetToTokenPricesAndDenom(
|
|
8718
|
+
formatUnitsNum6(
|
|
8719
|
+
userActivity?.totals[autopool?.poolAddress]?.totalWithdrawals || 0n,
|
|
8720
|
+
autopool?.baseAsset.decimals
|
|
8721
|
+
),
|
|
8722
|
+
autopool?.baseAsset.price,
|
|
8723
|
+
autopool?.denomination.price,
|
|
8724
|
+
prices
|
|
8725
|
+
);
|
|
8726
|
+
const returns = convertBaseAssetToTokenPricesAndDenom(
|
|
8727
|
+
nav.baseAsset + totalWithdrawals.baseAsset - totalDeposits.baseAsset,
|
|
8728
|
+
autopool?.baseAsset.price,
|
|
8729
|
+
autopool?.denomination.price,
|
|
8730
|
+
prices
|
|
8731
|
+
);
|
|
8732
|
+
const supplied = convertBaseAssetToTokenPricesAndDenom(
|
|
8733
|
+
totalDeposits.baseAsset - totalWithdrawals.baseAsset,
|
|
8734
|
+
autopool?.baseAsset.price,
|
|
8735
|
+
autopool?.denomination.price,
|
|
8736
|
+
prices
|
|
8737
|
+
);
|
|
8738
|
+
const poolEvents = userActivity?.events.filter(
|
|
8739
|
+
(event) => event.vaultAddress === autopool?.poolAddress
|
|
8740
|
+
);
|
|
8741
|
+
let lastDeposit;
|
|
8742
|
+
if (poolEvents && poolEvents?.length > 0) {
|
|
8743
|
+
lastDeposit = convertTimestampToDate4(
|
|
8744
|
+
poolEvents[poolEvents.length - 1].timestamp
|
|
8745
|
+
).toLocaleDateString("en-US", {
|
|
8746
|
+
day: "2-digit",
|
|
8747
|
+
month: "short",
|
|
8748
|
+
year: "numeric"
|
|
8749
|
+
});
|
|
8750
|
+
}
|
|
8751
|
+
return {
|
|
8752
|
+
symbol: autopool?.symbol,
|
|
8753
|
+
poolAddress: autopool?.poolAddress,
|
|
8754
|
+
userAddress: address,
|
|
8755
|
+
shares: {
|
|
8756
|
+
unstaked: unstakedShares,
|
|
8757
|
+
staked: stakedShares,
|
|
8758
|
+
total: shares
|
|
8759
|
+
},
|
|
8760
|
+
balance: {
|
|
8761
|
+
unstaked,
|
|
8762
|
+
staked,
|
|
8763
|
+
total: nav
|
|
8764
|
+
},
|
|
8765
|
+
returns,
|
|
8766
|
+
activity: {
|
|
8767
|
+
totalDeposits,
|
|
8768
|
+
totalWithdrawals,
|
|
8769
|
+
lastDeposit,
|
|
8770
|
+
supplied
|
|
8771
|
+
}
|
|
8772
|
+
};
|
|
8773
|
+
};
|
|
8558
8774
|
export {
|
|
8559
8775
|
AutopoolCategory,
|
|
8560
8776
|
BASE_ASSETS,
|
|
@@ -8585,6 +8801,8 @@ export {
|
|
|
8585
8801
|
getAutopoolDayData,
|
|
8586
8802
|
getAutopoolInfo,
|
|
8587
8803
|
getAutopoolRebalances,
|
|
8804
|
+
getAutopoolUser,
|
|
8805
|
+
getAutopoolUserActivity,
|
|
8588
8806
|
getAutopools,
|
|
8589
8807
|
getAutopoolsHistory,
|
|
8590
8808
|
getAutopoolsRebalances,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokemak/queries",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@tokemak/abis": "workspace:*",
|
|
25
|
+
"@tokemak/config": "workspace:*",
|
|
26
|
+
"@tokemak/constants": "workspace:*",
|
|
27
|
+
"@tokemak/graph-cli": "workspace:*",
|
|
28
|
+
"@tokemak/tokenlist": "workspace:*",
|
|
29
|
+
"@tokemak/utils": "workspace:*",
|
|
24
30
|
"@tokemak/autopilot-swap-route-calc": "0.0.7",
|
|
25
31
|
"viem": "2.x",
|
|
26
32
|
"@wagmi/core": "2.x",
|
|
27
|
-
"wagmi": "2.x"
|
|
28
|
-
"@tokemak/abis": "0.0.3",
|
|
29
|
-
"@tokemak/constants": "0.0.4",
|
|
30
|
-
"@tokemak/graph-cli": "0.0.5",
|
|
31
|
-
"@tokemak/config": "0.0.4",
|
|
32
|
-
"@tokemak/tokenlist": "0.0.3",
|
|
33
|
-
"@tokemak/utils": "0.0.5"
|
|
33
|
+
"wagmi": "2.x"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup",
|
|
37
37
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
38
38
|
"clean": "rimraf .turbo node_modules dist"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|