Skip to main content

canic_core/domain/
icp_refill.rs

1//! Module: domain::icp_refill
2//!
3//! Responsibility: define pure ICP refill operation value enums shared across
4//! storage projections, workflow decisions, and endpoint DTOs.
5//! Does not own: endpoint request/response structs, stable records, or ledger
6//! execution.
7//! Boundary: DTOs re-export these values to preserve the public API path while
8//! internal code imports them from the domain owner.
9
10use candid::CandidType;
11use serde::{Deserialize, Serialize};
12
13///
14/// IcpRefillMode
15///
16
17#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
18#[remain::sorted]
19pub enum IcpRefillMode {
20    Canister,
21    Fabricate,
22}
23
24///
25/// IcpRefillStatus
26///
27
28#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
29#[remain::sorted]
30pub enum IcpRefillStatus {
31    Completed,
32    Failed,
33    InvalidTransaction,
34    NotifyProcessing,
35    Refunded,
36    Requested,
37    TransactionTooOld,
38    Transferred,
39}
40
41///
42/// IcpRefillErrorCode
43///
44#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
45#[remain::sorted]
46pub enum IcpRefillErrorCode {
47    BadFee,
48    Duplicate,
49    FabricationUnavailable,
50    InvalidLedgerBlockIndex,
51    InvalidTransaction,
52    LedgerTransferFailed,
53    NotifyFailed,
54    NotifyMaxAttempts,
55    Processing,
56    RateGateDenied,
57    Refunded,
58    RequestDenied,
59    TransactionTooOld,
60    TransferWindowStale,
61}