diff --git a/src/solidity-syntax.md b/src/solidity-syntax.md
index 29c888f..0a0dfa0 100644
--- a/src/solidity-syntax.md
+++ b/src/solidity-syntax.md
@@ -254,10 +254,6 @@ Following is a list of supported expressions. Operator precendences are taken fr
> left: Expression "||" Expression [strict(1)]
> right:
Expression "?" Expression ":" Expression [strict(1)]
- | Expression "+=" Expression [strict(2)]
- | Expression "-=" Expression [strict(2)]
- | Expression "*=" Expression [strict(2)]
- | Expression "/=" Expression [strict(2)]
| Expression "=" Expression [strict(2)]
endmodule
diff --git a/test/examples/lending/LendingPool.sol b/test/examples/lending/LendingPool.sol
index 023b207..aa2a833 100644
--- a/test/examples/lending/LendingPool.sol
+++ b/test/examples/lending/LendingPool.sol
@@ -136,9 +136,9 @@ contract LendingPool {
uint256 shares = _toShares(vaults[token].totalAsset, amount, false);
require(shares >= minSharesOut, "LendingPool: too high slippage");
- vaults[token].totalAsset.shares += uint128(shares);
- vaults[token].totalAsset.amount += uint128(amount);
- userShares[msg.sender][token].collateral += shares;
+ vaults[token].totalAsset.shares = vaults[token].totalAsset.shares + uint128(shares);
+ vaults[token].totalAsset.amount = vaults[token].totalAsset.amount + uint128(amount);
+ userShares[msg.sender][token].collateral = userShares[msg.sender][token].collateral + shares;
emit Deposit(msg.sender, token, amount, shares);
}
@@ -148,9 +148,9 @@ contract LendingPool {
_accrueInterest(token);
uint256 shares = _toShares(vaults[token].totalBorrow, amount, false);
- vaults[token].totalBorrow.shares += uint128(shares);
- vaults[token].totalBorrow.amount += uint128(amount);
- userShares[msg.sender][token].borrow += shares;
+ vaults[token].totalBorrow.shares = vaults[token].totalBorrow.shares + uint128(shares);
+ vaults[token].totalBorrow.amount = vaults[token].totalBorrow.amount + uint128(amount);
+ userShares[msg.sender][token].borrow = userShares[msg.sender][token].borrow + shares;
_transferERC20(token, address(this), msg.sender, amount);
require(
@@ -170,8 +170,8 @@ contract LendingPool {
amount = _toAmount(vaults[token].totalBorrow, shares, true);
}
_transferERC20(token, msg.sender, address(this), amount);
- vaults[token].totalBorrow.shares -= uint128(shares);
- vaults[token].totalBorrow.amount -= uint128(amount);
+ vaults[token].totalBorrow.shares = vaults[token].totalBorrow.shares - uint128(shares);
+ vaults[token].totalBorrow.amount = vaults[token].totalBorrow.amount - uint128(amount);
userShares[msg.sender][token].borrow = userBorrowShare - shares;
emit Repay(msg.sender, token, amount, shares);
}
@@ -267,8 +267,8 @@ contract LendingPool {
false
)
);
- vaults[borrowToken].totalBorrow.shares -= repaidBorrowShares;
- vaults[borrowToken].totalBorrow.amount -= uint128(
+ vaults[borrowToken].totalBorrow.shares = vaults[borrowToken].totalBorrow.shares - repaidBorrowShares;
+ vaults[borrowToken].totalBorrow.amount = vaults[borrowToken].totalBorrow.amount - uint128(
liquidationAmount
);
@@ -279,12 +279,12 @@ contract LendingPool {
false
)
);
- vaults[collToken].totalAsset.shares -= liquidatedCollShares;
- vaults[collToken].totalAsset.amount -= uint128(
+ vaults[collToken].totalAsset.shares = vaults[collToken].totalAsset.shares - liquidatedCollShares;
+ vaults[collToken].totalAsset.amount = vaults[collToken].totalAsset.amount - uint128(
collateralAmountToLiquidate + liquidationReward
);
- userShares[user][borrowToken].borrow -= repaidBorrowShares;
- userShares[user][collToken].collateral -= liquidatedCollShares;
+ userShares[user][borrowToken].borrow = userShares[user][borrowToken].borrow - repaidBorrowShares;
+ userShares[user][collToken].collateral = userShares[user][collToken].collateral - liquidatedCollShares;
}
_transferERC20(
@@ -330,7 +330,7 @@ contract LendingPool {
false
);
if (tokenAmount != 0) {
- totalValueUSD += getAmountInUSD(token, tokenAmount);
+ totalValueUSD = totalValueUSD + getAmountInUSD(token, tokenAmount);
}
}
}
@@ -347,7 +347,7 @@ contract LendingPool {
false
);
if (tokenAmount != 0) {
- totalValueUSD += getAmountInUSD(token, tokenAmount);
+ totalValueUSD = totalValueUSD + getAmountInUSD(token, tokenAmount);
}
}
}
@@ -465,9 +465,9 @@ contract LendingPool {
userCollShares >= shares && IERC20(token).balanceOf(address(this)) >= amount,
"LendingPool: insufficient balance"
);
- vaults[token].totalAsset.shares -= uint128(shares);
- vaults[token].totalAsset.amount -= uint128(amount);
- userShares[msg.sender][token].collateral -= shares;
+ vaults[token].totalAsset.shares = vaults[token].totalAsset.shares - uint128(shares);
+ vaults[token].totalAsset.amount = vaults[token].totalAsset.amount - uint128(amount);
+ userShares[msg.sender][token].collateral = userShares[msg.sender][token].collateral - shares;
_transferERC20(token, address(this), msg.sender, amount);
require(
@@ -518,8 +518,8 @@ contract LendingPool {
_currentRateInfo.ratePerSec) /
(PRECISION * BLOCKS_PER_YEAR);
- _vault.totalBorrow.amount += uint128(_interestEarned);
- _vault.totalAsset.amount += uint128(_interestEarned);
+ _vault.totalBorrow.amount = _vault.totalBorrow.amount + uint128(_interestEarned);
+ _vault.totalAsset.amount = _vault.totalAsset.amount + uint128(_interestEarned);
_vault.vaultInfo = _currentRateInfo;
if (_currentRateInfo.feeToProtocolRate > 0) {
_feesAmount =
@@ -528,9 +528,9 @@ contract LendingPool {
_feesShare =
(_feesAmount * _vault.totalAsset.shares) /
(_vault.totalAsset.amount - _feesAmount);
- _vault.totalAsset.shares += uint128(_feesShare);
+ _vault.totalAsset.shares = _vault.totalAsset.shares + uint128(_feesShare);
- userShares[address(this)][token].collateral += _feesShare;
+ userShares[address(this)][token].collateral = userShares[address(this)][token].collateral + _feesShare;
}
emit AccruedInterest(
_currentRateInfo.ratePerSec,
diff --git a/test/examples/staking/LiquidStaking.sol b/test/examples/staking/LiquidStaking.sol
index 98d3ca7..dc57e66 100644
--- a/test/examples/staking/LiquidStaking.sol
+++ b/test/examples/staking/LiquidStaking.sol
@@ -29,7 +29,7 @@ contract LiquidStaking {
require(stakingToken.transferFrom(msg.sender, address(this), amount), "Token transfer failed");
- stakedBalances[msg.sender] += amount;
+ stakedBalances[msg.sender] = stakedBalances[msg.sender] + amount;
stakedTimestamps[msg.sender] = block.timestamp;
}
diff --git a/test/examples/swaps/UniswapV2Swap.sol b/test/examples/swaps/UniswapV2Swap.sol
index 4d3c599..be5f678 100644
--- a/test/examples/swaps/UniswapV2Swap.sol
+++ b/test/examples/swaps/UniswapV2Swap.sol
@@ -306,8 +306,8 @@ contract UniswapV2Pair{
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
- price0CumulativeLast += (_reserve1/_reserve0) * timeElapsed;
- price1CumulativeLast += (_reserve0/_reserve1) * timeElapsed;
+ price0CumulativeLast = price0CumulativeLast + (_reserve1/_reserve0) * timeElapsed;
+ price1CumulativeLast = price1CumulativeLast + (_reserve0/_reserve1) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
@@ -331,7 +331,7 @@ contract WETHMock {
}
function deposit() external payable {
- balanceOf[msg.sender] += msg.value;
+ balanceOf[msg.sender] = balanceOf[msg.sender] + msg.value;
emit Transfer(address(0), msg.sender, msg.value);
}
@@ -348,7 +348,7 @@ contract WETHMock {
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
- balanceOf[to] += value;
+ balanceOf[to] = balanceOf[to] + value;
emit Transfer(msg.sender, to, value);
} else { // Withdraw
uint256 balance = balanceOf[msg.sender];
@@ -379,7 +379,7 @@ contract WETHMock {
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[from] = balance - value;
- balanceOf[to] += value;
+ balanceOf[to] = balanceOf[to] + value;
emit Transfer(from, to, value);
} else {
uint256 balance = balanceOf[from];
@@ -515,7 +515,7 @@ contract USDCMock {
function _update(address from, address to, uint256 value) private {
if (from == address(0)) {
- _totalSupply += value;
+ _totalSupply = _totalSupply + value;
} else {
uint256 fromBalance = _balances[from];
require(fromBalance >= value, "USDC: insufficient balance");
@@ -524,10 +524,10 @@ contract USDCMock {
}
if (to == address(0)) {
- _totalSupply -= value;
+ _totalSupply = _totalSupply - value;
} else {
- _balances[to] += value;
+ _balances[to] = _balances[to] + value;
}
emit Transfer(from, to, value);
diff --git a/test/examples/tokens/SomeMultiToken.sol b/test/examples/tokens/SomeMultiToken.sol
index ffaa167..ead2d0e 100644
--- a/test/examples/tokens/SomeMultiToken.sol
+++ b/test/examples/tokens/SomeMultiToken.sol
@@ -106,7 +106,7 @@ contract SomeMultiToken{
}
if (to != address(0)) {
- _balances[id][to] += value;
+ _balances[id][to] = _balances[id][to] + value;
}
}
diff --git a/test/examples/tokens/SomeToken.sol b/test/examples/tokens/SomeToken.sol
index 8723490..1871552 100644
--- a/test/examples/tokens/SomeToken.sol
+++ b/test/examples/tokens/SomeToken.sol
@@ -77,7 +77,7 @@ contract SomeToken {
function _update(address from, address to, uint256 value) private {
if (from == address(0)) {
- _totalSupply += value;
+ _totalSupply = _totalSupply + value;
} else {
uint256 fromBalance = _balances[from];
require(fromBalance >= value, "SomeToken: insufficient balance");
@@ -86,9 +86,9 @@ contract SomeToken {
}
if (to == address(0)) {
- _totalSupply -= value;
+ _totalSupply = _totalSupply - value;
} else {
- _balances[to] += value;
+ _balances[to] = _balances[to] + value;
}
emit Transfer(from, to, value);
diff --git a/test/regression/function.ref b/test/regression/function.ref
index 36cb463..b27ccbc 100644
--- a/test/regression/function.ref
+++ b/test/regression/function.ref
@@ -455,7 +455,7 @@
.List
- if ( from == address ( 0 , .TypedVals ) ) { _totalSupply += value ; .Statements } else { uint256 fromBalance = _balances [ from ] ; require ( fromBalance >= value , "USDC: insufficient balance" , .TypedVals ) ; _balances [ from ] = fromBalance - value ; .Statements } if ( to == address ( 0 , .TypedVals ) ) { _totalSupply -= value ; .Statements } else { _balances [ to ] += value ; .Statements } .Statements
+ if ( from == address ( 0 , .TypedVals ) ) { _totalSupply = _totalSupply + value ; .Statements } else { uint256 fromBalance = _balances [ from ] ; require ( fromBalance >= value , "USDC: insufficient balance" , .TypedVals ) ; _balances [ from ] = fromBalance - value ; .Statements } if ( to == address ( 0 , .TypedVals ) ) { _totalSupply = _totalSupply - value ; .Statements } else { _balances [ to ] = _balances [ to ] + value ; .Statements } .Statements
@@ -697,7 +697,7 @@
.List
- require ( balance0 <= type ( uint112 , .TypedVals ) . max && balance1 <= type ( uint112 , .TypedVals ) . max , "UniswapV2: OVERFLOW" , .TypedVals ) ; uint32 blockTimestamp = uint32 ( block . timestamp % 2 ** 32 , .TypedVals ) ; uint32 timeElapsed = blockTimestamp - blockTimestampLast ; if ( timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0 ) { price0CumulativeLast += _reserve1 / _reserve0 * timeElapsed ; price1CumulativeLast += _reserve0 / _reserve1 * timeElapsed ; .Statements } reserve0 = uint112 ( balance0 , .TypedVals ) ; reserve1 = uint112 ( balance1 , .TypedVals ) ; blockTimestampLast = blockTimestamp ; .Statements
+ require ( balance0 <= type ( uint112 , .TypedVals ) . max && balance1 <= type ( uint112 , .TypedVals ) . max , "UniswapV2: OVERFLOW" , .TypedVals ) ; uint32 blockTimestamp = uint32 ( block . timestamp % 2 ** 32 , .TypedVals ) ; uint32 timeElapsed = blockTimestamp - blockTimestampLast ; if ( timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0 ) { price0CumulativeLast = price0CumulativeLast + _reserve1 / _reserve0 * timeElapsed ; price1CumulativeLast = price1CumulativeLast + _reserve0 / _reserve1 * timeElapsed ; .Statements } reserve0 = uint112 ( balance0 , .TypedVals ) ; reserve1 = uint112 ( balance1 , .TypedVals ) ; blockTimestampLast = blockTimestamp ; .Statements
@@ -1798,7 +1798,7 @@
ListItem ( noId )
- if ( to != address ( 0 , .TypedVals ) && to != address ( this , .TypedVals ) ) { uint256 balance = balanceOf [ msg . sender ] ; require ( balance >= value , "WETH: transfer amount exceeds balance" , .TypedVals ) ; balanceOf [ msg . sender ] = balance - value ; balanceOf [ to ] += value ; .Statements } else { uint256 balance = balanceOf [ msg . sender ] ; require ( balance >= value , "WETH: burn amount exceeds balance" , .TypedVals ) ; balanceOf [ msg . sender ] = balance - value ; ( bool success , ) = msg . sender . call { value : value , .KeyValues } ( "" , .TypedVals ) ; require ( success , "WETH: ETH transfer failed" , .TypedVals ) ; .Statements } return true ; .Statements
+ if ( to != address ( 0 , .TypedVals ) && to != address ( this , .TypedVals ) ) { uint256 balance = balanceOf [ msg . sender ] ; require ( balance >= value , "WETH: transfer amount exceeds balance" , .TypedVals ) ; balanceOf [ msg . sender ] = balance - value ; balanceOf [ to ] = balanceOf [ to ] + value ; .Statements } else { uint256 balance = balanceOf [ msg . sender ] ; require ( balance >= value , "WETH: burn amount exceeds balance" , .TypedVals ) ; balanceOf [ msg . sender ] = balance - value ; ( bool success , ) = msg . sender . call { value : value , .KeyValues } ( "" , .TypedVals ) ; require ( success , "WETH: ETH transfer failed" , .TypedVals ) ; .Statements } return true ; .Statements
@@ -1824,7 +1824,7 @@
ListItem ( noId )
- if ( from != msg . sender ) { uint256 allowed = allowance [ from ] [ msg . sender ] ; if ( allowed != type ( uint256 , .TypedVals ) . max ) { require ( allowed >= value , "WETH: request exceeds allowance" , .TypedVals ) ; uint256 reduced = allowed - value ; allowance [ from ] [ msg . sender ] = reduced ; .Statements } .Statements } if ( to != address ( 0 , .TypedVals ) && to != address ( this , .TypedVals ) ) { uint256 balance = balanceOf [ from ] ; require ( balance >= value , "WETH: transfer amount exceeds balance" , .TypedVals ) ; balanceOf [ from ] = balance - value ; balanceOf [ to ] += value ; .Statements } else { uint256 balance = balanceOf [ from ] ; require ( balance >= value , "WETH: burn amount exceeds balance" , .TypedVals ) ; balanceOf [ from ] = balance - value ; ( bool success , ) = msg . sender . call { value : value , .KeyValues } ( "" , .TypedVals ) ; require ( success , "WETH: ETH transfer failed" , .TypedVals ) ; .Statements } return true ; .Statements
+ if ( from != msg . sender ) { uint256 allowed = allowance [ from ] [ msg . sender ] ; if ( allowed != type ( uint256 , .TypedVals ) . max ) { require ( allowed >= value , "WETH: request exceeds allowance" , .TypedVals ) ; uint256 reduced = allowed - value ; allowance [ from ] [ msg . sender ] = reduced ; .Statements } .Statements } if ( to != address ( 0 , .TypedVals ) && to != address ( this , .TypedVals ) ) { uint256 balance = balanceOf [ from ] ; require ( balance >= value , "WETH: transfer amount exceeds balance" , .TypedVals ) ; balanceOf [ from ] = balance - value ; balanceOf [ to ] = balanceOf [ to ] + value ; .Statements } else { uint256 balance = balanceOf [ from ] ; require ( balance >= value , "WETH: burn amount exceeds balance" , .TypedVals ) ; balanceOf [ from ] = balance - value ; ( bool success , ) = msg . sender . call { value : value , .KeyValues } ( "" , .TypedVals ) ; require ( success , "WETH: ETH transfer failed" , .TypedVals ) ; .Statements } return true ; .Statements
diff --git a/test/regression/function.sol b/test/regression/function.sol
index 3e0de4a..3df5d46 100644
--- a/test/regression/function.sol
+++ b/test/regression/function.sol
@@ -284,8 +284,8 @@ contract UniswapV2Pair{
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
- price0CumulativeLast += (_reserve1/_reserve0) * timeElapsed;
- price1CumulativeLast += (_reserve0/_reserve1) * timeElapsed;
+ price0CumulativeLast = price0CumulativeLast + (_reserve1/_reserve0) * timeElapsed;
+ price1CumulativeLast = price1CumulativeLast + (_reserve0/_reserve1) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
@@ -314,7 +314,7 @@ contract WETHMock {
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
- balanceOf[to] += value;
+ balanceOf[to] = balanceOf[to] + value;
} else { // Withdraw
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "WETH: burn amount exceeds balance");
@@ -342,7 +342,7 @@ contract WETHMock {
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[from] = balance - value;
- balanceOf[to] += value;
+ balanceOf[to] = balanceOf[to] + value;
} else {
uint256 balance = balanceOf[from];
require(balance >= value, "WETH: burn amount exceeds balance");
@@ -463,7 +463,7 @@ contract USDCMock {
function _update(address from, address to, uint256 value) internal {
if (from == address(0)) {
- _totalSupply += value;
+ _totalSupply = _totalSupply + value;
} else {
uint256 fromBalance = _balances[from];
require(fromBalance >= value, "USDC: insufficient balance");
@@ -472,10 +472,10 @@ contract USDCMock {
}
if (to == address(0)) {
- _totalSupply -= value;
+ _totalSupply = _totalSupply - value;
} else {
- _balances[to] += value;
+ _balances[to] = _balances[to] + value;
}
}