KibbleConstants.sol
34 lines · sha256 2b526968ef1a768275ec206a83e012e820f8d445f43a79d4cc34d1141dc782ac · Raw
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.26; |
| 3 | |
| 4 | /// @title KibbleConstants |
| 5 | /// @notice Protocol parameters (docs §2). All constants, nothing adjustable. |
| 6 | library KibbleConstants { |
| 7 | /// @notice Max supply, docs §2. |
| 8 | uint256 internal constant MAX_SUPPLY = 10_000_000e18; |
| 9 | /// @notice Genesis LP mint, docs §2 / §6. The only mint outside emission. |
| 10 | uint256 internal constant GENESIS_SUPPLY = 1_000_000e18; |
| 11 | /// @notice Rig price, docs §3: 1 HYPE. |
| 12 | uint256 internal constant RIG_PRICE = 1e18; |
| 13 | /// @notice Power draw denominator: 1 rig draws exactly 1/60,000 HYPE per block (docs §2). |
| 14 | uint256 internal constant DRAW_DIVISOR = 60_000; |
| 15 | /// @notice Tank balances are stored in "power units" = wei × 60,000, so one rig drains exactly |
| 16 | /// 1e18 units per block and a full era is exactly 216,000e18 units = 3.6 HYPE. |
| 17 | uint256 internal constant UNITS_PER_RIG_BLOCK = 1e18; |
| 18 | /// @notice Era length in Elysium blocks, docs §2. |
| 19 | uint256 internal constant ERA_LENGTH = 216_000; |
| 20 | /// @notice Era 1 emission, docs §5: 4,500,000 KIBBLE (20.8333 per block as the ratio ERA1_EMISSION / ERA_LENGTH). |
| 21 | uint256 internal constant ERA1_EMISSION = 4_500_000e18; |
| 22 | /// @notice KIBBLE power discount, docs §4: credit = KIBBLE × TWAP / 0.9 = KIBBLE × TWAP × 10 / 9. |
| 23 | uint256 internal constant KIBBLE_CREDIT_NUM = 10; |
| 24 | uint256 internal constant KIBBLE_CREDIT_DEN = 9; |
| 25 | /// @notice TWAP window in blocks, docs §2. |
| 26 | uint256 internal constant TWAP_WINDOW = 10_000; |
| 27 | /// @notice Pool parameters (decision: Uniswap v4, native HYPE / KIBBLE, 0.3%, tickSpacing 60, no hook). |
| 28 | uint24 internal constant POOL_FEE = 3000; |
| 29 | int24 internal constant TICK_SPACING = 60; |
| 30 | /// @notice Max deviation of the execution price from the TWAP for protocol swaps (Burner, Zapper), in bps. |
| 31 | /// Safety bound against sandwiching of public burn / zap calls (not a docs mechanic, see README). |
| 32 | uint256 internal constant MAX_TWAP_DEVIATION_BPS = 1000; |
| 33 | } |
| 34 |