While view functions are designed for fortends use, it is still best practice to optimize for gas. Nodes can revert RPC calls to view functions if it cost too much, while this behavior is not defined standard, still some noted can reject the request.
In getUserMemorabiliaDetailed the second loop does not need to iterate over all collections and items, we know how many items the user have from the first loop.
If we expect getUserMemorabiliaDetailed to be frequently used, it is better to collect data at time of mint/burn/transfer. The performance will be O(1) instead of O(n).
userOwnedTokens mapping: Tracks all tokenIds owned by each user
userTokenIndex mapping: Provides O(1) lookup for token updates
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.