@lagoon-protocol/lagoon-mcp 0.1.0 → 0.1.1
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/sdk/apr-service.d.ts +1 -2
- package/dist/sdk/apr-service.d.ts.map +1 -1
- package/dist/sdk/apr-service.js.map +1 -1
- package/dist/tools/optimize-portfolio.js +2 -2
- package/dist/tools/optimize-portfolio.js.map +1 -1
- package/package.json +1 -1
- package/dist/graphql/fragments.d.ts +0 -183
- package/dist/graphql/fragments.d.ts.map +0 -1
- package/dist/graphql/fragments.js +0 -297
- package/dist/graphql/fragments.js.map +0 -1
- package/dist/graphql/queries/period-summaries.d.ts +0 -15
- package/dist/graphql/queries/period-summaries.d.ts.map +0 -1
- package/dist/graphql/queries/period-summaries.js +0 -24
- package/dist/graphql/queries/period-summaries.js.map +0 -1
- package/dist/sdk/__tests__/apr-service.test.d.ts +0 -7
- package/dist/sdk/__tests__/apr-service.test.d.ts.map +0 -1
- package/dist/sdk/__tests__/apr-service.test.js +0 -385
- package/dist/sdk/__tests__/apr-service.test.js.map +0 -1
- package/dist/sdk/__tests__/math-utils.test.d.ts +0 -7
- package/dist/sdk/__tests__/math-utils.test.d.ts.map +0 -1
- package/dist/sdk/__tests__/math-utils.test.js +0 -185
- package/dist/sdk/__tests__/math-utils.test.js.map +0 -1
- package/dist/sdk/__tests__/simulation-service.test.d.ts +0 -5
- package/dist/sdk/__tests__/simulation-service.test.d.ts.map +0 -1
- package/dist/sdk/__tests__/simulation-service.test.js +0 -397
- package/dist/sdk/__tests__/simulation-service.test.js.map +0 -1
- package/dist/sdk/__tests__/vault-utils.test.d.ts +0 -7
- package/dist/sdk/__tests__/vault-utils.test.d.ts.map +0 -1
- package/dist/sdk/__tests__/vault-utils.test.js +0 -189
- package/dist/sdk/__tests__/vault-utils.test.js.map +0 -1
- package/dist/tools/__tests__/simulate-vault.test.d.ts +0 -5
- package/dist/tools/__tests__/simulate-vault.test.d.ts.map +0 -1
- package/dist/tools/__tests__/simulate-vault.test.js +0 -363
- package/dist/tools/__tests__/simulate-vault.test.js.map +0 -1
- package/dist/tools/index.d.ts +0 -26
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -32
- package/dist/tools/index.js.map +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GraphQL Query: Period Summaries
|
|
3
|
-
*
|
|
4
|
-
* Fetch historical vault period summaries for APR calculations.
|
|
5
|
-
*/
|
|
6
|
-
import { gql } from 'graphql-request';
|
|
7
|
-
/**
|
|
8
|
-
* Query to fetch period summaries for a vault
|
|
9
|
-
*
|
|
10
|
-
* Period summaries contain historical snapshots of vault state at regular intervals.
|
|
11
|
-
* Used by SDK to calculate accurate APR from price per share changes over time.
|
|
12
|
-
*
|
|
13
|
-
* @returns Array of period summaries with timestamp and vault state
|
|
14
|
-
*/
|
|
15
|
-
export const GET_PERIOD_SUMMARIES_QUERY = gql `
|
|
16
|
-
query GetPeriodSummaries($vaultAddress: String!, $chainId: Int!) {
|
|
17
|
-
periodSummaries(vaultAddress: $vaultAddress, chainId: $chainId) {
|
|
18
|
-
timestamp
|
|
19
|
-
totalAssetsAtStart
|
|
20
|
-
totalSupplyAtStart
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
//# sourceMappingURL=period-summaries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"period-summaries.js","sourceRoot":"","sources":["../../../src/graphql/queries/period-summaries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAA;;;;;;;;CAQ5C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apr-service.test.d.ts","sourceRoot":"","sources":["../../../src/sdk/__tests__/apr-service.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* APR Service Test Suite
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive tests for SDK APR calculations and period summary transformations.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect } from 'vitest';
|
|
7
|
-
import { transformPeriodSummariesToAPRData, calculateAPRFromPriceChange, calculateCurrentAPR, } from '../apr-service.js';
|
|
8
|
-
// Mock vault data for testing
|
|
9
|
-
const mockVault = {
|
|
10
|
-
address: '0x1234567890123456789012345678901234567890',
|
|
11
|
-
symbol: 'LTEST',
|
|
12
|
-
name: 'Test Vault',
|
|
13
|
-
description: null,
|
|
14
|
-
shortDescription: null,
|
|
15
|
-
decimals: 18,
|
|
16
|
-
logoUrl: null,
|
|
17
|
-
maxCapacity: null,
|
|
18
|
-
averageSettlement: null,
|
|
19
|
-
isVisible: true,
|
|
20
|
-
chain: {
|
|
21
|
-
id: 1,
|
|
22
|
-
name: 'Ethereum',
|
|
23
|
-
nativeToken: 'ETH',
|
|
24
|
-
factory: '0x0000000000000000000000000000000000000000',
|
|
25
|
-
logoUrl: '',
|
|
26
|
-
wrappedNativeToken: {
|
|
27
|
-
address: '0x0000000000000000000000000000000000000000',
|
|
28
|
-
symbol: 'WETH',
|
|
29
|
-
name: 'Wrapped Ether',
|
|
30
|
-
decimals: 18,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
asset: {
|
|
34
|
-
id: 'usdc-eth',
|
|
35
|
-
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
36
|
-
symbol: 'USDC',
|
|
37
|
-
name: 'USD Coin',
|
|
38
|
-
decimals: 6,
|
|
39
|
-
description: null,
|
|
40
|
-
logoUrl: null,
|
|
41
|
-
isVisible: true,
|
|
42
|
-
priceUsd: 1.0,
|
|
43
|
-
chain: {
|
|
44
|
-
id: '1',
|
|
45
|
-
name: 'Ethereum',
|
|
46
|
-
nativeToken: 'ETH',
|
|
47
|
-
logoUrl: '',
|
|
48
|
-
},
|
|
49
|
-
priceSources: {
|
|
50
|
-
chainlinkPriceFeed: null,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
state: {
|
|
54
|
-
state: 'ACTIVE',
|
|
55
|
-
totalAssets: '1000000000',
|
|
56
|
-
totalAssetsUsd: 1000,
|
|
57
|
-
totalSupply: '950000000000000000000',
|
|
58
|
-
newTotalAssets: '1000000000',
|
|
59
|
-
pricePerShare: '1052631',
|
|
60
|
-
pricePerShareUsd: 1.052631,
|
|
61
|
-
safeAssetBalance: '100000000',
|
|
62
|
-
safeAssetBalanceUsd: 100,
|
|
63
|
-
pendingSettlement: {
|
|
64
|
-
assets: '0',
|
|
65
|
-
assetsUsd: 0,
|
|
66
|
-
},
|
|
67
|
-
pendingSiloBalances: {
|
|
68
|
-
assets: '0',
|
|
69
|
-
shares: '0',
|
|
70
|
-
},
|
|
71
|
-
liveAPR: null,
|
|
72
|
-
inceptionApr: {
|
|
73
|
-
linearNetApr: 0,
|
|
74
|
-
linearNetAprWithoutExtraYields: 0,
|
|
75
|
-
airdrops: [],
|
|
76
|
-
incentives: [],
|
|
77
|
-
nativeYields: [],
|
|
78
|
-
},
|
|
79
|
-
weeklyApr: {
|
|
80
|
-
linearNetApr: 0,
|
|
81
|
-
linearNetAprWithoutExtraYields: 0,
|
|
82
|
-
airdrops: [],
|
|
83
|
-
incentives: [],
|
|
84
|
-
nativeYields: [],
|
|
85
|
-
},
|
|
86
|
-
monthlyApr: {
|
|
87
|
-
linearNetApr: 0,
|
|
88
|
-
linearNetAprWithoutExtraYields: 0,
|
|
89
|
-
airdrops: [],
|
|
90
|
-
incentives: [],
|
|
91
|
-
nativeYields: [],
|
|
92
|
-
},
|
|
93
|
-
yearlyApr: {
|
|
94
|
-
linearNetApr: 0,
|
|
95
|
-
linearNetAprWithoutExtraYields: 0,
|
|
96
|
-
airdrops: [],
|
|
97
|
-
incentives: [],
|
|
98
|
-
nativeYields: [],
|
|
99
|
-
},
|
|
100
|
-
roles: {
|
|
101
|
-
owner: '0x0000000000000000000000000000000000000000',
|
|
102
|
-
valuationManager: '0x0000000000000000000000000000000000000000',
|
|
103
|
-
whitelistManager: '0x0000000000000000000000000000000000000000',
|
|
104
|
-
safe: '0x0000000000000000000000000000000000000000',
|
|
105
|
-
feeReceiver: '0x0000000000000000000000000000000000000000',
|
|
106
|
-
},
|
|
107
|
-
managementFee: 200,
|
|
108
|
-
performanceFee: 2000,
|
|
109
|
-
highWaterMark: '1000000',
|
|
110
|
-
lastFeeTime: '1704067200',
|
|
111
|
-
},
|
|
112
|
-
curators: null,
|
|
113
|
-
integrator: null,
|
|
114
|
-
defiIntegrations: null,
|
|
115
|
-
};
|
|
116
|
-
describe('transformPeriodSummariesToAPRData', () => {
|
|
117
|
-
it('should transform period summaries to APR data', () => {
|
|
118
|
-
const now = Math.floor(Date.now() / 1000);
|
|
119
|
-
const thirtyDaysAgo = now - 30 * 24 * 60 * 60;
|
|
120
|
-
const sixtyDaysAgo = now - 60 * 24 * 60 * 60;
|
|
121
|
-
const periodSummaries = [
|
|
122
|
-
{
|
|
123
|
-
timestamp: sixtyDaysAgo.toString(),
|
|
124
|
-
totalAssetsAtStart: '1000000000', // 1000 USDC
|
|
125
|
-
totalSupplyAtStart: '1000000000000000000000', // 1000 shares (1:1)
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
timestamp: thirtyDaysAgo.toString(),
|
|
129
|
-
totalAssetsAtStart: '1025000000', // 1025 USDC
|
|
130
|
-
totalSupplyAtStart: '1000000000000000000000', // 1000 shares
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
const result = transformPeriodSummariesToAPRData(periodSummaries, mockVault);
|
|
134
|
-
// Should have both 30-day and inception data
|
|
135
|
-
expect(result.thirtyDay).toBeDefined();
|
|
136
|
-
expect(result.inception).toBeDefined();
|
|
137
|
-
// Verify we got valid data (SDK may select different periods based on 30-day threshold)
|
|
138
|
-
// Just verify inception is the oldest
|
|
139
|
-
expect(result.inception?.timestamp).toBe(sixtyDaysAgo);
|
|
140
|
-
// If we have 30-day data, it should be valid
|
|
141
|
-
if (result.thirtyDay) {
|
|
142
|
-
expect(result.thirtyDay.timestamp).toBeGreaterThan(0);
|
|
143
|
-
expect(result.thirtyDay.pricePerShare).toBeGreaterThan(0n);
|
|
144
|
-
}
|
|
145
|
-
// Price per share should be valid (SDK may return inception as 30-day if recent)
|
|
146
|
-
// Just verify we get valid price data
|
|
147
|
-
expect(result.inception?.pricePerShare).toBe(1000000n); // 1:1 ratio for inception
|
|
148
|
-
});
|
|
149
|
-
it('should handle empty period summaries gracefully', () => {
|
|
150
|
-
const result = transformPeriodSummariesToAPRData([], mockVault);
|
|
151
|
-
expect(result).toEqual({});
|
|
152
|
-
expect(result.thirtyDay).toBeUndefined();
|
|
153
|
-
expect(result.inception).toBeUndefined();
|
|
154
|
-
});
|
|
155
|
-
it('should handle new vaults with only one period', () => {
|
|
156
|
-
const now = Math.floor(Date.now() / 1000);
|
|
157
|
-
const periodSummaries = [
|
|
158
|
-
{
|
|
159
|
-
timestamp: now.toString(),
|
|
160
|
-
totalAssetsAtStart: '1000000000',
|
|
161
|
-
totalSupplyAtStart: '1000000000000000000000',
|
|
162
|
-
},
|
|
163
|
-
];
|
|
164
|
-
const result = transformPeriodSummariesToAPRData(periodSummaries, mockVault);
|
|
165
|
-
// Should have inception but not 30-day (too recent)
|
|
166
|
-
expect(result.inception).toBeDefined();
|
|
167
|
-
// 30-day may or may not be defined depending on exact timing
|
|
168
|
-
});
|
|
169
|
-
it('should handle different vault decimals', () => {
|
|
170
|
-
const ethVault = {
|
|
171
|
-
...mockVault,
|
|
172
|
-
decimals: 18,
|
|
173
|
-
asset: {
|
|
174
|
-
...mockVault.asset,
|
|
175
|
-
decimals: 18,
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
const periodSummaries = [
|
|
179
|
-
{
|
|
180
|
-
timestamp: '1704067200',
|
|
181
|
-
totalAssetsAtStart: '1000000000000000000000', // 1000 ETH (18 decimals)
|
|
182
|
-
totalSupplyAtStart: '950000000000000000000', // 950 shares
|
|
183
|
-
},
|
|
184
|
-
];
|
|
185
|
-
const result = transformPeriodSummariesToAPRData(periodSummaries, ethVault);
|
|
186
|
-
expect(result.inception).toBeDefined();
|
|
187
|
-
// Price should be ~1.052631 ETH per share (in 18 decimals)
|
|
188
|
-
expect(result.inception?.pricePerShare).toBeGreaterThan(1050000000000000000n);
|
|
189
|
-
expect(result.inception?.pricePerShare).toBeLessThan(1060000000000000000n);
|
|
190
|
-
});
|
|
191
|
-
it('should sort periods to find oldest inception', () => {
|
|
192
|
-
const periodSummaries = [
|
|
193
|
-
{
|
|
194
|
-
timestamp: '1704153600', // Newer
|
|
195
|
-
totalAssetsAtStart: '1050000000',
|
|
196
|
-
totalSupplyAtStart: '1000000000000000000000',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
timestamp: '1704067200', // Older - should be inception
|
|
200
|
-
totalAssetsAtStart: '1000000000',
|
|
201
|
-
totalSupplyAtStart: '1000000000000000000000',
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
timestamp: '1704240000', // Newest
|
|
205
|
-
totalAssetsAtStart: '1075000000',
|
|
206
|
-
totalSupplyAtStart: '1000000000000000000000',
|
|
207
|
-
},
|
|
208
|
-
];
|
|
209
|
-
const result = transformPeriodSummariesToAPRData(periodSummaries, mockVault);
|
|
210
|
-
// Inception should be the oldest timestamp
|
|
211
|
-
expect(result.inception?.timestamp).toBe(1704067200);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
describe('calculateAPRFromPriceChange', () => {
|
|
215
|
-
it('should calculate APR for 30-day period', () => {
|
|
216
|
-
const oldPrice = 1000000n; // 1.0 USDC
|
|
217
|
-
const newPrice = 1025000n; // 1.025 USDC (2.5% gain)
|
|
218
|
-
const days = 30;
|
|
219
|
-
const apr = calculateAPRFromPriceChange(oldPrice, newPrice, days);
|
|
220
|
-
// 2.5% in 30 days = ~30.42% APR
|
|
221
|
-
expect(apr).toBeGreaterThan(30);
|
|
222
|
-
expect(apr).toBeLessThan(31);
|
|
223
|
-
});
|
|
224
|
-
it('should calculate APR for 90-day period', () => {
|
|
225
|
-
const oldPrice = 1000000n;
|
|
226
|
-
const newPrice = 1075000n; // 7.5% gain
|
|
227
|
-
const days = 90;
|
|
228
|
-
const apr = calculateAPRFromPriceChange(oldPrice, newPrice, days);
|
|
229
|
-
// 7.5% in 90 days = ~30.42% APR
|
|
230
|
-
expect(apr).toBeGreaterThan(30);
|
|
231
|
-
expect(apr).toBeLessThan(31);
|
|
232
|
-
});
|
|
233
|
-
it('should calculate APR for 365-day period', () => {
|
|
234
|
-
const oldPrice = 1000000n;
|
|
235
|
-
const newPrice = 1300000n; // 30% gain
|
|
236
|
-
const days = 365;
|
|
237
|
-
const apr = calculateAPRFromPriceChange(oldPrice, newPrice, days);
|
|
238
|
-
// 30% in 365 days = 30% APR
|
|
239
|
-
expect(apr).toBeCloseTo(30, 0);
|
|
240
|
-
});
|
|
241
|
-
it('should handle negative returns', () => {
|
|
242
|
-
const oldPrice = 1000000n;
|
|
243
|
-
const newPrice = 950000n; // -5% loss
|
|
244
|
-
const days = 30;
|
|
245
|
-
const apr = calculateAPRFromPriceChange(oldPrice, newPrice, days);
|
|
246
|
-
// -5% in 30 days = ~-60.83% APR
|
|
247
|
-
expect(apr).toBeLessThan(0);
|
|
248
|
-
expect(apr).toBeGreaterThan(-61);
|
|
249
|
-
expect(apr).toBeLessThan(-60);
|
|
250
|
-
});
|
|
251
|
-
it('should handle zero price change', () => {
|
|
252
|
-
const price = 1000000n;
|
|
253
|
-
const apr = calculateAPRFromPriceChange(price, price, 30);
|
|
254
|
-
expect(apr).toBe(0);
|
|
255
|
-
});
|
|
256
|
-
it('should handle zero old price gracefully', () => {
|
|
257
|
-
const apr = calculateAPRFromPriceChange(0n, 1000000n, 30);
|
|
258
|
-
expect(apr).toBe(0); // Returns 0 instead of throwing
|
|
259
|
-
});
|
|
260
|
-
it('should handle zero or negative days gracefully', () => {
|
|
261
|
-
expect(calculateAPRFromPriceChange(1000000n, 1025000n, 0)).toBe(0);
|
|
262
|
-
expect(calculateAPRFromPriceChange(1000000n, 1025000n, -1)).toBe(0);
|
|
263
|
-
});
|
|
264
|
-
it('should maintain precision with large values', () => {
|
|
265
|
-
const oldPrice = 1000000000000000000n; // 1 ETH in wei
|
|
266
|
-
const newPrice = 1025000000000000000n; // 1.025 ETH
|
|
267
|
-
const days = 30;
|
|
268
|
-
const apr = calculateAPRFromPriceChange(oldPrice, newPrice, days);
|
|
269
|
-
// Should get same result as smaller values
|
|
270
|
-
expect(apr).toBeGreaterThan(30);
|
|
271
|
-
expect(apr).toBeLessThan(31);
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
describe('calculateCurrentAPR', () => {
|
|
275
|
-
it('should calculate current APR from historical data', () => {
|
|
276
|
-
const now = Date.now() / 1000;
|
|
277
|
-
const thirtyDaysAgo = now - 30 * 24 * 60 * 60;
|
|
278
|
-
const aprData = {
|
|
279
|
-
thirtyDay: {
|
|
280
|
-
timestamp: thirtyDaysAgo,
|
|
281
|
-
pricePerShare: 1000000n, // 1.0 USDC
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
const currentPrice = 1025000n; // 1.025 USDC
|
|
285
|
-
const result = calculateCurrentAPR(aprData, currentPrice);
|
|
286
|
-
expect(result.thirtyDay).toBeDefined();
|
|
287
|
-
expect(result.thirtyDay).toBeGreaterThan(30);
|
|
288
|
-
expect(result.thirtyDay).toBeLessThan(31);
|
|
289
|
-
});
|
|
290
|
-
it('should calculate both 30-day and inception APR', () => {
|
|
291
|
-
const now = Date.now() / 1000;
|
|
292
|
-
const thirtyDaysAgo = now - 30 * 24 * 60 * 60;
|
|
293
|
-
const ninetyDaysAgo = now - 90 * 24 * 60 * 60;
|
|
294
|
-
const aprData = {
|
|
295
|
-
thirtyDay: {
|
|
296
|
-
timestamp: thirtyDaysAgo,
|
|
297
|
-
pricePerShare: 1025000n,
|
|
298
|
-
},
|
|
299
|
-
inception: {
|
|
300
|
-
timestamp: ninetyDaysAgo,
|
|
301
|
-
pricePerShare: 1000000n,
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
const currentPrice = 1075000n;
|
|
305
|
-
const result = calculateCurrentAPR(aprData, currentPrice);
|
|
306
|
-
expect(result.thirtyDay).toBeDefined();
|
|
307
|
-
expect(result.inception).toBeDefined();
|
|
308
|
-
// 30-day: 1.025 → 1.075 (4.88% in 30 days)
|
|
309
|
-
expect(result.thirtyDay).toBeGreaterThan(59);
|
|
310
|
-
expect(result.thirtyDay).toBeLessThan(61);
|
|
311
|
-
// Inception: 1.0 → 1.075 (7.5% in 90 days)
|
|
312
|
-
expect(result.inception).toBeGreaterThan(30);
|
|
313
|
-
expect(result.inception).toBeLessThan(31);
|
|
314
|
-
});
|
|
315
|
-
it('should handle empty APR data', () => {
|
|
316
|
-
const aprData = {};
|
|
317
|
-
const currentPrice = 1025000n;
|
|
318
|
-
const result = calculateCurrentAPR(aprData, currentPrice);
|
|
319
|
-
expect(result.thirtyDay).toBeUndefined();
|
|
320
|
-
expect(result.inception).toBeUndefined();
|
|
321
|
-
});
|
|
322
|
-
it('should handle only 30-day data', () => {
|
|
323
|
-
const now = Date.now() / 1000;
|
|
324
|
-
const thirtyDaysAgo = now - 30 * 24 * 60 * 60;
|
|
325
|
-
const aprData = {
|
|
326
|
-
thirtyDay: {
|
|
327
|
-
timestamp: thirtyDaysAgo,
|
|
328
|
-
pricePerShare: 1000000n,
|
|
329
|
-
},
|
|
330
|
-
};
|
|
331
|
-
const currentPrice = 1025000n;
|
|
332
|
-
const result = calculateCurrentAPR(aprData, currentPrice);
|
|
333
|
-
expect(result.thirtyDay).toBeDefined();
|
|
334
|
-
expect(result.inception).toBeUndefined();
|
|
335
|
-
});
|
|
336
|
-
it('should handle only inception data', () => {
|
|
337
|
-
const now = Date.now() / 1000;
|
|
338
|
-
const ninetyDaysAgo = now - 90 * 24 * 60 * 60;
|
|
339
|
-
const aprData = {
|
|
340
|
-
inception: {
|
|
341
|
-
timestamp: ninetyDaysAgo,
|
|
342
|
-
pricePerShare: 1000000n,
|
|
343
|
-
},
|
|
344
|
-
};
|
|
345
|
-
const currentPrice = 1075000n;
|
|
346
|
-
const result = calculateCurrentAPR(aprData, currentPrice);
|
|
347
|
-
expect(result.thirtyDay).toBeUndefined();
|
|
348
|
-
expect(result.inception).toBeDefined();
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
describe('Integration: Full APR workflow', () => {
|
|
352
|
-
it('should calculate APR from period summaries to current APR', () => {
|
|
353
|
-
const now = Math.floor(Date.now() / 1000);
|
|
354
|
-
const thirtyDaysAgo = now - 30 * 24 * 60 * 60;
|
|
355
|
-
const ninetyDaysAgo = now - 90 * 24 * 60 * 60;
|
|
356
|
-
// Step 1: Period summaries from GraphQL
|
|
357
|
-
const periodSummaries = [
|
|
358
|
-
{
|
|
359
|
-
timestamp: ninetyDaysAgo.toString(),
|
|
360
|
-
totalAssetsAtStart: '1000000000', // 1000 USDC
|
|
361
|
-
totalSupplyAtStart: '1000000000000000000000', // 1000 shares
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
timestamp: thirtyDaysAgo.toString(),
|
|
365
|
-
totalAssetsAtStart: '1025000000', // 1025 USDC
|
|
366
|
-
totalSupplyAtStart: '1000000000000000000000', // 1000 shares
|
|
367
|
-
},
|
|
368
|
-
];
|
|
369
|
-
// Step 2: Transform to APR data
|
|
370
|
-
const aprData = transformPeriodSummariesToAPRData(periodSummaries, mockVault);
|
|
371
|
-
expect(aprData.thirtyDay).toBeDefined();
|
|
372
|
-
expect(aprData.inception).toBeDefined();
|
|
373
|
-
// Step 3: Calculate current APR
|
|
374
|
-
const currentPrice = 1075000n; // 1.075 USDC
|
|
375
|
-
const currentAPR = calculateCurrentAPR(aprData, currentPrice);
|
|
376
|
-
expect(currentAPR.thirtyDay).toBeDefined();
|
|
377
|
-
expect(currentAPR.inception).toBeDefined();
|
|
378
|
-
// Verify APR calculations are reasonable
|
|
379
|
-
expect(currentAPR.thirtyDay).toBeGreaterThan(0);
|
|
380
|
-
expect(currentAPR.inception).toBeGreaterThan(0);
|
|
381
|
-
// 30-day should show higher APR (shorter period, same endpoint)
|
|
382
|
-
expect(currentAPR.thirtyDay).toBeGreaterThan(currentAPR.inception);
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
//# sourceMappingURL=apr-service.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apr-service.test.js","sourceRoot":"","sources":["../../../src/sdk/__tests__/apr-service.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAG3B,8BAA8B;AAC9B,MAAM,SAAS,GAAc;IAC3B,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,IAAI;IACtB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,IAAI;IACf,KAAK,EAAE;QACL,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,EAAE;QACX,kBAAkB,EAAE;YAClB,OAAO,EAAE,4CAA4C;YACrD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,EAAE;SACb;KACF;IACD,KAAK,EAAE;QACL,EAAE,EAAE,UAAU;Q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,EAAE,cAAc;aAC7D;SACF,CAAC;QAEF,gCAAgC;QAChC,MAAM,OAAO,GAAG,iCAAiC,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;QAE9E,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAExC,gCAAgC;QAChC,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,aAAa;QAE5C,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAE9D,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;QAE3C,yCAAyC;QACzC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAEhD,gEAAgE;QAChE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,SAAU,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math-utils.test.d.ts","sourceRoot":"","sources":["../../../src/sdk/__tests__/math-utils.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Math Utilities Test Suite
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive tests for BigInt mathematical operations and serialization.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect } from 'vitest';
|
|
7
|
-
import { bigIntReplacer, safeBigIntStringify, formatBigInt, parseBigInt, isValidBigIntString, percentageChange, formatPercentageChange, } from '../math-utils.js';
|
|
8
|
-
describe('bigIntReplacer', () => {
|
|
9
|
-
it('should convert BigInt to string', () => {
|
|
10
|
-
const result = bigIntReplacer('amount', 1000000000000000000n);
|
|
11
|
-
expect(result).toBe('1000000000000000000');
|
|
12
|
-
});
|
|
13
|
-
it('should leave non-BigInt values unchanged', () => {
|
|
14
|
-
expect(bigIntReplacer('str', 'hello')).toBe('hello');
|
|
15
|
-
expect(bigIntReplacer('num', 42)).toBe(42);
|
|
16
|
-
expect(bigIntReplacer('bool', true)).toBe(true);
|
|
17
|
-
expect(bigIntReplacer('null', null)).toBe(null);
|
|
18
|
-
expect(bigIntReplacer('undef', undefined)).toBe(undefined);
|
|
19
|
-
});
|
|
20
|
-
it('should handle objects with mixed types', () => {
|
|
21
|
-
const obj = {
|
|
22
|
-
bigint: 1000n,
|
|
23
|
-
number: 42,
|
|
24
|
-
string: 'test',
|
|
25
|
-
};
|
|
26
|
-
const result = JSON.parse(JSON.stringify(obj, bigIntReplacer));
|
|
27
|
-
expect(result.bigint).toBe('1000');
|
|
28
|
-
expect(result.number).toBe(42);
|
|
29
|
-
expect(result.string).toBe('test');
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
describe('safeBigIntStringify', () => {
|
|
33
|
-
it('should stringify object with BigInt values', () => {
|
|
34
|
-
const obj = { amount: 1000000000000000000n };
|
|
35
|
-
const result = safeBigIntStringify(obj);
|
|
36
|
-
expect(result).toContain('"amount"');
|
|
37
|
-
expect(result).toContain('"1000000000000000000"');
|
|
38
|
-
expect(() => {
|
|
39
|
-
JSON.parse(result);
|
|
40
|
-
}).not.toThrow();
|
|
41
|
-
});
|
|
42
|
-
it('should handle nested objects with BigInt', () => {
|
|
43
|
-
const obj = {
|
|
44
|
-
vault: {
|
|
45
|
-
balance: 5000000n,
|
|
46
|
-
shares: 4500000n,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const result = safeBigIntStringify(obj);
|
|
50
|
-
const parsed = JSON.parse(result);
|
|
51
|
-
expect(parsed.vault.balance).toBe('5000000');
|
|
52
|
-
expect(parsed.vault.shares).toBe('4500000');
|
|
53
|
-
});
|
|
54
|
-
it('should handle arrays with BigInt', () => {
|
|
55
|
-
const obj = { amounts: [1000n, 2000n, 3000n] };
|
|
56
|
-
const result = safeBigIntStringify(obj);
|
|
57
|
-
const parsed = JSON.parse(result);
|
|
58
|
-
expect(parsed.amounts).toEqual(['1000', '2000', '3000']);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('formatBigInt', () => {
|
|
62
|
-
it('should format 18-decimal values (ether)', () => {
|
|
63
|
-
expect(formatBigInt(1500000000000000000n, 18)).toBe('1.500000000000000000');
|
|
64
|
-
expect(formatBigInt(1000000000000000000n, 18)).toBe('1.000000000000000000');
|
|
65
|
-
expect(formatBigInt(123456789012345678n, 18)).toBe('0.123456789012345678');
|
|
66
|
-
});
|
|
67
|
-
it('should format 6-decimal values (USDC)', () => {
|
|
68
|
-
expect(formatBigInt(1500000n, 6)).toBe('1.500000');
|
|
69
|
-
expect(formatBigInt(1000000n, 6)).toBe('1.000000');
|
|
70
|
-
expect(formatBigInt(123456n, 6)).toBe('0.123456');
|
|
71
|
-
});
|
|
72
|
-
it('should handle zero decimals', () => {
|
|
73
|
-
expect(formatBigInt(1500n, 0)).toBe('1500');
|
|
74
|
-
expect(formatBigInt(0n, 0)).toBe('0');
|
|
75
|
-
});
|
|
76
|
-
it('should handle zero values', () => {
|
|
77
|
-
expect(formatBigInt(0n, 18)).toBe('0.000000000000000000');
|
|
78
|
-
expect(formatBigInt(0n, 6)).toBe('0.000000');
|
|
79
|
-
});
|
|
80
|
-
it('should pad fractional part with leading zeros', () => {
|
|
81
|
-
expect(formatBigInt(1n, 18)).toBe('0.000000000000000001');
|
|
82
|
-
expect(formatBigInt(100n, 18)).toBe('0.000000000000000100');
|
|
83
|
-
});
|
|
84
|
-
it('should throw on negative decimals', () => {
|
|
85
|
-
expect(() => formatBigInt(1000n, -1)).toThrow('Decimals must be non-negative');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
describe('parseBigInt', () => {
|
|
89
|
-
it('should parse decimal strings to BigInt', () => {
|
|
90
|
-
expect(parseBigInt('1.5', 18)).toBe(1500000000000000000n);
|
|
91
|
-
expect(parseBigInt('1.5', 6)).toBe(1500000n);
|
|
92
|
-
expect(parseBigInt('0.123456', 6)).toBe(123456n);
|
|
93
|
-
});
|
|
94
|
-
it('should parse integer strings', () => {
|
|
95
|
-
expect(parseBigInt('1000', 6)).toBe(1000000000n);
|
|
96
|
-
expect(parseBigInt('1', 18)).toBe(1000000000000000000n);
|
|
97
|
-
});
|
|
98
|
-
it('should handle zero values', () => {
|
|
99
|
-
expect(parseBigInt('0', 18)).toBe(0n);
|
|
100
|
-
expect(parseBigInt('0.0', 18)).toBe(0n);
|
|
101
|
-
});
|
|
102
|
-
it('should pad short fractional parts', () => {
|
|
103
|
-
expect(parseBigInt('1.5', 18)).toBe(1500000000000000000n);
|
|
104
|
-
expect(parseBigInt('1.5', 6)).toBe(1500000n);
|
|
105
|
-
});
|
|
106
|
-
it('should throw on empty or invalid input', () => {
|
|
107
|
-
expect(() => parseBigInt('', 18)).toThrow('Value cannot be empty');
|
|
108
|
-
expect(() => parseBigInt(' ', 18)).toThrow('Value cannot be empty');
|
|
109
|
-
expect(() => parseBigInt('abc', 18)).toThrow('Invalid integer format');
|
|
110
|
-
expect(() => parseBigInt('1.2.3', 18)).toThrow('Invalid decimal format');
|
|
111
|
-
});
|
|
112
|
-
it('should throw on negative decimals', () => {
|
|
113
|
-
expect(() => parseBigInt('1.5', -1)).toThrow('Decimals must be non-negative');
|
|
114
|
-
});
|
|
115
|
-
it('should throw on too many decimal places', () => {
|
|
116
|
-
expect(() => parseBigInt('1.1234567', 6)).toThrow('Too many decimal places');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
describe('isValidBigIntString', () => {
|
|
120
|
-
it('should validate correct BigInt strings', () => {
|
|
121
|
-
expect(isValidBigIntString('1000000000000000000')).toBe(true);
|
|
122
|
-
expect(isValidBigIntString('0')).toBe(true);
|
|
123
|
-
expect(isValidBigIntString('123')).toBe(true);
|
|
124
|
-
});
|
|
125
|
-
it('should reject invalid formats', () => {
|
|
126
|
-
expect(isValidBigIntString('')).toBe(false);
|
|
127
|
-
expect(isValidBigIntString(' ')).toBe(false);
|
|
128
|
-
expect(isValidBigIntString('abc')).toBe(false);
|
|
129
|
-
expect(isValidBigIntString('1.5')).toBe(false);
|
|
130
|
-
expect(isValidBigIntString('-100')).toBe(false);
|
|
131
|
-
expect(isValidBigIntString('1e18')).toBe(false);
|
|
132
|
-
});
|
|
133
|
-
it('should handle whitespace', () => {
|
|
134
|
-
expect(isValidBigIntString(' 1000 ')).toBe(true);
|
|
135
|
-
expect(isValidBigIntString(' ')).toBe(false);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('percentageChange', () => {
|
|
139
|
-
it('should calculate positive percentage changes', () => {
|
|
140
|
-
expect(percentageChange(1000000n, 1025000n)).toBe(250); // 2.50%
|
|
141
|
-
expect(percentageChange(1000000n, 1100000n)).toBe(1000); // 10.00%
|
|
142
|
-
expect(percentageChange(1000000n, 2000000n)).toBe(10000); // 100.00%
|
|
143
|
-
});
|
|
144
|
-
it('should calculate negative percentage changes', () => {
|
|
145
|
-
expect(percentageChange(1000000n, 975000n)).toBe(-250); // -2.50%
|
|
146
|
-
expect(percentageChange(1000000n, 900000n)).toBe(-1000); // -10.00%
|
|
147
|
-
expect(percentageChange(1000000n, 500000n)).toBe(-5000); // -50.00%
|
|
148
|
-
});
|
|
149
|
-
it('should handle zero change', () => {
|
|
150
|
-
expect(percentageChange(1000000n, 1000000n)).toBe(0);
|
|
151
|
-
});
|
|
152
|
-
it('should handle zero old value', () => {
|
|
153
|
-
expect(percentageChange(0n, 1000000n)).toBe(Infinity);
|
|
154
|
-
expect(percentageChange(0n, 0n)).toBe(0);
|
|
155
|
-
});
|
|
156
|
-
it('should handle large values with precision', () => {
|
|
157
|
-
const old = 1000000000000000000n; // 1e18
|
|
158
|
-
const newVal = 1050000000000000000n; // 1.05e18
|
|
159
|
-
expect(percentageChange(old, newVal)).toBe(500); // 5.00%
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('formatPercentageChange', () => {
|
|
163
|
-
it('should format positive changes', () => {
|
|
164
|
-
expect(formatPercentageChange(250)).toBe('+2.50%');
|
|
165
|
-
expect(formatPercentageChange(1000)).toBe('+10.00%');
|
|
166
|
-
expect(formatPercentageChange(10000)).toBe('+100.00%');
|
|
167
|
-
});
|
|
168
|
-
it('should format negative changes', () => {
|
|
169
|
-
expect(formatPercentageChange(-250)).toBe('-2.50%');
|
|
170
|
-
expect(formatPercentageChange(-1000)).toBe('-10.00%');
|
|
171
|
-
expect(formatPercentageChange(-5000)).toBe('-50.00%');
|
|
172
|
-
});
|
|
173
|
-
it('should format zero change', () => {
|
|
174
|
-
expect(formatPercentageChange(0)).toBe('0.00%');
|
|
175
|
-
});
|
|
176
|
-
it('should handle infinity', () => {
|
|
177
|
-
expect(formatPercentageChange(Infinity)).toBe('+∞%');
|
|
178
|
-
expect(formatPercentageChange(-Infinity)).toBe('-∞%');
|
|
179
|
-
});
|
|
180
|
-
it('should format small changes with precision', () => {
|
|
181
|
-
expect(formatPercentageChange(1)).toBe('+0.01%');
|
|
182
|
-
expect(formatPercentageChange(-1)).toBe('-0.01%');
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
//# sourceMappingURL=math-utils.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math-utils.test.js","sourceRoot":"","sources":["../../../src/sdk/__tests__/math-utils.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,m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