Skip to content

support multi currency rewards #601

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

Merged
merged 24 commits into from
Sep 15, 2021
Merged

support multi currency rewards #601

merged 24 commits into from
Sep 15, 2021

Conversation

ermalkaleci
Copy link
Member

No description provided.

@ermalkaleci ermalkaleci requested a review from xlc September 2, 2021 21:34
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2021

Codecov Report

Merging #601 (1eea735) into master (59df1df) will increase coverage by 0.92%.
The diff coverage is 94.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #601      +/-   ##
==========================================
+ Coverage   75.58%   76.51%   +0.92%     
==========================================
  Files          76       77       +1     
  Lines        5955     6246     +291     
==========================================
+ Hits         4501     4779     +278     
- Misses       1454     1467      +13     
Impacted Files Coverage Δ
rewards/src/lib.rs 78.81% <77.41%> (-3.54%) ⬇️
rewards/src/migrations.rs 100.00% <100.00%> (ø)
rewards/src/mock.rs 87.50% <100.00%> (+1.78%) ⬆️
rewards/src/tests.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59df1df...1eea735. Read the comment docs.

@xlc xlc requested a review from wangjj9219 September 3, 2021 02:01
@ermalkaleci ermalkaleci marked this pull request as ready for review September 4, 2021 06:47
/// The Reward Pool Info.
#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, Default, MaxEncodedLen)]
pub struct PoolInfo<Share: HasCompact, Balance: HasCompact> {
pub struct PoolInfoV0<Share: HasCompact, Balance: HasCompact> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move this to migration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

fmt::Debug,
vec::Vec,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have prelude::* which includes vec and few others

}
Pools::<T>::mutate_exists(pool, |maybe_pool_info| {
Pools::<T>::mutate_exists(pool, |maybe_pool_info| -> DispatchResult {
ensure!(maybe_pool_info.is_some(), Error::<T>::PoolDoesNotExist);
Copy link
Member

@xlc xlc Sep 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let pool_info = maybe_pool_info.ok_or(Error::<T>::PoolDoesNotExist)?;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let pool_info = maybe_pool_info.ok_or(Error::::PoolDoesNotExist)?;

missed that 👌

Copy link
Member

@xlc xlc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have some pre_migrate & post_migrate to allow us to verify state with try-runtime

https://github.com/paritytech/substrate/blob/master/frame/membership/src/migrations/v4.rs#L83

T::DbWeight::get().reads_writes(reads_writes, reads_writes)
}

// #[test]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen to this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triggered by migrate process of module-incentives

@wangjj9219 wangjj9219 requested a review from xlc September 15, 2021 03:19
@xlc xlc merged commit fc4496e into master Sep 15, 2021
@xlc xlc deleted the multi_currency_rewards branch September 15, 2021 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants