Overview
Architecture Overview
Hertzflow implements a modular, upgrade-friendly design for decentralized perpetual futures and liquidity management on BNB. At the center lies the DataStore, a generic key-value state store that decouples logic from storage, enabling seamless upgrades of underlying modules without state migration. Core logic—funds custody, perps execution, risk controls, and configuration—resides in dedicated contracts (Handlers, Utils, Vaults) that can evolve independently without disrupting external integrations.
The architecture balances security, composability, and low-latency execution:
Security
All assets are custodied in specialized Vaults with isolated accounting:
OrderVault
Holds execution fees
DepositVault
Holds LP deposit collateral
WithdrawalVault
Holds withdrawal collateral
ShiftVault
Holds market shift collateral
Permissioned updates are tightly scoped through a RoleStore with granular roles:
ORDER_KEEPER
Execute regular orders
LIQUIDATION_KEEPER
Execute liquidation orders
CONTROLLER
Call critical handler functions
CONFIG_KEEPER
Market and fee configuration
Additional protections include GlobalReentrancyGuard against reentrancy attacks and FeatureUtils for graceful feature deprecation.
Composability
A shared OracleModule provides normalized, manipulation-resistant price feeds to all consumers:
OrderHandler, DepositHandler, WithdrawalHandler
Position utilities (increase/decrease)
Risk checks and liquidation logic
Off-chain keepers sign prices with block hashes to prevent front-running.
Execution Flow

Request Phase: Users submit requests via ExchangeRouter (multicall-enabled); requests are stored in DataStore with tokens transferred to appropriate Vaults.
Execution Phase: Keepers monitor the blockchain, trigger execution through specialized Handlers (
OrderHandler,DepositHandler,WithdrawalHandler), and provide signed oracle prices via thewithOraclePricesmodifier.Settlement Phase: Execution modules (
IncreaseOrderExecutor,DecreaseOrderExecutor) resolve requests using validated prices from the Oracle.
The two-step execution model prevents front-running by separating request creation from price-dependent execution.
REST API
Smart Contracts
TypeScript SDK
Supported Networks
BSC Testnet
97
Active
BSC Mainnet
56
Coming Soon
Last updated

