Exercise - Demonstrate your knowledge of mappings.
FavoriteRecords
. It should not inherit from any other contracts. It should have the following properties:
approvedRecords
, which returns true
if an album name has been added as described below, and false
if it has notuserFavorites
that indexes user addresses to a mapping of string
record names which returns true
or false
, depending if the user has marked that album as a favoriteapprovedRecords
with the following:
getApprovedRecords
. This function should return a list of all of the names currently indexed in approvedRecords
.
addRecord
that accepts an album name as a parameter. If the album is on the approved list, add it to the list under the address of the sender. Otherwise, reject it with a custom error of NotApproved
with the submitted name as an argument.
getUserFavorites
that retrieves the list of favorites for a provided address memory
.
resetUserFavorites
that resets userFavorites
for the sender.