处理事务时VM异常:没钱了

时间:2019-06-21 11:06:11

标签: javascript solidity truffle

每次在ganache上上传数据时都会遇到麻烦

我尝试使用solc:{优化器:{启用:true,运行:200}}这也给出了相同的错误

pragma solidity >=0.4.18;

contract Health {
struct Patient{
 bytes14 fName;
  bytes14 lName;
  bytes14 DOB;
  uint age;
  uint Doctor_assigned;
}

mapping (uint => Patient) map;

event PatientInfo(
 bytes14 fName,
 bytes14 lName,
 bytes14 DOB,
 uint age,
 uint Doctor_assigned
 );

 function setPatient(uint Pid,bytes14 fName, bytes14 lName,bytes14 DOB,uint 
  age, uint Doctor_assigned) public {
   map[_Pid].fName = _fName;
   map[_Pid].lName = _lName;
   map[_Pid].DOB = _DOB;
   map[_Pid].age = _age;
   map[_Pid].Doctor_assigned = _Doctor_assigned;
  emit PatientInfo(_fName,_lName,_DOB, _age,_Doctor_assigned);
    }

  function getPatient(uint _Pid) view public returns 
  (bytes14,bytes14,bytes14,uint, uint) {
   return (map[_Pid].fName, map[_Pid].lName, map[_Pid].DOB, 
   map[_Pid].age,map[_Pid].Doctor_assigned);
   }
   }

0 个答案:

没有答案