-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
156 share distributor tokens #157
Conversation
…g-shares-that-get-minted' into 156-share_distributor-tokens
Codecov Report
@@ Coverage Diff @@
## main #157 +/- ##
==========================================
- Coverage 70.58% 70.45% -0.14%
==========================================
Files 49 49
Lines 3424 3503 +79
==========================================
+ Hits 2417 2468 +51
- Misses 1007 1035 +28
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job. A good variable naming act as a comment. Try to do it in the code.
pub fn owner_and_shares(collection_id: T::NftCollectionId, item_id: T::NftItemId) -> Vec<(T::AccountId, Percent)>{ | ||
|
||
//Get owners and their reserved contribution to the bid | ||
let infos = HousingFund::Reservations::<T>::get((collection_id,item_id)).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a test to ensure that the (collection_id, item_id) is present in the storage before the unwrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collection_id and item_id are parameters passed by the bidding pallet to the share_distributor pallet.
|
||
//Get owners and their reserved contribution to the bid | ||
let infos = HousingFund::Reservations::<T>::get((collection_id,item_id)).unwrap(); | ||
let vec0 = infos.contributions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
give name more meaningful names
…ibutor-tokens 156 share distributor tokens
Motivation
Two helpers functions were added to:
housing_fund
Suggested Solution
TokenId
storingu32
, and initialised at 0. it is tracking the Assets class IDshare_distributor
, 'type AssetId = u32` was added in order to apply the advice received on stackexchange ==> https://substrate.stackexchange.com/questions/2857/how-do-i-hardcode-asset-idstype.rs
the token_id field was added tostruct Ownership
with the type<T as pallet::Config>::AssetId
fn owner_and_shares(collection_id,item_id) -> owner_and_shares(collection_id: T::NftCollectionId, item_id: T::NftItemId) -> Vec<(T::AccountId, f64)>
fn create_tokens(origin: OriginFor<T>, account: T::AccountId)
In the next step tokens distribution to the owners by the virtual account will be implemented.