EYWA
  • Eywa v2
    • 💥Eywa v2: new era of Web3 interoperability
  • Eywa token
    • 💎Tokenomics Eywa/CrossCurve
    • 📈Eywa token utility
    • ⚡Eywa NFT Collection
      • Eywa NFT Bridge from Aurora to Arbitrum
      • Merge interface in the Arbitrum chain
      • EYWA NFT Manager interface
      • Dashboard interface
    • 🏢Eywa DAO
      • Overview of EYWA DAO
      • Voting
      • Obtaining veEYWA and Calculating the Boost
      • Staking
  • EYWA Ecosystem
    • 💡Vision
    • 🗺️Product & EYWA token Roadmap
    • 🏗️Products
      • Eywa v1
        • Cross-chain Liquidity Protocol
          • Cross-chain DEX v1
          • Eywa Token Bridge
          • Gasless transactions
        • Cross-chain Data Protocol
          • Eywa CDP Introduction
          • Eywa Oracle Network
          • Data transfer flow
      • Eywa v2
        • 🌉Consensus Bridge
        • ⚡CrossCurve
    • 🛡️Security audits
    • 🧠Team
    • 🦄Project History
    • 🔗External Links
    • ❓FAQ
  • User documentation
    • 💸Eywa DEX
      • About EYWA Cross-chain DEX
      • Interface Eywa WebApp
      • How to trade
      • Slippage settings
      • Routing
      • Operation Interruption
        • Slippage condition
        • Data transfer error
    • 🏢DAO
      • EYWA Locker Interface
      • Working with the EYWA Locker contract in Arbiscan.
      • EYWA Vote Interface
      • EYWA Incentives Interface
    • 🔗Contracts addresses
      • Cross-chain Liquidity Protocol
        • CLP smart-contracts
        • Supported stablecoins
        • Addresses of Eywa stableswap pools
        • Addresses of s-tokens
        • Addresses of e-tokens
      • Cross-chain Data Protocol
        • Governance of Eywa Oracle network
        • Cross-chain messaging
  • DEVELOPER DOCUMENTATION
    • 💻Guide for Developers
      • Technical Documentation for EYWA DAO Smart Contracts
        • EmissionManagerV1
        • EscrowManager
        • EscrowVoteManagerV1
        • GaugeFactoryV1
        • GaugeV1
        • IncentiveRewardsDistributor
        • ProposalManager
        • RebaseRewardsDistributorV1
        • RewardsDistributorFactoryV1
        • CalldataHelperV1
        • Treasury
        • DelegationManagerV1
        • DelegationConditionValidatorV1
        • LockHolderFactoryV1
        • LockHolderV1
  • Eywa Oracle Network - will be ENDED in April 2024
    • 🥇Validators token distribution
    • Incentivised PoA mainnet
      • General information
      • Application for participation in PoA mainnet
      • Requirements for PoA mainnet validators
      • Rewards for PoA mainnet
      • Instruction for node operators
    • FAQ
  • ⚖️LEGAL INFORMATION
    • Terms of Service
    • Protocol Disclaimer
    • Cookies Policy
    • Risk of using Eywa
Powered by GitBook
On this page
  • Overview
  • Inherited Contracts and Interfaces
  • State Variables
  • Constructor
  • External Functions
  • Internal Functions
  • Errors
  • Summary
  1. DEVELOPER DOCUMENTATION
  2. Guide for Developers
  3. Technical Documentation for EYWA DAO Smart Contracts

RewardsDistributorFactoryV1

Overview

RewardsDistributorFactoryV1 is an upgradeable contract (using UUPS) that deploys new instances of IncentiveRewardsDistributor. It restricts calls to createRewardsDistributor such that only the escrow vote manager can request a new distributor, thus ensuring controlled creation of additional reward distribution contracts.

