ton-blockchain / stablecoin-contract

Sample code for centralised stablecoin jetton. TEP-74 and TEP-89 compatible
141 stars 43 forks source link

Possible bug related with reserving ton coins #72

Closed slavaavr closed 2 months ago

slavaavr commented 2 months ago

Hi! Found out a possible bug related with reserving ton coins in the line https://github.com/ton-blockchain/stablecoin-contract/blob/main/contracts/jetton-wallet.fc#L131

raw_reserve(max(to_leave_on_balance, calculate_jetton_wallet_min_storage_fee()), RESERVE_AT_MOST);

If the balance is lower than storage fee, then subsequent instructions will not be processed. This is because the raw_reserve holds coins from the balance that are insufficient to meet the requirement

slavaavr commented 2 months ago

Wrote a unit test and it actually works. My bad. Closing issue