|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity ^0.8.0; |
| 3 | + |
| 4 | +import "./IProvider.sol"; |
| 5 | + |
| 6 | +/** |
| 7 | + * @title IInvestProvider |
| 8 | + * @dev Interface for managing investment pools, including investment actions and pool creation. |
| 9 | + * It extends the IProvider interface and defines additional functionality specific to investment pools. |
| 10 | + */ |
| 11 | +interface IInvestProvider is IProvider { |
| 12 | + /** |
| 13 | + * @notice Allows an address to invest in a specific IDO (Initial DEX Offering) pool. |
| 14 | + * @dev The function is used to transfer a specified amount of tokens into the pool. |
| 15 | + * @param poolId The ID of the pool where the investment will occur. |
| 16 | + * @param amount The amount of tokens to be invested in the pool. |
| 17 | + */ |
| 18 | + function invest(uint256 poolId, uint256 amount, uint256 validUntil, bytes calldata signature) external; |
| 19 | + |
| 20 | + /** |
| 21 | + * @notice Creates a new investment pool. |
| 22 | + * @dev This function is used to create a new pool with the specified parameters, copying the settings of an existing source pool. |
| 23 | + * It will initialize the new pool with the given details and return its poolId. |
| 24 | + * @param poolAmount The maximum amount of tokens that can be invested in the pool. |
| 25 | + * @param investSigner The address of the signer for investments. |
| 26 | + * @param dispenserSigner The address of the signer for dispenses. |
| 27 | + * @param sourcePoolId The ID of the source pool to copy settings from. |
| 28 | + * @return poolId The ID of the newly created pool. |
| 29 | + */ |
| 30 | + function createNewPool( |
| 31 | + uint256 poolAmount, |
| 32 | + address investSigner, |
| 33 | + address dispenserSigner, |
| 34 | + uint256 sourcePoolId |
| 35 | + ) external returns (uint256 poolId); |
| 36 | + |
| 37 | + /** |
| 38 | + * @notice Creates a new investment pool. |
| 39 | + * @dev This function is used to create a new pool with the specified parameters, copying the settings of an existing source pool. |
| 40 | + * It will initialize the new pool with the given details and return its poolId. |
| 41 | + * @param poolAmount The maximum amount of tokens that can be invested in the pool. |
| 42 | + * @param sourcePoolId The ID of the source pool to copy settings from. |
| 43 | + * @return poolId The ID of the newly created pool. |
| 44 | + */ |
| 45 | + function createNewPool(uint256 poolAmount, uint256 sourcePoolId) external returns (uint256 poolId); |
| 46 | + |
| 47 | + /** |
| 48 | + * @dev Struct that represents an IDO pool, which contains the pool's configuration and the remaining investment amount. |
| 49 | + */ |
| 50 | + struct Pool { |
| 51 | + uint256 maxAmount; // The maximum amount of tokens that can be invested in the pool |
| 52 | + uint256 leftAmount; // The amount of tokens left to invest in the pool |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @notice Emitted when a user successfully invests in a pool. |
| 57 | + * @param poolId The ID of the pool where the investment was made. |
| 58 | + * @param user The address of the user who made the investment. |
| 59 | + * @param amount The amount of tokens that were invested. |
| 60 | + */ |
| 61 | + event Invested(uint256 indexed poolId, address indexed user, uint256 amount); |
| 62 | + |
| 63 | + /** |
| 64 | + * @notice Emitted when a new pool is created. |
| 65 | + * @param poolId The ID of the newly created pool. |
| 66 | + * @param owner The address of the user who created the pool. |
| 67 | + * @param poolAmount The maximum amount of tokens that can be invested in the pool. |
| 68 | + */ |
| 69 | + event NewPoolCreated(uint256 indexed poolId, address indexed owner, uint256 poolAmount); |
| 70 | + |
| 71 | + error InvalidLockDealNFT(); |
| 72 | + error InvalidProvider(); |
| 73 | + error InvalidPoolId(); |
| 74 | + error OnlyLockDealNFT(); |
| 75 | + error NoZeroAddress(); |
| 76 | + error InvalidParams(); |
| 77 | + error NoZeroAmount(); |
| 78 | + error ExceededLeftAmount(); |
| 79 | + error InvalidParamsLength(uint256 paramsLength, uint256 minLength); |
| 80 | + error InvalidSignature(uint256 poolId, address owner); |
| 81 | + error InvalidTime(uint256 currentTime, uint256 validUntil); |
| 82 | + error InvalidSourcePoolId(uint256 sourcePoolId); |
| 83 | +} |
0 commit comments