Zilliqa / marketplace-contracts

GNU General Public License v3.0
2 stars 4 forks source link

invalid comments of underflow #22

Closed bb111189 closed 2 years ago

bb111189 commented 2 years ago

This is an add operation. and underflow will not occur

procedure AddToPaymentTokenBalance(to: ByStr20, payment_token_address: ByStr20, amount: Uint128)
  maybe_bal <- payment_tokens[to][payment_token_address];

  new_bal = 
    let cur_bal = get_bal maybe_bal in
    (* if underflow occurs, it throws CALL_CONTRACT_FAILED *)
    builtin add cur_bal amount;

  payment_tokens[to][payment_token_address] := new_bal
end