Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/perps-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **BREAKING:** Set `USDC_ARBITRUM_TESTNET_ADDRESS` and `HYPERLIQUID_ASSET_CONFIGS.usdc.testnet` to USDC2 (`0x1baAbB04529D43a73232B713C0FE471f7c7334d5`), the token the Arbitrum Sepolia bridge credits, so testnet deposit and withdrawal routes name the token that is deposited and paid out ([#10991](https://github.com/MetaMask/core/pull/10991))
- The exported literal type of `USDC_ARBITRUM_TESTNET_ADDRESS` changes to the USDC2 address. Code typed against `typeof USDC_ARBITRUM_TESTNET_ADDRESS` with the previous value no longer compiles.
- On testnet, `withdraw` rejects the previous asset ID (`0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d`). Read `HYPERLIQUID_ASSET_CONFIGS.usdc.testnet` or `getWithdrawalRoutes()` instead of hardcoding it, and update test fixtures that pin the previous asset ID.
- On a testnet session, `depositWithConfirmation` now prepares an Arbitrum Sepolia transfer to the Hyperliquid testnet bridge instead of an Arbitrum One transfer to the mainnet bridge; `DepositService.prepareTransaction` takes deposit routes for the provider's own network instead of forcing mainnet ([#10991](https://github.com/MetaMask/core/pull/10991))

## [21.0.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ export const USDC_ETHEREUM_MAINNET_ADDRESS =
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
export const USDC_ARBITRUM_MAINNET_ADDRESS =
'0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
// USDC2: the token the Arbitrum Sepolia bridge credits (its usdcToken())
export const USDC_ARBITRUM_TESTNET_ADDRESS =
'0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';
'0x1baAbB04529D43a73232B713C0FE471f7c7334d5';

// USDC token icon URL using MetaMask's official Token Icons API
// Format: https://static.cx.metamask.io/api/v1/tokenIcons/{chainId}/{contractAddress}.png
Expand Down Expand Up @@ -92,7 +93,7 @@ export const METAMASK_PERPS_ICONS_BASE_URL =
export const HYPERLIQUID_ASSET_CONFIGS: HyperLiquidAssetConfigs = {
usdc: {
mainnet: `${ARBITRUM_MAINNET_CAIP_CHAIN_ID}/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831/default`,
testnet: `${ARBITRUM_TESTNET_CAIP_CHAIN_ID}/erc20:0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d/default`,
testnet: `${ARBITRUM_TESTNET_CAIP_CHAIN_ID}/erc20:0x1baAbB04529D43a73232B713C0FE471f7c7334d5/default`,
},
};

Expand Down
4 changes: 2 additions & 2 deletions packages/perps-controller/src/services/DepositService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export class DepositService {
// Generate deposit request ID for tracking
const currentDepositId = generateDepositId();

// Get deposit routes from provider
const depositRoutes = provider.getDepositRoutes({ isTestnet: false });
// Get deposit routes for the provider's own network (testnet or mainnet)
const depositRoutes = provider.getDepositRoutes();
const route = depositRoutes[0];
if (!route) {
// Fail CLOSED with a routable message instead of a TypeError: some
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import { HIP3_ASSET_MARKET_TYPES } from '../../../src/constants/hyperLiquidConfig.js';
import {
getSupportedAssets,
HIP3_ASSET_MARKET_TYPES,
} from '../../../src/constants/hyperLiquidConfig.js';
import { MarketCategory, MARKET_CATEGORIES } from '../../../src/types/index.js';
import type { MarketType, MarketTypeFilter } from '../../../src/types/index.js';

describe('getSupportedAssets', () => {
it('returns the USDC2 token the Arbitrum Sepolia bridge credits on testnet', () => {
expect(getSupportedAssets(true)).toStrictEqual([
'eip155:421614/erc20:0x1baAbB04529D43a73232B713C0FE471f7c7334d5/default',
]);
});

it('returns Arbitrum One USDC on mainnet', () => {
expect(getSupportedAssets(false)).toStrictEqual([
'eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831/default',
]);
});
});

describe('HIP3_ASSET_MARKET_TYPES', () => {
it('classifies known US stocks correctly', () => {
expect(HIP3_ASSET_MARKET_TYPES['xyz:TSLA']).toBe('stock');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ describe('DepositService', () => {
expect(generateDepositId).toHaveBeenCalledTimes(1);
});

it('retrieves deposit routes from provider', async () => {
it('retrieves deposit routes for the provider network', async () => {
await service.prepareTransaction({
provider: mockProvider,
});

expect(mockProvider.getDepositRoutes).toHaveBeenCalledWith({
isTestnet: false,
});
expect(mockProvider.getDepositRoutes).toHaveBeenCalledWith();
});

it('uses first deposit route from provider', async () => {
Expand Down
Loading