Key Components
- BribeFactoryV3 Contract: The main contract for creating and managing bribe contracts.
- Bribe Contract: Individual contracts created for each pool, handling reward distribution.
- Voter Contract: Interacts with bribe contracts to allocate votes and distribute rewards.
How It Works
- Bribe contracts are created for each liquidity pool.
- External parties can add rewards (bribes) to these contracts.
- Voters allocate their voting power to pools.
- Rewards are distributed to voters based on their allocation.
Key Functions in BribeFactoryV3
Creating Bribes
- Creates a new bribe contract for a pool.
- Only callable by the voter contract or owner.
- Automatically adds default reward tokens.
Managing Reward Tokens
- Add reward tokens to existing bribe contracts.
- Restricted to owner or accounts with BRIBE_ADMIN role.
Updating Bribe Contract Settings
- Update voter, minter, or owner of bribe contracts.
- Only callable by the owner.
Emergency Functions
- Recover ERC20 tokens from bribe contracts in case of emergencies.
- Only callable by the owner.
Integration Points
- Voter Contract: Must be set correctly to interact with bribe contracts.
- Permissions Registry: Controls access to certain functions via the BRIBE_ADMIN role.
- Default Reward Tokens: Can be managed by the owner to add or remove tokens.
Best Practices for Development
- Always use the
onlyAllowedmodifier for sensitive functions. - Ensure the voter address is correctly set and updated when necessary.
- Regularly audit the list of default reward tokens.
- Be cautious when using emergency recovery functions to avoid disrupting the reward system.