When the payment amount exceeds the number of tokens available for purchase at this stage, the smart contract can act in two ways, depending on the any_stage parameter transmitted in the message. If any_stage = 1, then the smart contract will go to the next stage and buy tokens for the remaining funds at the price of a new phase. This feature allows you to finish the ICO ahead of schedule. If parameter any_stage = 0, then the smart contract will purchase the tokens of this stage only, any unspent funds will be returned to the buyer. By default, any_stage = 1, which means that you can make transfer grams to the address of the smart contract, without any message. If not the entire amount has been spent, the remaining grams will be returned to the buyer's account.
This smart contract allows the owner to accrue bounty steaks to various wallets. After a successful ICO (Soft Cap collected), the corresponding number of tokens will be transferred to these wallets. The number of tokens due for each steak will be known at the end of the ICO when the total number of tokens sold is known. The total number of bounty tokens is defined as a percentage of the total number of tokens sold and is indicated in the parameters when settings up a smart contract. Note that the bounty_percent parameter is a percentage time multiplied to 100. That is, if it is necessary to allocate 12.33% for bounty from the number of tokens sold, then in the bounty_percent parameter, you need to specify as 1233 when setting up a smart contract.
Upon completion of all stages, or reaching the end date of the ICO, the smart contract goes to the final part.
In the final part, if Soft Cap was collected, then all purchased tokens are sent to investor wallets, and the funds raised during the ICO are transferred to the wallet specified in the dest_wallet parameter.
If the end date of the ICO did not collect soft Cap, then all investors can return their funds. To do this, they just need to send a small number of grams, say 1 gram, from the same wallet to a smart contract. A smart contract will return the investor’s funds and this 1 gram, minus gas fees.