HYPE Price: $42.66 (+2.22%)
 

Overview

HYPE Balance

HyperEVM LogoHyperEVM LogoHyperEVM Logo0 HYPE

HYPE Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HypeOracle

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 10000 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import "../interfaces/IPriceOracle.sol";

/**
 * @title HypeOracle
 * @dev Oracle contract for converting USD amounts to HYPE using the Hyperliquid precompile
 */
contract HypeOracle is IPriceOracle {
    address constant PRECOMPILE = 0x0000000000000000000000000000000000000808; // Using 0x808 for spot prices
    uint32 constant PAIR_ID_TESTNET = 1035;
    uint32 constant PAIR_ID = 107;
    uint256 constant SCALE = 1e6; // 10^(8 − szDecimals)  (szDecimals = 2)

    /**
     * @dev Converts a USD amount to HYPE tokens
     * @param usdAmount 18-decimal USD amount (e.g. 1e18 = $1)
     * @return hypeAmount 18-decimal HYPE amount
     */
    function usdToHype(uint256 usdAmount) external view override returns (uint256 hypeAmount) {
        uint64 priceRaw = getRawPrice(); // uint64 spot price × 1e6
        hypeAmount = (usdAmount * SCALE) / priceRaw;
    }

    /**
     * @dev Gets the raw price from the precompile
     * @return price Raw price in the precompile format (scaled by 1e6)
     */
    function getRawPrice() public view override returns (uint64 price) {
        // Use standard abi.encode as used in hypercore-sim
        bytes memory data = abi.encode(PAIR_ID);
        (bool ok, bytes memory ret) = PRECOMPILE.staticcall(data);

        // Check if the call was successful
        require(ok, "SpotPx precompile call failed");

        // Use abi.decode to extract the uint64 value as done in hypercore-sim
        price = abi.decode(ret, (uint64));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

/**
 * @title IPriceOracle
 * @dev Interface for Hyperliquid price oracle functions
 */
interface IPriceOracle {
    /**
     * @dev Converts a USD amount to HYPE tokens
     * @param usdAmount 18-decimal USD amount (e.g. 1e18 = $1)
     * @return hypeAmount 18-decimal HYPE amount
     */
    function usdToHype(uint256 usdAmount) external view returns (uint256 hypeAmount);

    /**
     * @dev Gets the raw HYPE/USD price from the precompile
     * @return price Raw price in the precompile format (scaled by 1e6)
     */
    function getRawPrice() external view returns (uint64 price);
}

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@ens/=lib/ens-contracts/contracts/",
    "forge-std/=lib/forge-std/src/",
    "ens-contracts/=lib/ens-contracts/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "hypercore-sim/=lib/hypercore-sim/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"getRawPrice","outputs":[{"internalType":"uint64","name":"price","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdAmount","type":"uint256"}],"name":"usdToHype","outputs":[{"internalType":"uint256","name":"hypeAmount","type":"uint256"}],"stateMutability":"view","type":"function"}]

608080604052346015576102f4908161001a8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c8063084a3237146100fb5763f1dc104d1461002f575f80fd5b346100f75760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100f7576004356100696101b3565b620f4240820291808304620f424014901517156100ca5767ffffffffffffffff1690811561009d5760209160405191048152f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f80fd5b346100f7575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100f75760206101336101b3565b67ffffffffffffffff60405191168152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761018657604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f806040516020810190606b8252602081526101d0604082610145565b51906108085afa3d156102b6573d9067ffffffffffffffff8211610186576040519161022460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610145565b82523d5f602084013e5b15610258576020818051810103126100f7576020015167ffffffffffffffff811681036100f75790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f53706f74507820707265636f6d70696c652063616c6c206661696c65640000006044820152fd5b60609061022e56fea2646970667358221220cc4a3c4a5506a7931c5dd25a4873197b0f422e6e02ead494f1b8bc19682713fc64736f6c634300081b0033

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c8063084a3237146100fb5763f1dc104d1461002f575f80fd5b346100f75760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100f7576004356100696101b3565b620f4240820291808304620f424014901517156100ca5767ffffffffffffffff1690811561009d5760209160405191048152f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f80fd5b346100f7575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100f75760206101336101b3565b67ffffffffffffffff60405191168152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761018657604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f806040516020810190606b8252602081526101d0604082610145565b51906108085afa3d156102b6573d9067ffffffffffffffff8211610186576040519161022460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610145565b82523d5f602084013e5b15610258576020818051810103126100f7576020015167ffffffffffffffff811681036100f75790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f53706f74507820707265636f6d70696c652063616c6c206661696c65640000006044820152fd5b60609061022e56fea2646970667358221220cc4a3c4a5506a7931c5dd25a4873197b0f422e6e02ead494f1b8bc19682713fc64736f6c634300081b0033

Block Transaction Gas Used Reward
view all blocks ##produced##

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.