From 8adf3b4f8893ecdb39bbb6b04c6ff5846f9128da Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Thu, 2 Sep 2021 10:59:22 +0200 Subject: [PATCH] fix: Reducing compiler warnings for mocks --- .../mocks/flashloan/MockFlashLoanReceiver.sol | 7 +++-- .../helpers/MockReserveConfiguration.sol | 1 + .../oracle/CLAggregators/MockAggregator.sol | 4 +-- .../tests/MockReserveInterestRateStrategy.sol | 30 +++++++++---------- .../mocks/tokens/MintableDelegationERC20.sol | 2 +- contracts/mocks/tokens/MintableERC20.sol | 17 +++++------ 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/contracts/mocks/flashloan/MockFlashLoanReceiver.sol b/contracts/mocks/flashloan/MockFlashLoanReceiver.sol index 859305a22..a217f8e76 100644 --- a/contracts/mocks/flashloan/MockFlashLoanReceiver.sol +++ b/contracts/mocks/flashloan/MockFlashLoanReceiver.sol @@ -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; @@ -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]); diff --git a/contracts/mocks/helpers/MockReserveConfiguration.sol b/contracts/mocks/helpers/MockReserveConfiguration.sol index 20570c543..78b0bd5f2 100644 --- a/contracts/mocks/helpers/MockReserveConfiguration.sol +++ b/contracts/mocks/helpers/MockReserveConfiguration.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.6; import {ReserveConfiguration} from '../../protocol/libraries/configuration/ReserveConfiguration.sol'; diff --git a/contracts/mocks/oracle/CLAggregators/MockAggregator.sol b/contracts/mocks/oracle/CLAggregators/MockAggregator.sol index 61d426eb8..d83c01f64 100644 --- a/contracts/mocks/oracle/CLAggregators/MockAggregator.sol +++ b/contracts/mocks/oracle/CLAggregators/MockAggregator.sol @@ -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); } @@ -15,7 +15,7 @@ contract MockAggregator { return _latestAnswer; } - function getTokenType() external view returns (uint256) { + function getTokenType() external pure returns (uint256) { return 1; } diff --git a/contracts/mocks/tests/MockReserveInterestRateStrategy.sol b/contracts/mocks/tests/MockReserveInterestRateStrategy.sol index 2d9214101..5a956a58c 100644 --- a/contracts/mocks/tests/MockReserveInterestRateStrategy.sol +++ b/contracts/mocks/tests/MockReserveInterestRateStrategy.sol @@ -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; @@ -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 @@ -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 diff --git a/contracts/mocks/tokens/MintableDelegationERC20.sol b/contracts/mocks/tokens/MintableDelegationERC20.sol index 27f7e1dae..56bb2fe58 100644 --- a/contracts/mocks/tokens/MintableDelegationERC20.sol +++ b/contracts/mocks/tokens/MintableDelegationERC20.sol @@ -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); } diff --git a/contracts/mocks/tokens/MintableERC20.sol b/contracts/mocks/tokens/MintableERC20.sol index 2de495ec2..b77fc271a 100644 --- a/contracts/mocks/tokens/MintableERC20.sol +++ b/contracts/mocks/tokens/MintableERC20.sol @@ -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 { @@ -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);