Switch current USDC route to Ethereum wrapper
Some checks failed
deploy / deploy (push) Failing after 3m0s
Some checks failed
deploy / deploy (push) Failing after 3m0s
Proof: current BTC/USDC route seeding now targets the live Ethereum USDC wrapper; tests cover ETH-USDC route activation and prove Gnosis USDC no longer receives the automatic BTC/USDC route. Assumptions: the live NEAR Intents quote stream is emitting nBTC with Ethereum USDC, and Ethereum USDC uses bridge chain eth. Still fake: no live ETH-USDC solver fill is proven yet; Gnosis USDC may remain imported for visibility but is not intended as the active BTC/USDC trading wrapper.
This commit is contained in:
parent
c94d651fc9
commit
6b7c9874dc
2 changed files with 66 additions and 10 deletions
|
|
@ -10,6 +10,8 @@ export const LEGACY_OMFT_BTC_ASSET_ID = 'nep141:btc.omft.near';
|
||||||
export const CURRENT_EURE_ASSET_ID =
|
export const CURRENT_EURE_ASSET_ID =
|
||||||
'nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near';
|
'nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near';
|
||||||
export const CURRENT_USDC_ASSET_ID =
|
export const CURRENT_USDC_ASSET_ID =
|
||||||
|
'nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near';
|
||||||
|
export const GNOSIS_USDC_ASSET_ID =
|
||||||
'nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near';
|
'nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near';
|
||||||
|
|
||||||
export const CURRENT_PAIR_KEY = pairKey(CURRENT_NBTC_ASSET_ID, CURRENT_EURE_ASSET_ID);
|
export const CURRENT_PAIR_KEY = pairKey(CURRENT_NBTC_ASSET_ID, CURRENT_EURE_ASSET_ID);
|
||||||
|
|
@ -130,9 +132,9 @@ export function buildSeedAssets() {
|
||||||
symbol: 'USDC',
|
symbol: 'USDC',
|
||||||
label: 'USDC',
|
label: 'USDC',
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
blockchain: 'gnosis',
|
blockchain: 'eth',
|
||||||
chain: 'eth:100',
|
chain: 'eth',
|
||||||
contractAddress: '0x2a22f9c3b484c3629090feed35f17ff8f88f76f0',
|
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
||||||
latestPrice: null,
|
latestPrice: null,
|
||||||
priceUpdatedAt: null,
|
priceUpdatedAt: null,
|
||||||
supported: true,
|
supported: true,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import {
|
||||||
CURRENT_EURE_ASSET_ID,
|
CURRENT_EURE_ASSET_ID,
|
||||||
CURRENT_NBTC_ASSET_ID,
|
CURRENT_NBTC_ASSET_ID,
|
||||||
CURRENT_USDC_ASSET_ID,
|
CURRENT_USDC_ASSET_ID,
|
||||||
|
GNOSIS_USDC_ASSET_ID,
|
||||||
LEGACY_OMFT_BTC_ASSET_ID,
|
LEGACY_OMFT_BTC_ASSET_ID,
|
||||||
normalizeOneClickToken,
|
normalizeOneClickToken,
|
||||||
} from '../src/core/trading-config.mjs';
|
} 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', () => {
|
test('1Click token normalizer maps Gnosis assets to bridge chain id', () => {
|
||||||
const token = normalizeOneClickToken({
|
const token = normalizeOneClickToken({
|
||||||
assetId: CURRENT_USDC_ASSET_ID,
|
assetId: GNOSIS_USDC_ASSET_ID,
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
blockchain: 'gnosis',
|
blockchain: 'gnosis',
|
||||||
symbol: 'USDC',
|
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.pairs.length, 2);
|
||||||
assert.equal(snapshot.pairByKey.get(snapshot.activePair).strategyConfig.edgeBps, 49);
|
assert.equal(snapshot.pairByKey.get(snapshot.activePair).strategyConfig.edgeBps, 49);
|
||||||
assert.equal(snapshot.trackedAssetIds.includes(LEGACY_OMFT_BTC_ASSET_ID), true);
|
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.trackedAssetIds.includes(CURRENT_USDC_ASSET_ID), false);
|
||||||
assert.equal([...snapshot.makerPairKeys].some((pair) => pair.includes(LEGACY_OMFT_BTC_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();
|
const pool = createMemoryPool();
|
||||||
pool.assets.set(CURRENT_USDC_ASSET_ID, {
|
pool.assets.set(GNOSIS_USDC_ASSET_ID, {
|
||||||
asset_id: CURRENT_USDC_ASSET_ID,
|
asset_id: GNOSIS_USDC_ASSET_ID,
|
||||||
venue: 'near-intents',
|
venue: 'near-intents',
|
||||||
symbol: 'USDC',
|
symbol: 'USDC',
|
||||||
label: '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',
|
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 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.chain, 'eth:100');
|
||||||
assert.equal(usdc.enabledForInventory, false);
|
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.source, 'btc_usdc_reference');
|
||||||
assert.equal(pair.priceRoute.baseAssetId, CURRENT_NBTC_ASSET_ID);
|
assert.equal(pair.priceRoute.baseAssetId, CURRENT_NBTC_ASSET_ID);
|
||||||
assert.equal(pair.priceRoute.quoteAssetId, CURRENT_USDC_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.assetRegistry.get(CURRENT_USDC_ASSET_ID).enabledForInventory, true);
|
||||||
assert.equal(snapshot.trackedAssetIds.includes(CURRENT_USDC_ASSET_ID), 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 () => {
|
test('pair mode activation rejects invalid initial edge config', async () => {
|
||||||
const pool = createMemoryPool();
|
const pool = createMemoryPool();
|
||||||
await seedTradingConfig(pool);
|
await seedTradingConfig(pool);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue