6. Economic Model6.2 Keeper Bounty (0.2%)

6.2. 0.2% Keeper Bounty

The 0.2% Keeper Bounty is the economic engine that powers the decentralized automation of the Fhenix-FairMarket protocol. By converting the auction finalization function (triggerFinalize) into a public, incentivized action, the protocol removes reliance on centralized internal infrastructure. Instead, it creates a competitive, self-sustaining market where external Keepers (such as Gelato, Chainlink, or independent bots) are economically motivated to ensure auctions close exactly at their scheduled endTime.

This mechanism guarantees protocol liveness: even if the core development team’s servers fail, the economic reward ensures that independent actors will step in to finalize auctions, process CoFHE requests, and settle trades.

Core Design Principles

PrincipleTechnical Implementation
Decentralized LivenesstriggerFinalize() is public. Any actor can call it, removing single points of failure.
Success-Based RewardThe bounty is only paid upon successful execution. If the transaction reverts (e.g., auction not ended), the caller pays gas but receives no bounty, preventing DoS attacks.
First-Come-First-ServedThe reward is allocated to the single successful caller (msg.sender) per auction. This naturally discourages “gas wars” as the incentive is fixed (0.2%).
Economic AlignmentThe bounty covers the gas cost of the finalization transaction plus a profit margin, ensuring long-term viability for Keeper operators.
Split from Success FeeThe 0.2% is mathematically derived from the total 0.5% Success Fee (representing 40% of the fee), ensuring the protocol captures the remainder for Treasury/Insurance.

️ Technical Implementation

1. Bounty Calculation & Distribution

The bounty logic is integrated into the settlement phase. To ensure fairness and precision, it uses safe integer math and is distributed immediately upon successful state transition to RESOLVING (or finalized settlement depending on architecture).

// packages/contracts/settlement/SettlementEngine.sol (Conceptual Logic)
/**
 * @notice Distributes the Keeper bounty to the executor
 * @dev Called atomically after triggerFinalize() succeeds
 */
function _distributeKeeperBounty(uint256 auctionId, address finalizer) internal {
 // Retrieve the winning bid value (must be available or pre-calculated)
 // Note: In Async CoFHE, this might be estimated or distributed after AVS settlement.
 // Here we assume distribution upon valid resolution for simplicity of the incentive model.
 uint256 winningValue = auctions[auctionId].resolvedValue; 
 
 // Calculate 0.2%: (Value * 2) / 1000
 uint256 bounty = (winningValue * 2) / 1000;
 
 require(bounty > 0, "Bounty too low");
 
 // Transfer to the successful Keeper
 (bool success, ) = finalizer.call{value: bounty}("");
 require(success, "Keeper payout failed");
 
 emit KeeperBountyPaid(auctionId, finalizer, bounty);
}

2. Integration with triggerFinalize()

The core contract enforces the conditions under which the bounty becomes claimable.

// packages/contracts/core/FhenixFairMarket.sol
function triggerFinalize(uint256 auctionId) external nonReentrant {
 Auction storage auction = auctions[auctionId];
 
 // 1. Strict Time Condition
 require(block.timestamp >= auction.endTime, "Auction not ended");
 require(auction.state == AuctionState.ACTIVE, "Already processing");
 
 // 2. State Transition (Locks the auction)
 auction.state = AuctionState.RESOLVING;
 
 // 3. Emit Event for Off-Chain Processing
 emit DecryptionRequested(auctionId, auction.ciphertextHashes);
 
 // 4. Incentive Logic
 // The bounty is often recorded in a pending state to be claimed
 // or paid out directly if gas permits and value is known.
 pendingBounties[auctionId] = msg.sender;
 
 // If paid later upon AVS settlement:
 // settlementEngine.claimBounty(auctionId);
}

Economic Flow & Keeper Incentives

The Keeper operates on a profit-and-loss basis. The protocol ensures that the 0.2% reward is consistently higher than the average gas cost of a triggerFinalize transaction.

ScenarioKeeper OutcomeProtocol Outcome
Successful FinalizationProfit: Receives 0.2% of auction value. Covers Gas + Profit.Success: Auction moves to RESOLVING. CoFHE processing begins.
Failed Transaction (Revert)Loss: Pays Gas cost. No bounty received.Safety: State remains unchanged. No false triggers.
Duplicate ExecutionLoss: Second Keeper reverts because state is already RESOLVING.Efficiency: Only one bounty is ever paid per auction.

️ Security & Anti-Griefing Measures

  1. Revert Protection: The bounty logic is only reachable if the state transition succeeds. A malicious actor cannot drain the bounty pool by spamming failed transactions.
  2. Race Condition Handling: While multiple Keepers may attempt to call the function simultaneously, the EVM executes them serially. The first transaction succeeds and claims the bounty; subsequent transactions revert with “Already processing,” ensuring zero overpayment.
  3. Gas Limit Optimization: The triggerFinalize function is designed to be gas-efficient (O(1)), maximizing the Keeper’s net profit margin and encouraging participation.
  4. Decentralized Redundancy: By incentivizing external actors, the protocol ensures that if the primary automation infrastructure (e.g., Gelato) goes down, independent bots will likely pick up the incentive and finalize the auction.

Audit Gate Compliance (P0)

The protocol enforces strict verification gates for the incentive mechanism:

  • [] Fixed Percentage Enforcement: The calculation (value * 2) / 1000 is hardcoded or controlled by immutable constants to prevent inflation attacks.
  • [] Single Payout Guarantee: Unit tests confirm that only one address receives the bounty per auctionId, even under concurrent execution simulations.
  • [] Source of Funds: Bounty is strictly deducted from the protocol fee allocation, never from user principal or escrow deposits.
  • [] No Pre-mature Payout: Bounty is only released after the auction state has irrevocably transitioned to RESOLVING (or FINALIZED).

Next Steps