LEEQUID
  • 👋 Welcome
  • Navigating LEEQUID
    • 🌱 Staking
      • The staking protocol
      • Matching stake to unstake requests
      • Potential wait times while staking
      • Deposited LYX lifecycle
      • Importing sLYX to your wallet
    • 🍇 Collecting rewards
      • Reward distribution in the LEEQUID protocol
      • Auto-compounding
      • Withdrawing rewards
      • Reward calculation in Proof of Stake
    • 🍂 Exiting the protocol
      • Option 1: swapping sLYX for LYX
      • Option 2: unstaking through the staking pool
      • Matching unstake to stake requests
      • Potential wait times while unstaking
    • 🍷 Claiming
      • Claim queued stake
      • Claim unstaked LYX
      • Claim rewards
    • 🔄 Swapping
      • LYX for sLYX: An instant alternative to staking
      • sLYX for LYX: an instant alternative to exiting
      • Providing liquidty
      • Providing Liquidity: a practical example
  • LEEQUID in depth
    • 🔐 Protocol security and risks
      • Security overview
      • Smart contract code correctness
      • Slashing and unexpected validator behaviour
      • sLYX token: economic balance
      • Validator key management
    • 📃 Smart contracts
      • Oracles
      • Merkle Distributor
      • Rewards
      • Pool
      • StakedLyxToken
      • FeesEscrow
    • 💧 The sLYX token
      • Acquiring sLYX
      • 1:1 ratio with LYX
      • Potential unpeg of sLYX from LYX
    • 💦 The liquidity pool (DEX)
      • Implementation
  • Incident Response
    • Contacts
    • Vulnerability Disclosure Policy
Powered by GitBook
On this page
  1. LEEQUID in depth
  2. 📃 Smart contracts

FeesEscrow

0x9658B1Ff55597303EF2Ed963A9E8Aadb7E3E135e

Last updated 1 year ago

The FeesEscrow contract is a very short contract that has only one function: to temporarily store execution layer rewards.

Each time one of the validators in the LEEQUID protocol proposes a block, it benefits from transaction ordering tips, also called MEV or execution layer rewards. It does so by prioritizing transactions that offer a tip, which goes to an address called the "fee recipient". This address is set in fee_recipient attribute of the block's header and, expectedly, the LEEQUID protocol's validators are configured to set it to the FeesEscrow contract's address on mainnet. You can learn more about the block structure of EVM based blockchains in the .

Each time the in LEEQUID update the reward balance of the protocol (which happens roughly twice a day) they sweep the fees accumulated in the FeesEscrow contract and transfer them to the Rewards contract. That's the purpose of the transferToRewards function as seen below:

// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity ^0.8.20;

import {IFeesEscrow} from "../interfaces/IFeesEscrow.sol";

/**
 * @title FeesEscrow
 *
 * @dev FeesEscrow contract is used to receive tips from validators and transfer
 * them to the Rewards contract via a call to the transferToRewards method by the Rewards contract.
 */
contract FeesEscrow is IFeesEscrow {
    // @dev Rewards contract's address.
    address payable private immutable rewards;

    constructor(address _rewards) {
        rewards = payable(_rewards);
    }

    /**
     * @dev See {IFeesEscrow-transferToRewards}.
     */
    function transferToRewards() external override returns (uint256) {
        require(msg.sender == rewards, "FeesEscrow: invalid caller");

        uint256 balance = address(this).balance;

        if (balance == 0) {
            return balance;
        }

        rewards.transfer(balance);

        emit FeesTransferred(balance);

        return balance;
    }

    /**
     * @dev Allows FeesEscrow contract to receive execution layer tips. Later these rewards will be transferred
     * to the `Rewards` contract by `FeesEscrow.transferToRewards` method which is called by the `Rewards` contract.
     */
    receive() external payable {}
}
Ethereum official docs
Oracles