bit-country/Metaverse-Network

Refactor loose coupling bitcountry pallet to be more generic and reusable trait

Closed this issue · 5 comments

  • Create bc-country traits
  • fn check_ownership
  • fn get_country
  • fn get_country_token
ed-iv commented

I'm happy to work on this one @justinphamnz . Do we just want to create a new traits/ dir in the project root to house this and future traits?

Awesome @ed-iv. Yes, was thinking to create a "common" folder to house generic traits like auction-manager, bc-country traits etc.

ed-iv commented

Hey, @justinphamnz, working on this I saw the TODOs in continuum to add in ownership checks. The one in register_interest caught my attention because it's not verifying if the sender owns a particular country, rather (based on the function signature which lacks a country_id) it's just that the sender owns some country before letting them register an EOI.

With country ownership being kept track of in a double_map w/ CountryId as the first key, it doesn't seem that we have an efficient to check this when we've just got the AccountId.

We could create another map to keep track of the 'owners set', but I was thinking that modifying the register_interest signature to include a country_id parameter might be the way to go instead, and storing a (AccountId, CountryId) tuple (or a new struct to represent individual EOIs) in SpotEOI.participants.

This avoids a new storage item and the EOIs are already set up to get cleared out when spots change owners. Also seems to make sense since an owner is always registering interest on behalf of a particular country he/she owns. What do you think?

Hey, @justinphamnz, working on this I saw the TODOs in continuum to add in ownership checks. The one in register_interest caught my attention because it's not verifying if the sender owns a particular country, rather (based on the function signature which lacks a country_id) it's just that the sender owns some country before letting them register an EOI.

With country ownership being kept track of in a double_map w/ CountryId as the first key, it doesn't seem that we have an efficient to check this when we've just got the AccountId.

We could create another map to keep track of the 'owners set', but I was thinking that modifying the register_interest signature to include a country_id parameter might be the way to go instead, and storing a (AccountId, CountryId) tuple (or a new struct to represent individual EOIs) in SpotEOI.participants.

This avoids a new storage item and the EOIs are already set up to get cleared out when spots change owners. Also seems to make sense since an owner is always registering interest on behalf of a particular country he/she owns. What do you think?

Awesome @ed-iv, yes, modifying the signature of register_interest is the right approach. If you could add country_id to register_interest, that would be great.