构造函数错误,setter不工作(坚固性)



我正在做我的智能合约项目,当我把一些值作为输入的合同,我得到了一个错误,说:

"恢复事务已恢复到初始状态。注意:如果您发送值和值,则调用函数应支付您发送的金额应该小于您当前的余额。调试事务以获取更多信息。">

我的代码是
uint[] private Info;
function SetInfo(uint[] memory data) private onlyOwner{
Info = new uint[](data.length);
for(uint i = 0; i < data.length;i++){
Info[i] = data[i];
}

constructor(uint[] memory _Info,uint[] memory _SecondInfo)
ERC721(_name, _symbol) {
SetInfo(_Info);
SetSecondInfo(_SecondInfo)
}

我试着调整你的智能合约。我写了一些评论,帮助你理解我做了什么,以及你在原始智能合约中的错误。智能合约代码:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// Your class must  inheritance ERC721 smart contract, if you want to use its functions
contract Test is ERC721 {
uint[] private Info;
// Specify variable that will contain  owner address when contract will create.
address owner;
modifier onlyOwner() {
require(msg.sender == owner, "You aren't the owner!");
_;
}
// You must to give a name and symbol about your ERC721 token
constructor(uint[] memory _Info, uint[] memory _SecondInfo) ERC721("TESTToken", "TST") {
// Set owner variable with msg.sender value 
owner = msg.sender;
SetInfo(_Info);
SetSecondInfo(_SecondInfo);
} 
function SetInfo(uint[] memory data) private onlyOwner {
Info = new uint[](data.length);
for(uint i = 0; i < data.length;i++){
Info[i] = data[i];
}
}
function SetSecondInfo(uint[] memory data) private onlyOwner {
// your logic
}
}