Smart Contracts

  • Inputs:

    • strategyId: strategy identifier (uint256)

    • investId: investment identifier (uint256)

    • poolSize: total strategy pool size for share calculation (uint256)

  • Functionality:

    • Checks investment status (must be PENDING).

    • Transfers funds to vault.

    • Calculates strategy tokens to mint.

    • Issues tokens to investor.

    • Sets status to ACCEPTED and AMLpassed = true.

  • Event:

    • InvestmentAccepted(strategyId, investId, poolSize) (Entrypoint)

    • InvestmentAccepted(investId, sharesMinted, poolSize) (Strategy)

  • Exceptions:

    • StrategyNotExist(): if strategy does not exist

    • StrategyNotActive(): if strategy is paused

    • InvalidAmount(): if poolSize is zero

    • IncorrectStatus(): if investment not in PENDING status

rejectInvestment(uint256 strategyId, uint256 investId)

  • Inputs:

    • strategyId: strategy identifier (uint256)

    • investId: investment identifier (uint256)

  • Functionality:

    • Checks investment status (must be PENDING).

    • Returns funds to investor.

    • Sets status to REJECTED.

  • Events:

    • InvestmentRejected(strategyId, investId) (Entrypoint)

    • InvestmentRejected(investId) (Strategy)

  • Exceptions:

    • StrategyNotExist(): if strategy does not exist

    • IncorrectStatus(): if investment not in PENDING status

Revenue Management

withdrawRevenue(WithdrawParams params) / batchWithdrawRevenue(WithdrawParams[] params)

  • Inputs:

    • params.strategyId: strategy identifier (uint256)

    • params.investor: investor address (address)

    • params.destination: recipient address (address)

    • params.paymentToken: token for withdrawal (address)

    • params.withdrawAmount: withdrawal amount (uint256)

    • params.sharesBurned: number of tokens to burn (uint256)

  • Functionality:

    • Checks investor token sufficiency.

    • Checks contract fund sufficiency.

    • Burns specified number of strategy tokens.

    • Transfers funds to specified address.

    • Records revenue withdrawal info.

  • Events:

    • RevenueWithdrawn(revenueId, strategyId, investor, paymentToken, amount, sharesBurned) (Entrypoint)

    • RevenueWithdrawn(investor, paymentToken, amount, sharesBurned) (Strategy)

  • Exceptions:

    • StrategyNotExist(): if strategy does not exist

    • InvalidAmount(): if sharesBurned/withdrawAmount = 0

    • InsufficientShares(): if investor has insufficient tokens

    • InsufficientBalance(): if contract balance is insufficient

Extended Functionality

Token Normalization System

The system automatically converts amounts of different tokens to a unified format (18 decimals) for standardized calculations of minimum investments and shares.

normalizeAmount(address token, uint256 amount)

  • Inputs:

    • token – token address (address)

    • amount – original amount (uint256)

  • Functionality:

    • Retrieves the number of decimals for the token

    • Converts the amount to 18 decimals

    • Supports tokens with any number of decimals

  • Returns: Normalized amount (uint256)

Investor Share Calculation

The system uses proportional share calculation based on the pool size.

_calculateShares(uint256 investmentAmount, uint256 poolSize)

  • Inputs:

    • investmentAmount – normalized investment amount (uint256)

    • poolSize – total strategy pool size (uint256)

  • Functionality:

    • For the first investment: returns investmentAmount (1:1)

    • For subsequent investments: (investmentAmount×totalSupply)÷poolSize(investmentAmount×totalSupply)÷poolSize

    • Ensures proportional token distribution

    • Returns: Number of tokens to issue (uint256)

Investment State Management

Each investment follows a lifecycle:

  1. NOT_INVESTED - initial state

  2. PENDING - investment created, awaiting review

  3. ACCEPTED - passed AML/KYC, tokens issued

  4. REJECTED - declined, funds returned

Last updated