You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
}
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: