Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-18 10:31:03 +02:00
parent 9e0b8b3234
commit b449775ad8
112 changed files with 979 additions and 740 deletions

View file

@ -4,31 +4,31 @@ import com.tangem.domain.models.serialization.SerializedBigDecimal
import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable
/** P2P.org staking account */
/** P2P.org eth pooled staking account */
@Serializable
data class P2PStakingAccount(
data class P2PEthPoolStakingAccount(
val delegatorAddress: String,
val vaultAddress: String,
val stake: P2PStake,
val stake: P2PEthPoolStake,
val availableToUnstake: SerializedBigDecimal,
val availableToWithdraw: SerializedBigDecimal,
val exitQueue: P2PExitQueue,
val exitQueue: P2PEthPoolExitQueue,
)
@Serializable
data class P2PStake(
data class P2PEthPoolStake(
val assets: SerializedBigDecimal,
val totalEarnedAssets: SerializedBigDecimal,
)
@Serializable
data class P2PExitQueue(
data class P2PEthPoolExitQueue(
val total: SerializedBigDecimal,
val requests: List<P2PExitRequest>,
val requests: List<P2PEthPoolExitRequest>,
)
@Serializable
data class P2PExitRequest(
data class P2PEthPoolExitRequest(
val ticket: String,
val totalAssets: SerializedBigDecimal,
val timestamp: Instant,

View file

@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
import java.math.BigDecimal
/**
* Staking balance facade covering StakeKit and P2P balances
* Staking balance facade covering StakeKit and P2PEthPool balances
*/
@Serializable
sealed interface StakingBalance {
@ -50,10 +50,10 @@ sealed interface StakingBalance {
}
@Serializable
data class P2P(
data class P2PEthPool(
override val stakingId: StakingID,
override val source: StatusSource,
val account: P2PStakingAccount,
val account: P2PEthPoolStakingAccount,
) : Data {
override val totalStaked: BigDecimal
@ -93,7 +93,7 @@ sealed interface StakingBalance {
fun copySealed(source: StatusSource): StakingBalance {
return when (this) {
is Data.StakeKit -> copy(source = source)
is Data.P2P -> copy(source = source)
is Data.P2PEthPool -> copy(source = source)
is Empty -> copy(source = source)
is Error -> this
}

View file

@ -12,4 +12,17 @@ data class YieldToken(
val coinGeckoId: String?,
val logoURI: String?,
val isPoints: Boolean?,
)
) {
companion object {
val ETH = YieldToken( // TODO p2p
name = "Ethereum",
network = NetworkType.ETHEREUM,
symbol = "ETH",
decimals = 18,
address = null,
coinGeckoId = "ethereum",
logoURI = null,
isPoints = false,
)
}
}