Skip to content

Commit d258c85

Browse files
authored
Merge pull request #37 from wumibals/feat/guardian-types-stub
feat: add contracts/guardian/src/types.rs stub
2 parents ca869e2 + bc5f4dc commit d258c85

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

contracts/guardian/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![no_std]
22
pub mod error;
3+
pub mod types;
34
use soroban_sdk::{contract, contractimpl, Env};
45

56
/// Enforces guardian-controlled spending policies for child wallet accounts on the Stellar network.

contracts/guardian/src/types.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use soroban_sdk::{contracttype, Address};
2+
3+
/// Opaque identifier for a child wallet account managed by a guardian.
4+
pub type ChildId = Address;
5+
6+
/// Maximum amount (in stroops) a child may spend in a single transaction.
7+
pub type SpendLimit = u64;
8+
9+
/// Period over which the spend limit resets.
10+
#[contracttype]
11+
#[derive(Clone, Debug, Eq, PartialEq)]
12+
pub enum LimitPeriod {
13+
Daily,
14+
Weekly,
15+
Monthly,
16+
}
17+
18+
/// Full spending policy attached to a child account.
19+
#[contracttype]
20+
#[derive(Clone, Debug, Eq, PartialEq)]
21+
pub struct SpendPolicy {
22+
pub child: ChildId,
23+
pub limit: SpendLimit,
24+
pub period: LimitPeriod,
25+
}

0 commit comments

Comments
 (0)