Page cover image

🔮Rewards Distributor

Rewards Revolution with PerfectSwap

PerfectSwap introduces a groundbreaking approach to rewards distribution, surpassing the limitations of the previous system. Formerly, rewards, fees, and emissions were managed through distinct contracts—gauges, fee contracts, and bribe contracts—resulting in rigid distribution models and high transaction costs.

Core Functionalities

All these processes have now been consolidated into a single streamlined contract known as "RewardsDistributor.sol" (RD), which revolutionizes the reward distribution ecosystem:

  • Fee Collection: RD fetches fees from pools, simplifying the process of gathering rewards.

  • Comprehensive Tracking: It stores and calculates LP Bribes, Voter Bribes, Weekly Emissions, and Trading fees in a unified manner.

  • Merkle Roots: RD stores merkle roots, a crucial element for verifying reward claims.

  • Verification: The contract verifies user claims, ensuring that rewards are distributed to legitimate recipients.

The counterpart to RD is the off-chain rewards processor, designed to accurately mirror on-chain activities within PerfectSwap pools and related contracts.

Off-chain Processor

PerfectSwap Labs has developed a proprietary off-chain rewards processor to track and simulate on-chain movements, bridging the gap between on-chain and off-chain activity:

  • Data Gathering: It fetches all user actions, including swaps, mints, burns, votes, and bribes.

  • Simulation: The processor simulates on-chain states at any given moment, facilitating real-time tracking.

  • Merkle Roots Creation: It generates merkle trees and proofs based on the simulated data.

  • On-chain Verification: The resulting merkle root is pushed on-chain to RD, serving as an immutable record.

How It Operates

The off-chain processor and RD work in harmony to construct merkle trees that encompass all on-chain reward earnings. The resulting root is pushed on-chain, establishing a source of truth. Users then submit merkle proofs to RD, which verifies the legitimacy of the claims. If validated, RD efficiently distributes the rewards, even accommodating multiple claims for a wide array of assets simultaneously.

In the initial phase, merkle roots are pushed on-chain every 24 hours, followed by a one-hour security buffer period. This structured approach ensures secure and timely reward distribution.

An important distinction is that PerfectSwap enables liquidity providers to maintain full custody of their assets, with rewards earned seamlessly, enhancing security.

Advanced Applications

The offloading of computation to off-chain solutions is a burgeoning trend in DeFi. The RD and off-chain processor in PerfectSwap enable advanced use-cases, including:

  • Customized incentivization ranges for Concentrated Liquidity (CL).

  • Detection and filtering of malicious Just-In-Time (JIT) liquidity.

  • Significant gas savings.

Security and Decentralization

While advancing in this direction, security and decentralization remain paramount. PerfectSwap adheres to best practices, including:

  • Security time buffer after each merkle push, allowing third parties to halt RD with a collateral deposit.

  • Multi-signatures and time-locks.

  • Multi-verification setup.

  • Ongoing decentralization efforts.

Furthermore, exploration is underway to potentially run the off-chain processor on EigenLayer or incorporate it into an Ethereum Layer 2 solution.

In a testament to our commitment to transparency, we continuously publish all data used to calculate rewards. This empowers users to independently verify the accuracy of merkle trees, showcasing the inherent integrity of modern cryptography within PerfectSwap.

Last updated