epam / corgis

Simple solution for corgi NFT
https://epam.github.io/corgis
0 stars 4 forks source link

List last N corgies minted #128

Closed zahhar closed 3 years ago

zahhar commented 3 years ago

Tasks

acuarica commented 3 years ago

To keep the insertion order in the contract, we cannot use TreeMap[1] as discussed in our daily stand up. The TreeMap data structure retrieves its elements sorted by key (Corgi id), not by insertion order.

[1] https://docs.rs/near-sdk/2.0.1/near_sdk/collections/struct.TreeMap.html

zahhar commented 3 years ago

@acuarica - I'd like to suggest the way to solve the 'sorting dilemma' we discussed on the standup.

We could always sort by CreatedDate (abs date qhen Corgi was minted initially) across all endpoints. Difference is that:

acuarica commented 3 years ago

Thanks for the suggestion. The main issue with this solution is that it might show the global corgis and user owned corgis in different order. This might be confusing for the user. Let's take this scenario:

(the format G: # | A: # | B: # represents the corgis displayed Globally, for user A and user B respectively, the leftmost number represents first corgi the user see)

  1. User A mints Corgi 1 G: 1 | A: 1 | B:
  2. User B mints Corgi 2 G: 2 1 | A: 1 | B: 2
  3. User A transfers Corgi 1 to User B G: 2 1 | A: | B: 1 2

In step 3, the global list didn’t change, however user B now sees the transferred Corgi 1 in the top of her list. That's why we might be better off having a consistent ordering across the contract. The homepage can be corgis with last activities instead.

zahhar commented 3 years ago

The homepage can be corgis with last activities instead.

This looks elegant. In this case we only need to rename the block title on the homepage. Lets go with it.