I am trying to create a contract for "Land Registry".
A property can be sold by the user who owns it. I've created a function transferProperty(address _from, address _to, uint _propertyId) which transfers the ownership of the property from '_from' to '_to'.
I want to create a function getHistory(uint _propertyId) that returns me the address of it's past owners.
eg, Let user1, user2, user3, user4 be the four users and 1 be the property ID. transferProperty(user1, user2, 1) // property 1 transferred from user1 to user2. transferProperty(user2, user3, 1) // property 1 transferred from user2 to user3. transferProperty(user3, user4, 1) // property 1 transferred from user3 to user4.
I want getHistory(1) to return user1->user2->user3->user4.