// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.19; // Interfaces import {IRegistry} from "./IRegistry.sol"; import {IStrategy} from "./IStrategy.sol"; // Internal Libraries import {Metadata} from "../libraries/Metadata.sol"; // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⢿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⡟⠘⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣾⠻⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⡿⠀⠀⠸⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⢀⣠⣴⣴⣶⣶⣶⣦⣦⣀⡀⠀⠀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⡿⠃⠀⠙⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⠁⠀⠀⠀⢻⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡀⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠘⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⠃⠀⠀⠀⠀⠈⢿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⣰⣿⣿⣿⡿⠋⠁⠀⠀⠈⠘⠹⣿⣿⣿⣿⣆⠀⠀⠀ // ⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⢰⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⡀⠀⠀ // ⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣟⠀⡀⢀⠀⡀⢀⠀⡀⢈⢿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⠀ // ⠀⠀⣠⣿⣿⣿⣿⣿⣿⡿⠋⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⡿⢿⠿⠿⠿⠿⠿⠿⠿⠿⠿⢿⣿⣿⣿⣷⡀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠸⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⠂⠀⠀ // ⠀⠀⠙⠛⠿⠻⠻⠛⠉⠀⠀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣧⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⢻⣿⣿⣿⣷⣀⢀⠀⠀⠀⡀⣰⣾⣿⣿⣿⠏⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣧⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠹⢿⣿⣿⣿⣿⣾⣾⣷⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀ // ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠙⠋⠛⠙⠋⠛⠙⠋⠛⠙⠋⠃⠀⠀⠀⠀⠀⠀⠀⠀⠠⠿⠻⠟⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠟⠿⠟⠿⠆⠀⠸⠿⠿⠟⠯⠀⠀⠀⠸⠿⠿⠿⠏⠀⠀⠀⠀⠀⠈⠉⠻⠻⡿⣿⢿⡿⡿⠿⠛⠁⠀⠀⠀⠀⠀⠀ // allo.gitcoin.co /// @title Allo Interface /// @author @thelostone-mc , @0xKurt , @codenamejason , @0xZakk , @nfrgosselin /// @notice Interface for the Allo contract. It exposes all functions needed to use the Allo protocol. interface IAllo { /// ====================== /// ======= Structs ====== /// ====================== /// @notice the Pool struct that all strategy pools are based from struct Pool { bytes32 profileId; IStrategy strategy; address token; Metadata metadata; bytes32 managerRole; bytes32 adminRole; } /// ====================== /// ======= Events ======= /// ====================== /// @notice Event emitted when a new pool is created /// @param poolId ID of the pool created /// @param profileId ID of the profile the pool is associated with /// @param strategy Address of the strategy contract /// @param token Address of the token pool was funded with when created /// @param amount Amount pool was funded with when created /// @param metadata Pool metadata event PoolCreated( uint256 indexed poolId, bytes32 indexed profileId, IStrategy strategy, address token, uint256 amount, Metadata metadata ); /// @notice Emitted when a pools metadata is updated /// @param poolId ID of the pool updated /// @param metadata Pool metadata that was updated event PoolMetadataUpdated(uint256 indexed poolId, Metadata metadata); /// @notice Emitted when a pool is funded /// @param poolId ID of the pool funded /// @param amount Amount funded to the pool /// @param fee Amount of the fee paid to the treasury event PoolFunded(uint256 indexed poolId, uint256 amount, uint256 fee); /// @notice Emitted when the base fee is paid /// @param poolId ID of the pool the base fee was paid for /// @param amount Amount of the base fee paid event BaseFeePaid(uint256 indexed poolId, uint256 amount); /// @notice Emitted when the treasury address is updated /// @param treasury Address of the new treasury event TreasuryUpdated(address treasury); /// @notice Emitted when the percent fee is updated /// @param percentFee New percentage for the fee event PercentFeeUpdated(uint256 percentFee); /// @notice Emitted when the base fee is updated /// @param baseFee New base fee amount event BaseFeeUpdated(uint256 baseFee); /// @notice Emitted when the registry address is updated /// @param registry Address of the new registry event RegistryUpdated(address registry); /// @notice Emitted when a strategy is approved and added to the cloneable strategies /// @param strategy Address of the strategy approved event StrategyApproved(address strategy); /// @notice Emitted when a strategy is removed from the cloneable strategies /// @param strategy Address of the strategy removed event StrategyRemoved(address strategy); /// ==================================== /// ==== External/Public Functions ===== /// ==================================== /// @notice Initialize the Allo contract /// @param _owner Address of the owner /// @param _registry Address of the registry contract /// @param _treasury Address of the treasury /// @param _percentFee Percentage for the fee /// @param _baseFee Base fee amount function initialize( address _owner, address _registry, address payable _treasury, uint256 _percentFee, uint256 _baseFee ) external; /// @notice Creates a new pool (with a custom strategy) /// @dev 'msg.sender' must be a member or owner of a profile to create a pool with or without a custom strategy, The encoded data /// will be specific to a given strategy requirements, reference the strategy implementation of 'initialize()'. The strategy /// address passed must not be a cloneable strategy. The strategy address passed must not be the zero address. 'msg.sender' must /// be a member or owner of the profile id passed as '_profileId'. /// @param _profileId The 'profileId' of the registry profile, used to check if 'msg.sender' is a member or owner of the profile /// @param _strategy The address of the deployed custom strategy /// @param _initStrategyData The data to initialize the strategy /// @param _token The address of the token you want to use in your pool /// @param _amount The amount of the token you want to deposit into the pool on initialization /// @param _metadata The 'Metadata' of the pool, this uses our 'Meatdata.sol' struct (consistent throughout the protocol) /// @param _managers The managers of the pool, and can be added/removed later by the pool admin /// @return poolId The ID of the pool function createPoolWithCustomStrategy( bytes32 _profileId, address _strategy, bytes memory _initStrategyData, address _token, uint256 _amount, Metadata memory _metadata, address[] memory _managers ) external payable returns (uint256 poolId); /// @notice Creates a new pool (by cloning a cloneable strategies). /// @dev 'msg.sender' must be owner or member of the profile id passed as '_profileId'. /// @param _profileId The ID of the registry profile, used to check if 'msg.sender' is a member or owner of the profile /// @param _strategy The address of the strategy contract the pool will use. /// @param _initStrategyData The data to initialize the strategy /// @param _token The address of the token /// @param _amount The amount of the token /// @param _metadata The metadata of the pool /// @param _managers The managers of the pool /// @custom:initstrategydata The encoded data will be specific to a given strategy requirements, /// reference the strategy implementation of 'initialize()' function createPool( bytes32 _profileId, address _strategy, bytes memory _initStrategyData, address _token, uint256 _amount, Metadata memory _metadata, address[] memory _managers ) external payable returns (uint256 poolId); /// @notice Updates a pools metadata. /// @dev 'msg.sender' must be a pool admin. /// @param _poolId The ID of the pool to update /// @param _metadata The new metadata to set function updatePoolMetadata(uint256 _poolId, Metadata memory _metadata) external; /// @notice Update the registry address. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _registry The new registry address function updateRegistry(address _registry) external; /// @notice Updates the treasury address. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _treasury The new treasury address function updateTreasury(address payable _treasury) external; /// @notice Updates the percentage for the fee. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _percentFee The new percentage for the fee function updatePercentFee(uint256 _percentFee) external; /// @notice Updates the base fee. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _baseFee The new base fee function updateBaseFee(uint256 _baseFee) external; /// @notice Adds a strategy to the cloneable strategies. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _strategy The address of the strategy to add function addToCloneableStrategies(address _strategy) external; /// @notice Removes a strategy from the cloneable strategies. /// @dev 'msg.sender' must be the Allo contract owner. /// @param _strategy The address of the strategy to remove function removeFromCloneableStrategies(address _strategy) external; /// @notice Adds a pool manager to the pool. /// @dev 'msg.sender' must be a pool admin. /// @param _poolId The ID of the pool to add the manager to /// @param _manager The address of the manager to add function addPoolManager(uint256 _poolId, address _manager) external; /// @notice Removes a pool manager from the pool. /// @dev 'msg.sender' must be a pool admin. /// @param _poolId The ID of the pool to remove the manager from /// @param _manager The address of the manager to remove function removePoolManager(uint256 _poolId, address _manager) external; /// @notice Recovers funds from a pool. /// @dev 'msg.sender' must be a pool admin. /// @param _token The token to recover /// @param _recipient The address to send the recovered funds to function recoverFunds(address _token, address _recipient) external; /// @notice Registers a recipient and emits {Registered} event if successful and may be handled differently by each strategy. /// @param _poolId The ID of the pool to register the recipient for function registerRecipient(uint256 _poolId, bytes memory _data) external payable returns (address); /// @notice Registers a batch of recipients. /// @param _poolIds The pool ID's to register the recipients for /// @param _data The data to pass to the strategy and may be handled differently by each strategy function batchRegisterRecipient(uint256[] memory _poolIds, bytes[] memory _data) external returns (address[] memory); /// @notice Funds a pool. /// @dev 'msg.value' must be greater than 0 if the token is the native token /// or '_amount' must be greater than 0 if the token is not the native token. /// @param _poolId The ID of the pool to fund /// @param _amount The amount to fund the pool with function fundPool(uint256 _poolId, uint256 _amount) external payable; /// @notice Allocates funds to a recipient. /// @dev Each strategy will handle the allocation of funds differently. /// @param _poolId The ID of the pool to allocate funds from /// @param _data The data to pass to the strategy and may be handled differently by each strategy. function allocate(uint256 _poolId, bytes memory _data) external payable; /// @notice Allocates funds to multiple recipients. /// @dev Each strategy will handle the allocation of funds differently function batchAllocate(uint256[] calldata _poolIds, bytes[] memory _datas) external; /// @notice Distributes funds to recipients and emits {Distributed} event if successful /// @dev Each strategy will handle the distribution of funds differently /// @param _poolId The ID of the pool to distribute from /// @param _recipientIds The recipient ids to distribute to /// @param _data The data to pass to the strategy and may be handled differently by each strategy function distribute(uint256 _poolId, address[] memory _recipientIds, bytes memory _data) external; /// ========================= /// ==== View Functions ===== /// ========================= /// @notice Checks if an address is a pool admin. /// @param _poolId The ID of the pool to check /// @param _address The address to check /// @return 'true' if the '_address' is a pool admin, otherwise 'false' function isPoolAdmin(uint256 _poolId, address _address) external view returns (bool); /// @notice Checks if an address is a pool manager. /// @param _poolId The ID of the pool to check /// @param _address The address to check /// @return 'true' if the '_address' is a pool manager, otherwise 'false' function isPoolManager(uint256 _poolId, address _address) external view returns (bool); /// @notice Checks if a strategy is cloneable (is in the cloneableStrategies mapping). /// @param _strategy The address of the strategy to check /// @return 'true' if the '_strategy' is cloneable, otherwise 'false' function isCloneableStrategy(address _strategy) external view returns (bool); /// @notice Returns the address of the strategy for a given 'poolId' /// @param _poolId The ID of the pool to check /// @return strategy The address of the strategy for the ID of the pool passed in function getStrategy(uint256 _poolId) external view returns (address); /// @notice Returns the current percent fee /// @return percentFee The current percentage for the fee function getPercentFee() external view returns (uint256); /// @notice Returns the current base fee /// @return baseFee The current base fee function getBaseFee() external view returns (uint256); /// @notice Returns the current treasury address /// @return treasury The current treasury address function getTreasury() external view returns (address payable); /// @notice Returns the current registry address /// @return registry The current registry address function getRegistry() external view returns (IRegistry); /// @notice Returns the 'Pool' struct for a given 'poolId' /// @param _poolId The ID of the pool to check /// @return pool The 'Pool' struct for the ID of the pool passed in function getPool(uint256 _poolId) external view returns (Pool memory); /// @notice Returns the current fee denominator /// @dev 1e18 represents 100% /// @return feeDenominator The current fee denominator function getFeeDenominator() external view returns (uint256); }