junobuild_shared/rate/
types.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::types::state::Timestamp;
use candid::{CandidType, Deserialize};
use serde::Serialize;
use std::collections::HashMap;

pub type RateTokenStore = HashMap<String, RateTokens>;

#[derive(Default, CandidType, Serialize, Deserialize, Clone)]
pub struct RateTokens {
    pub tokens: u64,
    pub updated_at: Timestamp,
}

#[derive(Default, CandidType, Serialize, Deserialize, Clone)]
pub struct RateConfig {
    pub time_per_token_ns: u64,
    pub max_tokens: u64,
}