Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Infrared Protocol 🔴

pipeline Slither analysis Deploy Natspec docs to Pages

Liquid Staking Infrastructure for Berachain's Proof-of-Liquidity

Infrared Protocol revolutionizes staking on Berachain by providing liquid staking derivatives (LSDs) that unlock the full potential of BGT and BERA while maintaining exposure to Proof-of-Liquidity rewards.

📋 Table of Contents

Overview

The Infrared Protocol addresses critical limitations in Berachain's native staking system:

The Problem

  • BGT (Berachain Governance Token) lacks transferability and liquidity
  • Validator staking requires technical expertise and significant capital
  • Staked assets are locked, reducing capital efficiency

Our Solution

  • IBGT: A liquid staked representation of BGT that's fully transferable
  • IBERA: Democratized validator staking through liquid staking tokens
  • Seamless Integration: Tight coupling with Berachain's Proof-of-Liquidity system

Key Features

  • Liquid Staking: Convert BGT to IBGT and BERA to IBERA without lockups
  • POL Rewards: Continue earning Proof-of-Liquidity inflation while staked
  • Validator Democratization: Access validator rewards without running infrastructure
  • Composability: Use liquid staking tokens across DeFi protocols
  • Governance: Vote-escrowed NFTs (veNFTs) for protocol governance
  • Bribes & Incentives: Sophisticated reward distribution and bribe collection system

Documentation

ResourceDescription
📚 DocumentationComplete protocol documentation
🏗️ ArchitectureTechnical architecture overview
📍 DeploymentsContract addresses by network
🔍 AuditsSecurity audit reports
📖 NatSpec DocsAuto-generated contract documentation

Architecture

View Architecture Diagram

Architecture

Interactive Diagram →

Contract Modules

🔵 Core Contracts - POL Integration & BGT Management

Full documentation →

The core module facilitates interaction with Berachain's Proof-of-Liquidity reward system, managing BGT accumulation, iBGT issuance, and reward distribution.

ContractPurposeKey Features
Infrared.solMain coordination contract• Validator registration & RewardAllocation configuration
• Centralized BGT claiming and iBGT conversion
• Manages harvestBase and harvestBoostRewards functions
InfraredVault.solUser staking management• Stakes assets into BerachainRewardsVaults
• Accumulates BGT rewards for conversion to iBGT
• Extends MultiRewards for diverse token support
InfraredDistributor.solValidator reward distribution• Distributes iBGT rewards to Infrared validators
• Tracks rewards via snapshots for easy claiming
• Manages cumulative reward totals per validator
BribeCollector.solPOL bribe management• Collects bribes from BerachainRewardsVaults
• Auctions bribes with proceeds to validators & iBGT holders
• Governance-configurable parameters
MultiRewards.solMulti-token rewards base• Supports up to 10 reward tokens per vault
• Enables varied incentive structures

Key Flows: Users deposit → InfraredVaults stake into BerachainRewardsVaults → BGT rewards accumulate → Infrared claims & converts to iBGT → Distribution to stakers

🟢 Staking Contracts - BERA Liquid Staking

Full documentation →

The staking module enables liquid staking of BERA (native gas token) through iBERA tokens, maintaining liquidity while participating in consensus.

ContractPurposeKey Features
IBERA.solLiquid staking coordinator• Mints/burns iBERA tokens representing staked BERA
• Manages validator stakes and autocompounding
• Configures protocol fee parameters
IBERADepositor.solDeposit queue management• Queues and executes BERA deposits
• Interacts with Berachain's deposit precompile
• Distributes deposits across validators
IBERAWithdrawor.solWithdrawal processing• Manages withdrawal queue and requests
• Handles validator stake rebalancing
• Coordinates with IBERAClaimor for claims
IBERAClaimor.solSecure claim mechanism• Tracks user claim records
• Enables safe BERA transfers to users
• Supports batch processing
IBERAFeeReceivor.solFee & MEV collection• Receives priority fees and MEV from validators
• Splits between treasury and autocompounding
• Periodic fee sweeping into protocol

Key Flows:

  • Deposit: BERA → IBERA contract → Queue → Validator staking → Receive iBERA
  • Withdraw: Burn iBERA → Queue withdrawal → Process from validators → Claim BERA
  • Fees: Validator rewards → IBERAFeeReceivor → Treasury/Autocompound split

🟣 Voting Contracts - veTokenomics & Governance

