Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/guardian/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
pub mod error;
pub mod types;
use soroban_sdk::{contract, contractimpl, Env};

/// Enforces guardian-controlled spending policies for child wallet accounts on the Stellar network.
Expand Down
25 changes: 25 additions & 0 deletions contracts/guardian/src/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use soroban_sdk::{contracttype, Address};

/// Opaque identifier for a child wallet account managed by a guardian.
pub type ChildId = Address;

/// Maximum amount (in stroops) a child may spend in a single transaction.
pub type SpendLimit = u64;

/// Period over which the spend limit resets.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum LimitPeriod {
Daily,
Weekly,
Monthly,
}

/// Full spending policy attached to a child account.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SpendPolicy {
pub child: ChildId,
pub limit: SpendLimit,
pub period: LimitPeriod,
}
Loading