我有两个合同,如下所示。我正在通过DocInfo合同将文档详细信息保存到文档合同中。但是,当我尝试通过docINfo合同获取详细信息时,却得到了空洞的结果。我在这里想念什么吗?
pragma solidity 0.5.0;
contract DocumentContract {
struct Document{
string DocumentNo;
address DigitalID;
}
mapping(string=>Document) doc;
function CreateDocument(string calldata DocumentNo,address DigitalID) external {
doc[DocumentNo] = Document({
DocumentNo: DocumentNo,
DigitalID: DigitalID
});
}
function GetDocument(string calldata documentNumber) external view returns(address) {
Document memory document = doc[documentNumber];
return (document.DigitalID);
}
}
contract DocInfo {
function CreateDocument(address digitalID,string memory documentId) public returns (bool success) {
address contractAddress =<<Document contract address>>;
DocumentContract doc = DocumentContract(contractAddress);
doc.CreateDocument(documentId,digitalID);
return true;
}
function GetDocument(string memory documentId)
public view returns (address) {
address contractAddress = <<Document contract address>>;
DocumentContract doc = DocumentContract(contractAddress);
address digitalId = doc.GetDocument(documentId);
return digitalId;
}
}