0

I am trying to get older state of a contract. I have deployed contract using truffle. my contract is

pragma solidity ^0.4.15;
contract NDA {
bytes32  party1name;
bytes32  party2name; 
bytes32  pary1regaddr;

event Setparty2 (address indexed _from,bytes32 _party2name);
function NDA() {
    party1name = "Me";
}

function setparty2(bytes32 _party2name, bytes32 _pary1regaddr){
    party2name = _party2name;
    pary1regaddr = _pary1regaddr;
    Setparty2(msg.sender, _party2name);
}

function get() constant returns (bytes32, bytes32) {
    return (party1name, party2name);
}
}

When I do NDA.events i get

truffle(development)> NDA.events
{ 
'0x851b88ce358750e8e352d86d0712c570afe3624e605413a620f25f7e1c012463':
{ anonymous: false,
 inputs: [ [Object], [Object] ],
 name: 'Setparty2',
 type: 'event' } }

Now I did some transactions with this contract like

NDA.at(NDA.address).setparty2("Manish", "Kumar Singh");

and then some more .

Now I want to get the previous state of contract, I am trying to use events for that but when i do

truffle(development)> NDA.events.Setparty2({fromBlock : 0 });
TypeError: NDA.events.Setparty2 is not a function

I am not able to make out how to use my events. any help is appreciated.

1 Answer 1

0

Similar to your setparty2 call, try

NDA.at(NDA.address).Setparty2({fromBlock: 0});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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