I am trying to deploy the following smart contract in ganache-cli using truffle framework.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract Sample {
address[] public owners;
constructor(address[] memory temp) {
for(uint256 i=0; i<temp.length; i++) {
owners[i] = temp[i];
}
}
}
But I am getting the following error.
Deploying 'Sample'
------------------
ā Transaction submission failed with error -32000: 'VM Exception while processing transaction: revert'
*** Deployment Failed ***
"Sample" hit a require or revert statement with the following reason given:
* Panic: Index out of bounds
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.
Error: *** Deployment Failed ***
"Sample" hit a require or revert statement with the following reason given:
* Panic: Index out of bounds
Help me to fix this issue.