Full documentation →

The voting module implements a voting escrow (ve) system for allocating IBGT rewards and validator resources through community governance.

ContractPurposeKey Features
VotingEscrow.solveNFT token locking• Issues veNFTs for locked tokens
• Voting power based on lock duration
• Power decay over time mechanism
Voter.solAllocation voting system• Manages cutting board distribution votes
• Whitelisted token bribe system
• Epoch-based voting windows
• Weight tallying and updates
VelodromeTimeLibraryTime management• Weekly epoch calculations
• Voting window enforcement
• Synchronized voting cycles

Key Concepts:

  • Voting Power: Proportional to tokens locked and duration (with decay)
  • Cutting Board: Validator resource allocation across vaults
  • Bribes: Whitelisted tokens used to incentivize specific votes
  • Epochs: Weekly voting periods with defined windows

Key Flows: Lock tokens → Receive veNFT → Vote on allocations → Influence rewards → Claim bribes

Getting Started

Prerequisites

  • Foundry toolkit
  • Git
  • Make (optional, for using Makefile commands)

Installation

# Clone the repository
git clone https://github.com/infrared-dao/infrared-contracts.git
cd infrared-contracts

# Install dependencies
forge install

# Setup environment variables
cp .env.example .env
# Edit .env with your configuration

# Build contracts
forge build

Development

Build & Compile

# Build contracts
forge build

# Build with optimization
forge build --optimize --optimizer-runs 200

# Clean build artifacts
forge clean

Code Quality

# Format code
forge fmt

# Check formatting
forge fmt --check

# Run static analysis
slither .

Integration Guide

Installation for External Projects

Add Infrared to your Foundry project:

forge install infrared-dao/infrared-contracts

Update foundry.toml:

[dependencies]
infrared-contracts = { version = "1.0.0" }

[remappings]
"@infrared/=lib/infrared-contracts/contracts/"

Basic Integration Example

pragma solidity ^0.8.19;

import {IInfrared} from '@infrared/interfaces/IInfrared.sol';
import {IInfraredVault} from '@infrared/interfaces/IInfraredVault.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract MyIntegration {
    IInfrared public immutable infrared;
    
    constructor(address _infrared) {
        infrared = IInfrared(_infrared);
    }
    
    function stakeAssets(address asset, uint256 amount) external {
        // Get the vault for this asset
        IInfraredVault vault = IInfrared(infrared).vaultRegistry(asset);
        require(address(vault) != address(0), "Vault not found");
        
        // Approve and stake
        IERC20(asset).transferFrom(msg.sender, address(this), amount);
        IERC20(asset).approve(address(vault), amount);
        vault.stake(amount);
    }
    
    function checkRewards(address user, address asset) external view 
        returns (IInfraredVault.RewardData[] memory) {
        IInfraredVault vault = IInfrared(infrared).vaultRegistry(asset);
        return vault.getUserRewardsEarned(user);
    }
    
    function harvestRewards(address asset) external {
        IInfraredVault vault = IInfrared(infrared).vaultRegistry(asset);
        vault.getReward();
    }
    
    function exitPosition(address asset) external {
        IInfraredVault vault = IInfrared(infrared).vaultRegistry(asset);
        vault.exit(); // Withdraws all + harvests rewards
    }
}

Testing

Run Tests

# Run all tests
forge test

# Run with gas reporting
forge test --gas-report

# Run specific test file
forge test --match-path test/InfraredVault.t.sol

# Run specific test function
forge test --match-test testStakeFunction

# Run with verbosity (1-5)
forge test -vvv

# Run fork tests
forge test --fork-url $RPC_URL --fork-block-number 12345678

Test Coverage

# Generate coverage report
forge coverage

# Generate detailed coverage report
forge coverage --report lcov

# Generate HTML coverage report
forge coverage --report lcov && genhtml lcov.info -o coverage

Security

Audits

All audit reports are available in the audits directory and on our documentation site.

Bug Bounty

We have an active bug bounty program. Please review our security policy for details on:

  • Scope and rewards
  • Responsible disclosure process
  • Out-of-scope vulnerabilities

Security Contact

For security concerns, please email: security@infrared.finance

DO NOT open public issues for security vulnerabilities.

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Code of Conduct
  • Development process
  • Pull request process
  • Coding standards

Quick Contribution Guide

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Community & Support

License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ by the Infrared team

WebsiteDocumentationTwitter