Skip to content本文へ移動

HyperEVM Development · DeFi on HyperEVM · 7/8

Lending & Borrowing Protocols

The Opportunity

HyperEVM's read precompiles and CoreWriter give lending protocols something unusual: on-chain access to HyperCore prices, balances, and order books. A protocol can value collateral with HyperCore prices and liquidate by trading directly on the HyperCore order book.

How DeFi Lending Works

The basic lending model:

Lender deposits USDC → Lending Pool ← Borrower provides collateral
         ↓                                      ↓
    Earns interest                     Borrows USDC against collateral

Core Concepts

  1. Supply — Deposit assets to earn interest
  2. Collateral — Lock assets to enable borrowing
  3. Borrow — Take a loan against your collateral
  4. Liquidation — If collateral value drops below threshold, position is liquidated

Aave-Style Lending on HyperEVM

Several HyperEVM lending markets, such as HyperLend, use an Aave V3-style interface:

// Aave V3-style pool interface
// Supplying USDC to earn interest
IERC20(USDC).approve(address(hyperLend), amount);
hyperLend.supply(USDC, amount, onBehalfOf, referralCode);

// Borrowing against collateral
hyperLend.borrow(USDC, borrowAmount, interestRateMode, referralCode, onBehalfOf);

Perp Accounts as Collateral: Read vs. Control

A lending protocol can read a user's HyperCore perp account value via the account margin summary precompile (0x…080F). But reading is not control: the user can withdraw or lose that equity at any time, and a contract cannot seize another account's HyperCore funds. Counting it as collateral is only safe if the equity sits in an account the protocol controls — for example, the contract's own HyperCore account, which it can manage through CoreWriter.

abstract contract PerpCollateralLending {
    address constant ACCOUNT_MARGIN_SUMMARY = 0x000000000000000000000000000000000000080F;

    struct AccountMarginSummary { int64 accountValue; uint64 marginUsed; uint64 ntlPos; int64 rawUsd; }

    // Value of collateral the protocol actually holds for `user` (implementation-specific)
    function tokenCollateral(address user) public view virtual returns (uint256);

    // Equity of the protocol's OWN HyperCore account (perp dex 0)
    function protocolPerpEquity() public view returns (int64) {
        (bool ok, bytes memory res) =
            ACCOUNT_MARGIN_SUMMARY.staticcall(abi.encode(uint32(0), address(this)));
        require(ok, "margin summary failed");
        return abi.decode(res, (AccountMarginSummary)).accountValue;
    }

    function maxBorrow(address user) external view returns (uint256) {
        // Allow borrowing up to 50% of collateral the protocol controls
        return (tokenCollateral(user) * 50) / 100;
    }
}

HyperCore also has native borrow/lend ("Earn"): CoreWriter action 15 supplies or withdraws, and precompiles 0x…0811/0x…0812 read user and reserve state (Interacting with HyperCore).

Risks

Example HyperEVM DeFi Projects

Examples only, not endorsements; check current status in the ecosystem directories linked from the HyperEVM docs.

Project Type Description
HyperLend Lending Aave-style lending
Kinetiq Liquid Staking kHYPE (liquid staked HYPE)
HyperSwap DEX AMM for HyperEVM tokens
Felix Stablecoin CDP stablecoin backed by HYPE

HyperEVM 開発 · HyperEVM の DeFi · 7/8

貸し借りのプロトコル

ここにある機会

HyperEVM の読み取り用 precompile と CoreWriter は、貸し借りのプロトコルにめずらしいものを与えます。HyperCore の価格、残高、板に、チェーン上から触れられることです。プロトコルは HyperCore の価格で担保を評価し、HyperCore の板で直接売買して清算できます。

DeFi の貸し借りの仕組み

基本の形です。

Lender deposits USDC → Lending Pool ← Borrower provides collateral
         ↓                                      ↓
    Earns interest                     Borrows USDC against collateral

基本の考え方

  1. 供給 — 資産を預けて利息を得ます
  2. 担保 — 資産をロックして、借りられるようにします
  3. 借入 — 担保をもとにお金を借ります
  4. 清算 — 担保の価値が基準を下回ると、ポジションが清算されます

HyperEVM の Aave 型の貸し借り

HyperLend など、HyperEVM のいくつかの貸し借り市場は、Aave V3 型のインターフェースを使っています。

// Aave V3-style pool interface
// Supplying USDC to earn interest
IERC20(USDC).approve(address(hyperLend), amount);
hyperLend.supply(USDC, amount, onBehalfOf, referralCode);

// Borrowing against collateral
hyperLend.borrow(USDC, borrowAmount, interestRateMode, referralCode, onBehalfOf);

無期限先物の口座を担保にする: 読めることと動かせることは別

貸し借りのプロトコルは、口座の証拠金のまとめを返す precompile(0x…080F)で、ユーザーの HyperCore の無期限先物口座の評価額を読めます。ただし読めても動かせるわけではありません。ユーザーはその資金をいつでも引き出せますし、損失で失うこともあります。コントラクトがほかの口座の HyperCore の資金を差し押さえることはできません。それを担保として数えて安全なのは、資金がプロトコルの管理する口座にある場合だけです。たとえば、コントラクト自身の HyperCore 口座です。これは CoreWriter で管理できます。

abstract contract PerpCollateralLending {
    address constant ACCOUNT_MARGIN_SUMMARY = 0x000000000000000000000000000000000000080F;

    struct AccountMarginSummary { int64 accountValue; uint64 marginUsed; uint64 ntlPos; int64 rawUsd; }

    // Value of collateral the protocol actually holds for `user` (implementation-specific)
    function tokenCollateral(address user) public view virtual returns (uint256);

    // Equity of the protocol's OWN HyperCore account (perp dex 0)
    function protocolPerpEquity() public view returns (int64) {
        (bool ok, bytes memory res) =
            ACCOUNT_MARGIN_SUMMARY.staticcall(abi.encode(uint32(0), address(this)));
        require(ok, "margin summary failed");
        return abi.decode(res, (AccountMarginSummary)).accountValue;
    }

    function maxBorrow(address user) external view returns (uint256) {
        // Allow borrowing up to 50% of collateral the protocol controls
        return (tokenCollateral(user) * 50) / 100;
    }
}

HyperCore にはネイティブの貸し借り(「Earn」)もあります。CoreWriter の操作 15 で供給と引き出しを行い、precompile 0x…0811/0x…0812 でユーザーと準備金の状態を読みます(Interacting with HyperCore)。

リスク

HyperEVM の DeFi プロジェクトの例

例として挙げるだけで、推奨ではありません。今の状況は、HyperEVM の資料から辿れるエコシステムの一覧で確かめてください。

プロジェクト 種類 説明
HyperLend 貸し借り Aave 型の貸し借り
Kinetiq リキッドステーキング kHYPE(ステークした HYPE を流動化したもの)
HyperSwap DEX HyperEVM のトークン向けの AMM
Felix ステーブルコイン HYPE を裏付けにした CDP 型のステーブルコイン