Inside my smart contract I have a struct type NotaryEntry and a function addNotaryEntry which creates an instance of the struct and add to a mapping, I do pass the right values to the function but the struct is created with zero values and ignores the values I parse to it even though I passed the right parameter types values to the function. How do I resolve this problem? Thanks
This is what function addNotaryEntry creates :
1: string: description
2: uint256: timestamp 0
3: string: hash
4: address: setBy 0x0000000000000000000000000000000000000000
5: bool: isSet false
Below is my code:
uint filesCount;
mapping(uint => NotaryEntry) public files;
mapping(address => uint[]) public personFiles;
struct NotaryEntry{
uint id;
string description;
uint timestamp;
string hash;
address setBy;
bool isSet;
}
function addNotaryEntry( string memory _hash, string memory _desc) public {
uint _id = filesCount += 1;
NotaryEntry memory notary;
notary.id = _id;
notary.description = _desc;
notary.timestamp = now;
notary.hash = _hash;
notary.setBy = msg.sender;
notary.isSet = true;
personFiles[msg.sender].push(filesCount);
}
`