drive/state_transition_action/contract/contract_fee_claim/
mod.rs1pub mod transformer;
3pub mod v0;
5
6use crate::state_transition_action::contract::contract_fee_claim::v0::ContractFeeClaimTransitionActionV0;
7use derive_more::From;
8use dpp::block::epoch::EpochIndex;
9use dpp::data_contract::document_type::action_fees::{ContractFeePot, ContractFeePotLastClaim};
10use dpp::fee::Credits;
11use dpp::platform_value::Identifier;
12use dpp::prelude::{IdentityNonce, UserFeeIncrease};
13use std::collections::BTreeMap;
14
15#[derive(Debug, Clone, From)]
18pub enum ContractFeeClaimTransitionAction {
19 V0(ContractFeeClaimTransitionActionV0),
21}
22
23impl ContractFeeClaimTransitionAction {
24 pub fn claimant_id(&self) -> Identifier {
26 match self {
27 ContractFeeClaimTransitionAction::V0(action) => action.claimant_id,
28 }
29 }
30
31 pub fn data_contract_id(&self) -> Identifier {
33 match self {
34 ContractFeeClaimTransitionAction::V0(action) => action.data_contract_id,
35 }
36 }
37
38 pub fn identity_contract_nonce(&self) -> IdentityNonce {
40 match self {
41 ContractFeeClaimTransitionAction::V0(action) => action.identity_contract_nonce,
42 }
43 }
44
45 pub fn pot(&self) -> ContractFeePot {
47 match self {
48 ContractFeeClaimTransitionAction::V0(action) => action.pot,
49 }
50 }
51
52 pub fn epoch_index(&self) -> EpochIndex {
54 match self {
55 ContractFeeClaimTransitionAction::V0(action) => action.epoch_index,
56 }
57 }
58
59 pub fn last_claim(&self) -> ContractFeePotLastClaim {
62 match self {
63 ContractFeeClaimTransitionAction::V0(action) => ContractFeePotLastClaim {
64 epoch_index: action.epoch_index,
65 time_ms: action.time_ms,
66 claimant_id: action.claimant_id,
67 },
68 }
69 }
70
71 pub fn payouts(&self) -> &BTreeMap<Identifier, Credits> {
73 match self {
74 ContractFeeClaimTransitionAction::V0(action) => &action.payouts,
75 }
76 }
77
78 pub fn settled_action_counts(&self) -> &[Identifier] {
80 match self {
81 ContractFeeClaimTransitionAction::V0(action) => &action.settled_action_counts,
82 }
83 }
84
85 pub fn user_fee_increase(&self) -> UserFeeIncrease {
87 match self {
88 ContractFeeClaimTransitionAction::V0(action) => action.user_fee_increase,
89 }
90 }
91}