Skip to content

Commit

Permalink
ref(erc20): panic in _update
Browse files Browse the repository at this point in the history
  • Loading branch information
bidzyyys committed Apr 9, 2024
1 parent 1da8c70 commit a586a3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contracts/src/erc20/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ impl ERC20 {
// `_total_supply` never overflows.
// TODO: Think about SafeMath library
let total_supply = self.total_supply();
self._total_supply.set(total_supply + value);
self._total_supply.set(
total_supply
.checked_add(value)
.expect("Should not exceed U256::MAX for `_total_supply"),
);
} else {
let from_balance = self._balances.get(from);
if from_balance < value {
Expand Down

0 comments on commit a586a3a

Please sign in to comment.