Normalize Ethereum bridge chain for USDC
Some checks failed
deploy / deploy (push) Failing after 44s

Proof: Ethereum 1Click assets now persist bridge chain eth:1, the current BTC/USDC seed uses eth:1, and regression tests cover Ethereum and Gnosis bridge-chain normalization.

Assumptions: NEAR Intents bridge RPC expects eth:1 for Ethereum deposit and recent-deposit endpoints.

Still fake: live ETH-USDC fills are not proven yet; runtime validation must confirm inventory refresh and quote lifecycle after deployment.
This commit is contained in:
philipp 2026-05-13 16:51:51 +02:00
parent 6b7c9874dc
commit cd5c591a2c
2 changed files with 21 additions and 3 deletions

View file

@ -133,7 +133,7 @@ export function buildSeedAssets() {
label: 'USDC', label: 'USDC',
decimals: 6, decimals: 6,
blockchain: 'eth', blockchain: 'eth',
chain: 'eth', chain: 'eth:1',
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
latestPrice: null, latestPrice: null,
priceUpdatedAt: null, priceUpdatedAt: null,
@ -264,6 +264,9 @@ function normalizeBridgeChain({ assetId, blockchain }) {
if (normalizedBlockchain === 'gnosis' || normalizedAssetId.startsWith('nep141:gnosis-')) { if (normalizedBlockchain === 'gnosis' || normalizedAssetId.startsWith('nep141:gnosis-')) {
return 'eth:100'; return 'eth:100';
} }
if (normalizedBlockchain === 'eth' || normalizedAssetId.startsWith('nep141:eth-')) {
return 'eth:1';
}
return normalizedBlockchain; return normalizedBlockchain;
} }

View file

@ -54,6 +54,21 @@ test('1Click token normalizer maps Gnosis assets to bridge chain id', () => {
assert.equal(token.chain, 'eth:100'); assert.equal(token.chain, 'eth:100');
}); });
test('1Click token normalizer maps Ethereum assets to bridge chain id', () => {
const token = normalizeOneClickToken({
assetId: CURRENT_USDC_ASSET_ID,
decimals: 6,
blockchain: 'eth',
symbol: 'USDC',
price: 1,
priceUpdatedAt: '2026-05-12T16:25:00.425Z',
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
});
assert.equal(token.blockchain, 'eth');
assert.equal(token.chain, 'eth:1');
});
test('supported token import is idempotent, does not enable inventory, and retires missing assets', async () => { test('supported token import is idempotent, does not enable inventory, and retires missing assets', async () => {
const pool = createMemoryPool(); const pool = createMemoryPool();
const first = await importSupportedAssets(pool, { const first = await importSupportedAssets(pool, {
@ -122,7 +137,7 @@ 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'); assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).chain, 'eth:1');
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);
}); });
@ -329,7 +344,7 @@ 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).chain, 'eth:1');
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);
}); });