Is there a way to add more than 3 log topics using indexed attribute in contract events?

SouptacularSouptacular Member, Administrator, Moderator Posts: 14 admin
I read here that "up to three parameters can receive the attribute indexed which will cause the respective arguments to be treated as log topics instead of data." I need to store 4-6 attributes in the log for a data store lookup type program. My idea was to create 2 events that log 4+ attributes:
event FirstEvent(uint blockNumber, bytes32 indexed uniqueIdentifier, address indexed user, uint indexed sheepNumber);

event SecondEvent(uint blockNumber, bytes32 indexed personalIdentifier, bytes32 indexed favoriteColor, bytes32 indexed userHeight);
So FirstEvent would hold: blockNumber, personalIdentifier, user address, and sheepnumber.
and SecondEvent would hold: blockNumber, uniqueIdentifier, favoriteColor, and userHeight.

Once you find a unique value in the FirstEvent, you can use that as a query for the SecondEvent, or vice-versa.

Will this work?


Sign In or Register to comment.