Skip to main content

Overview

MakxYieldPad is the core orchestrator of the Makx protocol. It borrows ETH from MakxYieldVault for each token launch, manages Uniswap V4 LP positions, tracks rental state per launch, accrues interest on outstanding bonds, and handles liquidations.

Constants

ConstantValueDescription
TOTAL_TOKEN_SUPPLY1_000_000_000 etherFixed supply for every launched token
TICK_SPACING60Uniswap V4 tick spacing for all pools

Launch state

Each launch is stored in a LaunchConfig struct:
struct LaunchConfig {
    address token;
    address creator;
    uint256 bondAmount;
    uint256 lpTokenId;
    uint256 feePerSecond;
    uint256 launchFeeBalance;    // Accumulated hook fees
    uint256 totalEthFees;        // Lifetime ETH fees
    uint256 totalTokenFees;      // Lifetime token fees
    bytes32 poolId;
    uint48 launchBlock;
    uint48 launchTimestamp;
    uint48 prepaidUntil;
    uint16 hookFeeBps;
    Status status;               // Active | Liquidated | Repaid
}
Lookups:
  • launches[launchId] — by numeric ID
  • tokenToLaunchId[tokenAddress] — by token address
  • poolIdToLaunchId[poolId] — by Uniswap pool ID

Creator functions

createToken()

function createToken(
    string memory name,
    string memory symbol,
    uint48 duration,
    uint256 devBuyETH,
    uint16 hookFeeBps_
) external payable returns (uint256 launchId)
Launches a new token. msg.value = rentalPayment + devBuyETH. Borrows bondAmount from vault, mints 1B tokens, creates full-range Uniswap V4 LP, executes dev buy. duration must be ≥ minRentalDuration.

depositRent(uint256 launchId)

function depositRent(uint256 launchId) external payable
Extends rental by paying additional ETH. Blocked in the grace period. adminPayRentFeeBps is deducted.

repayBond(uint256 launchId)

function repayBond(uint256 launchId) external payable
Repays a portion of the outstanding bond, reducing bondAmount and feePerSecond. If bondAmount reaches zero, status transitions to Repaid.

claimFees(uint256 launchId)

function claimFees(uint256 launchId) external
Claims accumulated hook swap fees to the creator. Blocked in grace period. adminFeeBps cut goes to protocol.

collectLPFees(uint256 launchId)

function collectLPFees(uint256 launchId) external
Collects Uniswap V4 LP trading fees to the creator. Blocked in grace period. adminCollectLpFeeBps cut goes to protocol.

setHookFee(uint256 launchId, uint16 bps)

function setHookFee(uint256 launchId, uint16 bps) external
Updates the hook fee for this launch. Caller must be the creator. Capped at maxHookFeeBps.

Liquidation

liquidate(uint256 launchId)

function liquidate(uint256 launchId) external
Permissionless. Available when status == Active AND prepaidUntil ≤ block.timestamp + liquidationThreshold. Sequence:
  1. Withdraw LP NFT → receive ETH + tokens
  2. Repay bondAmount to vault
  3. Send surplus ETH to liquidator (minus adminLiquidationFeeBps)
  4. Send launchFeeBalance to liquidator
  5. Send all tokens to liquidator
  6. Set status = Liquidated

Interest accrual

collectInterest()

function collectInterest() external
Pushes accrued interest to the vault. Callable by anyone. The vault calls this automatically before every deposit and redemption. Interest formula:
pending = elapsed × interestRatePerSecond × totalBondedETH / 1e18

Hook interface

getPoolConfig(bytes32 poolId)

function getPoolConfig(bytes32 poolId) external view returns (uint16 hookFeeBps)
Returns the hook fee for a pool. Called by the hook on every swap.

recordHookFee(bytes32 poolId, uint256 amount)

function recordHookFee(bytes32 poolId, uint256 amount) external
Called by the hook to record a fee collection. Only callable by the hook address.

Owner configuration

configure(...)

Sets hook address, minRentalDuration, adminFeeBps, maxHookFeeBps, gracePeriod, liquidationThreshold, minBondAmount, maxBondAmount, and interestRatePerSecond.

setFeeRate(uint16 _feeRateBps)

Updates the rental fee rate.

setAdminFees(uint16 lpFeeBps, uint16 rentFeeBps, uint16 liquidationFeeBps)

Updates the three non-hook admin fee parameters.

Events

EventEmitted when
TokenLaunchedNew token created
RentalExtendedRent deposited
FeesClaimedHook fees claimed by creator
LPFeesCollectedLP fees collected
LiquidatedLaunch liquidated
HookFeeReceivedHook fee recorded
HookFeeUpdatedCreator changed hook fee
BondRepaidBond partially or fully repaid
InterestCollectedInterest pushed to vault
FeeRateUpdatedRental fee rate changed

Key errors

ErrorCondition
InsufficientPaymentmsg.value too low for rental duration
BondAmountOutOfRangebondAmount outside [minBond, maxBond]
InvalidDurationduration < minRentalDuration
NotLiquidatableNot yet in liquidation zone
InGracePeriodAction blocked during grace period
InLiquidationZonedepositRent blocked (already liquidatable)
NotCreatorCaller is not the launch creator
HookFeeTooHighhookFeeBps > maxHookFeeBps