@@ -108,7 +108,7 @@ where
108
108
fee_collector : Option < & S :: AccountId > ,
109
109
) -> Result < ( ) , BalanceError < S :: Tokens > > {
110
110
let debit_amount = amount. checked_add ( & fee) . ok_or_else ( || {
111
- // No account can hold more than u64::MAX .
111
+ // No account can hold more than Tokens::max_value() .
112
112
let balance = self . account_balance ( from) ;
113
113
BalanceError :: InsufficientFunds { balance }
114
114
} ) ?;
@@ -118,7 +118,7 @@ where
118
118
None => {
119
119
// NB. integer overflow is not possible here unless there is a
120
120
// severe bug in the system: total amount of tokens in the
121
- // circulation cannot exceed u64::MAX .
121
+ // circulation cannot exceed Tokens::max_value() .
122
122
self . token_pool = self
123
123
. token_pool
124
124
. checked_add ( & fee)
@@ -155,8 +155,8 @@ where
155
155
Ok ( ( ) )
156
156
}
157
157
158
- // Debiting an account will automatically remove it from the ` inner`
159
- // HashMap if the balance reaches zero.
158
+ // Debiting an account will automatically remove it from the inner
159
+ // `BalancesStore` if the balance reaches zero.
160
160
pub fn debit (
161
161
& mut self ,
162
162
from : & S :: AccountId ,
@@ -191,8 +191,8 @@ where
191
191
|prev| -> Result < S :: Tokens , std:: convert:: Infallible > {
192
192
// NB. credit cannot overflow unless there is a bug in the
193
193
// system: the total amount of tokens in the circulation cannot
194
- // exceed u64::MAX , so it's impossible to have more than
195
- // u64::MAX tokens on a single account.
194
+ // exceed Tokens::max_value() , so it's impossible to have more than
195
+ // Tokens::max_value() tokens on a single account.
196
196
Ok ( amount
197
197
. checked_add ( prev. unwrap_or ( & S :: Tokens :: zero ( ) ) )
198
198
. expect ( "bug: overflow in credit" ) )
0 commit comments