Skip to content

Commit dc9718a

Browse files
authored
Add Hyperliquid L1 (HyperEVM) chain support (#11962)
Add Hyperliquid location insertion to the v51->v52 user DB upgrade and update the packaged global DB balance scanner contract ABI for chain 999.
1 parent b910d23 commit dc9718a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+456
-23
lines changed

frontend/app/src/types/asset/asset-urls.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ export const explorerUrls: AssetExplorerUrls = {
9090
token: 'https://scrollscan.com/token/',
9191
transaction: 'https://scrollscan.com/tx/',
9292
},
93+
[Blockchain.HYPERLIQUID]: {
94+
address: 'https://www.hyperscan.com/address/',
95+
block: 'https://www.hyperscan.com/block/',
96+
token: 'https://www.hyperscan.com/token/',
97+
transaction: 'https://www.hyperscan.com/tx/',
98+
},
9399
[Blockchain.SOLANA]: {
94100
address: 'https://solscan.io/account/',
95101
block: 'https://solscan.io/block/',

frontend/app/tests/unit/fixtures/supported-chains.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@
107107
"image": "binance_sc.svg",
108108
"evm_chain_name": "binance_sc"
109109
},
110+
{
111+
"id": "hyperliquid",
112+
"name": "Hyperliquid",
113+
"type": "evm",
114+
"native_token": "HYPE",
115+
"image": "hyperliquid.svg",
116+
"evm_chain_name": "hyperliquid"
117+
},
110118
{
111119
"id": "zksync_lite",
112120
"name": "ZKSync Lite",

frontend/common/src/blockchain/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export enum Blockchain {
1515
GNOSIS = 'gnosis',
1616
SCROLL = 'scroll',
1717
ZKSYNC_LITE = 'zksync_lite',
18+
HYPERLIQUID = 'hyperliquid',
1819
}

rotkehlchen/accounting/export/csv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def reset(self, start_ts: Timestamp, end_ts: Timestamp) -> None:
100100
SupportedBlockchain.GNOSIS: ETHERSCAN_EXPLORER_TX_URL.format(base_url='gnosisscan.io'),
101101
SupportedBlockchain.SCROLL: ETHERSCAN_EXPLORER_TX_URL.format(base_url='scrollscan.com'), # noqa: E501
102102
SupportedBlockchain.BINANCE_SC: ETHERSCAN_EXPLORER_TX_URL.format(base_url='bscscan.com'), # noqa: E501
103+
SupportedBlockchain.HYPERLIQUID: 'https://www.hyperscan.com/tx/',
103104
SupportedBlockchain.ZKSYNC_LITE: 'https://zkscan.io/explorer/transactions/',
104105
}
105106
with self.database.conn.read_ctx() as cursor:

rotkehlchen/assets/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
from rotkehlchen.constants.assets import (
2424
A_BSC_BNB,
2525
A_ETH,
26+
A_HYPE,
2627
A_WBNB,
2728
A_WETH,
2829
A_WETH_ARB,
2930
A_WETH_BASE,
3031
A_WETH_OPT,
3132
A_WETH_SCROLL,
33+
A_WHYPE,
3234
A_WPOL,
3335
A_WXDAI,
3436
A_XDAI,
@@ -720,7 +722,7 @@ def get_decimals(asset: CryptoAsset) -> int:
720722
May raise:
721723
- UnsupportedAsset if the given asset is not a native token or an ERC20 token
722724
"""
723-
if asset in (A_ETH, A_XDAI, A_BSC_BNB):
725+
if asset in (A_ETH, A_XDAI, A_BSC_BNB, A_HYPE):
724726
return 18
725727
try:
726728
token = asset.resolve_to_evm_token()
@@ -753,6 +755,7 @@ def asset_raw_value(amount: FVal, asset: CryptoAsset) -> int:
753755
SupportedBlockchain.ARBITRUM_ONE: A_WETH_ARB,
754756
SupportedBlockchain.OPTIMISM: A_WETH_OPT,
755757
SupportedBlockchain.BASE: A_WETH_BASE,
758+
SupportedBlockchain.HYPERLIQUID: A_WHYPE,
756759
SupportedBlockchain.GNOSIS: A_WXDAI,
757760
SupportedBlockchain.POLYGON_POS: A_WPOL,
758761
SupportedBlockchain.BINANCE_SC: A_WBNB,

rotkehlchen/chain/accounts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class BlockchainAccounts:
2121
polygon_pos: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
2222
arbitrum_one: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
2323
base: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
24+
hyperliquid: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
2425
gnosis: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
2526
scroll: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)
2627
binance_sc: tuple[ChecksumEvmAddress, ...] = field(default_factory=tuple)

rotkehlchen/chain/aggregator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
from rotkehlchen.chain.evm.manager import EvmManager
142142
from rotkehlchen.chain.evm.proxies_inquirer import ProxyType
143143
from rotkehlchen.chain.gnosis.manager import GnosisManager
144+
from rotkehlchen.chain.hyperliquid.manager import HyperliquidManager
144145
from rotkehlchen.chain.manager import (
145146
ChainManager,
146147
ChainManagerWithNodesMixin,
@@ -234,6 +235,7 @@ def _module_name_to_class(module_name: ModuleName) -> type[EthereumModule]:
234235
HopBalances,
235236
GivethGnosisBalances,
236237
),
238+
ChainID.HYPERLIQUID: (),
237239
ChainID.SCROLL: (Compoundv3Balances,),
238240
ChainID.BINANCE_SC: (WoofiBalances,),
239241
}
@@ -252,6 +254,7 @@ def __init__(
252254
polygon_pos_manager: 'PolygonPOSManager',
253255
arbitrum_one_manager: 'ArbitrumOneManager',
254256
base_manager: 'BaseManager',
257+
hyperliquid_manager: 'HyperliquidManager',
255258
gnosis_manager: 'GnosisManager',
256259
scroll_manager: 'ScrollManager',
257260
binance_sc_manager: 'BinanceSCManager',
@@ -278,6 +281,7 @@ def __init__(
278281
self.polygon_pos = polygon_pos_manager
279282
self.arbitrum_one = arbitrum_one_manager
280283
self.base = base_manager
284+
self.hyperliquid = hyperliquid_manager
281285
self.gnosis = gnosis_manager
282286
self.scroll = scroll_manager
283287
self.binance_sc = binance_sc_manager
@@ -308,6 +312,7 @@ def __init__(
308312
self.polygon_pos_lock = Semaphore()
309313
self.arbitrum_one_lock = Semaphore()
310314
self.base_lock = Semaphore()
315+
self.hyperliquid_lock = Semaphore()
311316
self.gnosis_lock = Semaphore()
312317
self.scroll_lock = Semaphore()
313318
self.binance_sc_lock = Semaphore()

rotkehlchen/chain/evm/contracts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def abi(self: 'EvmContracts[Literal[ChainID.OPTIMISM]]', name: 'OPTIMISM_KNOWN_A
285285
...
286286

287287
@overload
288-
def abi(self: 'EvmContracts[Literal[ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ChainID.GNOSIS, ChainID.SCROLL, ChainID.BINANCE_SC]]', name: Literal['']) -> ABI: # noqa: E501
288+
def abi(self: 'EvmContracts[Literal[ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ChainID.HYPERLIQUID, ChainID.GNOSIS, ChainID.SCROLL, ChainID.BINANCE_SC]]', name: Literal['']) -> ABI: # noqa: E501
289289
...
290290

291291
def abi(self, name: str) -> ABI:

rotkehlchen/chain/evm/decoding/weth/constants.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from rotkehlchen.types import ChainID
55

66
CPT_WETH: Final = 'weth'
7-
CHAINS_WITHOUT_NATIVE_ETH: Final = {ChainID.GNOSIS, ChainID.POLYGON_POS, ChainID.BINANCE_SC}
7+
CHAINS_WITHOUT_NATIVE_ETH: Final = {
8+
ChainID.GNOSIS,
9+
ChainID.POLYGON_POS,
10+
ChainID.BINANCE_SC,
11+
ChainID.HYPERLIQUID,
12+
}
813
CHAINS_WITH_SPECIAL_WETH: Final = {ChainID.SCROLL, ChainID.ARBITRUM_ONE, ChainID.BASE}
914
CHAIN_ID_TO_WETH_MAPPING: Final = {
1015
ChainID.ETHEREUM: A_WETH,

rotkehlchen/chain/evm/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class NodeName(NamedTuple):
3232
Some open nodes taken from here: https://ethereumnodes.com/
3333
Related issue: https://github.com/rotki/rotki/issues/1716
3434
"""
35+
3536
name: str
3637
endpoint: str
3738
owned: bool
@@ -165,5 +166,9 @@ def serialize(self) -> dict[str, list[str]]:
165166
ChainID.BASE: BLOCKSCOUT_PRIORITY_ORDER,
166167
ChainID.OPTIMISM: BLOCKSCOUT_PRIORITY_ORDER,
167168
ChainID.BINANCE_SC: (EvmIndexer.ETHERSCAN,), # Blockscout and Routescan do not support BSC (will only work with premium etherscan) # noqa: E501
169+
ChainID.HYPERLIQUID: (
170+
EvmIndexer.ETHERSCAN,
171+
EvmIndexer.BLOCKSCOUT,
172+
), # Routescan does not support Hyperliquid
168173
},
169174
)

0 commit comments

Comments
 (0)