I am logging a specific event from a specific contract using nethereum. However, my event emits contract state (enum in solidity). My log processor shows 0 events instead of 2.

Solidity code snippet:

// event

event Transaction(address from, StateType contractState);

// function

    function submitProof
    (string memory clm_num, string memory lin_typ, string memory lin_st, string memory out_rsrv, string memory tot_paid, string memory date_post) public
        ProofData memory inputTransaction;
        inputTransaction.claim_num = clm_num;
        inputTransaction.line_typ = lin_typ;
        inputTransaction.line_status = lin_st;
        inputTransaction.outstanding_rsrv = out_rsrv;
        inputTransaction.total_paid = tot_paid;
        inputTransaction.date_posted = date_post;
        inputTransaction.isDataPresent = true;

        if (contractState == StateType.ZeroState || contractState == StateType.RetrievedState) {
            cedeData = inputTransaction;
            contractState = StateType.CedeState;
        else {
            if (cedeData.isDataPresent && contractState == StateType.CedeState) {
                verifiedData = inputTransaction;
                if (sha256(abi.encode(cedeData)) == sha256(abi.encode(verifiedData)))
                    contractState = StateType.AuditState;
        emit Transaction(msg.sender, contractState);

Nethereum code snippet:

// event class


        public class Transaction : IEventDTO
            [Parameter("address", "from", 1, false)]
            public string Sender { get; set; }

            [Parameter("int", "contractState", 2, false)]
            public string ContractState { get; set; }

// logic to log event

Log event using Nethereum

The logs show count 0 where I expect count to be 2. Also how to extract data from log to show that on UI? I couldn't find any extraction logic in Nethereum docs.

  • With all due respect, why is the last piece of code given as a screenshot instead of plain text which can be copy/pasted by those who may give you an answer? – goodvibration Apr 27 '20 at 6:24
  • @goodvibration when i was trying to copy the last piece of code, it wasn't getting formatted properly. So I chose to upload a pic instead. Can you help me with the above query? – jatinw Apr 27 '20 at 14:23
  • You can post a properly-formatted code snippet by using a line of 3 ticks at the beginning and a line of 3 ticks at the end. A tick looks like an "upper comma", and it is typically located at the top-left part of your keyboard. – goodvibration Apr 27 '20 at 14:25
  • Thanks for that @goodvibration – jatinw Apr 27 '20 at 14:26
  • @fixanoid need help here – jatinw Apr 27 '20 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.