After successfully deploying this basic smart contract using Remix, I encountered an issue when trying to interact with it through web3.js in my upcoming app. I used the evm version: paris for deployment and everything worked smoothly on Remix IDE.
Here is the code snippet of the smart contract:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Counter {
uint256 private count = 0;
function setCount(uint256 val) external payable {
count = val;
}
function viewCount() external view returns (uint256) {
return count;
}
}
In my web3.js interaction attempt, I expected a successful transaction but instead received an error in the transactionReceipt:
error: TransactionRevertedWithoutReasonError: Transaction has been reverted by the EVM:
{"blockHash":"0x6138b0cdd3a047486419f066ef056aab7b28c11bbaea82b5812c095f96cf86c7","blockNumber":"1382940","cumulativeGasUsed":"21046","from":"0x9ded1ae475bd50a15dde12bbc34b7ea04969cd0b","gasUsed":"21046","logs":[],"logsBloom":"0x00000000000000000000000000000000000..."
Currently investigating the reason behind this unexpected error.