Skip to content

Commit 4b92181

Browse files
authored
chore: deploy HyperliquidDepositHandler after audit of Jan 19 (#1313)
* deploy and configure Signed-off-by: Ihor Farion <ihor@umaproject.org> * add --verify Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix hyperliquiddeposithandler deployment script Signed-off-by: Ihor Farion <ihor@umaproject.org> * bump package version Signed-off-by: Ihor Farion <ihor@umaproject.org> * pr comments Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
1 parent 33a1047 commit 4b92181

21 files changed

+298
-209
lines changed

broadcast/DeployHyperliquidDepositHandler.s.sol/999/run-latest.json

Lines changed: 30 additions & 117 deletions
Large diffs are not rendered by default.

broadcast/deployed-addresses.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@
535535
"transaction_hash": "0x11abc3566704b51ee63255b70eddb4e3f127c7e6c9dad6bdfbf547b684bcaf2c"
536536
},
537537
"HyperliquidDepositHandler": {
538-
"address": "0x861E127036B28D32f3777B4676F6bbb9e007d195",
539-
"block_number": 20301679,
540-
"transaction_hash": "0x187b45f39be413aff2ff526946c64f76ed98763129e7e2ffb7d2d4c5bd997519"
538+
"address": "0xbFB53E9C8acCe6D6aC54885A8e33A7Aec95427D5",
539+
"block_number": 27144816,
540+
"transaction_hash": "0xf7f1b77559935ec04f3a3a89601b621f21d4cf38c2701e8df18e10f333b24c7c"
541541
},
542542
"SponsoredCCTPDstPeriphery": {
543543
"address": "0x478D451e101bE484880a14cf3cCC293CD48E6140",

broadcast/deployed-addresses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ This file contains the latest deployed smart contract addresses from the broadca
159159
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
160160
| DonationBox | [0xf9a0c1C775f1B6e156ad3f1DB784520461DDb19e](https://hyperevmscan.io//address/0xf9a0c1C775f1B6e156ad3f1DB784520461DDb19e) |
161161
| DstOFTHandler | [0x0Ca8316a6fcc15C833A220c40D84550B08339438](https://hyperevmscan.io//address/0x0Ca8316a6fcc15C833A220c40D84550B08339438) |
162-
| HyperliquidDepositHandler | [0x861E127036B28D32f3777B4676F6bbb9e007d195](https://hyperevmscan.io//address/0x861E127036B28D32f3777B4676F6bbb9e007d195) |
162+
| HyperliquidDepositHandler | [0xbFB53E9C8acCe6D6aC54885A8e33A7Aec95427D5](https://hyperevmscan.io//address/0xbFB53E9C8acCe6D6aC54885A8e33A7Aec95427D5) |
163163
| MulticallHandler | [0x5E7840E06fAcCb6d1c3b5F5E0d1d3d07F2829bba](https://hyperevmscan.io//address/0x5E7840E06fAcCb6d1c3b5F5E0d1d3d07F2829bba) |
164164
| SP1Helios | [0xc19B7EF43a6eBd393446F401d1eCFac01B181ac0](https://hyperevmscan.io//address/0xc19B7EF43a6eBd393446F401d1eCFac01B181ac0) |
165165
| SpokePool | [0x35E63eA3eb0fb7A3bc543C71FB66412e1F6B0E04](https://hyperevmscan.io//address/0x35E63eA3eb0fb7A3bc543C71FB66412e1F6B0E04) |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@across-protocol/contracts",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"author": "UMA Team",
55
"license": "AGPL-3.0-only",
66
"repository": {

script/mintburn/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# Hypercore token metadata notes
2+
3+
- To get `hypercore-tokens.json` info:
4+
5+
```
6+
curl -s 'https://api.hyperliquid.xyz/info' \
7+
-H 'content-type: application/json' \
8+
--data '{"type":"spotMeta"}' \
9+
| jq '.tokens[]
10+
| select((.name|ascii_upcase)=="USDT0"
11+
or (.name|ascii_upcase)=="USDC"
12+
or (.name|ascii_upcase)=="USDH")'
13+
```
14+
15+
These 3 fields added manually to each entry:
16+
17+
```
18+
"canBeUsedForAccountActivation": true,
19+
"accountActivationFeeCore": 100000000,
20+
"bridgeSafetyBufferCore": 100000000000000000
21+
```
22+
23+
- `script/mintburn/hypercore-tokens.json` is read by `script/mintburn/ReadHCoreTokenInfoUtil.s.sol`.
24+
- USDC is a special case: `evmContract.address` in that JSON is **not** the real HyperEVM USDC ERC20 address.
25+
- Read utils hard-override USDC to `0xb88339CB7199b77E23DB6E890353E22632Ba630f` for all script configuration paths.
26+
- Same address is documented in `script/mintburn/oft/README.md`.
27+
128
# Mintburn Prod Readiness Checks
229

330
`checkSponsoredPeripheryProdReadiness.sh` checks the latest canonical sponsored mintburn periphery deployments from [`broadcast/deployed-addresses.json`](broadcast/deployed-addresses.json).

script/mintburn/ReadHCoreTokenInfoUtil.s.sol

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,48 @@
22
pragma solidity ^0.8.0;
33

44
import { Script } from "forge-std/Script.sol";
5-
import { console } from "forge-std/console.sol";
6-
import { Constants } from "../utils/Constants.sol";
75

86
contract ReadHCoreTokenInfoUtil is Script {
97
string internal constant HCORE_JSON_PATH = "./script/mintburn/hypercore-tokens.json";
8+
address internal constant HYPEREVM_USDC = 0xb88339CB7199b77E23DB6E890353E22632Ba630f;
109

1110
struct TokenJson {
1211
uint256 index;
1312
address evmAddress;
1413
bool canBeUsedForAccountActivation;
1514
uint256 accountActivationFeeCore;
1615
uint256 bridgeSafetyBufferCore;
16+
bool isUsdc;
1717
}
1818

19-
function readToken(string memory tokenName) public view returns (TokenJson memory info) {
19+
function readToken(string memory tokenKey) public view returns (TokenJson memory info) {
2020
string memory json = vm.readFile(HCORE_JSON_PATH);
21-
string memory base = string.concat(".", tokenName);
21+
string memory base = string.concat(".", tokenKey);
2222

2323
info.index = vm.parseJsonUint(json, string.concat(base, ".index"));
24+
info.isUsdc = _isUsdc(tokenKey);
2425

25-
// evmAddress can be null in JSON; parseJsonAddress would revert. Try/catch and leave zero if unset.
26-
try this._parseAddress(json, string.concat(base, ".evmAddress")) returns (address a) {
26+
// evmContract.address can be null in JSON; parseJsonAddress would revert.
27+
try this._parseAddress(json, string.concat(base, ".evmContract.address")) returns (address a) {
2728
info.evmAddress = a;
2829
} catch {
2930
info.evmAddress = address(0);
3031
}
3132

32-
// Required fields for CoreTokenInfo
33-
info.canBeUsedForAccountActivation = vm.parseJsonBool(
34-
json,
35-
string.concat(base, ".canBeUsedForAccountActivation")
36-
);
37-
info.accountActivationFeeCore = vm.parseJsonUint(json, string.concat(base, ".accountActivationFeeCore"));
38-
info.bridgeSafetyBufferCore = vm.parseJsonUint(json, string.concat(base, ".bridgeSafetyBufferCore"));
33+
// Optional fields for CoreTokenInfo. Leave defaults if absent.
34+
try this._parseBool(json, string.concat(base, ".canBeUsedForAccountActivation")) returns (bool canActivate) {
35+
info.canBeUsedForAccountActivation = canActivate;
36+
} catch {}
37+
try this._parseUint(json, string.concat(base, ".accountActivationFeeCore")) returns (uint256 activationFee) {
38+
info.accountActivationFeeCore = activationFee;
39+
} catch {}
40+
try this._parseUint(json, string.concat(base, ".bridgeSafetyBufferCore")) returns (uint256 bridgeSafetyBuffer) {
41+
info.bridgeSafetyBufferCore = bridgeSafetyBuffer;
42+
} catch {}
3943
}
4044

41-
function resolveEvmAddress(TokenJson memory info, uint256 /* chainId */) public pure returns (address evm) {
45+
function resolveEvmAddress(TokenJson memory info) public pure returns (address evm) {
46+
if (info.isUsdc) return HYPEREVM_USDC;
4247
require(info.evmAddress != address(0), "evmAddress required in JSON");
4348
return info.evmAddress;
4449
}
@@ -47,4 +52,16 @@ contract ReadHCoreTokenInfoUtil is Script {
4752
function _parseAddress(string memory json, string memory key) external pure returns (address) {
4853
return vm.parseJsonAddress(json, key);
4954
}
55+
56+
function _parseBool(string memory json, string memory key) external pure returns (bool) {
57+
return vm.parseJsonBool(json, key);
58+
}
59+
60+
function _parseUint(string memory json, string memory key) external pure returns (uint256) {
61+
return vm.parseJsonUint(json, key);
62+
}
63+
64+
function _isUsdc(string memory tokenKey) internal pure returns (bool) {
65+
return keccak256(bytes(tokenKey)) == keccak256(bytes("usdc"));
66+
}
5067
}

script/mintburn/hypercore-tokens.json

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,51 @@
11
{
22
"usdc": {
33
"name": "USDC",
4-
"index": 0,
5-
"tokenId": "0x6d1e7cde53ba9467b783cb7c530ce054",
64
"szDecimals": 8,
75
"weiDecimals": 8,
6+
"index": 0,
7+
"tokenId": "0x6d1e7cde53ba9467b783cb7c530ce054",
88
"isCanonical": true,
9-
"evmAddress": null,
9+
"evmContract": {
10+
"address": "0x6b9e773128f453f5c2c60935ee2de2cbc5390a24",
11+
"evm_extra_wei_decimals": -2
12+
},
13+
"fullName": null,
14+
"deployerTradingFeeShare": "0.0",
1015
"canBeUsedForAccountActivation": true,
1116
"accountActivationFeeCore": 100000000,
1217
"bridgeSafetyBufferCore": 100000000000000000
1318
},
1419
"usdt0": {
1520
"name": "USDT0",
16-
"index": 268,
17-
"tokenId": "0x25faedc3f054130dbb4e4203aca63567",
1821
"szDecimals": 2,
1922
"weiDecimals": 8,
23+
"index": 268,
24+
"tokenId": "0x25faedc3f054130dbb4e4203aca63567",
2025
"isCanonical": false,
21-
"evmAddress": "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
26+
"evmContract": {
27+
"address": "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
28+
"evm_extra_wei_decimals": -2
29+
},
30+
"fullName": "USDT0",
31+
"deployerTradingFeeShare": "0.0",
2232
"canBeUsedForAccountActivation": true,
2333
"accountActivationFeeCore": 100000000,
2434
"bridgeSafetyBufferCore": 100000000000000000
2535
},
2636
"usdh": {
2737
"name": "USDH",
28-
"index": 360,
29-
"tokenId": "0x54e00a5988577cb0b0c9ab0cb6ef7f4b",
3038
"szDecimals": 2,
3139
"weiDecimals": 8,
40+
"index": 360,
41+
"tokenId": "0x54e00a5988577cb0b0c9ab0cb6ef7f4b",
3242
"isCanonical": false,
33-
"evmAddress": "0x111111a1a0667d36bd57c0a9f569b98057111111",
43+
"evmContract": {
44+
"address": "0x111111a1a0667d36bd57c0a9f569b98057111111",
45+
"evm_extra_wei_decimals": -2
46+
},
47+
"fullName": "USDH",
48+
"deployerTradingFeeShare": "0.0",
3449
"canBeUsedForAccountActivation": true,
3550
"accountActivationFeeCore": 100000000,
3651
"bridgeSafetyBufferCore": 100000000000000000

script/mintburn/oft/DstHandlerConfigLib.s.sol

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.0;
33

44
import { Config } from "forge-std/Config.sol";
55
import { console } from "forge-std/console.sol";
6-
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
6+
import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol";
77

88
import { ReadHCoreTokenInfoUtil } from "../../mintburn/ReadHCoreTokenInfoUtil.s.sol";
99
import { DstOFTHandler } from "../../../contracts/periphery/mintburn/sponsored-oft/DstOFTHandler.sol";
@@ -14,6 +14,7 @@ import { AddressToBytes32 } from "../../../contracts/libraries/AddressConverters
1414
/// @notice Shared helper for configuring `DstOFTHandler` instances using TOML and JSON metadata.
1515
abstract contract DstHandlerConfigLib is Config {
1616
using AddressToBytes32 for address;
17+
using SafeCast for uint256;
1718

1819
function _loadTokenConfig(string memory tokenKey) internal {
1920
require(bytes(tokenKey).length != 0, "token key required");
@@ -26,7 +27,7 @@ abstract contract DstHandlerConfigLib is Config {
2627

2728
ReadHCoreTokenInfoUtil reader = new ReadHCoreTokenInfoUtil();
2829
ReadHCoreTokenInfoUtil.TokenJson memory info = reader.readToken(tokenName);
29-
address tokenAddr = reader.resolveEvmAddress(info, block.chainid);
30+
address tokenAddr = reader.resolveEvmAddress(info);
3031
require(tokenAddr != address(0), "token addr missing");
3132

3233
console.log("Configuring CoreTokenInfo for", tokenName);
@@ -35,10 +36,10 @@ abstract contract DstHandlerConfigLib is Config {
3536

3637
HyperCoreFlowExecutor(dstHandlerAddress).setCoreTokenInfo(
3738
tokenAddr,
38-
uint32(info.index),
39+
info.index.toUint32(),
3940
info.canBeUsedForAccountActivation,
40-
uint64(info.accountActivationFeeCore),
41-
uint64(info.bridgeSafetyBufferCore)
41+
info.accountActivationFeeCore.toUint64(),
42+
info.bridgeSafetyBufferCore.toUint64()
4243
);
4344
}
4445

0 commit comments

Comments
 (0)