Skip to content

Commit

Permalink
fix: Reducing compiler warnings for mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Sep 2, 2021
1 parent e6c2e7c commit 8adf3b4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
7 changes: 4 additions & 3 deletions contracts/mocks/flashloan/MockFlashLoanReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract MockFlashLoanReceiver is FlashLoanReceiverBase {
uint256 _amountToApprove;
bool _simulateEOA;

constructor(IPoolAddressesProvider provider) public FlashLoanReceiverBase(provider) {}
constructor(IPoolAddressesProvider provider) FlashLoanReceiverBase(provider) {}

function setFailExecutionTransfer(bool fail) public {
_failExecution = fail;
Expand Down Expand Up @@ -70,8 +70,9 @@ contract MockFlashLoanReceiver is FlashLoanReceiverBase {
'Invalid balance for the contract'
);

uint256 amountToReturn =
(_amountToApprove != 0) ? _amountToApprove : amounts[i].add(premiums[i]);
uint256 amountToReturn = (_amountToApprove != 0)
? _amountToApprove
: amounts[i].add(premiums[i]);
//execution does not fail - mint tokens and return them to the _destination

token.mint(premiums[i]);
Expand Down
1 change: 1 addition & 0 deletions contracts/mocks/helpers/MockReserveConfiguration.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.6;

import {ReserveConfiguration} from '../../protocol/libraries/configuration/ReserveConfiguration.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/oracle/CLAggregators/MockAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contract MockAggregator {

event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);

constructor(int256 _initialAnswer) public {
constructor(int256 _initialAnswer) {
_latestAnswer = _initialAnswer;
emit AnswerUpdated(_initialAnswer, 0, block.timestamp);
}
Expand All @@ -15,7 +15,7 @@ contract MockAggregator {
return _latestAnswer;
}

function getTokenType() external view returns (uint256) {
function getTokenType() external pure returns (uint256) {
return 1;
}

Expand Down
30 changes: 15 additions & 15 deletions contracts/mocks/tests/MockReserveInterestRateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract MockReserveInterestRateStrategy is IReserveInterestRateStrategy {
uint256 variableRateSlope2,
uint256 stableRateSlope1,
uint256 stableRateSlope2
) public {
) {
OPTIMAL_UTILIZATION_RATE = optimalUtilizationRate;
EXCESS_UTILIZATION_RATE = WadRayMath.RAY - optimalUtilizationRate;
addressesProvider = provider;
Expand All @@ -51,12 +51,12 @@ contract MockReserveInterestRateStrategy is IReserveInterestRateStrategy {
}

function calculateInterestRates(
address reserve,
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 averageStableBorrowRate,
uint256 reserveFactor
address,
uint256,
uint256,
uint256,
uint256,
uint256
)
external
view
Expand All @@ -71,14 +71,14 @@ contract MockReserveInterestRateStrategy is IReserveInterestRateStrategy {
}

function calculateInterestRates(
address reserve,
address aToken,
uint256 liquidityAdded,
uint256 liquidityTaken,
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 averageStableBorrowRate,
uint256 reserveFactor
address,
address,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
external
view
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/tokens/MintableDelegationERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract MintableDelegationERC20 is ERC20 {
string memory name,
string memory symbol,
uint8 decimals
) public ERC20(name, symbol) {
) ERC20(name, symbol) {
_setupDecimals(decimals);
}

Expand Down
17 changes: 8 additions & 9 deletions contracts/mocks/tokens/MintableERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract MintableERC20 is ERC20 {
string memory name,
string memory symbol,
uint8 decimals
) public ERC20(name, symbol) {
) ERC20(name, symbol) {
uint256 chainId;

assembly {
Expand Down Expand Up @@ -54,14 +54,13 @@ contract MintableERC20 is ERC20 {
//solium-disable-next-line
require(block.timestamp <= deadline, 'INVALID_EXPIRATION');
uint256 currentValidNonce = _nonces[owner];
bytes32 digest =
keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, currentValidNonce, deadline))
)
);
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, currentValidNonce, deadline))
)
);
require(owner == ecrecover(digest, v, r, s), 'INVALID_SIGNATURE');
_nonces[owner] = currentValidNonce + 1;
_approve(owner, spender, value);
Expand Down

0 comments on commit 8adf3b4

Please sign in to comment.