[英]Error of Big number while using constructer in solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
struct account{
string _name;
uint _acc_id;
uint balance;
}
contract My_acc{
account public person;
constructor(string memory name, uint acc_id, uint _balance){
person._name = name;
person._acc_id = acc_id;
person.balance = _balance;
}
}
我試圖通過構造函數將值傳遞給結構變量但是我收到以下錯誤。
creation of My_acc errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.5.0)
我嘗試運行相同的代碼,但效果很好。
構造函數僅運行一次,即在部署時運行。 由於您將值傳遞給構造函數,因此您應該在部署時傳遞這些值。
我的聲譽似乎不允許我上傳圖像。 請通過以下鏈接撥打 go。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.