Contract
Review the contract in the starter snippet calledArraysExercise. It contains an array called numbers that is initialized with the numbers 1–10. Copy and paste this into your file.
Return a Complete Array
The compiler automatically adds a getter for individual elements in the array, but it does not automatically provide functionality to retrieve the entire array. Write a function calledgetNumbers that returns the entire numbers array.
Reset Numbers
Write apublic function called resetNumbers that resets the numbers array to its initial value, holding the numbers from 1-10.
We’ll award the pin for any solution that works, but one that doesn’t use
.push() is more gas-efficient!Remember, anyone can call a
public function! You’ll learn how to protect functionality in another lesson.Append to an Existing Array
Write a function calledappendToNumbers that takes a uint[] calldata array called _toAppend, and adds that array to the storage array called numbers, already present in the starter.
Timestamp Saving
At the contract level, add anaddress array called senders and a uint array called timestamps.
Write a function called saveTimestamp that takes a uint called _unixTimestamp as an argument. When called, it should add the address of the caller to the end of senders and the _unixTimestamp to timestamps.
You’ll need to research on your own to discover the correct Special Variables and Functions that can help you with this challenge!
Timestamp Filtering
Write a function calledafterY2K that takes no arguments. When called, it should return two arrays.
The first should return all timestamps that are more recent than January 1, 2000, 12:00am. To save you a click, the Unix timestamp for this date and time is 946702800.
The second should return a list of senders addresses corresponding to those timestamps.
Resets
Addpublic functions called resetSenders and resetTimestamps that reset those storage variables.