rkalis / truffle-plugin-verify

✅ Verify your smart contracts on Etherscan from the Truffle CLI
https://kalis.me/verify-truffle-smart-contracts-etherscan/
MIT License
467 stars 130 forks source link

Fail - Unable to verify. #194

Closed Hashflower closed 1 year ago

Hashflower commented 1 year ago

Describe the bug

Ive used your tool for some time now, but suddenly im unable to verify any contracts with it. Im compiling, deploying, trying to verify as usual (with the same build folder), however the error keeps coming : Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode. Are there some incompatibility I'm not seeing ? Do I need to flatten the contract manually then pass it to verify ?

Steps To Reproduce

truffle run verify [CONTRACT1 CONTRACT 2...] --network arbitrum

Environment information

truffle-plugin-verify 0.6.1 Truffle v5.3.12 (core: 5.3.12) Solidity - 0.8.7 (solc-js) Node v16.15.1 Web3.js v1.3.6

Debug output DEBUG logging is turned ON Running truffle-plugin-verify v0.5.11 Verifying xxxx Reading artifact file at xxxx Retrieving constructor parameters from https://api.arbiscan.io/api?apiKey=xxxxx&module=account&action=txlist&address=0xxxxxxx&page=1&sort=asc&offset=1 Constructor parameters retrieved: 0x Sending verify request with POST arguments: { "apikey": "xxxxxxxx", "module": "contract", "action": "verifysourcecode", "contractaddress": "0xxxxxxxx", "sourceCode": [...] "codeformat": "solidity-standard-json-input", "contractname": "xxxxxx", "compilerversion": "v0.8.7+commit.e28d00a7", "constructorArguements": "" } Checking status of verification request xxxxxxxxxxxxx Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.

sebastian-baier commented 1 year ago

I have the exact same problem. Did you find a fix yet? The sourcify verification is working for me

rkalis commented 1 year ago

It's very hard to debug these kinds of issues.

@Hashflower could you run it using the latest version of the plugin since you state that you're using v0.6.1, but the debug log output shows v0.5.11?

@sebastian-baier If sourcify verification does work it's possible that there's something weird on Etherscan's side 🤔

Hashflower commented 1 year ago

It seems that the issue happens with imports, esp with open zeppelin. I managed to verify once deployed flattened.

sebastian-baier commented 1 year ago

@rkalis hmm yes it's really strange, especially because I verified the same contract last week (I think), without updating inbetween here my output (it says Successfully verified 1 contract(s).):

