Ability to “commit()” the ERC20 token transferring it to the smart contract, and when the current round expires (timestamp) then you can either withdraw() or invest().
If at least X amount was committed in that round before timestamo, then withdraw() fails and one can only invest() which takes their committed ERC20 and releases enough tokens for X, taking into account the group discounts as before.
The main difference is locking up some money before the end, and option to withdraw() if X wasnt reach. User can invest() right away, or commit().
Also have limit to commit/invest, to the maximum amount of ITR tokens ie the remaining balance in the fund. Once you run out then revert all new commit / inembest
The tricky part is to simulate how many tokens would be given out with all the group bonuses, and revert if not enougu are in the fund.
Remember that a group bonus is also paid out to past investors of the group if it reaches next lebel
Understand? Existing logic already fhere but add intermediate-phase commit+invest
Amount X is a sum of all that has been invested or committed during the round
Amount X is a sum of all that has been invested or committed during the round