I am kinda new to solidity and I have this error that keeps popping up after I deployed the contract and run the initTest() function. What I am trying to do is passing the string that I insert in the initTest() on the runTest so it runs and save the entire string on the blockchain. I don't have any error when I compile the contrct, only after I deployed it.
pragma solidity ^0.8.0;
import "../contracts/Code.sol";
contract CodeTest {
ContrIdCard private _UniCode;
bytes[] private CustID;
bytes[] private ContractID ;
function pubblishCode (bytes memory _CustID, bytes memory _ContractID, bool _MultiCustID) private {
_UniCode.mkCode(_CustID, _ContractID, _MultiCustID);
}
function initTest() public {
uint i = 0;
CustID[i] = "04wT9Os3uv7p"; ContractID[i++] = "e7tk6peihfcc6ece1ffbe8f8cd433ae61c1081ae6b94";
}
function runTest(bool _MultiCustID) public {
for (uint i = 0; i<CustID.length; i++)
pubblishCode (CustID[i], ContractID[i], _MultiCustID);
}
function runTest() public {
runTest(false);
}
}
The error given when I run initTest() is: "transact to CodeTest.initTest errored: VM error: revert.
revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information."
When I do the debug it gives me value 0 for the CustID e ContractID. What can I do to fix it?