DealFundraising

Contract behaviors:

  • purchase(dealUuid,amount) - can be called multiple times to add to previous value

  • refund(dealUuid) - only when refunds are allowed

Contract properties:

  • mapping(string => mapping(address => uint256)) dealsWalletsDeposits

  • mapping(string => address[]) public dealsWallets; //can be multiple times!

  • mapping(string => uint256) public dealsDeposits

  • mapping(string => uint256) public dealsWithdrawals

  • mapping(string => uint256) public dealsLastChangeAt

  • lastChangeAt

Contract events:

  • event WalletPurchased(string dealUuid, address wallet, uint256 amount);

  • emit WalletRefunded(dealUuid, msg.sender, depositedAmount);

Roles:

  • DEFAULT_ADMIN_ROLE

  • EDITOR_ROLE

Admin-only functions:

  • withdrawFundraisedTokens(DEFAULT_ADMIN_ROLE) - withdraw money

Importing original deals

To be able to import original deals, contract contains method importOldDealPurchase. This method allows to configure deal purchases without transferring real token. This feature is enabled only during deployment and after that it is revoked by revokeImportingOldDealPurchases. After revoking, there is no way how to enable it again and there is no way how to create deal purchases without money transferring.

  • importOldDealPurchase(EDITOR_ROLE) - import original deals

  • revokeImportingOldDealPurchases() - revoke importing feature

  • allowedImportingOldDeals - info about importing enabled

CA

interface IDealFundrising {
    //register interest in specific deal (can be called multiple times)
    function purchase(string memory dealUuid, uint256 amount) external;

    //refund to caller from specific deal (if refund is allowed)
    function refund(string memory dealUuid) external;

    //withdraw colleted tokens
    function withdrawFundraisedTokens(
        string memory dealUuid,
        address withdrawDestination
    ) external;

    //import original deals before platform
    function importOldDealPurchase(
        string memory dealUuid,
        address[] memory recipients,
        uint256[] memory amounts
    ) public onlyRole(DEFAULT_ADMIN_ROLE);
}

Last updated