Skip to main content

canic_cdk/spec/system/
cycles.rs

1use crate::spec::prelude::*;
2
3//
4// IcpXdrConversionRate
5// Canonical payload from the cycles minting canister describing ICP/XDR rate.
6//
7
8#[derive(CandidType, Debug, Deserialize)]
9pub struct IcpXdrConversionRate {
10    pub timestamp_seconds: u64,
11    pub xdr_permyriad_per_icp: u64,
12}
13
14//
15// IcpXdrConversionRateResponse
16// Wrapper around the rate record returned by `get_icp_xdr_conversion_rate`.
17//
18
19#[derive(CandidType, Debug, Deserialize)]
20pub struct IcpXdrConversionRateResponse {
21    pub data: IcpXdrConversionRate,
22}
23
24//
25// IcpXdrConversionRateCertifiedResponse
26// Certified wrapper returned by `get_icp_xdr_conversion_rate` (when available).
27//
28
29#[derive(CandidType, Debug, Deserialize)]
30pub struct IcpXdrConversionRateCertifiedResponse {
31    pub data: IcpXdrConversionRate,
32    pub hash_tree: ByteBuf,
33    pub certificate: ByteBuf,
34}
35
36//
37// NotifyTopUpArgs
38// Arguments expected by the cycles canister when notifying a top-up.
39//
40
41#[derive(CandidType, Deserialize)]
42pub struct NotifyTopUpArgs {
43    pub block_index: u64,
44    pub canister_id: Principal,
45}