Open
Description
When using a constructor with many arguments, such that each argument should drop to its own line, the body of the constructor has too many levels of indentation.
The same is not true of a function having the same arguments. That is, functions still format the body correctly, regardless of the style of the function declaration.
The following code demonstrates the issue with the style/format of the constructor:
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract SolidityModeExample {
IERC20 public tokenA;
IERC20 public tokenB;
IERC20 public tokenC;
IERC20 public tokenD;
/// @dev The body of this constructor is indented too far, by 8 spaces
constructor (
address _tokenA,
address _tokenB,
address _tokenC,
address _tokenD
)
public
{
tokenA = IERC20(_tokenA);
tokenB = IERC20(_tokenB);
tokenC = IERC20(_tokenC);
tokenD = IERC20(_tokenD);
}
/// @dev The body of this function is indented correctly
function updateTokens (
address _tokenA,
address _tokenB,
address _tokenC,
address _tokenD
)
public
{
tokenA = IERC20(_tokenA);
tokenB = IERC20(_tokenB);
tokenC = IERC20(_tokenC);
tokenD = IERC20(_tokenD);
}
}
Metadata
Metadata
Assignees
Labels
No labels