Skip to content
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

Myth staking/selected collators #1790

Merged
merged 3 commits into from
Feb 10, 2025

Conversation

valentunn
Copy link
Member

image
image
image

Comment on lines 65 to +68
totalStake = collatorStake.stake,
delegators = collatorStake.stakers,
// TODO APY calculation
apr = Fraction.ZERO
apr = Fraction.ZERO.takeIf { collatorId in sessionValidators }
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about adding a field isActive to this model?
Or we can create a sealed class here

I think it's more readable than relying on nullable field

@@ -4,7 +4,7 @@ import io.novafoundation.nova.common.base.BaseViewModel
import io.novafoundation.nova.common.presentation.LoadingState
import kotlinx.coroutines.flow.Flow

abstract class CurrentStakeTargetsViewModel : BaseViewModel() {
abstract class CurrentStakeTargetsViewModel: BaseViewModel() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have a space

.shareInBackground()

private val flattenCurrentCollators = groupedCurrentCollatorsFlow
.map { it.toValueList() }
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about rename toValueList to flatMapValuesToList?

Copy link
Member Author

@valentunn valentunn Feb 10, 2025

Choose a reason for hiding this comment

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

Yeah worth renaming, andflattenValues looks even better, following the naming of Iterable<Itereable<T>>.flatten(): List<T> from stdlib

Base automatically changed from myth_staking/claim_rewards to myth_staking_base February 10, 2025 09:32
@valentunn valentunn merged commit c68f254 into myth_staking_base Feb 10, 2025
10 of 11 checks passed
@valentunn valentunn deleted the myth_staking/selected_collators branch February 10, 2025 09:32
@novasamatech novasamatech deleted a comment from alialobidm Feb 10, 2025
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.

2 participants