Contracts
Crowdpoolmanager

CrowdPool Manager

Description

The CrowdPoolManage contract is responsible for generating and managing CrowdPool contracts. It provides functions for creating new CrowdPool contracts, calculating the required token amount, and managing the registered CrowdPool contracts.

Dependencies

This contract relies on the following external dependencies:

  • OpenZeppelin Contracts: ERC20, EnumerableSet

Functions

constructor

constructor(
    address payable _owner,
    address lock_addr,
    address uniswapfactory_addr,
    address uniswaprouter_Addr,
    address weth_addr,
    CrowdPoolFactory _crowdpoolFactory
)

The constructor initializes the contract and sets the initial values for various contract parameters.

  • _owner: The address of the contract owner.
  • lock_addr: The address of the CrowdPoolLockForwarder contract.
  • uniswapfactory_addr: The address of the Uniswap factory contract.
  • uniswaprouter_Addr: The address of the Uniswap router contract.
  • weth_addr: The address of the Wrapped Ether (WETH) contract.
  • _crowdpoolFactory: An instance of the CrowdPoolFactory contract.

ownerWithdraw

function ownerWithdraw() public

Allows the contract owner to withdraw the contract's balance. Only the creator of the contract is allowed to call this function.

calculateAmountRequired

function calculateAmountRequired(
    uint256 _amount,
    uint256 _tokenPrice,
    uint256 _listingRate,
    uint256 _liquidityPercent,
    uint256 _tokenFee
) public pure returns (uint256)

Calculates the total amount of tokens required for a CrowdPool contract based on various parameters.

  • _amount: The amount of tokens to be pooled in ETH.
  • _tokenPrice: The price of each token in ETH.
  • _listingRate: The rate at which tokens will be listed on exchanges.
  • _liquidityPercent: The percentage of tokens reserved for liquidity.
  • _tokenFee: The fee percentage charged in tokens.

Returns the total amount of tokens required for the CrowdPool contract.

createCrowdPool

function createCrowdPool(
    SharedStructs.CrowdPoolInfo memory _crowdpool_info,
    SharedStructs.CrowdPoolLink memory _crowdpoollink
) public payable

Creates a new CrowdPool contract and registers it in the CrowdPoolFactory contract.

  • _crowdpool_info: The configuration details for the new CrowdPool contract.
  • _crowdpoollink: The link details for the new CrowdPool contract.

getCount

function getCount() external view returns (uint256)

Returns the total number of registered CrowdPool contracts.

getBalance

function getBalance() external view returns (uint256)

Returns the current balance of the contract.

getCrowdPoolAt

function getCrowdPoolAt(uint256 index) external view returns (address)

Returns the address of the CrowdPool contract at the specified index.

  • index: The index of the CrowdPool contract.

IsRegistered

function IsRegistered(address crowdpool_addr) external view returns (bool)

Checks if a CrowdPool contract is registered.

  • crowdpool_addr: The address of the CrowdPool contract.

Events

OwnerWithdrawSuccess


solidity
event OwnerWithdrawSuccess(uint256 value)

Emitted when the contract owner successfully withdraws the contract's balance.

CreateCrowdpoolSucess

event CreateCrowdpoolSucess(address, address)

Emitted when a new CrowdPool contract is successfully created and registered.

License

This contract is licensed under UNLICENSED.