-
Notifications
You must be signed in to change notification settings - Fork 35
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
Conversation
valentunn
commented
Jan 30, 2025
totalStake = collatorStake.stake, | ||
delegators = collatorStake.stakers, | ||
// TODO APY calculation | ||
apr = Fraction.ZERO | ||
apr = Fraction.ZERO.takeIf { collatorId in sessionValidators } |
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.
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() { |
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.
Should have a space
.shareInBackground() | ||
|
||
private val flattenCurrentCollators = groupedCurrentCollatorsFlow | ||
.map { it.toValueList() } |
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.
What do you think about rename toValueList to flatMapValuesToList?
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.
Yeah worth renaming, andflattenValues
looks even better, following the naming of Iterable<Itereable<T>>.flatten(): List<T>
from stdlib