Store Data in a Smart Contract struct Variable

Share this video with your friends

Send Tweet

Now, we have the base contract to work on. The goal of the contract is to act as a tip jar, a way to allow users or followers to send you some ETH through the web, including some message. But also, to showcase the people that sent you that money by making the actions public in the web too. This means that the contract need to:

  1. Identify to who to send the tip
  2. Store the tip sender data including the message, and the amount of eth.
  3. Allow a way to retrieve the actions (the tips sent) made through it.

We will add an address payable variable of owner to tell the contract that the contract will receive payments.

For the actual tip data, we will define a Tip struct that will have all the information needed to send a tip.