DEBUG logging is turned ON
Running truffle-plugin-verify v0.6.0
Retrieving network's network ID & chain ID
Verifying contracts on etherscan
   Verifying DocScheduler
   Reading artifact file at /home/sebastian/Documents/Dev/doc-scheduler-smartcontract/build/contracts/DocScheduler.json
   Retrieving constructor parameters from https://api-sepolia.etherscan.io/api?apiKey= xxxxxx&module=account&action=txlist&address=0x585195CCD1dEDd5A121C95DD05Fe0D66Ee166a8B&page=1&sort=asc&offset=1
   Constructor parameters retrieved: 0x000000000000000000000000e00a38b6f023d9a79b7da6d881832379cf53288d
   Sending verify request with POST arguments:
      {
        "apikey": "xxxxxx",
        "module": "contract",
        "action": "verifysourcecode",
        "contractaddress": "0x585195CCD1dEDd5A121C95DD05Fe0D66Ee166a8B",
        "sourceCode": "{\"language\":\"Solidity\",\"sources\":{\"/contracts/DocScheduler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport './Ownable.sol';\\nimport './DateTimeContract.sol';\\n\\ncontract DocScheduler is Ownable {\\n  uint256 internal _counter;\\n  uint256 internal _reservationFee = 10000000000000;\\n  DateTimeContract _dateTime;\\n\\n  struct Doctor {\\n    uint256 id;\\n    address owner;\\n    //todo move this data to ipfs\\n    string firstName;\\n    string lastName;\\n    string street;\\n    uint256 streetNumber;\\n    uint256 zipCode;\\n    string city;\\n    string phoneNumber;\\n    string freeText;\\n    uint256[] openingTime;\\n    uint256[] closingTime;\\n    uint256[] startLunchbreak;\\n    uint256[] stopLunchbreak;\\n    uint256[] specializations;\\n  }\\n\\n  struct OfficeDay {\\n    uint256 openingTime;\\n    uint256 closingTime;\\n    uint256 startLunchbreak;\\n    uint256 stopLunchbreak;\\n  }\\n\\n  Doctor[] internal _doctors;\\n  mapping(uint256 => Appointment[]) internal _appointments;\\n  mapping(uint256 => uint256) internal _appointmentCounter;\\n  mapping(uint256 => mapping(uint256 => uint256))\\n    internal _reservationFeeStorage;\\n\\n  constructor(address dateTimeAddress) {\\n    _dateTime = DateTimeContract(dateTimeAddress);\\n  }\\n\\n  function createDoctorsOffice(Doctor memory newDoctor) public {\\n    //todo add plausichecks\\n    _appointmentCounter[_counter] = 0;\\n    _doctors.push(\\n      Doctor(\\n        _counter++,\\n        msg.sender,\\n        newDoctor.firstName,\\n        newDoctor.lastName,\\n        newDoctor.street,\\n        newDoctor.streetNumber,\\n        newDoctor.zipCode,\\n        newDoctor.city,\\n        newDoctor.phoneNumber,\\n        newDoctor.freeText,\\n        newDoctor.openingTime,\\n        newDoctor.closingTime,\\n        newDoctor.startLunchbreak,\\n        newDoctor.stopLunchbreak,\\n        newDoctor.specializations\\n      )\\n    );\\n  }\\n\\n  function reconfigureOffice(Doctor memory doctor) public {\\n    require(\\n      msg.sender == _doctors[doctor.id].owner,\\n      'Sorry, you have no permission to make changes'\\n    );\\n\\n    _doctors[doctor.id].firstName = doctor.firstName;\\n    _doctors[doctor.id].lastName = doctor.lastName;\\n    _doctors[doctor.id].street = doctor.street;\\n    _doctors[doctor.id].streetNumber = doctor.streetNumber;\\n    _doctors[doctor.id].zipCode = doctor.zipCode;\\n    _doctors[doctor.id].city = doctor.city;\\n    _doctors[doctor.id].phoneNumber = doctor.phoneNumber;\\n    _doctors[doctor.id].freeText = doctor.freeText;\\n    _doctors[doctor.id].openingTime = doctor.openingTime;\\n    _doctors[doctor.id].closingTime = doctor.closingTime;\\n    _doctors[doctor.id].startLunchbreak = doctor.startLunchbreak;\\n    _doctors[doctor.id].stopLunchbreak = doctor.stopLunchbreak;\\n    _doctors[doctor.id].specializations = doctor.specializations;\\n  }\\n\\n  function getDoctors() external view returns (Doctor[] memory) {\\n    return _doctors;\\n  }\\n\\n  struct Appointment {\\n    uint256 id;\\n    uint256 startTime;\\n    uint256 duration;\\n    address patient;\\n    uint256 doctorsId;\\n    uint256 reservationFee;\\n  }\\n\\n  //make seperate contract\\n  function createAppointment(Appointment calldata appointment)\\n    external\\n    payable\\n  {\\n    require(\\n      msg.value == _reservationFee,\\n      'msg.value not equal to reservation Fee'\\n    );\\n\\n    _reservationFeeStorage[appointment.doctorsId][\\n      _appointmentCounter[appointment.doctorsId]\\n    ] = msg.value;\\n    _appointments[appointment.doctorsId].push(\\n      Appointment(\\n        _appointmentCounter[appointment.doctorsId]++,\\n        appointment.startTime,\\n        appointment.duration,\\n        appointment.patient,\\n        appointment.doctorsId,\\n        _reservationFee\\n      )\\n    );\\n  }\\n\\n  function getAppointments(uint256 doctorId)\\n    external\\n    view\\n    returns (Appointment[] memory)\\n  {\\n    return _appointments[doctorId];\\n  }\\n\\n  function getReservationFee() external view returns (uint256) {\\n    return _reservationFee;\\n  }\\n\\n  function setReservationFee(uint256 newFee) external onlyOwner {\\n    _reservationFee = newFee;\\n  }\\n\\n  function payoutAppointment(uint256 doctorId, uint256 appointmentId)\\n    external\\n  {}\\n\\n  function getDay(uint256 startTime) public view returns (uint256) {\\n    return _dateTime.getDayOfWeek(startTime);\\n  }\\n}\\n\"},\"/contracts/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Ownable {\\n  //todo add abstract after compiler upgrade\\n  address private _owner;\\n  bool private isFirstCall = true;\\n  bool private isFirstCallToken = true;\\n\\n  event OwnershipTransferred(\\n    address indexed previousOwner,\\n    address indexed newOwner\\n  );\\n\\n  constructor() {\\n    _transferOwnership(msg.sender);\\n  }\\n\\n  function owner() public view returns (address) {\\n    //todo add virtual\\n    return _owner;\\n  }\\n\\n  modifier onlyOwner() {\\n    require(owner() == msg.sender, 'Ownable: caller is not the owner');\\n    _;\\n  }\\n\\n  modifier onlyOwnerOrFirst() {\\n    require(\\n      owner() == msg.sender || isFirstCall,\\n      'Ownable: caller is not the owner'\\n    );\\n    isFirstCall = false;\\n    _;\\n  }\\n\\n  modifier onlyOwnerOrFirstToken() {\\n    //todo find a better alternative\\n    require(\\n      owner() == msg.sender || isFirstCallToken,\\n      'Ownable: caller is not the owner'\\n    );\\n    isFirstCallToken = false;\\n    _;\\n  }\\n\\n  function transferOwnership(address newOwner) public onlyOwner {\\n    //todo add virtual\\n    require(newOwner != address(0), 'Ownable: new owner is the zero address');\\n    _transferOwnership(newOwner);\\n  }\\n\\n  function _transferOwnership(address newOwner) internal {\\n    //todo add virtual\\n    address oldOwner = _owner;\\n    _owner = newOwner;\\n    emit OwnershipTransferred(oldOwner, newOwner);\\n  }\\n}\\n\"},\"/contracts/DateTimeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.6.0 <0.9.0;\\n\\nlibrary DateTimeLibrary {\\n  uint256 constant SECONDS_PER_DAY = 24 * 60 * 60;\\n  uint256 constant SECONDS_PER_HOUR = 60 * 60;\\n  uint256 constant SECONDS_PER_MINUTE = 60;\\n  int256 constant OFFSET19700101 = 2440588;\\n\\n  uint256 constant DOW_MON = 1;\\n  uint256 constant DOW_TUE = 2;\\n  uint256 constant DOW_WED = 3;\\n  uint256 constant DOW_THU = 4;\\n  uint256 constant DOW_FRI = 5;\\n  uint256 constant DOW_SAT = 6;\\n  uint256 constant DOW_SUN = 7;\\n\\n  // ------------------------------------------------------------------------\\n  // Calculate the number of days from 1970/01/01 to year/month/day using\\n  // the date conversion algorithm from\\n  //   https://aa.usno.navy.mil/faq/JD_formula.html\\n  // and subtracting the offset 2440588 so that 1970/01/01 is day 0\\n  //\\n  // days = day\\n  //      - 32075\\n  //      + 1461 * (year + 4800 + (month - 14) / 12) / 4\\n  //      + 367 * (month - 2 - (month - 14) / 12 * 12) / 12\\n  //      - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4\\n  //      - offset\\n  // ------------------------------------------------------------------------\\n  function _daysFromDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) internal pure returns (uint256 _days) {\\n    require(year >= 1970);\\n    int256 _year = int256(year);\\n    int256 _month = int256(month);\\n    int256 _day = int256(day);\\n\\n    int256 __days = _day -\\n      32075 +\\n      (1461 * (_year + 4800 + (_month - 14) / 12)) /\\n      4 +\\n      (367 * (_month - 2 - ((_month - 14) / 12) * 12)) /\\n      12 -\\n      (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) /\\n      4 -\\n      OFFSET19700101;\\n\\n    _days = uint256(__days);\\n  }\\n\\n  // ------------------------------------------------------------------------\\n  // Calculate year/month/day from the number of days since 1970/01/01 using\\n  // the date conversion algorithm from\\n  //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php\\n  // and adding the offset 2440588 so that 1970/01/01 is day 0\\n  //\\n  // int L = days + 68569 + offset\\n  // int N = 4 * L / 146097\\n  // L = L - (146097 * N + 3) / 4\\n  // year = 4000 * (L + 1) / 1461001\\n  // L = L - 1461 * year / 4 + 31\\n  // month = 80 * L / 2447\\n  // dd = L - 2447 * month / 80\\n  // L = month / 11\\n  // month = month + 2 - 12 * L\\n  // year = 100 * (N - 49) + year + L\\n  // ------------------------------------------------------------------------\\n  function _daysToDate(uint256 _days)\\n    internal\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day\\n    )\\n  {\\n    int256 __days = int256(_days);\\n\\n    int256 L = __days + 68569 + OFFSET19700101;\\n    int256 N = (4 * L) / 146097;\\n    L = L - (146097 * N + 3) / 4;\\n    int256 _year = (4000 * (L + 1)) / 1461001;\\n    L = L - (1461 * _year) / 4 + 31;\\n    int256 _month = (80 * L) / 2447;\\n    int256 _day = L - (2447 * _month) / 80;\\n    L = _month / 11;\\n    _month = _month + 2 - 12 * L;\\n    _year = 100 * (N - 49) + _year + L;\\n\\n    year = uint256(_year);\\n    month = uint256(_month);\\n    day = uint256(_day);\\n  }\\n\\n  function timestampFromDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) internal pure returns (uint256 timestamp) {\\n    timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY;\\n  }\\n\\n  function timestampFromDateTime(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day,\\n    uint256 hour,\\n    uint256 minute,\\n    uint256 second\\n  ) internal pure returns (uint256 timestamp) {\\n    timestamp =\\n      _daysFromDate(year, month, day) *\\n      SECONDS_PER_DAY +\\n      hour *\\n      SECONDS_PER_HOUR +\\n      minute *\\n      SECONDS_PER_MINUTE +\\n      second;\\n  }\\n\\n  function timestampToDate(uint256 timestamp)\\n    internal\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day\\n    )\\n  {\\n    (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n  }\\n\\n  function timestampToDateTime(uint256 timestamp)\\n    internal\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day,\\n      uint256 hour,\\n      uint256 minute,\\n      uint256 second\\n    )\\n  {\\n    (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n    uint256 secs = timestamp % SECONDS_PER_DAY;\\n    hour = secs / SECONDS_PER_HOUR;\\n    secs = secs % SECONDS_PER_HOUR;\\n    minute = secs / SECONDS_PER_MINUTE;\\n    second = secs % SECONDS_PER_MINUTE;\\n  }\\n\\n  function isValidDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) internal pure returns (bool valid) {\\n    if (year >= 1970 && month > 0 && month <= 12) {\\n      uint256 daysInMonth = _getDaysInMonth(year, month);\\n      if (day > 0 && day <= daysInMonth) {\\n        valid = true;\\n      }\\n    }\\n  }\\n\\n  function isValidDateTime(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day,\\n    uint256 hour,\\n    uint256 minute,\\n    uint256 second\\n  ) internal pure returns (bool valid) {\\n    if (isValidDate(year, month, day)) {\\n      if (hour < 24 && minute < 60 && second < 60) {\\n        valid = true;\\n      }\\n    }\\n  }\\n\\n  function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear) {\\n    (uint256 year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n    leapYear = _isLeapYear(year);\\n  }\\n\\n  function _isLeapYear(uint256 year) internal pure returns (bool leapYear) {\\n    leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);\\n  }\\n\\n  function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay) {\\n    weekDay = getDayOfWeek(timestamp) <= DOW_FRI;\\n  }\\n\\n  function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd) {\\n    weekEnd = getDayOfWeek(timestamp) >= DOW_SAT;\\n  }\\n\\n  function getDaysInMonth(uint256 timestamp)\\n    internal\\n    pure\\n    returns (uint256 daysInMonth)\\n  {\\n    (uint256 year, uint256 month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n    daysInMonth = _getDaysInMonth(year, month);\\n  }\\n\\n  function _getDaysInMonth(uint256 year, uint256 month)\\n    internal\\n    pure\\n    returns (uint256 daysInMonth)\\n  {\\n    if (\\n      month == 1 ||\\n      month == 3 ||\\n      month == 5 ||\\n      month == 7 ||\\n      month == 8 ||\\n      month == 10 ||\\n      month == 12\\n    ) {\\n      daysInMonth = 31;\\n    } else if (month != 2) {\\n      daysInMonth = 30;\\n    } else {\\n      daysInMonth = _isLeapYear(year) ? 29 : 28;\\n    }\\n  }\\n\\n  // 1 = Monday, 7 = Sunday\\n  function getDayOfWeek(uint256 timestamp)\\n    internal\\n    pure\\n    returns (uint256 dayOfWeek)\\n  {\\n    uint256 _days = timestamp / SECONDS_PER_DAY;\\n    dayOfWeek = ((_days + 3) % 7) + 1;\\n  }\\n\\n  function getYear(uint256 timestamp) internal pure returns (uint256 year) {\\n    (year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n  }\\n\\n  function getMonth(uint256 timestamp) internal pure returns (uint256 month) {\\n    (, month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n  }\\n\\n  function getDay(uint256 timestamp) internal pure returns (uint256 day) {\\n    (, , day) = _daysToDate(timestamp / SECONDS_PER_DAY);\\n  }\\n\\n  function getHour(uint256 timestamp) internal pure returns (uint256 hour) {\\n    uint256 secs = timestamp % SECONDS_PER_DAY;\\n    hour = secs / SECONDS_PER_HOUR;\\n  }\\n\\n  function getMinute(uint256 timestamp) internal pure returns (uint256 minute) {\\n    uint256 secs = timestamp % SECONDS_PER_HOUR;\\n    minute = secs / SECONDS_PER_MINUTE;\\n  }\\n\\n  function getSecond(uint256 timestamp) internal pure returns (uint256 second) {\\n    second = timestamp % SECONDS_PER_MINUTE;\\n  }\\n\\n  function addYears(uint256 timestamp, uint256 _years)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    (uint256 year, uint256 month, uint256 day) = _daysToDate(\\n      timestamp / SECONDS_PER_DAY\\n    );\\n    year += _years;\\n    uint256 daysInMonth = _getDaysInMonth(year, month);\\n    if (day > daysInMonth) {\\n      day = daysInMonth;\\n    }\\n    newTimestamp =\\n      _daysFromDate(year, month, day) *\\n      SECONDS_PER_DAY +\\n      (timestamp % SECONDS_PER_DAY);\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function addMonths(uint256 timestamp, uint256 _months)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    (uint256 year, uint256 month, uint256 day) = _daysToDate(\\n      timestamp / SECONDS_PER_DAY\\n    );\\n    month += _months;\\n    year += (month - 1) / 12;\\n    month = ((month - 1) % 12) + 1;\\n    uint256 daysInMonth = _getDaysInMonth(year, month);\\n    if (day > daysInMonth) {\\n      day = daysInMonth;\\n    }\\n    newTimestamp =\\n      _daysFromDate(year, month, day) *\\n      SECONDS_PER_DAY +\\n      (timestamp % SECONDS_PER_DAY);\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function addDays(uint256 timestamp, uint256 _days)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp + _days * SECONDS_PER_DAY;\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function addHours(uint256 timestamp, uint256 _hours)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp + _hours * SECONDS_PER_HOUR;\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function addMinutes(uint256 timestamp, uint256 _minutes)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE;\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function addSeconds(uint256 timestamp, uint256 _seconds)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp + _seconds;\\n    require(newTimestamp >= timestamp);\\n  }\\n\\n  function subYears(uint256 timestamp, uint256 _years)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    (uint256 year, uint256 month, uint256 day) = _daysToDate(\\n      timestamp / SECONDS_PER_DAY\\n    );\\n    year -= _years;\\n    uint256 daysInMonth = _getDaysInMonth(year, month);\\n    if (day > daysInMonth) {\\n      day = daysInMonth;\\n    }\\n    newTimestamp =\\n      _daysFromDate(year, month, day) *\\n      SECONDS_PER_DAY +\\n      (timestamp % SECONDS_PER_DAY);\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function subMonths(uint256 timestamp, uint256 _months)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    (uint256 year, uint256 month, uint256 day) = _daysToDate(\\n      timestamp / SECONDS_PER_DAY\\n    );\\n    uint256 yearMonth = year * 12 + (month - 1) - _months;\\n    year = yearMonth / 12;\\n    month = (yearMonth % 12) + 1;\\n    uint256 daysInMonth = _getDaysInMonth(year, month);\\n    if (day > daysInMonth) {\\n      day = daysInMonth;\\n    }\\n    newTimestamp =\\n      _daysFromDate(year, month, day) *\\n      SECONDS_PER_DAY +\\n      (timestamp % SECONDS_PER_DAY);\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function subDays(uint256 timestamp, uint256 _days)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp - _days * SECONDS_PER_DAY;\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function subHours(uint256 timestamp, uint256 _hours)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp - _hours * SECONDS_PER_HOUR;\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function subMinutes(uint256 timestamp, uint256 _minutes)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE;\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function subSeconds(uint256 timestamp, uint256 _seconds)\\n    internal\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = timestamp - _seconds;\\n    require(newTimestamp <= timestamp);\\n  }\\n\\n  function diffYears(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _years)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    (uint256 fromYear, , ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);\\n    (uint256 toYear, , ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);\\n    _years = toYear - fromYear;\\n  }\\n\\n  function diffMonths(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _months)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    (uint256 fromYear, uint256 fromMonth, ) = _daysToDate(\\n      fromTimestamp / SECONDS_PER_DAY\\n    );\\n    (uint256 toYear, uint256 toMonth, ) = _daysToDate(\\n      toTimestamp / SECONDS_PER_DAY\\n    );\\n    _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth;\\n  }\\n\\n  function diffDays(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _days)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY;\\n  }\\n\\n  function diffHours(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _hours)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR;\\n  }\\n\\n  function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _minutes)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE;\\n  }\\n\\n  function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp)\\n    internal\\n    pure\\n    returns (uint256 _seconds)\\n  {\\n    require(fromTimestamp <= toTimestamp);\\n    _seconds = toTimestamp - fromTimestamp;\\n  }\\n}\\n\"},\"/contracts/DateTimeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.6.0 <0.9.0;\\n\\n// ----------------------------------------------------------------------------\\n// BokkyPooBah's DateTime Library v1.00 - Contract Instance\\n//\\n// A gas-efficient Solidity date and time library\\n//\\n// https://github.com/bokkypoobah/DateTimeLibrary\\n//\\n// Tested date range 1970/01/01 to 2345/12/31\\n//\\n// Conventions:\\n// Unit      | Range         | Notes\\n// :-------- |:-------------:|:-----\\n// timestamp | >= 0          | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC\\n// year      | 1970 ... 2345 |\\n// month     | 1 ... 12      |\\n// day       | 1 ... 31      |\\n// hour      | 0 ... 23      |\\n// minute    | 0 ... 59      |\\n// second    | 0 ... 59      |\\n// dayOfWeek | 1 ... 7       | 1 = Monday, ..., 7 = Sunday\\n//\\n//\\n// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018.\\n//\\n// GNU Lesser General Public License 3.0\\n// https://www.gnu.org/licenses/lgpl-3.0.en.html\\n// ----------------------------------------------------------------------------\\n\\nimport './DateTimeLibrary.sol';\\n\\ncontract DateTimeContract {\\n  uint256 public constant SECONDS_PER_DAY = 24 * 60 * 60;\\n  uint256 public constant SECONDS_PER_HOUR = 60 * 60;\\n  uint256 public constant SECONDS_PER_MINUTE = 60;\\n  int256 public constant OFFSET19700101 = 2440588;\\n\\n  uint256 public constant DOW_MON = 1;\\n  uint256 public constant DOW_TUE = 2;\\n  uint256 public constant DOW_WED = 3;\\n  uint256 public constant DOW_THU = 4;\\n  uint256 public constant DOW_FRI = 5;\\n  uint256 public constant DOW_SAT = 6;\\n  uint256 public constant DOW_SUN = 7;\\n\\n  function _now() public view returns (uint256 timestamp) {\\n    timestamp = block.timestamp;\\n  }\\n\\n  function _nowDateTime()\\n    public\\n    view\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day,\\n      uint256 hour,\\n      uint256 minute,\\n      uint256 second\\n    )\\n  {\\n    (year, month, day, hour, minute, second) = DateTimeLibrary\\n      .timestampToDateTime(block.timestamp);\\n  }\\n\\n  function _daysFromDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) public pure returns (uint256 _days) {\\n    return DateTimeLibrary._daysFromDate(year, month, day);\\n  }\\n\\n  function _daysToDate(uint256 _days)\\n    public\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day\\n    )\\n  {\\n    return DateTimeLibrary._daysToDate(_days);\\n  }\\n\\n  function timestampFromDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) public pure returns (uint256 timestamp) {\\n    return DateTimeLibrary.timestampFromDate(year, month, day);\\n  }\\n\\n  function timestampFromDateTime(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day,\\n    uint256 hour,\\n    uint256 minute,\\n    uint256 second\\n  ) public pure returns (uint256 timestamp) {\\n    return\\n      DateTimeLibrary.timestampFromDateTime(\\n        year,\\n        month,\\n        day,\\n        hour,\\n        minute,\\n        second\\n      );\\n  }\\n\\n  function timestampToDate(uint256 timestamp)\\n    public\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day\\n    )\\n  {\\n    (year, month, day) = DateTimeLibrary.timestampToDate(timestamp);\\n  }\\n\\n  function timestampToDateTime(uint256 timestamp)\\n    public\\n    pure\\n    returns (\\n      uint256 year,\\n      uint256 month,\\n      uint256 day,\\n      uint256 hour,\\n      uint256 minute,\\n      uint256 second\\n    )\\n  {\\n    (year, month, day, hour, minute, second) = DateTimeLibrary\\n      .timestampToDateTime(timestamp);\\n  }\\n\\n  function isValidDate(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day\\n  ) public pure returns (bool valid) {\\n    valid = DateTimeLibrary.isValidDate(year, month, day);\\n  }\\n\\n  function isValidDateTime(\\n    uint256 year,\\n    uint256 month,\\n    uint256 day,\\n    uint256 hour,\\n    uint256 minute,\\n    uint256 second\\n  ) public pure returns (bool valid) {\\n    valid = DateTimeLibrary.isValidDateTime(\\n      year,\\n      month,\\n      day,\\n      hour,\\n      minute,\\n      second\\n    );\\n  }\\n\\n  function isLeapYear(uint256 timestamp) public pure returns (bool leapYear) {\\n    leapYear = DateTimeLibrary.isLeapYear(timestamp);\\n  }\\n\\n  function _isLeapYear(uint256 year) public pure returns (bool leapYear) {\\n    leapYear = DateTimeLibrary._isLeapYear(year);\\n  }\\n\\n  function isWeekDay(uint256 timestamp) public pure returns (bool weekDay) {\\n    weekDay = DateTimeLibrary.isWeekDay(timestamp);\\n  }\\n\\n  function isWeekEnd(uint256 timestamp) public pure returns (bool weekEnd) {\\n    weekEnd = DateTimeLibrary.isWeekEnd(timestamp);\\n  }\\n\\n  function getDaysInMonth(uint256 timestamp)\\n    public\\n    pure\\n    returns (uint256 daysInMonth)\\n  {\\n    daysInMonth = DateTimeLibrary.getDaysInMonth(timestamp);\\n  }\\n\\n  function _getDaysInMonth(uint256 year, uint256 month)\\n    public\\n    pure\\n    returns (uint256 daysInMonth)\\n  {\\n    daysInMonth = DateTimeLibrary._getDaysInMonth(year, month);\\n  }\\n\\n  function getDayOfWeek(uint256 timestamp)\\n    public\\n    pure\\n    returns (uint256 dayOfWeek)\\n  {\\n    dayOfWeek = DateTimeLibrary.getDayOfWeek(timestamp);\\n  }\\n\\n  function getYear(uint256 timestamp) public pure returns (uint256 year) {\\n    year = DateTimeLibrary.getYear(timestamp);\\n  }\\n\\n  function getMonth(uint256 timestamp) public pure returns (uint256 month) {\\n    month = DateTimeLibrary.getMonth(timestamp);\\n  }\\n\\n  function getDay(uint256 timestamp) public pure returns (uint256 day) {\\n    day = DateTimeLibrary.getDay(timestamp);\\n  }\\n\\n  function getHour(uint256 timestamp) public pure returns (uint256 hour) {\\n    hour = DateTimeLibrary.getHour(timestamp);\\n  }\\n\\n  function getMinute(uint256 timestamp) public pure returns (uint256 minute) {\\n    minute = DateTimeLibrary.getMinute(timestamp);\\n  }\\n\\n  function getSecond(uint256 timestamp) public pure returns (uint256 second) {\\n    second = DateTimeLibrary.getSecond(timestamp);\\n  }\\n\\n  function addYears(uint256 timestamp, uint256 _years)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addYears(timestamp, _years);\\n  }\\n\\n  function addMonths(uint256 timestamp, uint256 _months)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addMonths(timestamp, _months);\\n  }\\n\\n  function addDays(uint256 timestamp, uint256 _days)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addDays(timestamp, _days);\\n  }\\n\\n  function addHours(uint256 timestamp, uint256 _hours)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addHours(timestamp, _hours);\\n  }\\n\\n  function addMinutes(uint256 timestamp, uint256 _minutes)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addMinutes(timestamp, _minutes);\\n  }\\n\\n  function addSeconds(uint256 timestamp, uint256 _seconds)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.addSeconds(timestamp, _seconds);\\n  }\\n\\n  function subYears(uint256 timestamp, uint256 _years)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subYears(timestamp, _years);\\n  }\\n\\n  function subMonths(uint256 timestamp, uint256 _months)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subMonths(timestamp, _months);\\n  }\\n\\n  function subDays(uint256 timestamp, uint256 _days)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subDays(timestamp, _days);\\n  }\\n\\n  function subHours(uint256 timestamp, uint256 _hours)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subHours(timestamp, _hours);\\n  }\\n\\n  function subMinutes(uint256 timestamp, uint256 _minutes)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subMinutes(timestamp, _minutes);\\n  }\\n\\n  function subSeconds(uint256 timestamp, uint256 _seconds)\\n    public\\n    pure\\n    returns (uint256 newTimestamp)\\n  {\\n    newTimestamp = DateTimeLibrary.subSeconds(timestamp, _seconds);\\n  }\\n\\n  function diffYears(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _years)\\n  {\\n    _years = DateTimeLibrary.diffYears(fromTimestamp, toTimestamp);\\n  }\\n\\n  function diffMonths(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _months)\\n  {\\n    _months = DateTimeLibrary.diffMonths(fromTimestamp, toTimestamp);\\n  }\\n\\n  function diffDays(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _days)\\n  {\\n    _days = DateTimeLibrary.diffDays(fromTimestamp, toTimestamp);\\n  }\\n\\n  function diffHours(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _hours)\\n  {\\n    _hours = DateTimeLibrary.diffHours(fromTimestamp, toTimestamp);\\n  }\\n\\n  function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _minutes)\\n  {\\n    _minutes = DateTimeLibrary.diffMinutes(fromTimestamp, toTimestamp);\\n  }\\n\\n  function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp)\\n    public\\n    pure\\n    returns (uint256 _seconds)\\n  {\\n    _seconds = DateTimeLibrary.diffSeconds(fromTimestamp, toTimestamp);\\n  }\\n}\\n\"}},\"settings\":{\"remappings\":[],\"optimizer\":{\"enabled\":true,\"runs\":100},\"evmVersion\":\"byzantium\",\"libraries\":{}}}",
        "codeformat": "solidity-standard-json-input",
        "contractname": "/contracts/DocScheduler.sol:DocScheduler",
        "compilerversion": "v0.8.19+commit.7dd6d404",
        "constructorArguements": "000000000000000000000000e00a38b6f023d9a79b7da6d881832379cf53288d"
      }
   Checking status of verification request txkussdplv4ikwkhiibwrvcdg8ta7ymxpbqedqczhivfsuw1zq
   Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.: https://sepolia.etherscan.io/address/0x585195CCD1dEDd5A121C95DD05Fe0D66Ee166a8B#code
   Successfully verified 1 contract(s).
rkalis commented 1 year ago

@Hashflower happy to hear that you managed to verify it in the end. Your debug output shows that you're using version 0.5.11 of the plugin, which was released 2+ years ago. Since that time several bugs have been fixed, so I wouldn't be surprised if one of those fixes also fixes your issue if you switch to the latest version.

rkalis commented 1 year ago

@sebastian-baier especially if that's the case, I'd think that the issue might be on Etherscan's side. Let me see if I can summon @Enigmatic331 to see if he knows what's up.

Hashflower commented 1 year ago

@rkalis i actually tried many many versions including the latest, with the same result. Sourcify was working tho. The only way I made it work was to deploy a flattened version and then verify. Imports won't let me verify it.

rkalis commented 1 year ago

@Hashflower hmm yeah in that case it might be related to something on Etherscan's side if the verification does work on Sourcify

sebastian-baier commented 1 year ago

It works now again with the same contract ^^ @rkalis seems like there really was a problem with etherscan

rkalis commented 1 year ago

Thanks for letting me know. I guess we can chalk it up to an ephemeral issue with Etherscan that has been resolved now. If it persists we can re-open the issue.