diff --git a/src/core/trading-config.mjs b/src/core/trading-config.mjs index 0a05c64..5083cd0 100644 --- a/src/core/trading-config.mjs +++ b/src/core/trading-config.mjs @@ -10,6 +10,8 @@ export const LEGACY_OMFT_BTC_ASSET_ID = 'nep141:btc.omft.near'; export const CURRENT_EURE_ASSET_ID = 'nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near'; export const CURRENT_USDC_ASSET_ID = + 'nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near'; +export const GNOSIS_USDC_ASSET_ID = 'nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near'; export const CURRENT_PAIR_KEY = pairKey(CURRENT_NBTC_ASSET_ID, CURRENT_EURE_ASSET_ID); @@ -130,9 +132,9 @@ export function buildSeedAssets() { symbol: 'USDC', label: 'USDC', decimals: 6, - blockchain: 'gnosis', - chain: 'eth:100', - contractAddress: '0x2a22f9c3b484c3629090feed35f17ff8f88f76f0', + blockchain: 'eth', + chain: 'eth', + contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', latestPrice: null, priceUpdatedAt: null, supported: true, diff --git a/test/trading-config.test.mjs b/test/trading-config.test.mjs index ddda109..8797f8c 100644 --- a/test/trading-config.test.mjs +++ b/test/trading-config.test.mjs @@ -6,6 +6,7 @@ import { CURRENT_EURE_ASSET_ID, CURRENT_NBTC_ASSET_ID, CURRENT_USDC_ASSET_ID, + GNOSIS_USDC_ASSET_ID, LEGACY_OMFT_BTC_ASSET_ID, normalizeOneClickToken, } from '../src/core/trading-config.mjs'; @@ -40,7 +41,7 @@ test('1Click token normalizer preserves live asset fields', () => { test('1Click token normalizer maps Gnosis assets to bridge chain id', () => { const token = normalizeOneClickToken({ - assetId: CURRENT_USDC_ASSET_ID, + assetId: GNOSIS_USDC_ASSET_ID, decimals: 6, blockchain: 'gnosis', symbol: 'USDC', @@ -121,15 +122,15 @@ test('seeded DB config preserves current nBTC/EURe pair, 49 bps edge, and legacy assert.equal(snapshot.pairs.length, 2); assert.equal(snapshot.pairByKey.get(snapshot.activePair).strategyConfig.edgeBps, 49); assert.equal(snapshot.trackedAssetIds.includes(LEGACY_OMFT_BTC_ASSET_ID), true); - assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).chain, 'eth:100'); + assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).chain, 'eth'); assert.equal(snapshot.trackedAssetIds.includes(CURRENT_USDC_ASSET_ID), false); assert.equal([...snapshot.makerPairKeys].some((pair) => pair.includes(LEGACY_OMFT_BTC_ASSET_ID)), false); }); -test('repo seed corrects legacy USDC Gnosis chain without inventory-enabling it', async () => { +test('supported-token import corrects legacy USDC Gnosis chain without inventory-enabling it', async () => { const pool = createMemoryPool(); - pool.assets.set(CURRENT_USDC_ASSET_ID, { - asset_id: CURRENT_USDC_ASSET_ID, + pool.assets.set(GNOSIS_USDC_ASSET_ID, { + asset_id: GNOSIS_USDC_ASSET_ID, venue: 'near-intents', symbol: 'USDC', label: 'USDC', @@ -149,9 +150,20 @@ test('repo seed corrects legacy USDC Gnosis chain without inventory-enabling it' updated_at: '2026-05-12T16:25:00.425Z', }); - await seedTradingConfig(pool, { now: '2026-05-12T16:35:00.000Z' }); + await importSupportedAssets(pool, { + fetchedAt: '2026-05-12T16:35:00.000Z', + response: [{ + assetId: GNOSIS_USDC_ASSET_ID, + decimals: 6, + blockchain: 'gnosis', + symbol: 'USDC', + price: 1, + priceUpdatedAt: '2026-05-12T16:25:00.425Z', + contractAddress: '0x2a22f9c3b484c3629090feed35f17ff8f88f76f0', + }], + }); const snapshot = await loadTradingConfig(pool); - const usdc = snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID); + const usdc = snapshot.assetRegistry.get(GNOSIS_USDC_ASSET_ID); assert.equal(usdc.chain, 'eth:100'); assert.equal(usdc.enabledForInventory, false); @@ -317,10 +329,52 @@ test('pair mode activation wires known BTC/USDC route and inventory tracking', a assert.equal(pair.priceRoute.source, 'btc_usdc_reference'); assert.equal(pair.priceRoute.baseAssetId, CURRENT_NBTC_ASSET_ID); assert.equal(pair.priceRoute.quoteAssetId, CURRENT_USDC_ASSET_ID); + assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).chain, 'eth'); assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).enabledForInventory, true); assert.equal(snapshot.trackedAssetIds.includes(CURRENT_USDC_ASSET_ID), true); }); +test('Gnosis USDC no longer gets the automatic BTC/USDC trading route', async () => { + const pool = createMemoryPool(); + await seedTradingConfig(pool); + pool.assets.set(GNOSIS_USDC_ASSET_ID, { + asset_id: GNOSIS_USDC_ASSET_ID, + venue: 'near-intents', + symbol: 'USDC', + label: 'USDC', + decimals: 6, + blockchain: 'gnosis', + chain: 'eth:100', + contract_address: '0x2a22f9c3b484c3629090feed35f17ff8f88f76f0', + latest_price: '1', + price_updated_at: '2026-05-12T16:25:00.425Z', + supported: true, + retired_at: null, + enabled_for_inventory: false, + role: null, + withdraw_address: '', + raw_payload: { source: 'test' }, + last_supported_at: '2026-05-12T16:25:00.425Z', + updated_at: '2026-05-12T16:25:00.425Z', + }); + const pairId = `${CURRENT_NBTC_ASSET_ID}->${GNOSIS_USDC_ASSET_ID}`; + + await setTradingPairMode(pool, { + pairId, + mode: 'maker', + edgeBps: 49, + maxNotional: '150', + changedBy: 'test', + reason: 'operator gnosis usdc activation test', + }); + const snapshot = await loadTradingConfig(pool); + const pair = snapshot.pairByKey.get(pairId); + + assert.equal(pair.canTrade, false); + assert.equal(pair.blockReason, 'price_route_missing'); + assert.equal(pair.priceRoute, null); +}); + test('pair mode activation rejects invalid initial edge config', async () => { const pool = createMemoryPool(); await seedTradingConfig(pool);