That happened to my Tamagotchi a while ago. I don't have any brothers or sisters and it couldn't be my parents because they have no clue how to work them so I don't know how it happened.
On one of my Tamagotchi V3 I donated 12000 gp to the king. I went to get a sheet of paper and a pencil to write it down when I got back the code was gone so I had to start donating on my other V3 to get the code. :D
That happened to my friend. She had her Tamagotchi in her backpack and when she took it out at the Y.M.C.A. it had water in it. She wrapped in paper towel for the night and it was okay in the morning. :D