Skip to main content

sla_escrow_api/state/
payment.rs

1use super::EscrowAccount;
2use steel::*;
3
4#[repr(C)]
5#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
6pub struct Payment {
7    pub payment_uid: [u8; 32],     // 32 bytes - payment unique identifier
8    pub escrow: Pubkey,            // 32 bytes
9    pub buyer: Pubkey,             // 32 bytes
10    pub seller: Pubkey,            // 32 bytes
11    pub mint: Pubkey,              // 32 bytes
12    pub oracle_authority: Pubkey,  // 32 bytes - oracle authority (Pubkey::default() for "None")
13    pub sla_hash: [u8; 32],        // 32 bytes - hashed AI prompt / SLA requirements
14    pub delivery_hash: [u8; 32],   // 32 bytes - hashed AI delivery payload
15    pub resolution_hash: [u8; 32], // 32 bytes - oracle's attestation digest (written at ConfirmOracle)
16    pub amount: u64,               // 8 bytes
17    pub min_fee_amount: u64,       // 8 bytes - snapshotted at funding time
18
19    pub created_at: i64,              // 8 bytes
20    pub expires_at: i64,              // 8 bytes
21    pub closed_at: i64,               // 8 bytes
22    pub delivery_timestamp: i64,      // 8 bytes
23    pub oracle_authority_set_at: i64, // 8 bytes - ts when oracle_authority was bound (== created_at at initial funding; updated by future rotation ix)
24    pub closure_delay_seconds: i64,   // 8 bytes - snapshotted at funding time
25    pub refund_cooldown_seconds: i64, // 8 bytes - snapshotted at funding time
26    pub delivery_cutoff_seconds: i64, // 8 bytes - snapshotted at funding time
27    pub resolution_reason: u16, // 2 bytes - oracle-supplied reason code (see ResolutionReason enum)
28    pub fee_bps: u16,           // 2 bytes - snapshotted at funding time
29    pub oracle_fee_bps: u16,    // 2 bytes - snapshotted at funding time
30    pub state: u8,              // 1 byte  - 0: Funded, 1: Released, 2: Refunded
31    pub resolution_state: u8,   // 1 byte  - 0: Pending, 1: Approved, 2: Rejected
32}
33
34account!(EscrowAccount, Payment);