Key Roles and Features:

  1. Factory Pattern: It centralizes the instantiation of IncentiveRewardsDistributor contracts, simplifying the process of creating new distributors for different escrow managers.

  2. Access Control: Only the escrow vote manager can call createRewardsDistributor, preventing unauthorized distribution contract creation.

  3. Upgradeable via UUPS: Ensures the factory contract can be upgraded over time, with ownership-based control on upgrades.

By implementing IRewardsDistributorFactoryV1, RewardsDistributorFactoryV1 provides a standard interface for deployment logic and event transparency (though no new custom events are declared here beyond the interface's contract structure).


Inherited Contracts and Interfaces

  • UUPSUpgradeable (OpenZeppelin): Provides the upgrade mechanism under the UUPS proxy standard, restricting upgrades to the contract owner.

  • OwnableUpgradeable (OpenZeppelin): Establishes ownership logic, allowing the owner to authorize upgrades and potentially modify other aspects of the factory (not used extensively here but available if needed).

  • IRewardsDistributorFactoryV1: Declares the initialize and createRewardsDistributor functions, along with an InvalidCaller error.

Additional External References:

  • IncentiveRewardsDistributor: The contract being deployed by this factory. It manages incentive reward distributions for an escrow manager and is constructed with references to the escrow vote manager and escrow manager.


State Variables

address public s_escrowVoteManager;
  • s_escrowVoteManager (address): The address of the escrow vote manager contract. Only this address may invoke createRewardsDistributor on the factory.


Constructor

constructor() {
    _disableInitializers();
}
  • Description: Disables contract initializers to ensure initialize() can only be called once. A standard pattern for UUPS upgradeable contracts.


External Functions

1. initialize(address owner_, address escrowVoteManager_)

function initialize(address owner_, address escrowVoteManager_) external initializer
  • Description: Configures the factory contract by assigning ownership (owner_) and storing the escrow vote manager address. This function can be called only once due to the initializer modifier.

  • Parameters:

    • owner_: The address to be assigned as the owner of this factory contract.

    • escrowVoteManager_: The address of the escrow vote manager responsible for orchestrating new distributor creations.

  • Logic and Effects:

    1. Invokes __UUPSUpgradeable_init() and __Ownable_init(owner_) for upgrade and ownership setup.

    2. Sets s_escrowVoteManager = escrowVoteManager_.


2. createRewardsDistributor(address escrowManager_)

function createRewardsDistributor(address escrowManager_) external returns (address)
  • Description: Creates and returns a new IncentiveRewardsDistributor contract instance, linking it to the calling escrow vote manager (msg.sender) and the provided escrowManager_. The call reverts if not invoked by s_escrowVoteManager.

  • Checks:

    • Must be called by s_escrowVoteManager. Otherwise, it reverts with InvalidCaller().

  • Logic:

    1. If msg.sender != s_escrowVoteManager, revert with InvalidCaller().

    2. Deploys a new IncentiveRewardsDistributor by calling its constructor:

      new IncentiveRewardsDistributor(msg.sender, escrowManager_)
      
    3. Returns the newly created contract’s address.

  • Return:

    • address: The address of the newly created incentive rewards distributor contract.


Internal Functions

1. _authorizeUpgrade(address newImplementation)

function _authorizeUpgrade(address) internal override onlyOwner
  • Description: Restricts upgrades of this factory to the contract’s owner, following the UUPS standard. This ensures that only the owner can deploy a new logic implementation for this factory contract.


Errors

  • InvalidCaller() Thrown if createRewardsDistributor is called by an address other than s_escrowVoteManager.


Summary

RewardsDistributorFactoryV1 provides a straightforward pattern for creating new IncentiveRewardsDistributor instances. By restricting calls to its createRewardsDistributor function to the escrow vote manager, it ensures that only authorized processes can spin up new distributor contracts. Coupled with UUPS upgradeability, the factory is future-proofed, allowing for modifications to how distributors are instantiated if the protocol’s requirements evolve over time.

PreviousRebaseRewardsDistributorV1NextCalldataHelperV1

Last updated 3 months ago

💻