LayerCover

IPoolAllocationManager

Interface reference for IPoolAllocationManager.

Interface

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.20;

import {Types} from "../libraries/helpers/Types.sol";

/**
 * @title IPoolAllocationManager
 * @author LayerCover Protocol
 * @notice User-facing interface for pool allocations - used by Syndicates to manage capital
 * @dev This is the ACTION CONTRACT that Syndicates call to deposit, allocate, and deallocate.
 *      NOT to be confused with IPoolAllocations, which is the internal state contract
 *      that stores allocation data (PoolAllocationManager delegates to it).
 *
 * Relationship:
 * - IPoolAllocationManager: User-facing allocation actions (syndicates call this)
 * - IPoolAllocations: Internal state storage + validation (PoolAllocationManager calls this)
 */
interface IPoolAllocationManager {
    /**
     * @notice Deposits capital into CapitalPool and allocates to risk pools
     * @param depositAmount Amount to deposit into CapitalPool
     * @param poolIds Array of pool IDs to allocate to
     * @param amounts Amount of capital to allocate to each pool
     */
    function depositAndAllocate(
        uint256 depositAmount,
        uint256[] calldata poolIds,
        uint256[] calldata amounts
    ) external;

    /**
     * @notice Allocates existing capital to risk pools
     * @param poolIds Array of pool IDs to allocate to
     * @param amounts Amount of capital to allocate to each pool
     */
    function allocateToPools(
        uint256[] calldata poolIds,
        uint256[] calldata amounts
    ) external;

    /**
     * @notice Deallocate from a pool after coverage cooldown expires
     * @dev No request needed - just call when cooldown has passed (30 days after last coverage expires)
     * @param poolId Pool to deallocate from
     */
    function deallocateFromPool(uint256 poolId) external;

    /**
     * @notice Withdraw available assets from CapitalPool to the syndicate wallet.
     * @param amount Requested amount of assets to withdraw
     * @param recipient Recipient address for the withdrawn assets
     * @return withdrawn Amount actually withdrawn
     */
    function withdrawToSyndicate(
        uint256 amount,
        address recipient
    ) external returns (uint256 withdrawn);

    /**
     * @notice Gets the core dependency contracts for this manager
     * @return capitalPool Address of CapitalPool
     * @return poolAllocations Address of PoolAllocations
     * @return syndicateFactory Address of SyndicateFactory
     */
    function getDependencies()
        external
        view
        returns (
            address capitalPool,
            address poolAllocations,
            address syndicateFactory
        );
}