0

Not sure what the best approach is to get around this. New to solidity. I've read the complicated 'answers' to this that suggest using structs, arrays, etc. but I can't figure out how to address this. Any help welcome!

Here is the code:

    pragma solidity ^0.7.5;
// "SPDX-License-Identifier: UNLICENSED"

contract myLSCDocVerfReqsts {
    uint256 public docVerfReqstsCount = 0;
    mapping(uint => DocVerfReqst) public docVerfReqsts;

    address owner;

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    struct DocVerfReqst {
        string _intstitutionId;
        string _clientId;
        string _documentId;
        string _requestDate;
        string _requestType;
        string _requestReasonCode;
        string _statusCode;
        string _clientActionedDate;
    }

    constructor() {
        owner = msg.sender;
    }

    function addDocVerfReqst(
        string memory _institutionId,
        string memory _clientId,
        string memory _documentId,
        string memory _requestDate,
        string memory _requestType,
        string memory _requestReasonCode,
        string memory _statusCode,
        string memory _clientActionedDate
    )
        public
        onlyOwner
    {
        incrementCount();
        docVerfReqsts[docVerfReqstsCount] = DocVerfReqst(
                _institutionId,
                _clientId,  
                _documentId, 
                _requestDate,                
                _requestType, 
                _requestReasonCode,
                _statusCode,
                _clientActionedDate
                );
    }

    function incrementCount() internal {
        docVerfReqstsCount += 1;
    }
}
1
  • Don't store binary data as strings. Jan 4 at 14:18
0

Replace the string type with bytes32 - in your case, it will be enough for data of the "identifier" type (this is a GUID without separators), "code" or "date".

Not the answer you're looking for? Browse other questions tagged or ask your own question.