Lock in today's gas prices for future transactions. FIrst ever gas derivative market.
The InvestInGas project is a comprehensive, institutional-grade gas hedging ecosystem designed to solve one of the most persistent issues in decentralized finance: Gas Price Volatility.
By leveraging the advanced capabilities of Uniswap v4 Hooks, the platform allows users and protocol managers to "lock in" future gas costs, effectively creating a decentralized futures market for Ethereum gas.
What is InvestInGas? At its core, InvestInGas is more than just a dashboard; it is a multi-chain hedging platform. It allows users to purchase Gas Credits when prices are low and redeem them when the network is congested, protecting them from sudden price spikes.
These credits are not just numbers on a screen, they are backed by real assets (WETH) locked within a Uniswap v4 pool and represented by dynamic NFTs (IIGPOS).
How it Works (Under the Hood):
Uniswap v4 Hedging Engine: The project uses a custom Uniswap v4 Hook to offer gas-locked liquidity. When a user "buys gas," the hook executes a swap (e.g., USDC for WETH) and locks the resulting WETH into a position NFT. This ensures that the user's gas credit is always fully collateralized.
Verifiable Sui Oracle: To ensure fair market pricing, gas prices are fetched from a high-frequency Sui-based Oracle. By using Sui as a data layer, the platform benefits from low-latency, verifiable data feeds that track Ethereum gas prices across various timeframes.
Cross-Chain Settlement via LI.FI: One of the most powerful features is the ability to hedge on Ethereum L1 but settle on Layer 2s. A user can purchase credits on Sepolia and redeem them to receive native gas on Arbitrum, Base, Polygon, or Optimism. This is seamlessly handled through an integration with LI.FI.
Relayer & UX Bridge: To provide a "gasless" management experience, the platform uses a relayer that handles transaction execution via EIP-712 signed intents. This allows users to manage and redeem their positions without having to worry about the very gas prices they are trying to hedge against.
Key Components: Dashboard (Frontend): A high-fidelity, tactical dashboard built with Next.js 15 and Tailwind CSS, featuring real-time gas tickers, tactical intelligence signals, and a premium "command center" aesthetic.
The Engine (v4-Contracts): The solidity-based core that manages the Uniswap hooks, NFT position minting, and the internal accounting of gas units.
The Bridge (Relayer): A TypeScript-based backend that connects the frontend, the Sui Oracle, and the EVM contracts, facilitating cross-chain redemptions.
Oracle Bot: A dedicated service that bridges the gap between off-chain gas price data and the Sui-native oracle modules.
Future Roadmap: The Path to Fully Agentic Gas Markets While the current version of InvestInGas provides a robust terminal for manual gas hedging, the next evolution of the project focuses on disintermediation and autonomous execution. My goal is to move beyond the "Relayer" model and transition into a fully decentralized, agent-driven ecosystem.
Direct V4 Interaction: Agents will be equipped with the logic to interact directly with the Uniswap v4 PoolManager, managing the complexities of the unlock callback and token settlement without human or relayer intervention.
Autonomous Redemptions: Instead of a user manually clicking "Redeem," an agent will monitor the user’s protocol needs (e.g., an impending liquidator bot run) and autonomously trigger redemptions when gas prices reach a specific threshold or the "Alpha Signal" indicates peak volatility.
Permissionless Gas Pockets: Anyone will be able to provide liquidity to custom Uniswap v4 pools ("Gas Pockets") and sell their own gas hedges, allowing for a competitive, market-driven gas price discovery.
Secondary Market Liquidity: Since positions are represented by NFTs (IIGPOS), we will build the infrastructure for agents to trade these futures positions on the secondary market, allowing users to sell their "locked-in" low prices to others when they no longer need the hedge.
By decoupling the relayer and empowering autonomous agents, InvestInGas will become the primary throughput management layer for the next generation of automated DeFi protocols.
InvestInGas transforms gas from an unpredictable expense into a manageable asset, providing DeFi participants with the tools they need to operate with certainty in a volatile market.
The "How it's made" of InvestInGas involves a tight integration of cutting-edge DeFi primitives, cross-chain infrastructure, and high-frequency data oracles.
🛠 The Tech Stack
Smart Contracts: Solidity, built on the Uniswap v4 framework. Frontend: Next.js 15, Tailwind CSS, Viem/Wagmi, and TanStack Query. Infrastructure: LI.FI for cross-chain liquidity, Sui for the high-frequency gas price oracle. Backend: Node.js/TypeScript Relayer using EIP-712 for intent-based transactions.
🏗 How It's Pieced Together
The Core Engine (Uniswap v4): We leveraged the Uniswap v4 beforeSwap and afterSwap hooks along with the unlock pattern. When a user purchases a position, the relayer calls the hook, which unlocks the PoolManager. In the callback, we pull USDC, swap it for WETH within the pool, "take" the WETH out, and mint an ERC721 NFT representing the user's gas position.
Strategic Partner Integrations: LI.FI: We used LI.FI to abstract the nightmare of cross-chain bridging. When a user redeems their credit on Ethereum but wants gas on Base or Arbitrum, our LiFiBridger.sol contract uses LI.FI's SDK-generated calldata to route the ETH exactly where the user needs it.
Sui Gas Oracle: We built a custom Sui Oracle module to store gas prices across major chains. Sui's high-speed object-oriented architecture allowed us to maintain a low-latency "gas ticker" that the relayer reads to ensure users are locking in fair, real-time market rates.
The UX Bridge (Relayer): To make the experience "gasless-like," we implemented a relayer that accepts EIP-712 signed intents. This means the user never has to interact with the complex unlock logic themselves, they just sign a message, and the relayer handles the precision execution.
Notable "Hacky" & Technical Bits
The Swap-and-Mint Sequence: One of the most challenging parts was getting the internal accounting of the PoolManager correct during a swap. I had to carefully sequence sync, settle, and take operations within the unlockCallback to ensure the hook could accurately extract WETH from the pool without leaving "dust" or failing the delta checks.
Dynamic Gas Unit Calculation: I implemented a virtual "Gas Unit" metric within the hook. By dividing the locked WETH amount by the gas price at the time of purchase, I give users a precise estimate of how many transactions (at a specific complexity) they have secured, which updates in real-time as they perform partial redemptions.
The Sui-to-EVM Bridge: Since i am using Sui as our primary data layer for prices, i had to build a robust synchronization layer in the relayer that translates Sui's dynamic field object data into a format that our EVM contracts can verify and use for slippage checks.

