@@ -120,7 +120,8 @@ contract Forth {
120
120
// mint the amount
121
121
uint96 amount = safe96 (rawAmount, "Forth::mint: amount exceeds 96 bits " );
122
122
require (amount <= SafeMath.div (SafeMath.mul (totalSupply, mintCap), 100 ), "Forth::mint: exceeded mint cap " );
123
- totalSupply = safe96 (SafeMath.add (totalSupply, amount), "Forth::mint: totalSupply exceeds 96 bits " );
123
+ uint96 supply = safe96 (totalSupply, "Forth::mint old totalSupply exceeds 96 bits " );
124
+ totalSupply = add96 (supply, amount, "Forth::mint: new totalSupply exceeds 96 bits " );
124
125
125
126
// transfer the amount to the recipient
126
127
balances[dst] = add96 (balances[dst], amount, "Forth::mint: transfer amount overflows " );
@@ -150,8 +151,8 @@ contract Forth {
150
151
*/
151
152
function approve (address spender , uint rawAmount ) external returns (bool ) {
152
153
uint96 amount;
153
- if (rawAmount == uint ( - 1 ) ) {
154
- amount = uint96 ( - 1 ) ;
154
+ if (rawAmount == type ( uint ).max ) {
155
+ amount = type ( uint96 ).max ;
155
156
} else {
156
157
amount = safe96 (rawAmount, "Forth::approve: amount exceeds 96 bits " );
157
158
}
@@ -174,8 +175,8 @@ contract Forth {
174
175
*/
175
176
function permit (address owner , address spender , uint rawAmount , uint deadline , uint8 v , bytes32 r , bytes32 s ) external {
176
177
uint96 amount;
177
- if (rawAmount == uint ( - 1 ) ) {
178
- amount = uint96 ( - 1 ) ;
178
+ if (rawAmount == type ( uint ).max ) {
179
+ amount = type ( uint96 ).max ;
179
180
} else {
180
181
amount = safe96 (rawAmount, "Forth::permit: amount exceeds 96 bits " );
181
182
}
@@ -226,7 +227,7 @@ contract Forth {
226
227
uint96 spenderAllowance = allowances[src][spender];
227
228
uint96 amount = safe96 (rawAmount, "Forth::approve: amount exceeds 96 bits " );
228
229
229
- if (spender != src && spenderAllowance != uint96 ( - 1 ) ) {
230
+ if (spender != src && spenderAllowance != type ( uint96 ).max ) {
230
231
uint96 newAllowance = sub96 (spenderAllowance, amount, "Forth::transferFrom: transfer amount exceeds spender allowance " );
231
232
allowances[src][spender] = newAllowance;
232
233
0 commit comments