Normalize Ethereum bridge chain for USDC
Some checks failed
deploy / deploy (push) Failing after 44s
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:
parent
6b7c9874dc
commit
cd5c591a2c
2 changed files with 21 additions and 3 deletions
|
|
@ -133,7 +133,7 @@ export function buildSeedAssets() {
|
|||
label: 'USDC',
|
||||
decimals: 6,
|
||||
blockchain: 'eth',
|
||||
chain: 'eth',
|
||||
chain: 'eth:1',
|
||||
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
||||
latestPrice: null,
|
||||
priceUpdatedAt: null,
|
||||
|
|
@ -264,6 +264,9 @@ function normalizeBridgeChain({ assetId, blockchain }) {
|
|||
if (normalizedBlockchain === 'gnosis' || normalizedAssetId.startsWith('nep141:gnosis-')) {
|
||||
return 'eth:100';
|
||||
}
|
||||
if (normalizedBlockchain === 'eth' || normalizedAssetId.startsWith('nep141:eth-')) {
|
||||
return 'eth:1';
|
||||
}
|
||||
return normalizedBlockchain;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,21 @@ test('1Click token normalizer maps Gnosis assets to bridge chain id', () => {
|
|||
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 () => {
|
||||
const pool = createMemoryPool();
|
||||
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.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');
|
||||
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.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.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).chain, 'eth:1');
|
||||
assert.equal(snapshot.assetRegistry.get(CURRENT_USDC_ASSET_ID).enabledForInventory, true);
|
||||
assert.equal(snapshot.trackedAssetIds.includes(CURRENT_USDC_ASSET_ID), true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue