Hello everybody:
am trying to start the counter by constructor with a increment, add one, but when deploying I verify that it is still zero.
Is there any problem to start a count through constructor with this library? Or what mistake am I making?
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract Contract is Ownable {
using Counters for Counters.Counter;
using SafeMath for uint256;
mapping(uint256 => mapping(address => address[])) public mapping1;
mapping(uint256 => address) public mapping2;
mapping(uint256 => uint256) public mapping3;
mapping(uint256 => uint256) public mapping3;
Counters.Counter private counter1;
uint16 public constant CONSTANT1 = 2;
address public variable1;
uint256 public variable2;
constructor(address _parameter) {
variable1 = variable1.add(1);
mapping2[counter1.current()] = _parameter;
mapping3[counter1.current()] = CONSTANT1;
counter1.increment();
}
}