Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Jun 8, 2023
1 parent 14d34d5 commit ea2f222
Show file tree
Hide file tree
Showing 15 changed files with 879 additions and 104 deletions.
17 changes: 8 additions & 9 deletions src/AprOracle/AprOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ interface IVault {
}

interface IOracle {
function aprAfterDebtChange(address _asset, int256 _delta)
external
view
returns (uint256);
function aprAfterDebtChange(
address _asset,
int256 _delta
) external view returns (uint256);
}

contract AprOacle {
Expand All @@ -26,11 +26,10 @@ contract AprOacle {
uint256 internal constant MAX_BPS_EXTENDED = 1_000_000_000_000;
uint256 internal constant SECONDS_PER_YEAR = 31_556_952;

function getExpectedApr(address _strategy, int256 _debtChange)
public
view
returns (uint256)
{
function getExpectedApr(
address _strategy,
int256 _debtChange
) public view returns (uint256) {
address oracle = oracles[_strategy];

// Will revert if a oracle is not set.
Expand Down
9 changes: 4 additions & 5 deletions src/AprOracle/AprOracleBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ abstract contract AprOracleBase is Ownable {
* @param _delta The difference in debt.
* @return . The expected apr for the strategy.
*/
function aprAfterDebtChange(address _strategy, int256 _delta)
external
view
virtual
returns (uint256);
function aprAfterDebtChange(
address _strategy,
int256 _delta
) external view virtual returns (uint256);
}
8 changes: 3 additions & 5 deletions src/HealthCheck/HealthCheck.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ contract HealthCheck {
* @param _invested The amount that will be returned during `totalInvested()`.
* @return . Bool repersenting if the health check passed
*/
function _executHealthCheck(uint256 _invested)
internal
view
returns (bool)
{
function _executHealthCheck(
uint256 _invested
) internal view returns (bool) {
// Static call self to get the total assets from the implementation.
uint256 _totalAssets = IStrategy(address(this)).totalAssets();

Expand Down
46 changes: 22 additions & 24 deletions src/ReportTrigger/CommonReportTrigger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ interface ICustomStrategyTrigger {
}

interface ICustomVaultTrigger {
function reportTrigger(address _vault, address _strategy)
external
view
returns (bool);
function reportTrigger(
address _vault,
address _strategy
) external view returns (bool);
}

interface IBaseFee {
Expand Down Expand Up @@ -134,9 +134,10 @@ contract CommonReportTrigger {
* @param _strategy The address of the strategy to set the trigger for.
* @param _trigger The address of the custom trigger contract.
*/
function setCustomStrategyTrigger(address _strategy, address _trigger)
external
{
function setCustomStrategyTrigger(
address _strategy,
address _trigger
) external {
require(msg.sender == IStrategy(_strategy).management(), "!authorized");
customStrategyTrigger[_strategy] = _trigger;

Expand All @@ -156,9 +157,10 @@ contract CommonReportTrigger {
* @param _strategy The address of the strategy to customize.
* @param _baseFee The max acceptable network base fee.
*/
function setCustomStrategyBaseFee(address _strategy, uint256 _baseFee)
external
{
function setCustomStrategyBaseFee(
address _strategy,
uint256 _baseFee
) external {
require(msg.sender == IStrategy(_strategy).management(), "!authorized");
acceptableStrategyBaseFee[_strategy] = _baseFee;

Expand Down Expand Up @@ -247,11 +249,9 @@ contract CommonReportTrigger {
* @param _strategy The address of the strategy to check the trigger for.
* @return . Bool repersenting if the strategy is ready to report.
*/
function strategyReportTrigger(address _strategy)
external
view
returns (bool)
{
function strategyReportTrigger(
address _strategy
) external view returns (bool) {
address _trigger = customStrategyTrigger[_strategy];

if (_trigger != address(0)) {
Expand Down Expand Up @@ -301,11 +301,10 @@ contract CommonReportTrigger {
* @param _strategy The address of the strategy to report.
* @return . Bool if the strategy should report to the vault.
*/
function vaultReportTrigger(address _vault, address _strategy)
external
view
returns (bool)
{
function vaultReportTrigger(
address _vault,
address _strategy
) external view returns (bool) {
address _trigger = customVaultTrigger[_vault][_strategy];

if (_trigger != address(0)) {
Expand Down Expand Up @@ -357,10 +356,9 @@ contract CommonReportTrigger {
* @dev Throws if the caller is not current owner.
* @param _newAcceptableBaseFee The acceptable network base fee.
*/
function setAcceptableBaseFee(uint256 _newAcceptableBaseFee)
external
onlyOwner
{
function setAcceptableBaseFee(
uint256 _newAcceptableBaseFee
) external onlyOwner {
acceptableBaseFee = _newAcceptableBaseFee;

emit UpdatedAcceptableBaseFee(_newAcceptableBaseFee);
Expand Down
8 changes: 3 additions & 5 deletions src/ReportTrigger/CustomStrategyTriggerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ abstract contract CustomStrategyTriggerBase {
* @param _strategy The address of the strategy to check.
* @return . Bool repersenting if the strategy is ready to report.
*/
function reportTrigger(address _strategy)
external
view
virtual
returns (bool);
function reportTrigger(
address _strategy
) external view virtual returns (bool);
}
9 changes: 4 additions & 5 deletions src/ReportTrigger/CustomVaultTriggerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ abstract contract CustomVaultTriggerBase {
* @param _strategy The address of the strategy that would report.
* @return . Bool repersenting if the strategy is ready to report.
*/
function reportTrigger(address _vault, address _strategy)
external
view
virtual
returns (bool);
function reportTrigger(
address _vault,
address _strategy
) external view virtual returns (bool);
}
7 changes: 3 additions & 4 deletions src/interfaces/IVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ interface IVault {
uint256 maxDebt;
}

function strategies(address _strategy)
external
view
returns (StrategyParams memory);
function strategies(
address _strategy
) external view returns (StrategyParams memory);

function roles(address _address) external view returns (uint256);

Expand Down
28 changes: 12 additions & 16 deletions src/interfaces/Uniswap/V3/ISwapRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ interface ISwapRouter is IUniswapV3SwapCallback {
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
returns (uint256 amountOut);
function exactInputSingle(
ExactInputSingleParams calldata params
) external payable returns (uint256 amountOut);

struct ExactInputParams {
bytes path;
Expand All @@ -37,10 +36,9 @@ interface ISwapRouter is IUniswapV3SwapCallback {
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params)
external
payable
returns (uint256 amountOut);
function exactInput(
ExactInputParams calldata params
) external payable returns (uint256 amountOut);

struct ExactOutputSingleParams {
address tokenIn;
Expand All @@ -56,10 +54,9 @@ interface ISwapRouter is IUniswapV3SwapCallback {
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params)
external
payable
returns (uint256 amountIn);
function exactOutputSingle(
ExactOutputSingleParams calldata params
) external payable returns (uint256 amountIn);

struct ExactOutputParams {
bytes path;
Expand All @@ -72,10 +69,9 @@ interface ISwapRouter is IUniswapV3SwapCallback {
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params)
external
payable
returns (uint256 amountIn);
function exactOutput(
ExactOutputParams calldata params
) external payable returns (uint256 amountIn);

// Taken from https://soliditydeveloper.com/uniswap3
// Manually added to the interface
Expand Down
7 changes: 4 additions & 3 deletions src/swappers/TradeFactorySwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ abstract contract TradeFactorySwapper {
delete _rewardTokens;
}

function _setTradeFactory(address tradeFactory_, address _tokenTo)
internal
{
function _setTradeFactory(
address tradeFactory_,
address _tokenTo
) internal {
if (_tradeFactory != address(0)) {
_removeTradeFactoryPermissions();
}
Expand Down
20 changes: 9 additions & 11 deletions src/test/mocks/MockHealthCheck.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {HealthCheck} from "../../HealthCheck/HealthCheck.sol";
import {BaseTokenizedStrategy} from "@tokenized-strategy/BaseTokenizedStrategy.sol";

contract MockHealthCheck is BaseTokenizedStrategy, HealthCheck {
constructor(address _asset)
BaseTokenizedStrategy(_asset, "Mock Health Check")
{}
constructor(
address _asset
) BaseTokenizedStrategy(_asset, "Mock Health Check") {}

function _deployFunds(uint256) internal override {}

Expand All @@ -27,17 +27,15 @@ contract MockHealthCheck is BaseTokenizedStrategy, HealthCheck {
}
}

function setProfitLimitRatio(uint256 _profitLimitRatio)
external
onlyManagement
{
function setProfitLimitRatio(
uint256 _profitLimitRatio
) external onlyManagement {
_setProfitLimitRatio(_profitLimitRatio);
}

function setLossLimitRatio(uint256 _lossLimitRatio)
external
onlyManagement
{
function setLossLimitRatio(
uint256 _lossLimitRatio
) external onlyManagement {
_setLossLimitRatio(_lossLimitRatio);
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/mocks/MockStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {BaseTokenizedStrategy} from "@tokenized-strategy/BaseTokenizedStrategy.sol";

contract MockStrategy is BaseTokenizedStrategy {
constructor(address _asset)
BaseTokenizedStrategy(_asset, "Mock Basic Strategy")
{}
constructor(
address _asset
) BaseTokenizedStrategy(_asset, "Mock Basic Strategy") {}

function _deployFunds(uint256) internal override {}

Expand Down
6 changes: 1 addition & 5 deletions src/test/mocks/MockUniswapV3Swapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,5 @@ interface IMockUniswapV3Swapper is IStrategy, IUniswapV3Swapper {
uint256 _minAmountOut
) external returns (uint256);

function setUniFees(
address _token0,
address _token1,
uint24 _fee
) external;
function setUniFees(address _token0, address _token1, uint24 _fee) external;
}
6 changes: 1 addition & 5 deletions src/test/utils/Setup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ contract Setup is ExtendedTest {
assertEq(_totalAssets, _totalDebt + _totalIdle, "!Added");
}

function airdrop(
ERC20 _asset,
address _to,
uint256 _amount
) public {
function airdrop(ERC20 _asset, address _to, uint256 _amount) public {
uint256 balanceBefore = _asset.balanceOf(_to);
deal(address(_asset), _to, balanceBefore + _amount);
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/utils/VyperDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ contract VyperDeployer {
* For example, the file name for "Token.vy" is "Token".
* @return deployedAddress The address that the contract was deployed to.
*/
function deployContract(string memory path, string memory fileName)
public
returns (address)
{
function deployContract(
string memory path,
string memory fileName
) public returns (address) {
///@notice create a list of strings with the commands necessary to compile Vyper contracts
string[] memory cmds = new string[](2);
cmds[0] = "vyper";
Expand Down
Loading

0 comments on commit ea2f222

Please sign in to comment.