-1

Here's my contract.

// SPDX-License-Identifier: MIT

pragma solidity >= 0.7.3;

contract terceiroTest {
    // We pass and old String, a new string and when this event is
    // broadcast everybody is able to see that the even happened.
    // and see the strings exposed too.
    event UpdatedMessages(string oldStr, string newStr);

    string public message;

    // When this contract is deployed we require an argument passed called initMessasge
    constructor (string memory initMessage) {
        message = initMessage;
    }

    function update(string memory newMessage) public {
        string memory oldMsg = message;
        message = newMessage;
        emit UpdatedMessages(oldMsg, newMessage);
    }
} 

and it gives me the error:

I've tried to find any kind of description about this error, even changed solidity's version. I'm studying about smartcontracts still, if someone having or had the same error I would apretiate for enlighting me. Thanks.

  • **DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob Dec 02 '22 at 00:27

2 Answers2

0

I took your contract and tested it in my hardhat env. Everything worked fine. Maybe there's something else happening in your local setup?

Try again with a fresh hardhat setup. Try using this 'badass hardhat setup' https://github.com/mistersingh179/badass-hardhat-setup

I used that setup as a clean slate, started my localhost chain, and then connected that to my sidekik interface to test the functions. Your code works fine. Example here: enter image description here

MorningHacker
  • 1,204
  • 2
  • 13
  • 17
0

I have had similar problems and they all resolved by themselves. It is possible that there is no issue in your code and the issue is with etherscan.

Here are a few things I recommend to triage:

  1. Submit again
  2. Give gap between submission and verification
  3. Try a different env like polygonscan.
  4. Manually submit from their UI.
user566245
  • 4,011
  • 1
  • 30
  • 36