@mento-protocol/mento-sdk 3.2.6-beta.1 → 3.2.6-beta.2
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/cache/routes.js +1033 -669
- package/dist/cache/tokens.js +29 -15
- package/dist/core/constants/borrowRegistries.js +2 -0
- package/dist/esm/cache/routes.js +1033 -669
- package/dist/esm/cache/tokens.js +29 -15
- package/dist/esm/core/constants/borrowRegistries.js +2 -0
- package/dist/esm/services/trading/TradingService.js +37 -11
- package/dist/services/trading/TradingService.d.ts +3 -1
- package/dist/services/trading/TradingService.js +34 -8
- package/package.json +1 -1
package/dist/esm/cache/tokens.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
// Generated on 2026-
|
|
2
|
+
// Generated on 2026-04-23T15:34:16.106Z
|
|
3
3
|
/**
|
|
4
4
|
* Enum of all token symbols across all supported chains
|
|
5
5
|
*/
|
|
@@ -56,6 +56,18 @@ export const cachedTokens = {
|
|
|
56
56
|
symbol: TokenSymbol.AUSD,
|
|
57
57
|
name: 'AUSD',
|
|
58
58
|
decimals: 6,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
address: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
62
|
+
symbol: TokenSymbol.USDT0,
|
|
63
|
+
name: 'USDT0',
|
|
64
|
+
decimals: 6,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
address: '0x4D502d735B4C574B487Ed641ae87cEaE884731C7',
|
|
68
|
+
symbol: TokenSymbol.EURm,
|
|
69
|
+
name: 'Mento Euro',
|
|
70
|
+
decimals: 18,
|
|
59
71
|
}
|
|
60
72
|
],
|
|
61
73
|
// Chain 10143
|
|
@@ -258,6 +270,18 @@ export const cachedTokens = {
|
|
|
258
270
|
name: 'Mento Mock axlEUROC',
|
|
259
271
|
decimals: 18,
|
|
260
272
|
},
|
|
273
|
+
{
|
|
274
|
+
address: '0x85Bee67D435A39f7467a8a9DE34a5B73D25Df426',
|
|
275
|
+
symbol: TokenSymbol.JPYm,
|
|
276
|
+
name: 'Mento Japanese Yen',
|
|
277
|
+
decimals: 18,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
address: '0x284E9b7B623eAE866914b7FA0eB720C2Bb3C2980',
|
|
281
|
+
symbol: TokenSymbol.CHFm,
|
|
282
|
+
name: 'Mento Swiss Franc',
|
|
283
|
+
decimals: 18,
|
|
284
|
+
},
|
|
261
285
|
{
|
|
262
286
|
address: '0x0352976d940a2C3FBa0C3623198947Ee1d17869E',
|
|
263
287
|
symbol: TokenSymbol.PHPm,
|
|
@@ -288,18 +312,6 @@ export const cachedTokens = {
|
|
|
288
312
|
name: 'Mento South African Rand',
|
|
289
313
|
decimals: 18,
|
|
290
314
|
},
|
|
291
|
-
{
|
|
292
|
-
address: '0x284E9b7B623eAE866914b7FA0eB720C2Bb3C2980',
|
|
293
|
-
symbol: TokenSymbol.CHFm,
|
|
294
|
-
name: 'Mento Swiss Franc',
|
|
295
|
-
decimals: 18,
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
address: '0x85Bee67D435A39f7467a8a9DE34a5B73D25Df426',
|
|
299
|
-
symbol: TokenSymbol.JPYm,
|
|
300
|
-
name: 'Mento Japanese Yen',
|
|
301
|
-
decimals: 18,
|
|
302
|
-
},
|
|
303
315
|
{
|
|
304
316
|
address: '0x5F8d55c3627d2dc0a2B4afa798f877242F382F67',
|
|
305
317
|
symbol: TokenSymbol.COPm,
|
|
@@ -342,6 +354,8 @@ export const TOKEN_ADDRESSES_BY_CHAIN = {
|
|
|
342
354
|
[TokenSymbol.USDm]: '0xBC69212B8E4d445b2307C9D32dD68E2A4Df00115',
|
|
343
355
|
[TokenSymbol.USDC]: '0x754704Bc059F8C67012fEd69BC8A327a5aafb603',
|
|
344
356
|
[TokenSymbol.AUSD]: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
|
|
357
|
+
[TokenSymbol.USDT0]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
358
|
+
[TokenSymbol.EURm]: '0x4D502d735B4C574B487Ed641ae87cEaE884731C7',
|
|
345
359
|
},
|
|
346
360
|
10143: {
|
|
347
361
|
[TokenSymbol.GBPm]: '0x04de554E875c9797dC4ceBd834A9e99fa8fD5Df9',
|
|
@@ -380,13 +394,13 @@ export const TOKEN_ADDRESSES_BY_CHAIN = {
|
|
|
380
394
|
[TokenSymbol.USD_]: '0xd077A400968890Eacc75cdc901F0356c943e4fDb',
|
|
381
395
|
[TokenSymbol.EURm]: '0xA99dC247d6b7B2E3ab48a1fEE101b83cD6aCd82a',
|
|
382
396
|
[TokenSymbol.axlEUROC]: '0x9883d788d40F1C7595a780ed881Ea833C7743B4B',
|
|
397
|
+
[TokenSymbol.JPYm]: '0x85Bee67D435A39f7467a8a9DE34a5B73D25Df426',
|
|
398
|
+
[TokenSymbol.CHFm]: '0x284E9b7B623eAE866914b7FA0eB720C2Bb3C2980',
|
|
383
399
|
[TokenSymbol.PHPm]: '0x0352976d940a2C3FBa0C3623198947Ee1d17869E',
|
|
384
400
|
[TokenSymbol.XOFm]: '0x5505b70207aE3B826c1A7607F19F3Bf73444A082',
|
|
385
401
|
[TokenSymbol.AUDm]: '0x5873Faeb42F3563dcD77F0fbbdA818E6d6DA3139',
|
|
386
402
|
[TokenSymbol.CADm]: '0xF151c9a13b78C84f93f50B8b3bC689fedc134F60',
|
|
387
403
|
[TokenSymbol.ZARm]: '0x10CCfB235b0E1Ed394bACE4560C3ed016697687e',
|
|
388
|
-
[TokenSymbol.CHFm]: '0x284E9b7B623eAE866914b7FA0eB720C2Bb3C2980',
|
|
389
|
-
[TokenSymbol.JPYm]: '0x85Bee67D435A39f7467a8a9DE34a5B73D25Df426',
|
|
390
404
|
[TokenSymbol.COPm]: '0x5F8d55c3627d2dc0a2B4afa798f877242F382F67',
|
|
391
405
|
[TokenSymbol.BRLm]: '0x2294298942fdc79417DE9E0D740A4957E0e7783a',
|
|
392
406
|
[TokenSymbol.GHSm]: '0x5e94B8C872bD47BC4255E60ECBF44D5E66e7401C',
|
|
@@ -9,6 +9,8 @@ export const borrowRegistries = {
|
|
|
9
9
|
},
|
|
10
10
|
[ChainId.CELO_SEPOLIA]: {
|
|
11
11
|
GBPm: '0x8b33D626E8d79388889d404fBC515Ed131c9508e',
|
|
12
|
+
CHFm: '0x1e3CCCC62cEBd9Bf2a26Ba512E3abee086816c58',
|
|
13
|
+
JPYm: '0x812e5ccec5e55b81f4270898fdf1c916e3a284fb',
|
|
12
14
|
},
|
|
13
15
|
};
|
|
14
16
|
export function getBorrowRegistry(chainId, debtTokenSymbol) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isTradingEnabled, } from '../../core/types';
|
|
1
|
+
import { isTradingEnabled, PoolType, } from '../../core/types';
|
|
2
2
|
import { TradingLimitsService } from './TradingLimitsService';
|
|
3
|
-
import { BREAKERBOX_ABI, FPMM_ABI } from '../../core/abis';
|
|
4
|
-
import { getContractAddress } from '../../core/constants';
|
|
3
|
+
import { BIPOOL_MANAGER_ABI, BREAKERBOX_ABI, FPMM_ABI } from '../../core/abis';
|
|
4
|
+
import { getContractAddress, tryGetContractAddress } from '../../core/constants';
|
|
5
5
|
import { multicall } from '../../utils/multicall';
|
|
6
6
|
/**
|
|
7
7
|
* Service for checking trading status and circuit breaker state in the Mento protocol.
|
|
@@ -136,7 +136,9 @@ export class TradingService {
|
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Get the reference rate feed ID for a pool.
|
|
139
|
-
*
|
|
139
|
+
* FPMM pools expose this via referenceRateFeedID() directly.
|
|
140
|
+
* Virtual pools wrap a BiPoolManager exchange; the rate feed is read from
|
|
141
|
+
* BiPoolManager.getPoolExchange(exchangeId).config.referenceRateFeedID.
|
|
140
142
|
*
|
|
141
143
|
* @param pool - The pool to get rate feed ID for
|
|
142
144
|
* @returns The rate feed ID address
|
|
@@ -153,16 +155,40 @@ export class TradingService {
|
|
|
153
155
|
if (pools.length === 0) {
|
|
154
156
|
return [];
|
|
155
157
|
}
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
const biPoolManagerAddr = pools.some((pool) => pool.poolType === PoolType.Virtual)
|
|
159
|
+
? tryGetContractAddress(this.chainId, 'BiPoolManager')
|
|
160
|
+
: undefined;
|
|
161
|
+
const contracts = pools.map((pool) => {
|
|
162
|
+
if (pool.poolType === PoolType.Virtual) {
|
|
163
|
+
if (!pool.exchangeId) {
|
|
164
|
+
throw new Error(`Virtual pool ${pool.poolAddr} is missing exchangeId`);
|
|
165
|
+
}
|
|
166
|
+
if (!biPoolManagerAddr) {
|
|
167
|
+
throw new Error(`BiPoolManager address not configured for chain ID ${this.chainId}; cannot resolve rate feed for virtual pool ${pool.poolAddr}`);
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
address: biPoolManagerAddr,
|
|
171
|
+
abi: BIPOOL_MANAGER_ABI,
|
|
172
|
+
functionName: 'getPoolExchange',
|
|
173
|
+
args: [pool.exchangeId],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
address: pool.poolAddr,
|
|
178
|
+
abi: FPMM_ABI,
|
|
179
|
+
functionName: 'referenceRateFeedID',
|
|
180
|
+
args: [],
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
const results = await multicall(this.publicClient, contracts, { allowFailure: false });
|
|
184
|
+
return results.map((result, index) => {
|
|
163
185
|
if (result.status === 'failure') {
|
|
164
186
|
throw result.error;
|
|
165
187
|
}
|
|
188
|
+
if (pools[index].poolType === PoolType.Virtual) {
|
|
189
|
+
const exchange = result.result;
|
|
190
|
+
return exchange.config.referenceRateFeedID;
|
|
191
|
+
}
|
|
166
192
|
return result.result;
|
|
167
193
|
});
|
|
168
194
|
}
|
|
@@ -100,7 +100,9 @@ export declare class TradingService {
|
|
|
100
100
|
getPoolTradabilityStatus(pool: Pool): Promise<PoolTradabilityStatus>;
|
|
101
101
|
/**
|
|
102
102
|
* Get the reference rate feed ID for a pool.
|
|
103
|
-
*
|
|
103
|
+
* FPMM pools expose this via referenceRateFeedID() directly.
|
|
104
|
+
* Virtual pools wrap a BiPoolManager exchange; the rate feed is read from
|
|
105
|
+
* BiPoolManager.getPoolExchange(exchangeId).config.referenceRateFeedID.
|
|
104
106
|
*
|
|
105
107
|
* @param pool - The pool to get rate feed ID for
|
|
106
108
|
* @returns The rate feed ID address
|
|
@@ -139,7 +139,9 @@ class TradingService {
|
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Get the reference rate feed ID for a pool.
|
|
142
|
-
*
|
|
142
|
+
* FPMM pools expose this via referenceRateFeedID() directly.
|
|
143
|
+
* Virtual pools wrap a BiPoolManager exchange; the rate feed is read from
|
|
144
|
+
* BiPoolManager.getPoolExchange(exchangeId).config.referenceRateFeedID.
|
|
143
145
|
*
|
|
144
146
|
* @param pool - The pool to get rate feed ID for
|
|
145
147
|
* @returns The rate feed ID address
|
|
@@ -156,16 +158,40 @@ class TradingService {
|
|
|
156
158
|
if (pools.length === 0) {
|
|
157
159
|
return [];
|
|
158
160
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
const biPoolManagerAddr = pools.some((pool) => pool.poolType === types_1.PoolType.Virtual)
|
|
162
|
+
? (0, constants_1.tryGetContractAddress)(this.chainId, 'BiPoolManager')
|
|
163
|
+
: undefined;
|
|
164
|
+
const contracts = pools.map((pool) => {
|
|
165
|
+
if (pool.poolType === types_1.PoolType.Virtual) {
|
|
166
|
+
if (!pool.exchangeId) {
|
|
167
|
+
throw new Error(`Virtual pool ${pool.poolAddr} is missing exchangeId`);
|
|
168
|
+
}
|
|
169
|
+
if (!biPoolManagerAddr) {
|
|
170
|
+
throw new Error(`BiPoolManager address not configured for chain ID ${this.chainId}; cannot resolve rate feed for virtual pool ${pool.poolAddr}`);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
address: biPoolManagerAddr,
|
|
174
|
+
abi: abis_1.BIPOOL_MANAGER_ABI,
|
|
175
|
+
functionName: 'getPoolExchange',
|
|
176
|
+
args: [pool.exchangeId],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
address: pool.poolAddr,
|
|
181
|
+
abi: abis_1.FPMM_ABI,
|
|
182
|
+
functionName: 'referenceRateFeedID',
|
|
183
|
+
args: [],
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
const results = await (0, multicall_1.multicall)(this.publicClient, contracts, { allowFailure: false });
|
|
187
|
+
return results.map((result, index) => {
|
|
166
188
|
if (result.status === 'failure') {
|
|
167
189
|
throw result.error;
|
|
168
190
|
}
|
|
191
|
+
if (pools[index].poolType === types_1.PoolType.Virtual) {
|
|
192
|
+
const exchange = result.result;
|
|
193
|
+
return exchange.config.referenceRateFeedID;
|
|
194
|
+
}
|
|
169
195
|
return result.result;
|
|
170
196
|
});
|
|
171
197
|
}
|