Perps as Collateral
This post builds on my previous idea. Our team has been working hard to turn this concept into reality, and we’ve finally done it! This marks the first time a perpetual position on Hyperliquid has been used as collateral—potentially the first time across all blockchains. And this is just the beginning. We have plenty of exciting developments in the pipeline.
This innovation is possible only on Hyperliquid today. We leverage precompiles extensively to fetch prices, transfer assets between HyperCore and HyperEVM, and manage perpetual positions directly from mainnet contracts. We’ve also repurposed Sentiment v2 contracts to build this system, which gives us confidence that we’ll be able to take it to production soon. More details on that later!
Architecture Overview
You can see a high-level architecture overview of the system.
This product is heavily inspired by Sentiment v2, which is already live on Hyperliquid mainnet. It uses isolated, non-custodial contracts (“Sentiment Positions”) which function as containerized borrowing accounts.
To enable perps as collateral, we modified these positions to work with precompiles, allowing Hyperliquid perp positions to be used as collateral. The contract treats the perpetual position as a collateral asset and calculates its value, risk, and solvency using precompiles.
As always, markets consist of two sides: Lenders and Borrowers. In this case, lenders supply USDC (though any ERC-20 token on HyperEVM could be used). Borrowers then use a perpetual position on HyperCore as collateral to borrow the lenders’ USDC. In this example, we use a 20x ETH long as collateral and borrow USDC against it. To make it easier to follow, we’ll link to testnet transactions at each step.
Since precompiles are not yet live on mainnet, everything demonstrated here was performed on testnet. Once precompiles go live, the same process will work on mainnet. Also, note that these steps are presented as separate transactions only for this PoC. The final product will batch most of these steps for a seamless user experience, just as we did with Sentiment v2.
Contract Flows
Lending
Lending is straightforward: Lenders supply USDC to earn competitive interest rates, just like traditional lending protocols. This USDC is lent to borrowers, who can use it throughout the Hyperliquid ecosystem—whether in vaults, farms, or spot markets on HyperEVM, or even to open and manage perpetual positions on HyperCore.
While we use USDC for this example, any ERC-20 token on HyperEVM could be used, opening up many possibilities. Lenders earn interest and can withdraw their assets anytime.
On testnet, we use a lending pool which accepts mockUSDC. Here’s how it works: (1) The lender first approves the lending pool and (2) they then supply assets to the pool. That’s it! The lender now earns interest and can withdraw funds (including earned interest) at any time.
Borrowing
This is where HyperCore <> HyperEVM interactions come into play. Borrowers use perp positions on HyperCore as collateral to borrow from Sentiment. In this case, a user borrows USDC against a 20x ETH long position on HyperCore. We modified our Sentiment v2 system to accept perpetual positions as collateral—and, as a bonus, to also accept spot assets as collateral.
Every borrower position is an isolated and non-custodial contract, ensuring that only the position owner has control over the assets. The borrower also has multiple ways to open the perp position that will be used as collateral. For this example, we use the route that showcases the precompiles in the best way possible.
Below are the transactions to set up a Sentiment Position:
- The borrower creates a position
- Transfers USDC to the position address on HyperCore.
- Transfers assets to the position’s perp account.
- Finally, open a 20x ETH long through the EVM.
At this point, the borrower is fully set up and can now borrow USDC using the perpetual position as collateral. It can be seen that the user borrows the same USDC that was previously deposited by the lender. These debt assets can be used across HyperEVM and HyperCore.
As noted earlier, these atomic transaction steps are mainly illustrative. They will be batched for a seamless user experience. To see the benefits of batching and composability in Sentiment systems, try our v2 product on HyperEVM mainnet. Users can see how we simplify complexities, delivering a standard lending protocol experience.
Liquidations
Liquidations in perp and lending markets are both time-sensitive and price-sensitive. To ensure real-time risk management, our system pulls prices directly from HyperCore order books. This guarantees that perp positions used as collateral remain in sync with the global chain state, mitigating price risk effectively.
Sentiment’s liquidation engine also relies on the same price data that Hyperliquid uses, ensuring reliable security for all open HyperCore positions. This is enabled via the enshrined oracles exposed via read precompiles.
Unwind Position
To close things off, let's unwind the borrower position. When unwinding a position:
- The borrower repays their debt.
- They then close their perp position, realizing any profit or loss.
- Finally, funds can be transferred back to the perps account, spot account or user EOA.
What's Next
This primitive unlocks a whole new set of DeFi opportunities. Here's some ideas from our whiteboards: subsidized perpetuals (trade on HyperCore and farm on HyperEVM to offset funding costs), innovative farming strategies, exotic spot-perpetual pair trades, better funding rate farming, among others. And this is just the beginning.