Project token->Content pallet integration#3771
Merged
Lezek123 merged 13 commits intoJoystream:ephesusfrom Jun 1, 2022
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
added 5 commits
May 19, 2022 20:17
added 5 commits
May 20, 2022 14:39
dobertRowneySr
approved these changes
May 26, 2022
This was referenced Jun 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #3734
A few notes about how the integration was done:
Events:
The only event emitted by
contentpallet w.r.t. creator tokens isCreatorTokenIssued, since this is the only event needed in order for the query node to be able to connect a creator token with a given channel. All other events are emitted fromproject_tokenpallet (some missing events were added:TokenSaleInitialized,UpcomingTokenSaleUpdated,TransferPolicyChangedToPermissionless)Deriving member context:
get_worker_member_idmethod was added toWorkingGroupAuthenticator, allowing thecontentpallet to derive themember_idbased onContentActorcontext through a new function calledget_member_id_of_actor:get_member_id_of_actorMembermember_idofMemberCuratorworker.member_idofCuratorLeadworker.member_idofLeadThis function is used to determine:
init_creator_token_sale)claim_creator_token_patronage_credit)creator_token_issuer_transfer)Token sale JOY earnings
A new
earnings_destinationfield was added toTokenSale, which isOption<AccountId>and works as follows:earnings_destination.is_some()- JOY earnings from the sale (minus platform fee) are sent toearnings_destinationaccountearnings_destination.is_none()- all JOY earnings from the sale are burnedThe
contentpallet fills this field based on the channel owner:ChannelOwnerisMember:earnings_destinationisSome(member_controller_account)ChannelOwnerisCuratorGroup:earnings_destinationisNoneCurator channels
Following #3784, there were a few other curator-channel-specific features implemented:
auto_finalizefield was added toTokenSale, which controls whether the sale is automatically removed whenquantity_left == 0. Content pallet sets this field totrueifChannelOwnerisMemberandfalseifChannelOwnerisCuratorGroup.recover_unsold_tokensextrinsic was replaced withfinalize_token_salemethod, which is callable only by channel owner throughcontentpallet and returns the total amount of JOY collected during the sale (funds_collected). Additionally, ifChannelOwnerisCuratorGroup, the content pallet then addsfunds_collectedto the Council Budgetclaim_creator_token_patronage_creditwas blocked for curator-owned channelsBloat bonds
Some code in
project_tokenpallet was changed so that thebloat_bondis always paid by the sender ofcontentextrinsic (in case the interaction withproject_tokenpallet happens throughcontentpallet). This means:ChannelOwnerisMemberChannelOwnerisCuratorTests:
I limited the scope of the tests to errors / events / state changes coming directly from
contentpallet, as we have a separate set of tests forproject_tokenpallet. This can be improved in the future, but I suggest it to be done outside of the scope of this PR, as it's already quite large.Types and
ProjectTokentrait:pallet_token'strait.rsandtypes.rswere exposed and some types were made public (pub(crate) -> pub), I also slightly modified theProjectTokentrait to make it easier for thecontentmodule to use it.