templar_vault_kernel/
lib.rs

1#![no_std]
2
3extern crate alloc;
4#[cfg(any(test, feature = "std", feature = "schemars", feature = "borsh-schema"))]
5extern crate std;
6
7pub mod actions;
8pub mod address_book;
9pub mod effects;
10pub mod error;
11pub mod fee;
12pub mod math;
13pub mod restrictions;
14pub mod state;
15
16#[doc(hidden)]
17pub mod test_utils;
18pub mod transitions;
19pub mod types;
20pub mod utils;
21
22pub use actions::{
23    apply_action, convert_to_assets, convert_to_assets_ceil, convert_to_shares,
24    convert_to_shares_ceil, effective_totals, plan_idle_payout, preview_deposit_shares,
25    preview_withdraw_assets, EffectiveTotals, IdlePayoutPlan, KernelAction, KernelResult,
26    PayoutOutcome,
27};
28pub use address_book::AddressBook;
29pub use fee::{Fee, FeeSlot, Fees, FeesSpec};
30pub use math::number::Number;
31pub use math::wad::{
32    compute_fee_shares, compute_fee_shares_from_assets, compute_management_fee_shares,
33    mul_div_ceil, mul_div_floor, mul_wad_floor, total_assets_for_fee_accrual, Wad, MAX_FEE_WAD,
34    MAX_MANAGEMENT_FEE_WAD, MAX_PERFORMANCE_FEE_WAD, YEAR_NS,
35};
36pub use restrictions::{RestrictionKind, Restrictions};
37pub use state::escrow::{
38    apply_settlement, can_apply_settlement, compute_escrow_stats, find_by_owner, is_stale,
39    settle_proportional, total_burn, total_refund, EscrowEntry, EscrowSettlement, EscrowStats,
40    SettlementResult,
41};
42pub use state::op_state::{
43    AllocatingState, AllocationPlanEntry, IdleState, OpState, PayoutState, RefreshingState,
44    TargetId, WithdrawingState,
45};
46pub use state::queue::{
47    can_enqueue, can_partially_satisfy, can_satisfy_withdrawal, compute_full_withdrawal,
48    compute_idle_settlement, compute_partial_withdrawal, compute_queue_status, compute_settlement,
49    compute_settlement_by_price, count_satisfiable, find_request_status, is_past_cooldown,
50    is_valid_withdrawal_amount, PendingWithdrawal, QueueError, QueueStatus, WithdrawQueue,
51    WithdrawalRequestStatus, WithdrawalResult, DEFAULT_COOLDOWN_NS, MAX_PENDING, MAX_QUEUE_LENGTH,
52    MIN_WITHDRAWAL_ASSETS,
53};
54pub use state::vault::{FeeAccrualAnchor, VaultConfig, VaultState};
55pub use transitions::{
56    allocation_step_callback, complete_allocation, complete_refresh, payout_complete,
57    refresh_step_callback, start_allocation, start_refresh, start_withdrawal, stop_withdrawal,
58    withdrawal_collected, withdrawal_settled, withdrawal_step_callback, TransitionError,
59    TransitionRes, TransitionResult, WithdrawalRequest,
60};
61pub use types::{ActualIdx, Address, AssetId, ExpectedIdx, KernelVersion, TimestampNs};
62pub use utils::TimeGate;