Amplify
Launch AppGithub
  • Introduction
    • Amplify Overview
    • Concepts
      • Networks
      • DApps
      • Network Investors
      • LPs & Traders
    • Getting Started
      • Networks
      • DApps
      • Investors
  • Developers
    • Smart Contracts
      • VoteEscrowDistribution
      • Voter
      • VoteEscrow
      • Factories
        • Factory
        • IncentivesManagerFactory
        • VoterFactories
        • VoteEscrowFactory
        • GaugeFactory
          • BaseGaugeFactory
        • BribeFactory
          • BaseBribeFactory
      • Bribe
      • Gauge
      • IncentivesManager
    • Deployments
      • Arbitrum Sepolia
  • Resources
    • Brand Assets
    • Bug Bounty
    • Security & Audits
    • Whitelisting
  • Terms of Service
    • Privacy Policy
    • Terms of Use
Powered by GitBook
On this page
  • Description
  • deployContracts
  • configureProjectsFromRegistry
  • getDeploymentRegisteredDapps
  1. Developers
  2. Smart Contracts
  3. Factories

Factory

Description

This contract acts as a high-level orchestrator for deploying and configuring complete instances of the voting escrow, gauge, bribe, and incentive management system. It utilizes various underlying "base" factory contracts (for gauges, bribes, vote escrow, etc.) to deploy the necessary functional contracts (GaugeFactory, BribeFactory, VoteEscrow, Voter, IncentivesManager, VoteEscrowDistribution). After deployment, it wires these contracts together by setting the required references (e.g., setting the Voter on the VoteEscrow, setting the Incentives Manager as the depositor on the VoteEscrowDistribution).


Constructor

constructor(
    address _baseGaugeFactory,
    address _baseBribeFactory,
    address _voteEscrowFactory,
    address _voteEscrowDistributionFactory,
    address _incentivesManagerFactory,
    address _voterFactory,
    address _dappRegistry,
    address _projectRegistry
)

Description:

Initializes the main Factory contract upon deployment. It sets the deployer (msg.sender) as the owner and stores the addresses of all required underlying base factory contracts and external registry contracts. These addresses are used later during the deployment and configuration phases.

Input Parameters:

Name
Type
Description

_baseGaugeFactory

address

Address of the contract that deploys GaugeFactory instances.

_baseBribeFactory

address

Address of the contract that deploys BribeFactory instances.

_voteEscrowFactory

address

Address of the contract that deploys VoteEscrow instances.

_voteEscrowDistributionFactory

address

Address of the contract that deploys VoteEscrowDistribution instances.

_incentivesManagerFactory

address

Address of the contract that deploys IncentivesManager instances.

_voterFactory

address

Address of the contract that deploys Voter instances.

_dappRegistry

address

Address of the IDappRegistry contract.

_projectRegistry

address

Address of the IProjectRegistry contract.


deployContracts

function deployContracts(
    address rewardToken,
    address voteEscrowToken,
    address incentivesDistributorAddr
) external

Description:

Deploys a complete set of core contracts required for one instance of the voting escrow system. It uses the pre-configured base factory addresses to deploy a GaugeFactory, BribeFactory, VoteEscrow, VoteEscrowDistribution, Voter, and IncentivesManager. It stores the addresses of these newly deployed contracts associated with an incrementing deploymentCounter. It then wires the contracts together by calling setter functions (e.g., setting the IncentivesManager on the Voter, setting the Voter on the VoteEscrow, setting the IncentivesManager as the depositor for VoteEscrowDistribution). The caller (msg.sender) is recorded as the owner of this specific deployment instance.

Input Parameters:

Name
Type
Description

rewardToken

address

The address of the ERC20 token used for base rewards (distributed by the Voter).

voteEscrowToken

address

The address of the ERC20 token locked in the VoteEscrow contract.

incentivesDistributorAddr

address

The address authorized to distribute incentives via the IncentivesManager.

Events Emitted:

DeploymentComplete(...) with details of the deployed contract addresses and configuration.


configureProjectsFromRegistry

function configureProjectsFromRegistry(uint256 deploymentIndex, uint256[] calldata dappIndices) external

Description:

Configures specific projects (represented by Dapp tokens) for a previously deployed system instance (deploymentIndex). Requires the caller (msg.sender) to be the owner of that specific deployment. It iterates through the provided dappIndices, retrieves Dapp information (token address, protocol admin) from the dappRegistry, creates a gauge for each Dapp's token via the deployment's Voter contract (using voterFactory._createGauge), mints a small initial amount of the Dapp's token (assuming it's IMintableERC20), approves the gauge, and deposits the minted tokens into the gauge on behalf of the protocolAdmin. It tracks which Dapps have been registered for the deployment and finally registers the entire deployment configuration in the external projectRegistry.

Input Parameters:

Name
Type
Description

deploymentIndex

uint256

The index of the deployment instance (created via deployContracts) to configure.

dappIndices

uint256[] calldata

An array of indices corresponding to Dapps listed in the dappRegistry.

Events Emitted:

ProjectConfigured(...) for each Dapp successfully configured.


getDeploymentRegisteredDapps

function getDeploymentRegisteredDapps(uint256 deploymentId) external view returns (DappInfo[] memory dapps)

Description:

A view function to retrieve the list of Dapps that have been configured for a specific deployment instance using configureProjectsFromRegistry. Returns an array of DappInfo structs, each containing the tokenAddress and protocolAdmin for a configured Dapp.

Input Parameters:

Name
Type
Description

deploymentId

uint256

The index ID of the deployment to query for.

Return Value:

Name
Type
Description

dapps

DappInfo[] memory

An array containing information about the Dapps registered for the deployment.

PreviousFactoriesNextIncentivesManagerFactory

Last updated 2 months ago